@credithub/harlan-components 1.97.10 → 1.99.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.
@@ -5,8 +5,9 @@ export type { Contact, ContactsState } from '@/@types/domain/contactsTypes';
5
5
  export type { Divida, DividasPublicasState } from '@/@types/domain/dividasTypes';
6
6
  export type { DocumentHistoryData } from '@/@types/domain/documentHistoryData';
7
7
  export type { CarouselState, DossieState, SummaryState, TransactionTableState } from '@/@types/domain/dossieTypes';
8
- export type { ImoveisConsultaResponse, IPTUItem } from '@/@types/domain/imoveisTypes';
8
+ export type { IPTUItem, ImoveisConsultaResponse } from '@/@types/domain/imoveisTypes';
9
9
  export type { LiminarResponse } from '@/@types/domain/liminarTypes';
10
+ export type { LiteError } from '@/@types/domain/liteError';
10
11
  export type { Partner, PartnersState } from '@/@types/domain/partnersTypes';
11
12
  export type { PepData, PepState } from '@/@types/domain/pepTypes';
12
13
  export type { EnvolvidoUltimaMovimentacao, ProcessoJuridicoResume, ProcessosJuridicosState } from '@/@types/domain/processosJuridicosTypes';
@@ -0,0 +1,14 @@
1
+ import React, { ReactNode } from 'react';
2
+ export interface TooltipProps {
3
+ content: ReactNode;
4
+ icon?: ReactNode;
5
+ placement?: 'top' | 'bottom' | 'left' | 'right';
6
+ className?: string;
7
+ defaultVisible?: boolean;
8
+ visible?: boolean;
9
+ onVisibleChange?: (v: boolean) => void;
10
+ /** Quando true, o ícone não reserva espaço no layout do texto (não aumenta o label) */
11
+ float?: boolean;
12
+ }
13
+ declare const Tooltip: React.FC<TooltipProps>;
14
+ export default Tooltip;
@@ -0,0 +1,67 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ import theme from '../../styles/theme';
6
+ import React, { useRef, useState } from 'react';
7
+ import styled from 'styled-components';
8
+ var Container = styled.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n display: ", ";\n align-items: center;\n /* Quando flutuante, o container n\u00E3o ocupa largura para n\u00E3o deslocar o conte\u00FAdo adjacente */\n width: ", ";\n vertical-align: middle;\n"], ["\n position: relative;\n display: ", ";\n align-items: center;\n /* Quando flutuante, o container n\u00E3o ocupa largura para n\u00E3o deslocar o conte\u00FAdo adjacente */\n width: ", ";\n vertical-align: middle;\n"])), function (_a) {
9
+ var $float = _a.$float;
10
+ return ($float ? 'inline-block' : 'inline-flex');
11
+ }, function (_a) {
12
+ var $float = _a.$float;
13
+ return ($float ? 0 : 'auto');
14
+ });
15
+ var Trigger = styled.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n ", "\n"], ["\n display: inline-flex;\n align-items: center;\n ", "\n"])), function (_a) {
16
+ var $float = _a.$float;
17
+ return $float
18
+ ? "\n position: absolute;\n right: 0;\n top: 50%;\n transform: translate(100%, -50%);\n "
19
+ : '';
20
+ });
21
+ var Bubble = styled.span(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n visibility: ", ";\n pointer-events: ", ";\n opacity: ", ";\n transform: ", ";\n\n width: 380px;\n max-width: 90vw;\n background-color: ", ";\n color: ", ";\n text-align: left;\n border-radius: 10px;\n padding: 10px 16px 16px 16px;\n font-size: 15px;\n font-weight: 500;\n line-height: 1.35;\n position: absolute;\n z-index: 10;\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);\n transition:\n opacity 0.3s ease-in-out,\n transform 0.3s ease-in-out;\n\n ", "\n\n @media screen and (max-width: 768px) {\n font-size: 14px;\n padding: 10px 14px 14px 14px;\n }\n"], ["\n visibility: ", ";\n pointer-events: ", ";\n opacity: ", ";\n transform: ", ";\n\n width: 380px;\n max-width: 90vw;\n background-color: ", ";\n color: ", ";\n text-align: left;\n border-radius: 10px;\n padding: 10px 16px 16px 16px;\n font-size: 15px;\n font-weight: 500;\n line-height: 1.35;\n position: absolute;\n z-index: 10;\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);\n transition:\n opacity 0.3s ease-in-out,\n transform 0.3s ease-in-out;\n\n ", "\n\n @media screen and (max-width: 768px) {\n font-size: 14px;\n padding: 10px 14px 14px 14px;\n }\n"])), function (_a) {
22
+ var $visible = _a.$visible;
23
+ return ($visible ? 'visible' : 'hidden');
24
+ }, function (_a) {
25
+ var $visible = _a.$visible;
26
+ return ($visible ? 'auto' : 'none');
27
+ }, function (_a) {
28
+ var $visible = _a.$visible;
29
+ return ($visible ? 1 : 0);
30
+ }, function (_a) {
31
+ var $visible = _a.$visible;
32
+ return $visible ? 'translateY(0)' : 'translateY(-10px)';
33
+ }, theme.colors.cinzaBase, theme.colors.erroApoio, function (_a) {
34
+ var $placement = _a.$placement;
35
+ return $placement === 'bottom'
36
+ ? 'top: 130%; left: 0;'
37
+ : $placement === 'top'
38
+ ? 'bottom: 130%; left: 0;'
39
+ : $placement === 'left'
40
+ ? 'right: 110%; top: 0;'
41
+ : 'left: 110%; top: 0;';
42
+ });
43
+ var Tooltip = function (_a) {
44
+ var content = _a.content, icon = _a.icon, _b = _a.placement, placement = _b === void 0 ? 'bottom' : _b, className = _a.className, defaultVisible = _a.defaultVisible, visible = _a.visible, onVisibleChange = _a.onVisibleChange, _c = _a.float, float = _c === void 0 ? false : _c;
45
+ var _d = useState(!!defaultVisible), internalVisible = _d[0], setInternalVisible = _d[1];
46
+ var isControlled = typeof visible === 'boolean';
47
+ var currentVisible = isControlled ? !!visible : internalVisible;
48
+ var hideTimeout = useRef();
49
+ return (React.createElement(Container, { "$float": float, className: className, onMouseEnter: function () {
50
+ clearTimeout(hideTimeout.current);
51
+ if (isControlled)
52
+ onVisibleChange && onVisibleChange(true);
53
+ else
54
+ setInternalVisible(true);
55
+ }, onMouseLeave: function () {
56
+ hideTimeout.current = setTimeout(function () {
57
+ if (isControlled)
58
+ onVisibleChange && onVisibleChange(false);
59
+ else
60
+ setInternalVisible(false);
61
+ }, 300);
62
+ } },
63
+ React.createElement(Trigger, { "$float": float }, icon),
64
+ React.createElement(Bubble, { "$visible": currentVisible, "$placement": placement }, content)));
65
+ };
66
+ export default Tooltip;
67
+ var templateObject_1, templateObject_2, templateObject_3;
@@ -25,22 +25,25 @@ var __rest = (this && this.__rest) || function (s, e) {
25
25
  return t;
26
26
  };
