@credithub/harlan-components 1.120.10 → 1.121.1
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/common/ModalInstallExtension.js +3 -2
- package/dist/components/consultaSimplesSection/consultaSimplesSection.d.ts +1 -0
- package/dist/components/consultaSimplesSection/consultaSimplesSection.js +64 -53
- package/dist/components/protestos/protestos.js +22 -10
- package/dist/components/protestos/protestosList.d.ts +4 -1
- package/dist/components/protestos/protestosList.js +43 -12
- package/dist/constants/extensionCopy.d.ts +7 -0
- package/dist/constants/extensionCopy.js +7 -0
- package/dist/consultaSimples.js +1 -1
- package/lib/cjs/index.js +246 -188
- package/lib/esm/index.js +246 -188
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
4
4
|
};
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import styled from 'styled-components';
|
|
7
|
+
import { EXTENSION_MODAL_DESCRIPTION, EXTENSION_MODAL_TITLE } from '../../constants/extensionCopy';
|
|
7
8
|
import Button from './button';
|
|
8
9
|
import Modal from './modal';
|
|
9
10
|
var EXTENSION_URL = 'https://chromewebstore.google.com/detail/credithub/kbabapbdjbfdigkbmicgjkfgobifkoli';
|
|
@@ -62,8 +63,8 @@ var ModalInstallExtension = function (_a) {
|
|
|
62
63
|
React.createElement(ContentWrapper, null,
|
|
63
64
|
React.createElement(IconContainer, null,
|
|
64
65
|
React.createElement(PuzzleIcon, null)),
|
|
65
|
-
React.createElement(Title, null,
|
|
66
|
-
React.createElement(Description, null,
|
|
66
|
+
React.createElement(Title, null, EXTENSION_MODAL_TITLE),
|
|
67
|
+
React.createElement(Description, null, EXTENSION_MODAL_DESCRIPTION))));
|
|
67
68
|
};
|
|
68
69
|
export default ModalInstallExtension;
|
|
69
70
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|
|
@@ -25,6 +25,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
25
25
|
return t;
|
|
26
26
|
};
|
|
27
27
|
import ConsultaSimplesIcon from '../../assets/icones/consultaSimples';
|
|
28
|
+
import { EXTENSION_PROTESTO_LABEL } from '../../constants/extensionCopy';
|
|
28
29
|
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
29
30
|
import { usePostHog } from '../../contexts/PostHogContext';
|
|
30
31
|
import usePrintWhenStable from '../../hooks/usePrintWhenStable';
|
|
@@ -34,11 +35,13 @@ import { formatDocument } from '../../utils/string';
|
|
|
34
35
|
import { hasOneOfTags } from '../../utils/tags';
|
|
35
36
|
import { format } from 'date-fns';
|
|
36
37
|
import { WarningCircle } from 'phosphor-react';
|
|
37
|
-
import React, { useContext, useEffect } from 'react';
|
|
38
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
38
39
|
import styled, { keyframes } from 'styled-components';
|
|
39
40
|
import Section from '../interface/section';
|
|
40
41
|
import StatusMessage from '../interface/statusMessage';
|
|
41
42
|
import { Queries, RequestStatus } from '../webservice';
|
|
43
|
+
import ModalInstallExtension from '../common/ModalInstallExtension';
|
|
44
|
+
var PREMIUM_TAGS_EXTENSION = ['prata', 'ouro', 'diamante', 'prata-new', 'ouro-new', 'diamante-new'];
|
|
42
45
|
// Animação do spinner
|
|
43
46
|
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"])));
|
|
44
47
|
// Componente Spinner sutil
|
|
@@ -48,13 +51,18 @@ var ClickableStatusMessage = styled(StatusMessage)(templateObject_3 || (template
|
|
|
48
51
|
// Wrapper para o texto clicável dentro do StatusMessage
|
|
49
52
|
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"])));
|
|
50
53
|
var ConsultaSimplesSection = function (_a) {
|
|
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,
|
|
54
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
55
|
+
var documento = _a.documento, children = _a.children, onClose = _a.onClose, onClickPrint = _a.onClickPrint, isFinancial = _a.isFinancial, ctime = _a.ctime, printMode = _a.printMode, _1 = _a.tags, tags = _1 === void 0 ? [] : _1, extensionInstalled = _a.extensionInstalled, rest = __rest(_a, ["documento", "children", "onClose", "onClickPrint", "isFinancial", "ctime", "printMode", "tags", "extensionInstalled"]);
|
|
53
56
|
var ctx = useContext(Queries.Finder);
|
|
54
57
|
var data = useGlobalData().data;
|
|
55
58
|
var posthog = usePostHog().posthog;
|
|
59
|
+
var _2 = useState(false), isExtensionModalOpen = _2[0], setIsExtensionModalOpen = _2[1];
|
|
60
|
+
var hasProtestos = ((_c = (_b = data === null || data === void 0 ? void 0 : data.protestosData) === null || _b === void 0 ? void 0 : _b.totalProtestos) !== null && _c !== void 0 ? _c : 0) > 0 &&
|
|
61
|
+
((_d = data === null || data === void 0 ? void 0 : data.protestosData) === null || _d === void 0 ? void 0 : _d.isLoaded) === true;
|
|
62
|
+
var hasPremiumAccess = hasOneOfTags(tags, PREMIUM_TAGS_EXTENSION);
|
|
63
|
+
var showExtensionLabel = hasProtestos && hasPremiumAccess && extensionInstalled === false;
|
|
56
64
|
// Hook para observar mutações no DOM e chamar callback quando estável
|
|
57
|
-
var
|
|
65
|
+
var _3 = usePrintWhenStable({
|
|
58
66
|
debounceTime: 500,
|
|
59
67
|
maxWaitTime: 30000,
|
|
60
68
|
onStart: function () {
|
|
@@ -65,13 +73,13 @@ var ConsultaSimplesSection = function (_a) {
|
|
|
65
73
|
// Chama o callback externo (Harlan decide como imprimir)
|
|
66
74
|
onClickPrint === null || onClickPrint === void 0 ? void 0 : onClickPrint();
|
|
67
75
|
}
|
|
68
|
-
}), printWhenStable =
|
|
76
|
+
}), printWhenStable = _3.printWhenStable, isWaiting = _3.isWaiting;
|
|
69
77
|
// Handler que usa o observer ao invés de imprimir diretamente
|
|
70
78
|
var handlePrint = function () {
|
|
71
79
|
printWhenStable();
|
|
72
80
|
};
|
|
73
81
|
// Extraindo valores do globalData
|
|
74
|
-
var receitaStatus = ((
|
|
82
|
+
var receitaStatus = ((_f = (_e = data.dossie) === null || _e === void 0 ? void 0 : _e.summary) === null || _f === void 0 ? void 0 : _f.receitaStatus) &&
|
|
75
83
|
['ATIVA', 'REGULAR'].indexOf(data.dossie.summary.receitaStatus) === -1
|
|
76
84
|
? data.dossie.summary.receitaStatus
|
|
77
85
|
: null;
|
|
@@ -100,7 +108,7 @@ var ConsultaSimplesSection = function (_a) {
|
|
|
100
108
|
var ctimeDate = parseCTIME(ctimeStr);
|
|
101
109
|
var displayDate = ctimeDate !== null && ctimeDate !== void 0 ? ctimeDate : new Date();
|
|
102
110
|
// Origem dos dados a partir de um único header: x-data-source: realtime|cache
|
|
103
|
-
var dataSource = (((
|
|
111
|
+
var dataSource = (((_h = (_g = ctx === null || ctx === void 0 ? void 0 : ctx.response) === null || _g === void 0 ? void 0 : _g.headers) === null || _h === void 0 ? void 0 : _h.get('x-data-source')) || '').toLowerCase();
|
|
104
112
|
var sourceLabel = dataSource === 'realtime'
|
|
105
113
|
? 'tempo real'
|
|
106
114
|
: dataSource === 'cache'
|
|
@@ -115,26 +123,26 @@ var ConsultaSimplesSection = function (_a) {
|
|
|
115
123
|
}); };
|
|
116
124
|
var pendencias = [
|
|
117
125
|
makeItem('Situação Receita', true, receitaStatus ? "".concat(receitaStatus) : ''),
|
|
118
|
-
makeItem('Dívidas Públicas', (
|
|
126
|
+
makeItem('Dívidas Públicas', (_j = data.divida) === null || _j === void 0 ? void 0 : _j.isLoaded, data.dividasPublicas
|
|
119
127
|
? "".concat(formatMoney(data.dividasPublicas), " em D\u00EDvidas P\u00FAblicas")
|
|
120
|
-
: '', (
|
|
121
|
-
makeItem('Cheques sem Fundo', (
|
|
128
|
+
: '', (_k = data.divida) === null || _k === void 0 ? void 0 : _k.error),
|
|
129
|
+
makeItem('Cheques sem Fundo', (_l = data.ccfData) === null || _l === void 0 ? void 0 : _l.isLoaded, data.ccf
|
|
122
130
|
? "".concat(data.ccf === 1 ? 'Cheque sem Fundo' : "".concat(data.ccf, " Cheques sem Fundo"), " com \u00DAltima Ocorr\u00EAncia em ").concat(data.ultimoRegistroCCF)
|
|
123
|
-
: '', (
|
|
124
|
-
makeItem('Protestos', (
|
|
131
|
+
: '', (_m = data.ccfData) === null || _m === void 0 ? void 0 : _m.error),
|
|
132
|
+
makeItem('Protestos', (_o = data.protestosData) === null || _o === void 0 ? void 0 : _o.isLoaded, data.protestos
|
|
125
133
|
? data.protestos === 1
|
|
126
134
|
? 'Protesto Encontrado'
|
|
127
135
|
: "".concat(data.protestos, " Protestos")
|
|
128
|
-
: '', (
|
|
129
|
-
makeItem('Processos Jurídicos', (
|
|
136
|
+
: '', (_p = data.protestosData) === null || _p === void 0 ? void 0 : _p.error),
|
|
137
|
+
makeItem('Processos Jurídicos', (_q = data.processosJuridicosData) === null || _q === void 0 ? void 0 : _q.isLoaded, data.processosJuridicos
|
|
130
138
|
? "".concat(data.processosJuridicos, " ").concat(data.processosJuridicos === 1
|
|
131
139
|
? 'Processo Jurídico'
|
|
132
140
|
: 'Processos Jurídicos')
|
|
133
|
-
: '', (
|
|
134
|
-
makeItem('Liminar', (
|
|
141
|
+
: '', (_r = data.processosJuridicosData) === null || _r === void 0 ? void 0 : _r.error),
|
|
142
|
+
makeItem('Liminar', (_s = data.liminar) === null || _s === void 0 ? void 0 : _s.isLoaded, ((_t = data.liminar) === null || _t === void 0 ? void 0 : _t.message) === 'Encontrado'
|
|
135
143
|
? 'Indício de Liminar'
|
|
136
|
-
: '', (
|
|
137
|
-
makeItem('Potenciais Protestos Entrantes', true, ((
|
|
144
|
+
: '', (_u = data.liminar) === null || _u === void 0 ? void 0 : _u.error),
|
|
145
|
+
makeItem('Potenciais Protestos Entrantes', true, ((_v = data.editalData) === null || _v === void 0 ? void 0 : _v.recentesCount)
|
|
138
146
|
? "".concat(data.editalData.recentesCount === 1 ? '1 Potencial Protesto Entrante' : "".concat(data.editalData.recentesCount, " Potenciais Protestos Entrantes"))
|
|
139
147
|
: ''
|
|
140
148
|
// Não exibe erro de edital - deve falhar silenciosamente
|
|
@@ -153,8 +161,8 @@ var ConsultaSimplesSection = function (_a) {
|
|
|
153
161
|
data.dividasPublicas ||
|
|
154
162
|
data.processosJuridicos ||
|
|
155
163
|
receitaStatus ||
|
|
156
|
-
((
|
|
157
|
-
(((
|
|
164
|
+
((_w = data.liminar) === null || _w === void 0 ? void 0 : _w.message) === 'Encontrado' ||
|
|
165
|
+
(((_x = data.editalData) === null || _x === void 0 ? void 0 : _x.recentesCount) &&
|
|
158
166
|
hasOneOfTags(tags, ['diamante', 'diamante-new']));
|
|
159
167
|
var statusType = isError ? 'warning' : hasPendencias ? 'error' : 'success';
|
|
160
168
|
useEffect(function () {
|
|
@@ -259,39 +267,42 @@ var ConsultaSimplesSection = function (_a) {
|
|
|
259
267
|
" edita",
|
|
260
268
|
remaining === 1 ? 'l' : 'is'))));
|
|
261
269
|
};
|
|
262
|
-
return (React.createElement(
|
|
263
|
-
|
|
264
|
-
React.createElement(
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
React.createElement(
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
270
|
+
return (React.createElement(React.Fragment, null,
|
|
271
|
+
React.createElement(Section, __assign({ title: "Consulta Simples", subtitle: "Consulta de informa\u00E7\u00F5es do documento.", onClickPrint: handlePrint, isPrintLoading: isWaiting, printLoadingMessage: "O sistema est\u00E1 verificando se todas as consultas foram conclu\u00EDdas. Por favor, aguarde...", description: React.createElement(React.Fragment, null,
|
|
272
|
+
ctimeDate ? (React.createElement(StatusMessage, { type: "warning" },
|
|
273
|
+
React.createElement(WarningCircle, { weight: "fill", size: 18, color: theme.colors.cinzaEscuro, style: { marginRight: 6, verticalAlign: 'text-bottom' } }),
|
|
274
|
+
"Informa\u00E7\u00F5es referem-se a",
|
|
275
|
+
' ',
|
|
276
|
+
format(displayDate, "dd/MM/yyyy 'às' HH:mm"))) : (React.createElement(StatusMessage, null, format(displayDate, "dd/MM/yyyy 'às' HH:mm"))),
|
|
277
|
+
React.createElement(StatusMessage, { type: "found" }, formatDocument(documento)),
|
|
278
|
+
isError && (ctx === null || ctx === void 0 ? void 0 : ctx.error) && (React.createElement(StatusMessage, { type: statusType }, ctx.error.message)),
|
|
279
|
+
pendencias.map(function (item) {
|
|
280
|
+
var _a;
|
|
281
|
+
if (!item.loaded) {
|
|
282
|
+
return (React.createElement(StatusMessage, { key: item.label, type: "loading" },
|
|
283
|
+
React.createElement(Spinner, null),
|
|
284
|
+
" ",
|
|
285
|
+
item.label,
|
|
286
|
+
"..."));
|
|
287
|
+
}
|
|
288
|
+
if ((_a = item.error) === null || _a === void 0 ? void 0 : _a.summary) {
|
|
289
|
+
return (React.createElement(StatusMessage, { key: item.label, type: "warning" }, item.error.summary));
|
|
290
|
+
}
|
|
291
|
+
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;
|
|
292
|
+
}),
|
|
293
|
+
((_y = data.editalData) === null || _y === void 0 ? void 0 : _y.isLoaded) &&
|
|
294
|
+
!!((_z = data.editalData) === null || _z === void 0 ? void 0 : _z.vencidosCount) &&
|
|
295
|
+
data.editalData.vencidosCount > 0 &&
|
|
296
|
+
hasOneOfTags(tags, ['diamante', 'diamante-new']) && (React.createElement(StatusMessage, { type: "error" },
|
|
297
|
+
React.createElement(ClickableText, { onClick: scrollToEditais, title: "Clique para ver detalhes" },
|
|
298
|
+
"Cart\u00F3rio com dificuldade para intimar",
|
|
299
|
+
((_0 = data.editalData) === null || _0 === void 0 ? void 0 : _0.dataEditalMaisAntigo) &&
|
|
300
|
+
" desde o: ".concat(data.editalData.dataEditalMaisAntigo)))),
|
|
301
|
+
showExtensionLabel && (React.createElement(ClickableStatusMessage, { type: "warning", onClick: function () { return setIsExtensionModalOpen(true); }, title: "Clique para instalar a extens\u00E3o e ver mais detalhes" }, EXTENSION_PROTESTO_LABEL))), onClose: onClose, icon: ConsultaSimplesIcon, variant: isLoading ? 'loading' : 'default', ctx: ctx, loadingProps: {
|
|
302
|
+
percentage: (ctx === null || ctx === void 0 ? void 0 : ctx.progress) || 0,
|
|
303
|
+
hidden: !isLoading
|
|
304
|
+
}, printMode: printMode }, rest), children),
|
|
305
|
+
React.createElement(ModalInstallExtension, { isOpen: isExtensionModalOpen, onClose: function () { return setIsExtensionModalOpen(false); } })));
|
|
295
306
|
};
|
|
296
307
|
export default ConsultaSimplesSection;
|
|
297
308
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -34,8 +34,10 @@ import { parseProtesto } from '../../utils/parseProtesto';
|
|
|
34
34
|
import XPathUtils from '../../utils/xpath';
|
|
35
35
|
import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
36
36
|
import styled from 'styled-components';
|
|
37
|
+
import { EXTENSION_PROTESTO_LABEL } from '../../constants/extensionCopy';
|
|
37
38
|
import Button from '../common/button';
|
|
38
39
|
import ModalDadosCartorio from '../common/ModalDadosCartorio';
|
|
40
|
+
import ModalInstallExtension from '../common/ModalInstallExtension';
|
|
39
41
|
import StatusMessage from '../interface/statusMessage';
|
|
40
42
|
import Section from '../section';
|
|
41
43
|
import { Queries, RequestStatus } from '../webservice';
|
|
@@ -43,7 +45,9 @@ import ProtestosCategory from './protestosCategory';
|
|
|
43
45
|
import { ProtestoItem } from './protestosList';
|
|
44
46
|
import { hasOneOfTags } from '../../utils/tags';
|
|
45
47
|
var ResultProtestos = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n row-gap: 20px;\n margin-top: 20px;\n"], ["\n display: flex;\n flex-direction: column;\n row-gap: 20px;\n margin-top: 20px;\n"])));
|
|
46
|
-
var
|
|
48
|
+
var PREMIUM_TAGS = ['prata', 'ouro', 'diamante', 'prata-new', 'ouro-new', 'diamante-new'];
|
|
49
|
+
var ClickableStatusMessage = styled(StatusMessage)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n cursor: pointer;\n transition: opacity 0.2s ease;\n &:hover {\n opacity: 0.85;\n }\n @media print {\n cursor: default;\n }\n"], ["\n cursor: pointer;\n transition: opacity 0.2s ease;\n &:hover {\n opacity: 0.85;\n }\n @media print {\n cursor: default;\n }\n"])));
|
|
50
|
+
var BtnWrapper = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n text-align: center;\n @media print {\n display: none;\n }\n"], ["\n text-align: center;\n @media print {\n display: none;\n }\n"])));
|
|
47
51
|
// Função utilitária para extrair as chaves dos protestos
|
|
48
52
|
var getChaves = function (arr) { return arr.map(function (p) { return p.nm_chave; }); };
|
|
49
53
|
var PROTESTOS_ERROR_SUMMARY = 'Falha ao consultar protestos, tente novamente mais tarde.';
|
|
@@ -56,6 +60,8 @@ var Protestos = function (_a) {
|
|
|
56
60
|
var _f = useGlobalData(), globalData = _f.data, setData = _f.setData;
|
|
57
61
|
var _g = useState(false), dataUpdated = _g[0], setDataUpdated = _g[1];
|
|
58
62
|
var _h = useState(false), isModalCartorioOpen = _h[0], setIsModalCartorioOpen = _h[1];
|
|
63
|
+
var _j = useState(false), isExtensionModalOpen = _j[0], setIsExtensionModalOpen = _j[1];
|
|
64
|
+
var openExtensionModal = useCallback(function () { return setIsExtensionModalOpen(true); }, []);
|
|
59
65
|
var showInstrumento = !hasOneOfTags(tags, [/flex/, 'bronze']);
|
|
60
66
|
var protestosAll = useMemo(function () {
|
|
61
67
|
if (!ctx.document)
|
|
@@ -63,7 +69,7 @@ var Protestos = function (_a) {
|
|
|
63
69
|
return XPathUtils.selectArray('//body//protesto', ctx.document).map(parseProtesto);
|
|
64
70
|
}, [ctx.document]);
|
|
65
71
|
var iaOverrides = (_b = globalData.protestosData) === null || _b === void 0 ? void 0 : _b.iaOverrides;
|
|
66
|
-
var
|
|
72
|
+
var _k = useProtestosClassification(protestosAll, iaOverrides), protestosDeCredito = _k.protestosDeCredito, protestosDeImposto = _k.protestosDeImposto, protestosGerais = _k.protestosGerais;
|
|
67
73
|
useEffect(function () {
|
|
68
74
|
var _a;
|
|
69
75
|
var prevProtestos = globalData.protestosData;
|
|
@@ -165,16 +171,21 @@ var Protestos = function (_a) {
|
|
|
165
171
|
return (React.createElement("div", { key: i }, element));
|
|
166
172
|
}))) : null;
|
|
167
173
|
var variant = registros ? 'error' : 'default';
|
|
174
|
+
var showExtensionLabel = registros > 0 &&
|
|
175
|
+
hasOneOfTags(tags, PREMIUM_TAGS) &&
|
|
176
|
+
extensionInstalled === false;
|
|
168
177
|
return {
|
|
169
178
|
children: React.createElement(React.Fragment, null, children),
|
|
170
179
|
variant: variant,
|
|
171
|
-
description: (React.createElement(
|
|
172
|
-
|
|
173
|
-
?
|
|
174
|
-
|
|
175
|
-
|
|
180
|
+
description: (React.createElement(React.Fragment, null,
|
|
181
|
+
React.createElement(StatusMessage, { type: registros ? 'error' : 'default' }, registros
|
|
182
|
+
? registros === 1
|
|
183
|
+
? 'Encontrado um protesto'
|
|
184
|
+
: "Encontrados ".concat(registros, " protestos")
|
|
185
|
+
: 'Não há ocorrência de protesto'),
|
|
186
|
+
showExtensionLabel && (React.createElement(ClickableStatusMessage, { type: "warning", onClick: openExtensionModal, title: "Clique para instalar a extens\u00E3o e ver mais detalhes" }, EXTENSION_PROTESTO_LABEL))))
|
|
176
187
|
};
|
|
177
|
-
}, [iaOverrides]);
|
|
188
|
+
}, [iaOverrides, tags, extensionInstalled, openExtensionModal]);
|
|
178
189
|
var effectiveCtx = useMemo(function () {
|
|
179
190
|
var _a, _b;
|
|
180
191
|
if (!ctx)
|
|
@@ -202,7 +213,8 @@ var Protestos = function (_a) {
|
|
|
202
213
|
document: formattedDoc
|
|
203
214
|
});
|
|
204
215
|
} }, "Apontar Protesto"))) : null }),
|
|
205
|
-
React.createElement(ModalDadosCartorio, { isOpen: isModalCartorioOpen, onClose: function () { return setIsModalCartorioOpen(false); }, cartorio: (_e = (_d = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _d === void 0 ? void 0 : _d.cartorio) !== null && _e !== void 0 ? _e : null })
|
|
216
|
+
React.createElement(ModalDadosCartorio, { isOpen: isModalCartorioOpen, onClose: function () { return setIsModalCartorioOpen(false); }, cartorio: (_e = (_d = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _d === void 0 ? void 0 : _d.cartorio) !== null && _e !== void 0 ? _e : null }),
|
|
217
|
+
React.createElement(ModalInstallExtension, { isOpen: isExtensionModalOpen, onClose: function () { return setIsExtensionModalOpen(false); } })));
|
|
206
218
|
};
|
|
207
219
|
export default React.memo(Protestos);
|
|
208
|
-
var templateObject_1, templateObject_2;
|
|
220
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -7,7 +7,10 @@ export declare const ProtestoItem: React.MemoExoticComponent<({ protesto, showIn
|
|
|
7
7
|
extensionInstalled?: boolean;
|
|
8
8
|
tags?: (string | RegExp)[];
|
|
9
9
|
}) => React.JSX.Element>;
|
|
10
|
-
export declare const Instrumento: ({ nm_chave, cpfCnpj }: {
|
|
10
|
+
export declare const Instrumento: ({ nm_chave, cpfCnpj, extensionInstalled, tags, onExtensionRequired }: {
|
|
11
11
|
nm_chave?: string;
|
|
12
12
|
cpfCnpj?: string;
|
|
13
|
+
extensionInstalled?: boolean;
|
|
14
|
+
tags?: (string | RegExp)[];
|
|
15
|
+
onExtensionRequired?: () => void;
|
|
13
16
|
}) => React.JSX.Element;
|
|
@@ -139,14 +139,17 @@ var AIIndicator = function () { return (React.createElement("span", { title: "In
|
|
|
139
139
|
* em produção com estilos globais do app host (button { min-width, margin, flex }).
|
|
140
140
|
* Layout explícito (width: fit-content, display: inline-block) evita deslocamento.
|
|
141
141
|
*/
|
|
142
|
-
/**
|
|
142
|
+
/** Célula UF clicável: sublinhado pontilhado no estado normal (indica ação), sólido no hover. */
|
|
143
143
|
var UfCellButton = styled.button.attrs({
|
|
144
144
|
type: 'button',
|
|
145
145
|
title: 'Ver dados do cartório',
|
|
146
146
|
'data-harlan': 'uf-cartorio-button'
|
|
147
|
-
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n all: unset;\n box-sizing: border-box;\n display: inline-block;\n width: fit-content;\n min-width: 0;\n margin: 0;\n padding: 0;\n background: none;\n border: none;\n cursor: pointer;\n color: ", ";\n text-decoration: underline;\n vertical-align: top;\n line-height: ", ";\n ", ";\n transition:
|
|
147
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n all: unset;\n box-sizing: border-box;\n display: inline-block;\n width: fit-content;\n min-width: 0;\n margin: 0;\n padding: 0;\n background: none;\n border: none;\n cursor: pointer;\n color: ", ";\n text-decoration: underline;\n text-decoration-style: dotted;\n text-underline-offset: 3px;\n text-decoration-color: ", ";\n vertical-align: top;\n line-height: ", ";\n ", ";\n transition: color 0.2s ease, text-decoration-color 0.2s ease, text-decoration-style 0.2s ease;\n\n &:hover {\n color: ", ";\n text-decoration-style: solid;\n text-decoration-color: ", ";\n }\n\n &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: 2px;\n }\n"], ["\n all: unset;\n box-sizing: border-box;\n display: inline-block;\n width: fit-content;\n min-width: 0;\n margin: 0;\n padding: 0;\n background: none;\n border: none;\n cursor: pointer;\n color: ", ";\n text-decoration: underline;\n text-decoration-style: dotted;\n text-underline-offset: 3px;\n text-decoration-color: ", ";\n vertical-align: top;\n line-height: ", ";\n ", ";\n transition: color 0.2s ease, text-decoration-color 0.2s ease, text-decoration-style 0.2s ease;\n\n &:hover {\n color: ", ";\n text-decoration-style: solid;\n text-decoration-color: ", ";\n }\n\n &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: 2px;\n }\n"])), function (_a) {
|
|
148
148
|
var theme = _a.theme;
|
|
149
|
-
return theme.colors.
|
|
149
|
+
return theme.colors.cinzaEscuro;
|
|
150
|
+
}, function (_a) {
|
|
151
|
+
var theme = _a.theme;
|
|
152
|
+
return theme.colors.cinzaMedio;
|
|
150
153
|
}, function (_a) {
|
|
151
154
|
var theme = _a.theme;
|
|
152
155
|
return theme.typography.headline16.lineHeight;
|
|
@@ -156,13 +159,35 @@ var UfCellButton = styled.button.attrs({
|
|
|
156
159
|
}, function (_a) {
|
|
157
160
|
var theme = _a.theme;
|
|
158
161
|
return theme.colors.azulCredithub;
|
|
162
|
+
}, function (_a) {
|
|
163
|
+
var theme = _a.theme;
|
|
164
|
+
return theme.colors.azulCredithub;
|
|
165
|
+
}, function (_a) {
|
|
166
|
+
var theme = _a.theme;
|
|
167
|
+
return theme.colors.azulCredithub;
|
|
159
168
|
});
|
|
160
169
|
/** Evita que a célula UF estique e desloque o conteúdo em produção (conflito com estilos do host). */
|
|
161
170
|
var UfCellValueWrapper = styled.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: inline-block;\n width: fit-content;\n min-width: 0;\n vertical-align: top;\n line-height: ", ";\n"], ["\n display: inline-block;\n width: fit-content;\n min-width: 0;\n vertical-align: top;\n line-height: ", ";\n"])), function (_a) {
|
|
162
171
|
var theme = _a.theme;
|
|
163
172
|
return theme.typography.headline16.lineHeight;
|
|
164
173
|
});
|
|
165
|
-
|
|
174
|
+
/** "Quem Protestou" clicável: sublinhado pontilhado no estado normal (indica ação), sólido no hover. */
|
|
175
|
+
var QuemProtestouClickable = styled.button(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n all: unset;\n box-sizing: border-box;\n display: inline-block;\n width: fit-content;\n min-width: 0;\n margin: 0;\n padding: 0;\n cursor: pointer;\n color: ", ";\n text-decoration: underline;\n text-decoration-style: dotted;\n text-underline-offset: 3px;\n text-decoration-color: ", ";\n line-height: ", ";\n ", ";\n transition: color 0.2s ease, text-decoration-color 0.2s ease, text-decoration-style 0.2s ease;\n\n &:hover {\n color: ", ";\n text-decoration-style: solid;\n text-decoration-color: ", ";\n }\n\n &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: 2px;\n }\n"], ["\n all: unset;\n box-sizing: border-box;\n display: inline-block;\n width: fit-content;\n min-width: 0;\n margin: 0;\n padding: 0;\n cursor: pointer;\n color: ", ";\n text-decoration: underline;\n text-decoration-style: dotted;\n text-underline-offset: 3px;\n text-decoration-color: ", ";\n line-height: ", ";\n ", ";\n transition: color 0.2s ease, text-decoration-color 0.2s ease, text-decoration-style 0.2s ease;\n\n &:hover {\n color: ", ";\n text-decoration-style: solid;\n text-decoration-color: ", ";\n }\n\n &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: 2px;\n }\n"])), function (_a) {
|
|
176
|
+
var theme = _a.theme;
|
|
177
|
+
return theme.colors.cinzaEscuro;
|
|
178
|
+
}, function (_a) {
|
|
179
|
+
var theme = _a.theme;
|
|
180
|
+
return theme.colors.cinzaMedio;
|
|
181
|
+
}, function (_a) {
|
|
182
|
+
var theme = _a.theme;
|
|
183
|
+
return theme.typography.headline16.lineHeight;
|
|
184
|
+
}, function (_a) {
|
|
185
|
+
var theme = _a.theme;
|
|
186
|
+
return theme.typography.headline16;
|
|
187
|
+
}, function (_a) {
|
|
188
|
+
var theme = _a.theme;
|
|
189
|
+
return theme.colors.azulCredithub;
|
|
190
|
+
}, function (_a) {
|
|
166
191
|
var theme = _a.theme;
|
|
167
192
|
return theme.colors.azulCredithub;
|
|
168
193
|
}, function (_a) {
|
|
@@ -267,7 +292,8 @@ export var ProtestoItem = memo(function (_a) {
|
|
|
267
292
|
}
|
|
268
293
|
};
|
|
269
294
|
var shouldShowExtensionPrompt = hasPremiumAccess && extensionInstalled === false;
|
|
270
|
-
var
|
|
295
|
+
var quemProtestouDisplay = getQuemProtestouDisplay();
|
|
296
|
+
var quemProtestouValue = shouldShowExtensionPrompt ? (React.createElement(QuemProtestouClickable, { onClick: handleQuemProtestouClick }, quemProtestouDisplay || '—')) : (quemProtestouDisplay);
|
|
271
297
|
return (React.createElement(React.Fragment, null,
|
|
272
298
|
React.createElement(ResultContent, { print: "repeat(8, 1fr)", desktop: "repeat(8, 1fr)", tablet: "repeat(4, 1fr)", mobile: "repeat(2, 1fr)" },
|
|
273
299
|
React.createElement(AddItemField, { name: "Quem Protestou", value: quemProtestouValue }),
|
|
@@ -277,12 +303,13 @@ export var ProtestoItem = memo(function (_a) {
|
|
|
277
303
|
React.createElement(AddItemField, { name: "Valor Do Protesto", value: formatMoney(protesto.valor) }),
|
|
278
304
|
React.createElement(AddItemField, { name: "Custas de Cart\u00F3rio para Baixa", value: protesto.vl_custas ? formatMoney(protesto.vl_custas) : '—' }),
|
|
279
305
|
React.createElement(AddItemField, { name: "UF", value: React.createElement(UfCell, { uf: cartorio === null || cartorio === void 0 ? void 0 : cartorio.uf, hasCartorio: Boolean(cartorio), onOpenCartorio: onOpenCartorioModal }) }),
|
|
280
|
-
showInstrumento && (React.createElement(Instrumento, { nm_chave: nm_chave, cpfCnpj: documento }))),
|
|
306
|
+
showInstrumento && (React.createElement(Instrumento, { nm_chave: nm_chave, cpfCnpj: documento, extensionInstalled: extensionInstalled, tags: tags, onExtensionRequired: function () { return setIsExtensionModalOpen(true); } }))),
|
|
281
307
|
React.createElement(ModalInstallExtension, { isOpen: isExtensionModalOpen, onClose: function () { return setIsExtensionModalOpen(false); } })));
|
|
282
308
|
});
|
|
283
309
|
export var Instrumento = function (_a) {
|
|
284
|
-
var nm_chave = _a.nm_chave, cpfCnpj = _a.cpfCnpj;
|
|
310
|
+
var nm_chave = _a.nm_chave, cpfCnpj = _a.cpfCnpj, extensionInstalled = _a.extensionInstalled, _b = _a.tags, tags = _b === void 0 ? [] : _b, onExtensionRequired = _a.onExtensionRequired;
|
|
285
311
|
var client = useContext(WebService);
|
|
312
|
+
var shouldInterceptForExtension = hasOneOfTags(tags, PREMIUM_TAGS) && extensionInstalled === false;
|
|
286
313
|
var normalizedKey = useMemo(function () { return normalizeInstrumentKey(nm_chave); }, [nm_chave]);
|
|
287
314
|
// Hook para gerenciar fluxo de instrumento (fase mockada)
|
|
288
315
|
var instrumentoHook = useInstrumento({
|
|
@@ -310,11 +337,11 @@ export var Instrumento = function (_a) {
|
|
|
310
337
|
return 'invalid-key';
|
|
311
338
|
return null;
|
|
312
339
|
}, [hasKey, hasCpfCnpj, isValidKey]);
|
|
313
|
-
var
|
|
314
|
-
var
|
|
315
|
-
var
|
|
316
|
-
var
|
|
317
|
-
var
|
|
340
|
+
var _c = useState(deriveErrorKind), errorKind = _c[0], setErrorKind = _c[1];
|
|
341
|
+
var _d = useState(false), isLoading = _d[0], setIsLoading = _d[1];
|
|
342
|
+
var _e = useState(false), isDiscoveryConfirmOpen = _e[0], setIsDiscoveryConfirmOpen = _e[1];
|
|
343
|
+
var _f = useState(false), isMissingKeyLoading = _f[0], setIsMissingKeyLoading = _f[1];
|
|
344
|
+
var _g = useState(false), isCheckingCache = _g[0], setIsCheckingCache = _g[1];
|
|
318
345
|
useEffect(function () {
|
|
319
346
|
setErrorKind(deriveErrorKind());
|
|
320
347
|
}, [deriveErrorKind]);
|
|
@@ -370,6 +397,10 @@ export var Instrumento = function (_a) {
|
|
|
370
397
|
case 0:
|
|
371
398
|
if (isDisabled)
|
|
372
399
|
return [2 /*return*/];
|
|
400
|
+
if (shouldInterceptForExtension && onExtensionRequired) {
|
|
401
|
+
onExtensionRequired();
|
|
402
|
+
return [2 /*return*/];
|
|
403
|
+
}
|
|
373
404
|
if (!(normalizedKey && cpfCnpj)) return [3 /*break*/, 5];
|
|
374
405
|
setIsCheckingCache(true);
|
|
375
406
|
setIsLoading(true);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copy único para o aviso de instalação da extensão (protestos, Quem Protestou, etc.).
|
|
3
|
+
* Usado no label da section, no modal e em tooltips.
|
|
4
|
+
*/
|
|
5
|
+
export declare const EXTENSION_PROTESTO_LABEL = "Mais detalhes do protesto (extens\u00E3o)";
|
|
6
|
+
export declare const EXTENSION_MODAL_TITLE = "Mais detalhes do protesto (extens\u00E3o)";
|
|
7
|
+
export declare const EXTENSION_MODAL_DESCRIPTION = "A extens\u00E3o CreditHub permite acessar mais informa\u00E7\u00F5es dos protestos diretamente em sua Consulta Simples (Quem Protestou, instrumentos, etc.).";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copy único para o aviso de instalação da extensão (protestos, Quem Protestou, etc.).
|
|
3
|
+
* Usado no label da section, no modal e em tooltips.
|
|
4
|
+
*/
|
|
5
|
+
export var EXTENSION_PROTESTO_LABEL = 'Mais detalhes do protesto (extensão)';
|
|
6
|
+
export var EXTENSION_MODAL_TITLE = 'Mais detalhes do protesto (extensão)';
|
|
7
|
+
export var EXTENSION_MODAL_DESCRIPTION = 'A extensão CreditHub permite acessar mais informações dos protestos diretamente em sua Consulta Simples (Quem Protestou, instrumentos, etc.).';
|
package/dist/consultaSimples.js
CHANGED
|
@@ -102,7 +102,7 @@ var ConsultaSimples = function (_a) {
|
|
|
102
102
|
React.createElement(EditalQueryWrapper, { hasDiamanteAccess: hasDiamanteAccess, documento: documento },
|
|
103
103
|
React.createElement(Wrapper, null,
|
|
104
104
|
React.createElement(GlobalDataProvider, null,
|
|
105
|
-
React.createElement(ConsultaSimplesSection, { documento: documento, onClose: onClose, onClickPrint: onClickPrint, isFinancial: isFinancial, ctime: ctimeProp, printMode: printMode, tags: tags },
|
|
105
|
+
React.createElement(ConsultaSimplesSection, { documento: documento, onClose: onClose, onClickPrint: onClickPrint, isFinancial: isFinancial, ctime: ctimeProp, printMode: printMode, tags: tags, extensionInstalled: extensionInstalled },
|
|
106
106
|
React.createElement(ConsultaRfbProvider, { documento: documento },
|
|
107
107
|
React.createElement(Dossie, { documento: documento, printMode: printMode, isFinancial: isFinancial }),
|
|
108
108
|
React.createElement(Liminar, { isFinancial: isFinancial, hasCredits: hasCredits, tags: tags }),
|