@credithub/harlan-components 1.106.2 → 1.107.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 +15 -14
- package/dist/components/edital/edital.js +27 -27
- package/dist/components/edital/editalList.js +1 -1
- package/dist/consultaSimples.js +12 -1
- package/lib/cjs/index.js +63 -233
- package/lib/esm/index.js +63 -233
- package/package.json +1 -1
|
@@ -25,7 +25,6 @@ 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';
|
|
29
28
|
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
30
29
|
import { usePostHog } from '../../contexts/PostHogContext';
|
|
31
30
|
import usePrintWhenStable from '../../hooks/usePrintWhenStable';
|
|
@@ -34,7 +33,7 @@ import { formatMoney } from '../../utils/number';
|
|
|
34
33
|
import { formatDocument } from '../../utils/string';
|
|
35
34
|
import { hasOneOfTags } from '../../utils/tags';
|
|
36
35
|
import { format } from 'date-fns';
|
|
37
|
-
import {
|
|
36
|
+
import { WarningCircle } from 'phosphor-react';
|
|
38
37
|
import React, { useContext, useEffect } from 'react';
|
|
39
38
|
import styled, { keyframes } from 'styled-components';
|
|
40
39
|
import Section from '../interface/section';
|
|
@@ -49,13 +48,13 @@ var ClickableStatusMessage = styled(StatusMessage)(templateObject_3 || (template
|
|
|
49
48
|
// Wrapper para o texto clicável dentro do StatusMessage
|
|
50
49
|
var ClickableText = styled.span(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n cursor: pointer;\n &:hover {\n opacity: 0.85;\n }\n"], ["\n cursor: pointer;\n &:hover {\n opacity: 0.85;\n }\n"])));
|
|
51
50
|
var ConsultaSimplesSection = function (_a) {
|
|
52
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x
|
|
53
|
-
var documento = _a.documento, children = _a.children, onClose = _a.onClose, onClickPrint = _a.onClickPrint, isFinancial = _a.isFinancial, ctime = _a.ctime, printMode = _a.printMode,
|
|
51
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
52
|
+
var documento = _a.documento, children = _a.children, onClose = _a.onClose, onClickPrint = _a.onClickPrint, isFinancial = _a.isFinancial, ctime = _a.ctime, printMode = _a.printMode, _y = _a.tags, tags = _y === void 0 ? [] : _y, rest = __rest(_a, ["documento", "children", "onClose", "onClickPrint", "isFinancial", "ctime", "printMode", "tags"]);
|
|
54
53
|
var ctx = useContext(Queries.Finder);
|
|
55
54
|
var data = useGlobalData().data;
|
|
56
55
|
var posthog = usePostHog().posthog;
|
|
57
56
|
// Hook para observar mutações no DOM e chamar callback quando estável
|
|
58
|
-
var
|
|
57
|
+
var _z = usePrintWhenStable({
|
|
59
58
|
debounceTime: 500,
|
|
60
59
|
maxWaitTime: 30000,
|
|
61
60
|
onStart: function () {
|
|
@@ -66,7 +65,7 @@ var ConsultaSimplesSection = function (_a) {
|
|
|
66
65
|
// Chama o callback externo (Harlan decide como imprimir)
|
|
67
66
|
onClickPrint === null || onClickPrint === void 0 ? void 0 : onClickPrint();
|
|
68
67
|
}
|
|
69
|
-
}), printWhenStable =
|
|
68
|
+
}), printWhenStable = _z.printWhenStable, isWaiting = _z.isWaiting;
|
|
70
69
|
// Handler que usa o observer ao invés de imprimir diretamente
|
|
71
70
|
var handlePrint = function () {
|
|
72
71
|
printWhenStable();
|
|
@@ -139,7 +138,9 @@ var ConsultaSimplesSection = function (_a) {
|
|
|
139
138
|
: '', (_q = data.liminar) === null || _q === void 0 ? void 0 : _q.error),
|
|
140
139
|
makeItem('Potenciais Protestos Entrantes', (_r = data.editalData) === null || _r === void 0 ? void 0 : _r.isLoaded, ((_s = data.editalData) === null || _s === void 0 ? void 0 : _s.recentesCount)
|
|
141
140
|
? "".concat(data.editalData.recentesCount === 1 ? '1 Potencial Protesto Entrante' : "".concat(data.editalData.recentesCount, " Potenciais Protestos Entrantes"))
|
|
142
|
-
: ''
|
|
141
|
+
: ''
|
|
142
|
+
// Não exibe erro de edital - deve falhar silenciosamente
|
|
143
|
+
)
|
|
143
144
|
].filter(function (e) {
|
|
144
145
|
if (e.label === 'Liminar')
|
|
145
146
|
return isFinancial;
|
|
@@ -154,8 +155,9 @@ var ConsultaSimplesSection = function (_a) {
|
|
|
154
155
|
data.dividasPublicas ||
|
|
155
156
|
data.processosJuridicos ||
|
|
156
157
|
receitaStatus ||
|
|
157
|
-
((
|
|
158
|
-
((
|
|
158
|
+
((_t = data.liminar) === null || _t === void 0 ? void 0 : _t.message) === 'Encontrado' ||
|
|
159
|
+
(((_u = data.editalData) === null || _u === void 0 ? void 0 : _u.recentesCount) &&
|
|
160
|
+
hasOneOfTags(tags, ['diamante', 'diamante-new']));
|
|
159
161
|
var statusType = isError ? 'warning' : hasPendencias ? 'error' : 'success';
|
|
160
162
|
useEffect(function () {
|
|
161
163
|
if (posthog && pendencias.every(function (pendencia) { return pendencia.loaded; }))
|
|
@@ -281,15 +283,14 @@ var ConsultaSimplesSection = function (_a) {
|
|
|
281
283
|
}
|
|
282
284
|
return item.text ? (item.label === 'Potenciais Protestos Entrantes' ? (React.createElement(ClickableStatusMessage, { key: item.label, type: "error", onClick: scrollToEditais, title: "Clique para ver detalhes" }, item.text)) : (React.createElement(StatusMessage, { key: item.label, type: "error" }, item.text))) : null;
|
|
283
285
|
}),
|
|
284
|
-
((
|
|
285
|
-
!!((
|
|
286
|
+
((_v = data.editalData) === null || _v === void 0 ? void 0 : _v.isLoaded) &&
|
|
287
|
+
!!((_w = data.editalData) === null || _w === void 0 ? void 0 : _w.vencidosCount) &&
|
|
286
288
|
data.editalData.vencidosCount > 0 &&
|
|
287
289
|
hasOneOfTags(tags, ['diamante', 'diamante-new']) && (React.createElement(StatusMessage, { type: "error" },
|
|
288
290
|
React.createElement(ClickableText, { onClick: scrollToEditais, title: "Clique para ver detalhes" },
|
|
289
291
|
"Cart\u00F3rio com dificuldade para intimar",
|
|
290
|
-
((
|
|
291
|
-
" desde o: ".concat(data.editalData.dataEditalMaisAntigo)),
|
|
292
|
-
React.createElement(Tooltip, { icon: React.createElement(Info, { size: 16, weight: "fill", style: { marginLeft: 6, verticalAlign: 'middle' } }), content: renderVencidosTooltip(), placement: "left", float: true })))), onClose: onClose, icon: ConsultaSimplesIcon, variant: isLoading ? 'loading' : 'default', ctx: ctx, loadingProps: {
|
|
292
|
+
((_x = data.editalData) === null || _x === void 0 ? void 0 : _x.dataEditalMaisAntigo) &&
|
|
293
|
+
" desde o: ".concat(data.editalData.dataEditalMaisAntigo))))), onClose: onClose, icon: ConsultaSimplesIcon, variant: isLoading ? 'loading' : 'default', ctx: ctx, loadingProps: {
|
|
293
294
|
percentage: (ctx === null || ctx === void 0 ? void 0 : ctx.progress) || 0,
|
|
294
295
|
hidden: !isLoading
|
|
295
296
|
}, printMode: printMode }, rest), children));
|
|
@@ -44,26 +44,30 @@ var Edital = function (_a) {
|
|
|
44
44
|
var hasAccess = useMemo(function () {
|
|
45
45
|
return hasOneOfTags(tags, ['diamante', 'diamante-new']);
|
|
46
46
|
}, [tags]);
|
|
47
|
-
|
|
47
|
+
// const EDITAL_ERROR_SUMMARY =
|
|
48
|
+
// 'Falha ao consultar intimações de protestos entrantes.';
|
|
48
49
|
// Atualiza globalData quando há erro
|
|
49
50
|
useEffect(function () {
|
|
50
|
-
if (!ctx)
|
|
51
|
+
if (!hasAccess || !ctx)
|
|
51
52
|
return;
|
|
52
|
-
if (ctx.type === RequestStatus.Error) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
53
|
+
// if (ctx.type === RequestStatus.Error) {
|
|
54
|
+
// setData((prevState: GlobalState) => ({
|
|
55
|
+
// ...prevState,
|
|
56
|
+
// editalData: {
|
|
57
|
+
// isLoaded: true,
|
|
58
|
+
// error: { summary: EDITAL_ERROR_SUMMARY }
|
|
59
|
+
// }
|
|
60
|
+
// }));
|
|
61
|
+
// return;
|
|
62
|
+
// }
|
|
63
|
+
if (ctx.type === RequestStatus.Empty || ctx.type === RequestStatus.Error) {
|
|
60
64
|
setData(function (prevState) { return (__assign(__assign({}, prevState), { editalData: { isLoaded: true } })); });
|
|
61
65
|
return;
|
|
62
66
|
}
|
|
63
|
-
}, [ctx, setData]);
|
|
67
|
+
}, [ctx, setData, hasAccess]);
|
|
64
68
|
// Atualiza globalData com os dados do edital
|
|
65
69
|
useEffect(function () {
|
|
66
|
-
if (dataUpdated || !ctx.document)
|
|
70
|
+
if (!hasAccess || dataUpdated || !ctx.document)
|
|
67
71
|
return;
|
|
68
72
|
var response = ctx.document;
|
|
69
73
|
var editais = (response === null || response === void 0 ? void 0 : response.editalEletronico) || [];
|
|
@@ -131,15 +135,15 @@ var Edital = function (_a) {
|
|
|
131
135
|
: undefined
|
|
132
136
|
} })); });
|
|
133
137
|
setDataUpdated(true);
|
|
134
|
-
}, [ctx.document, dataUpdated, setData]);
|
|
138
|
+
}, [ctx.document, dataUpdated, setData, hasAccess]);
|
|
135
139
|
// Marca como carregando quando inicia requisição
|
|
136
140
|
useEffect(function () {
|
|
137
|
-
if (!ctx)
|
|
141
|
+
if (!hasAccess || !ctx)
|
|
138
142
|
return;
|
|
139
143
|
if (ctx.type === RequestStatus.Loading) {
|
|
140
144
|
setData(function (prevState) { return (__assign(__assign({}, prevState), { editalData: __assign(__assign({}, (prevState.editalData || {})), { isLoaded: false }) })); });
|
|
141
145
|
}
|
|
142
|
-
}, [ctx, setData]);
|
|
146
|
+
}, [ctx, setData, hasAccess]);
|
|
143
147
|
var handleSuccess = function (response) {
|
|
144
148
|
var _a, _b, _c, _d;
|
|
145
149
|
var editais = (response === null || response === void 0 ? void 0 : response.editalEletronico) || [];
|
|
@@ -160,24 +164,20 @@ var Edital = function (_a) {
|
|
|
160
164
|
return (React.createElement(StatusMessage, { type: "default" }, "N\u00E3o h\u00E1 intima\u00E7\u00F5es por edital eletr\u00F4nico"));
|
|
161
165
|
}
|
|
162
166
|
var messages = [];
|
|
163
|
-
// Count message
|
|
167
|
+
// Count message - sempre mostra apenas recentes
|
|
168
|
+
var countText = recentesCount === 0
|
|
169
|
+
? 'Nenhuma intimação recente encontrada'
|
|
170
|
+
: recentesCount === 1
|
|
171
|
+
? 'Encontrada 1 intimação'
|
|
172
|
+
: "Encontradas ".concat(recentesCount, " intima\u00E7\u00F5es");
|
|
173
|
+
messages.push(React.createElement(StatusMessage, { key: "count", type: recentesCount > 0 ? 'error' : 'default' }, countText));
|
|
174
|
+
// Warning banner apenas se houver vencidos
|
|
164
175
|
if (vencidosCount > 0) {
|
|
165
|
-
var countText = total === 1
|
|
166
|
-
? "Encontrada 1 intima\u00E7\u00E3o (".concat(recentesCount, " recente; ").concat(vencidosCount, " vencida oculta)")
|
|
167
|
-
: "Encontradas ".concat(total, " intima\u00E7\u00F5es (").concat(recentesCount, " recentes; ").concat(vencidosCount, " vencidas ocultas)");
|
|
168
|
-
messages.push(React.createElement(StatusMessage, { key: "count", type: total > 0 ? 'error' : 'default' }, countText));
|
|
169
|
-
// Warning banner
|
|
170
176
|
var dataDesde = (_a = globalData.editalData) === null || _a === void 0 ? void 0 : _a.dataEditalMaisAntigo;
|
|
171
177
|
messages.push(React.createElement(StatusMessage, { key: "warning", type: "error" },
|
|
172
178
|
"Cart\u00F3rio com dificuldade para intimar",
|
|
173
179
|
dataDesde && " desde o: ".concat(dataDesde)));
|
|
174
180
|
}
|
|
175
|
-
else {
|
|
176
|
-
var countText = recentesCount === 1
|
|
177
|
-
? 'Encontrada 1 intimação'
|
|
178
|
-
: "Encontradas ".concat(recentesCount, " intima\u00E7\u00F5es");
|
|
179
|
-
messages.push(React.createElement(StatusMessage, { key: "count", type: recentesCount > 0 ? 'error' : 'default' }, countText));
|
|
180
|
-
}
|
|
181
181
|
return React.createElement(React.Fragment, null, messages);
|
|
182
182
|
};
|
|
183
183
|
return {
|
|
@@ -72,7 +72,7 @@ var EditalList = function (_a) {
|
|
|
72
72
|
React.createElement(Clock, { size: 14, weight: "bold" }),
|
|
73
73
|
remainingDays > 0
|
|
74
74
|
? "".concat(remainingDays, " ").concat(remainingDays === 1 ? 'dia útil' : 'dias úteis', " para protesto")
|
|
75
|
-
: '
|
|
75
|
+
: 'Protesto entrando hoje'))),
|
|
76
76
|
React.createElement(ResultContent, { print: "repeat(3, 1fr)", desktop: "repeat(3, 1fr)", tablet: "repeat(2, 1fr)", mobile: "1fr" },
|
|
77
77
|
React.createElement(AddItemField, { name: "Cart\u00F3rio", value: edital.nome_cartorio }),
|
|
78
78
|
React.createElement(AddItemField, { name: "Endere\u00E7o", value: "".concat(edital.endereco, ", ").concat(edital.endereco_numero, " - ").concat(edital.bairroc, ", ").concat(edital.cidadec, "/").concat(edital.uf) }),
|
package/dist/consultaSimples.js
CHANGED
|
@@ -26,6 +26,7 @@ import { PrintModeProvider } from './contexts/printModeContext';
|
|
|
26
26
|
import useToggle from './hooks/useToggle';
|
|
27
27
|
import GlobalStyle from './styles/globalStyle';
|
|
28
28
|
import theme from './styles/theme';
|
|
29
|
+
import { hasOneOfTags } from './utils/tags';
|
|
29
30
|
Chart.register.apply(Chart, registerables);
|
|
30
31
|
var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: 'Open Sans Condensed';\n display: flex;\n flex-direction: column;\n gap: 20px;\n margin-bottom: 20px;\n\n * {\n -webkit-print-color-adjust: exact !important;\n print-color-adjust: exact !important;\n }\n\n @media print {\n @page {\n size: auto;\n margin: 5mm;\n }\n }\n"], ["\n font-family: 'Open Sans Condensed';\n display: flex;\n flex-direction: column;\n gap: 20px;\n margin-bottom: 20px;\n\n * {\n -webkit-print-color-adjust: exact !important;\n print-color-adjust: exact !important;\n }\n\n @media print {\n @page {\n size: auto;\n margin: 5mm;\n }\n }\n"])));
|
|
31
32
|
var FinderDependency = function (_a) {
|
|
@@ -60,12 +61,22 @@ var HasCreditsVerification = function (_a) {
|
|
|
60
61
|
React.createElement("a", { href: "https://painel.credithub.com.br/?apiKey=".concat(apiKey), target: "_blank", rel: "noopener noreferrer" }, "painel.credithub.com.br"),
|
|
61
62
|
".")));
|
|
62
63
|
};
|
|
64
|
+
// Conditional wrapper for Edital query based on diamante tags
|
|
65
|
+
var EditalQueryWrapper = function (_a) {
|
|
66
|
+
var hasDiamanteAccess = _a.hasDiamanteAccess, documento = _a.documento, children = _a.children;
|
|
67
|
+
if (hasDiamanteAccess) {
|
|
68
|
+
return (React.createElement(Queries.Edital.Request, { data: { documento: documento } }, children));
|
|
69
|
+
}
|
|
70
|
+
return React.createElement(React.Fragment, null, children);
|
|
71
|
+
};
|
|
63
72
|
var ConsultaSimples = function (_a) {
|
|
64
73
|
var _b, _c, _d;
|
|
65
74
|
var _documento = _a.documento, onClickConsultarProcessoJuridico = _a.onClickConsultarProcessoJuridico, onClickQSA = _a.onClickQSA, onClickPrint = _a.onClickPrint, apiKey = _a.apiKey, queryParams = _a.queryParams, onClose = _a.onClose, hasCredits = _a.hasCredits, _e = _a.initRefinBoaVista, initRefinBoaVista = _e === void 0 ? false : _e, _f = _a.initRefinSerasa, initRefinSerasa = _f === void 0 ? false : _f, _g = _a.initVeiculos, initVeiculos = _g === void 0 ? false : _g, _h = _a.printMode, printMode = _h === void 0 ? false : _h, _j = _a.isFinancial, isFinancial = _j === void 0 ? false : _j, _k = _a.tags, tags = _k === void 0 ? [] : _k, posthog = _a.posthog;
|
|
66
75
|
var documento = _documento.replace(/\D+/g, '');
|
|
67
76
|
// extrai CTIME (case-insensitive) dos urlData para repassar como prop
|
|
68
77
|
var ctimeProp = (_c = (_b = queryParams === null || queryParams === void 0 ? void 0 : queryParams.urlData) === null || _b === void 0 ? void 0 : _b.CTIME) !== null && _c !== void 0 ? _c : (_d = queryParams === null || queryParams === void 0 ? void 0 : queryParams.urlData) === null || _d === void 0 ? void 0 : _d.ctime;
|
|
78
|
+
// Check if user has diamante access
|
|
79
|
+
var hasDiamanteAccess = hasOneOfTags(tags, ['diamante', 'diamante-new']);
|
|
69
80
|
return (React.createElement(ThemeProvider, { theme: theme },
|
|
70
81
|
React.createElement(ErrorModalProvider, null,
|
|
71
82
|
React.createElement(PostHogProvider, { posthog: posthog },
|
|
@@ -79,7 +90,7 @@ var ConsultaSimples = function (_a) {
|
|
|
79
90
|
React.createElement(Queries.ProcessosJuridicos.Request, { data: { documento: documento } },
|
|
80
91
|
React.createElement(Queries.Liminar.Request, { data: { documento: documento } },
|
|
81
92
|
React.createElement(Queries.LiminarCenprot.Request, { data: { documento: documento } },
|
|
82
|
-
React.createElement(
|
|
93
|
+
React.createElement(EditalQueryWrapper, { hasDiamanteAccess: hasDiamanteAccess, documento: documento },
|
|
83
94
|
React.createElement(Wrapper, null,
|
|
84
95
|
React.createElement(GlobalDataProvider, null,
|
|
85
96
|
React.createElement(ConsultaSimplesSection, { documento: documento, onClose: onClose, onClickPrint: onClickPrint, isFinancial: isFinancial, ctime: ctimeProp, printMode: printMode, tags: tags },
|