27
27
  import ConsultaSimplesIcon from '../../assets/icones/consultaSimples';
28
+ import Tooltip from '../../components/common/tooltip';
28
29
  import { useGlobalData } from '../../contexts/globalDataContext';
30
+ import { usePostHog } from '../../contexts/PostHogContext';
31
+ import theme from '../../styles/theme';
29
32
  import { formatMoney } from '../../utils/number';
30
33
  import { formatDocument } from '../../utils/string';
31
34
  import { format } from 'date-fns';
35
+ import { WarningCircle } from 'phosphor-react';
32
36
  import React, { useContext, useEffect } from 'react';
33
37
  import styled, { keyframes } from 'styled-components';
34
38
  import Section from '../interface/section';
35
39
  import StatusMessage from '../interface/statusMessage';
36
40
  import { Queries, RequestStatus } from '../webservice';
37
- import { usePostHog } from '../../contexts/PostHogContext';
38
41
  // Animação do spinner
39
42
  var spin = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n"], ["\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n"])));
40
43
  // Componente Spinner sutil
41
44
  var Spinner = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border: 1px solid rgba(0, 0, 0, 0.1);\n border-left-color: #222;\n border-radius: 50%;\n width: 9px;\n height: 9px;\n animation: ", " 1s linear infinite;\n margin-right: 8px;\n display: inline-block;\n vertical-align: middle;\n"], ["\n border: 1px solid rgba(0, 0, 0, 0.1);\n border-left-color: #222;\n border-radius: 50%;\n width: 9px;\n height: 9px;\n animation: ", " 1s linear infinite;\n margin-right: 8px;\n display: inline-block;\n vertical-align: middle;\n"])), spin);
42
45
  var ConsultaSimplesSection = function (_a) {
43
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
46
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
44
47
  var documento = _a.documento, children = _a.children, onClose = _a.onClose, isFinancial = _a.isFinancial, rest = __rest(_a, ["documento", "children", "onClose", "isFinancial"]);
45
48
  var ctx = useContext(Queries.Finder);
46
49
  var data = useGlobalData().data;
@@ -50,52 +53,74 @@ var ConsultaSimplesSection = function (_a) {
50
53
  ['ATIVA', 'REGULAR'].indexOf(data.dossie.summary.receitaStatus) === -1
51
54
  ? data.dossie.summary.receitaStatus
52
55
  : null;
56
+ // Leitura case-insensitive do CTIME (pode vir "CTIME" ou "ctime" etc.)
57
+ var getCI = function (obj, key) {
58
+ if (!obj)
59
+ return undefined;
60
+ var found = Object.keys(obj).find(function (k) { return k.toLowerCase() === key.toLowerCase(); });
61
+ return found ? String(obj[found]).trim() : undefined;
62
+ };
63
+ var ctimeStr = getCI(ctx === null || ctx === void 0 ? void 0 : ctx.urlData, 'CTIME');
64
+ // Parser simples para ISO e epoch (s/ms)
65
+ var parseCTIME = function (v) {
66
+ if (!v)
67
+ return null;
68
+ var n = Number(v);
69
+ if (!Number.isNaN(n)) {
70
+ var ms = n < 1e12 ? n * 1000 : n;
71
+ var d_1 = new Date(ms);
72
+ return Number.isNaN(d_1.getTime()) ? null : d_1;
73
+ }
74
+ var d = new Date(v);
75
+ return Number.isNaN(d.getTime()) ? null : d;
76
+ };
77
+ var ctimeDate = parseCTIME(ctimeStr);
78
+ var displayDate = ctimeDate !== null && ctimeDate !== void 0 ? ctimeDate : new Date();
79
+ // Origem dos dados a partir de um único header: x-data-source: realtime|cache
80
+ var dataSource = (((_e = (_d = ctx === null || ctx === void 0 ? void 0 : ctx.response) === null || _d === void 0 ? void 0 : _d.headers) === null || _e === void 0 ? void 0 : _e.get('x-data-source')) || '').toLowerCase();
81
+ var sourceLabel = dataSource === 'realtime'
82
+ ? 'tempo real'
83
+ : dataSource === 'cache'
84
+ ? 'cache'
85
+ : '';
86
+ // Conteúdos dos tooltips: linguagem clara para usuário final
87
+ var referenceTooltip = (React.createElement(React.Fragment, null,
88
+ React.createElement("strong", null, "Data de refer\u00EAncia"),
89
+ ":",
90
+ ' ',
91
+ format(displayDate, "dd/MM/yyyy 'às' HH:mm"),
92
+ React.createElement("br", null),
93
+ "Este \u00E9 o retrato da situa\u00E7\u00E3o nesse momento. Para ver a posi\u00E7\u00E3o mais recente, refa\u00E7a a consulta sem data fixa."));
53
94
  // Cria um array com cada tag de pendência, seu texto e sua flag de carregamento
95
+ var makeItem = function (label, loaded, text, error) { return ({
96
+ label: label,
97
+ loaded: Boolean(loaded),
98
+ text: text,
99
+ error: error
100
+ }); };
54
101
  var pendencias = [
55
- {
56
- label: 'Situação Receita',
57
- text: receitaStatus ? "".concat(receitaStatus) : '',
58
- loaded: true // assume que essa informação está disponível
59
- },
60
- {
61
- label: 'Dívidas Públicas',
62
- text: data.dividasPublicas
63
- ? "".concat(formatMoney(data.dividasPublicas), " em D\u00EDvidas P\u00FAblicas")
64
- : '',
65
- loaded: (_e = (_d = data.divida) === null || _d === void 0 ? void 0 : _d.isLoaded) !== null && _e !== void 0 ? _e : false
66
- },
67
- {
68
- label: 'Cheques sem Fundo',
69
- text: data.ccf
70
- ? "".concat(data.ccf === 1 ? 'Cheque sem Fundo' : "".concat(data.ccf, " Cheques sem Fundo"), " com \u00DAltima Ocorr\u00EAncia em ").concat(data.ultimoRegistroCCF)
71
- : '',
72
- loaded: (_g = (_f = data.ccfData) === null || _f === void 0 ? void 0 : _f.isLoaded) !== null && _g !== void 0 ? _g : false
73
- },
74
- {
75
- label: 'Protestos',
76
- text: data.protestos
77
- ? data.protestos === 1
78
- ? 'Protesto Encontrado'
79
- : "".concat(data.protestos, " Protestos")
80
- : '',
81
- loaded: (_j = (_h = data.protestosData) === null || _h === void 0 ? void 0 : _h.isLoaded) !== null && _j !== void 0 ? _j : false
82
- },
83
- {
84
- label: 'Processos Jurídicos',
85
- text: data.processosJuridicos
86
- ? "".concat(data.processosJuridicos, " ").concat(data.processosJuridicos === 1 ? 'Processo Jurídico' : 'Processos Jurídicos')
87
- : '',
88
- loaded: (_l = (_k = data.processosJuridicosData) === null || _k === void 0 ? void 0 : _k.isLoaded) !== null && _l !== void 0 ? _l : false
89
- },
90
- {
91
- label: 'Liminar',
92
- text: data.liminar &&
93
- (data.liminar.totalProtestos === 'NADA CONSTA' ||
94
- data.liminar.message === 'Encontrado')
95
- ? 'Indício de Liminar'
96
- : '',
97
- loaded: (_o = (_m = data.liminar) === null || _m === void 0 ? void 0 : _m.isLoaded) !== null && _o !== void 0 ? _o : false
98
- }
102
+ makeItem('Situação Receita', true, receitaStatus ? "".concat(receitaStatus) : ''),
103
+ makeItem('Dívidas Públicas', (_f = data.divida) === null || _f === void 0 ? void 0 : _f.isLoaded, data.dividasPublicas
104
+ ? "".concat(formatMoney(data.dividasPublicas), " em D\u00EDvidas P\u00FAblicas")
105
+ : '', (_g = data.divida) === null || _g === void 0 ? void 0 : _g.error),
106
+ makeItem('Cheques sem Fundo', (_h = data.ccfData) === null || _h === void 0 ? void 0 : _h.isLoaded, data.ccf
107
+ ? "".concat(data.ccf === 1 ? 'Cheque sem Fundo' : "".concat(data.ccf, " Cheques sem Fundo"), " com \u00DAltima Ocorr\u00EAncia em ").concat(data.ultimoRegistroCCF)
108
+ : '', (_j = data.ccfData) === null || _j === void 0 ? void 0 : _j.error),
109
+ makeItem('Protestos', (_k = data.protestosData) === null || _k === void 0 ? void 0 : _k.isLoaded, data.protestos
110
+ ? data.protestos === 1
111
+ ? 'Protesto Encontrado'
112
+ : "".concat(data.protestos, " Protestos")
113
+ : '', (_l = data.protestosData) === null || _l === void 0 ? void 0 : _l.error),
114
+ makeItem('Processos Jurídicos', (_m = data.processosJuridicosData) === null || _m === void 0 ? void 0 : _m.isLoaded, data.processosJuridicos
115
+ ? "".concat(data.processosJuridicos, " ").concat(data.processosJuridicos === 1
116
+ ? 'Processo Jurídico'
117
+ : 'Processos Jurídicos')
118
+ : '', (_o = data.processosJuridicosData) === null || _o === void 0 ? void 0 : _o.error),
119
+ makeItem('Liminar', (_p = data.liminar) === null || _p === void 0 ? void 0 : _p.isLoaded, data.liminar &&
120
+ (data.liminar.totalProtestos === 'NADA CONSTA' ||
121
+ data.liminar.message === 'Encontrado')
122
+ ? 'Indício de Liminar'
123
+ : '', (_q = data.liminar) === null || _q === void 0 ? void 0 : _q.error)
99
124
  ].filter(function (e) { return (e.label === 'Liminar' ? isFinancial : e); });
100
125
  var isError = (ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Error;
101
126
  var isLoading = (ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Loading;
@@ -104,7 +129,7 @@ var ConsultaSimplesSection = function (_a) {
104
129
  data.dividasPublicas ||
105
130
  data.processosJuridicos ||
106
131
  receitaStatus ||
107
- ((_p = data.liminar) === null || _p === void 0 ? void 0 : _p.message) === 'Encontrado';
132
+ ((_r = data.liminar) === null || _r === void 0 ? void 0 : _r.message) === 'Encontrado';
108
133
  var statusType = isError ? 'warning' : hasPendencias ? 'error' : 'success';
109
134
  useEffect(function () {
110
135
  if (posthog && pendencias.every(function (pendencia) { return pendencia.loaded; }))
@@ -112,16 +137,22 @@ var ConsultaSimplesSection = function (_a) {
112
137
  documento: documento,
113
138
  pendencias: pendencias.map(function (pendencia) { return ({
114
139
  label: pendencia.label,
115
- text: pendencia.text,
116
- }); }),
140
+ text: pendencia.text
141
+ }); })
117
142
  });
118
143
  }, [posthog, pendencias]);
119
144
  return (React.createElement(Section, __assign({ title: "Consulta Simples", subtitle: "Consulta de informa\u00E7\u00F5es do documento.", description: React.createElement(React.Fragment, null,
120
- React.createElement(StatusMessage, null, format(new Date(), "dd/MM/yyyy 'às' HH:mm")),
145
+ React.createElement(StatusMessage, null,
146
+ format(displayDate, "dd/MM/yyyy 'às' HH:mm"),
147
+ ctimeDate ? (React.createElement(React.Fragment, null,
148
+ ' ',
149
+ React.createElement(Tooltip, { content: referenceTooltip, placement: "left", float: true, icon: React.createElement(WarningCircle, { weight: "fill", size: 20, color: ctimeDate
150
+ ? theme.colors.cinzaEscuro
151
+ : theme.colors.cinzaEscuro, "aria-label": "Data de refer\u00EAncia" }) }))) : null),
121
152
  React.createElement(StatusMessage, { type: "found" }, formatDocument(documento)),
122
153
  isError && (ctx === null || ctx === void 0 ? void 0 : ctx.error) && (React.createElement(StatusMessage, { type: statusType }, ctx.error.message)),
123
154
  pendencias.map(function (item) {
124
- // Se a tag não está carregada, mostra o spinner com a mensagem de carregamento
155
+ var _a;
125
156
  if (!item.loaded) {
126
157
  return (React.createElement(StatusMessage, { key: item.label, type: "loading" },
127
158
  React.createElement(Spinner, null),
@@ -129,7 +160,9 @@ var ConsultaSimplesSection = function (_a) {
129
160
  item.label,
130
161
  "..."));
131
162
  }
132
- // Se carregado e houver texto, exibe-o; caso contrário, não renderiza nada
163
+ if ((_a = item.error) === null || _a === void 0 ? void 0 : _a.summary) {
164
+ return (React.createElement(StatusMessage, { key: item.label, type: "warning" }, item.error.summary));
165
+ }
133
166
  return item.text ? (React.createElement(StatusMessage, { key: item.label, type: "error" }, item.text)) : null;
134
167
  })), onClose: onClose, icon: ConsultaSimplesIcon, variant: isLoading ? 'loading' : 'default', ctx: ctx, loadingProps: {
135
168
  percentage: (ctx === null || ctx === void 0 ? void 0 : ctx.progress) || 0,
@@ -56,11 +56,12 @@ import { WarningCircle } from 'phosphor-react';
56
56
  import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
57
57
  import Button from '../common/button';
58
58
  import Modal from '../common/modal';
59
+ import Tooltip from '../common/tooltip';
59
60
  import { SummaryButton } from '../dossie/summary/styles';
60
61
  import StatusMessage from '../interface/statusMessage';
61
62
  import Section from '../section';
62
63
  import { Queries, RequestStatus, useFetch } from '../webservice';
63
- import { TitleWithTooltip, TooltipContainer, TooltipText } from './liminarStyles';
64
+ import { TitleWithTooltip } from './liminarStyles';
64
65
  import { useLiminarHistory } from './useLiminarHistory';
65
66
  import useLiminarProtestosDoPassado from './useLiminarProtestosDoPassado';
66
67
  /* ----------------------------------
@@ -95,12 +96,10 @@ var Liminar = function (_a) {
95
96
  var processedRef = useRef(false);
96
97
  var dataHashRef = useRef('');
97
98
  var invertedIdsRef = useRef([]);
98
- var _w = useState(false), isTooltipVisible = _w[0], setTooltipVisible = _w[1];
99
- var _x = useState(false), isEmailModalOpen = _x[0], setIsEmailModalOpen = _x[1];
100
- var _y = useState(''), emailModalMessage = _y[0], setEmailModalMessage = _y[1];
99
+ var _w = useState(false), isEmailModalOpen = _w[0], setIsEmailModalOpen = _w[1];
100
+ var _x = useState(''), emailModalMessage = _x[0], setEmailModalMessage = _x[1];
101
101
  var liminarMailPrice = 50000;
102
- var _z = useFetch("SELECT FROM 'LIMINAR'.'SENDMAIL'"), sendIndiciosEmail = _z.fetch, isEmailSending = _z.isLoading, emailError = _z.error;
103
- var hideTt = useRef();
102
+ var _y = useFetch("SELECT FROM 'LIMINAR'.'SENDMAIL'"), sendIndiciosEmail = _y.fetch, isEmailSending = _y.isLoading, emailError = _y.error;
104
103
  /*
105
104
  * Extrai e normaliza os tipos de documento presentes em ctx.document, retornando sempre um array de strings em minúsculo.
106
105
  */
@@ -142,7 +141,7 @@ var Liminar = function (_a) {
142
141
  /*
143
142
  * Identifica as origens de liminares detectadas e verifica se existe liminar de protesto invertida
144
143
  */
145
- var _0 = useMemo(function () {
144
+ var _z = useMemo(function () {
146
145
  var _a, _b;
147
146
  var labels = new Set();
148
147
  var indiciosApi = ((_a = ctx.document) === null || _a === void 0 ? void 0 : _a.indiciosDeLiminar) === true;
@@ -178,7 +177,7 @@ var Liminar = function (_a) {
178
177
  tiposDocumento,
179
178
  processosComAssuntoValido,
180
179
  (_f = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _f === void 0 ? void 0 : _f.indiciosDeLiminarProtestosDoPassado
181
- ]), origensDetectadas = _0.origensDetectadas, foundBusinessEntity = _0.foundBusinessEntity;
180
+ ]), origensDetectadas = _z.origensDetectadas, foundBusinessEntity = _z.foundBusinessEntity;
182
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]);
183
182
  useEffect(function () {
184
183
  if (!protestosIsReady)
@@ -394,22 +393,14 @@ var Liminar = function (_a) {
394
393
  return (React.createElement(React.Fragment, null,
395
394
  React.createElement(Section, { title: React.createElement(TitleWithTooltip, null,
396
395
  "Liminares para Remo\u00E7\u00E3o de Protesto",
397
- !!processosComAssuntoValido.length && ready && (React.createElement(TooltipContainer, { onMouseEnter: function () {
398
- clearTimeout(hideTt.current);
399
- setTooltipVisible(true);
400
- }, onMouseLeave: function () {
401
- hideTt.current = setTimeout(function () { return setTooltipVisible(false); }, 300);
402
- } },
403
- renderTooltipIcon(),
404
- React.createElement(TooltipText, { visible: isTooltipVisible },
405
- React.createElement(React.Fragment, null,
406
- tooltipMessage,
407
- 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: {
408
- fontSize: 13,
409
- cursor: 'pointer',
410
- textDecoration: 'underline',
411
- color: '#007aff'
412
- } }, p.id)); }))))))), subtitle: "Ind\u00EDcios de liminares para oculta\u00E7\u00E3o de registros.", icon: ProtestosIcon, ctx: ready ? ctx : ctxLoading, onSuccess: ready
396
+ !!processosComAssuntoValido.length && ready && (React.createElement(Tooltip, { icon: renderTooltipIcon(), content: React.createElement(React.Fragment, null,
397
+ tooltipMessage,
398
+ 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: {
399
+ fontSize: 13,
400
+ cursor: 'pointer',
401
+ textDecoration: 'underline',
402
+ color: '#007aff'
403
+ } }, p.id)); }))), placement: "bottom" }))), subtitle: "Ind\u00EDcios de liminares para oculta\u00E7\u00E3o de registros.", icon: ProtestosIcon, ctx: ready ? ctx : ctxLoading, onSuccess: ready
413
404
  ? function (_data, _context) {
414
405
  var _a, _b, _c, _d, _e, _f;
415
406
  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';
@@ -1,10 +1 @@
1
- export declare const TooltipContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
2
- export declare const TooltipIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("phosphor-react").IconProps & import("react").RefAttributes<SVGSVGElement>>, import("styled-components").DefaultTheme, {
3
- weight: "fill";
4
- size: 24;
5
- }, "size" | "weight">;
6
- export declare const TooltipText: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
7
- visible: boolean;
8
- }, never>;
9
1
  export declare const TitleWithTooltip: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
10
- export declare const GrayHighlighted: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -2,27 +2,6 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
2
2
  if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
3
  return cooked;
4
4
  };
5
- import theme from '../../styles/theme';
6
- import { WarningCircle } from 'phosphor-react';
7
5
  import styled from 'styled-components';
8
- export var TooltipContainer = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n display: inline-flex;\n align-items: center;\n margin-left: 8px;\n"], ["\n position: relative;\n display: inline-flex;\n align-items: center;\n margin-left: 8px;\n"])));
9
- export var TooltipIcon = styled(WarningCircle).attrs({
10
- weight: 'fill',
11
- size: 24
12
- })(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n color: ", ";\n cursor: pointer;\n transition: transform 0.2s ease;\n\n &:hover {\n transform: scale(1.2);\n }\n"], ["\n color: ", ";\n cursor: pointer;\n transition: transform 0.2s ease;\n\n &:hover {\n transform: scale(1.2);\n }\n"])), theme.colors.laranja);
13
- export var TooltipText = styled.span(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n visibility: ", ";\n pointer-events: ", ";\n opacity: ", ";\n transform: ", ";\n\n width: 380px;\n max-width: 90vw;\n background-color: ", ";\n color: ", ";\n text-align: left;\n border-radius: 10px;\n padding: 10px 16px 16px 16px;\n font-size: 15px;\n font-weight: 500;\n line-height: 1.35;\n position: absolute;\n z-index: 10;\n top: 130%;\n left: 0;\n transition:\n opacity 0.3s ease-in-out,\n transform 0.3s ease-in-out;\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);\n\n @media screen and (max-width: 768px) {\n font-size: 14px;\n padding: 10px 14px 14px 14px;\n }\n"], ["\n visibility: ", ";\n pointer-events: ", ";\n opacity: ", ";\n transform: ", ";\n\n width: 380px;\n max-width: 90vw;\n background-color: ", ";\n color: ", ";\n text-align: left;\n border-radius: 10px;\n padding: 10px 16px 16px 16px;\n font-size: 15px;\n font-weight: 500;\n line-height: 1.35;\n position: absolute;\n z-index: 10;\n top: 130%;\n left: 0;\n transition:\n opacity 0.3s ease-in-out,\n transform 0.3s ease-in-out;\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);\n\n @media screen and (max-width: 768px) {\n font-size: 14px;\n padding: 10px 14px 14px 14px;\n }\n"])), function (_a) {
14
- var visible = _a.visible;
15
- return (visible ? 'visible' : 'hidden');
16
- }, function (_a) {
17
- var visible = _a.visible;
18
- return (visible ? 'auto' : 'none');
19
- }, function (_a) {
20
- var visible = _a.visible;
21
- return (visible ? 1 : 0);
22
- }, function (_a) {
23
- var visible = _a.visible;
24
- return visible ? 'translateY(0)' : 'translateY(-10px)';
25
- }, theme.colors.cinzaBase, theme.colors.erroApoio);
26
- export var TitleWithTooltip = styled.div(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"])));
27
- export var GrayHighlighted = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n animation: highlight-gray 0.6s ease-out;\n\n @keyframes highlight-gray {\n from {\n background-color: ", ";\n }\n to {\n background-color: transparent;\n }\n }\n"], ["\n animation: highlight-gray 0.6s ease-out;\n\n @keyframes highlight-gray {\n from {\n background-color: ", ";\n }\n to {\n background-color: transparent;\n }\n }\n"])), theme.colors.cinzaClaro);
28
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
6
+ export var TitleWithTooltip = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: 8px;\n"], ["\n display: flex;\n align-items: center;\n gap: 8px;\n"])));
7
+ var templateObject_1;
@@ -34,15 +34,19 @@ var ProcessosJuridicos = function (_a) {
34
34
  ctxHashRef.current = currentCtxHash;
35
35
  if (ctx.type === RequestStatus.Error && !processedRef.current) {
36
36
  setData(function (prevState) {
37
- var _a;
38
- if (((_a = prevState.processosJuridicosData) === null || _a === void 0 ? void 0 : _a.isLoaded) &&
37
+ var _a, _b;
38
+ var alreadyEmpty = ((_a = prevState.processosJuridicosData) === null || _a === void 0 ? void 0 : _a.isLoaded) &&
39
39
  Array.isArray(prevState.processosJuridicosData.empresa) &&
40
- prevState.processosJuridicosData.empresa.length === 0) {
40
+ prevState.processosJuridicosData.empresa.length === 0;
41
+ if (alreadyEmpty && ((_b = prevState.processosJuridicosData) === null || _b === void 0 ? void 0 : _b.error)) {
41
42
  return prevState;
42
43
  }
43
44
  return __assign(__assign({}, prevState), { processosJuridicosData: {
44
45
  empresa: [],
45
- isLoaded: true
46
+ isLoaded: true,
47
+ error: {
48
+ summary: 'Falha ao consultar processos jurídicos, tente novamente mais tarde.'
49
+ }
46
50
  } });
47
51
  });
48
52
  processedRef.current = true;
@@ -56,7 +60,8 @@ var ProcessosJuridicos = function (_a) {
56
60
  if (qtyProcessos_1 > 0) {
57
61
  var processosJuridicosData_1 = {
58
62
  empresa: documentData_1.empresa,
59
- isLoaded: true
63
+ isLoaded: true,
64
+ error: undefined
60
65
  };
61
66
  setData(function (prevState) {
62
67
  var _a;
@@ -69,18 +74,11 @@ var ProcessosJuridicos = function (_a) {
69
74
  });
70
75
  }
71
76
  else {
72
- setData(function (prevState) {
73
- var _a;
74
- if (((_a = prevState.processosJuridicosData) === null || _a === void 0 ? void 0 : _a.isLoaded) &&
75
- Array.isArray(prevState.processosJuridicosData.empresa) &&
76
- prevState.processosJuridicosData.empresa.length === 0) {
77
- return prevState;
78
- }
79
- return __assign(__assign({}, prevState), { processosJuridicosData: {
80
- empresa: [],
81
- isLoaded: true
82
- } });
83
- });
77
+ setData(function (prevState) { return (__assign(__assign({}, prevState), { processosJuridicosData: {
78
+ empresa: [],
79
+ isLoaded: true,
80
+ error: undefined
81
+ } })); });
84
82
  }
85
83
  processedRef.current = true;
86
84
  }
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export { default as BankAccounts } from './components/bank-accounts/bank-account
3
3
  export { default as CCF } from './components/ccf/ccf';
4
4
  export { default as ChartSystem } from './components/chart/chartSystem';
5
5
  export { default as AddItemField } from './components/common/addItem';
6
+ export { default as Tooltip } from './components/common/tooltip';
6
7
  export { default as Contacts } from './components/contacts/contacts';
7
8
  export { default as DividasPublicas } from './components/dividasPublicas/dividasPublicas';
8
9
  export { default as Dossie } from './components/dossie/dossie';
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ export { default as BankAccounts } from './components/bank-accounts/bank-account
3
3
  export { default as CCF } from './components/ccf/ccf';
4
4
  export { default as ChartSystem } from './components/chart/chartSystem';
5
5
  export { default as AddItemField } from './components/common/addItem';
6
+ export { default as Tooltip } from './components/common/tooltip';
6
7
  export { default as Contacts } from './components/contacts/contacts';
7
8
  export { default as DividasPublicas } from './components/dividasPublicas/dividasPublicas';
8
9
  export { default as Dossie } from './components/dossie/dossie';