@credithub/harlan-components 1.120.11 → 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.
@@ -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, "Instale a Extens\u00E3o CreditHub para acessar mais detalhes."),
66
- React.createElement(Description, null, "A extens\u00E3o permite acessar mais informa\u00E7\u00F5es diretamente em sua Consulta Simples."))));
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;
@@ -5,5 +5,6 @@ declare const ConsultaSimplesSection: React.FC<SectionProps & {
5
5
  isFinancial: boolean;
6
6
  ctime?: string;
7
7
  tags?: (string | RegExp)[];
8
+ extensionInstalled?: boolean;
8
9
  }>;
9
10
  export default ConsultaSimplesSection;
@@ -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, _y = _a.tags, tags = _y === void 0 ? [] : _y, rest = __rest(_a, ["documento", "children", "onClose", "onClickPrint", "isFinancial", "ctime", "printMode", "tags"]);
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 _z = usePrintWhenStable({
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 = _z.printWhenStable, isWaiting = _z.isWaiting;
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 = ((_c = (_b = data.dossie) === null || _b === void 0 ? void 0 : _b.summary) === null || _c === void 0 ? void 0 : _c.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 = (((_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();
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', (_f = data.divida) === null || _f === void 0 ? void 0 : _f.isLoaded, data.dividasPublicas
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
- : '', (_g = data.divida) === null || _g === void 0 ? void 0 : _g.error),
121
- makeItem('Cheques sem Fundo', (_h = data.ccfData) === null || _h === void 0 ? void 0 : _h.isLoaded, data.ccf
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
- : '', (_j = data.ccfData) === null || _j === void 0 ? void 0 : _j.error),
124
- makeItem('Protestos', (_k = data.protestosData) === null || _k === void 0 ? void 0 : _k.isLoaded, data.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
- : '', (_l = data.protestosData) === null || _l === void 0 ? void 0 : _l.error),
129
- makeItem('Processos Jurídicos', (_m = data.processosJuridicosData) === null || _m === void 0 ? void 0 : _m.isLoaded, data.processosJuridicos
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
- : '', (_o = data.processosJuridicosData) === null || _o === void 0 ? void 0 : _o.error),
134
- makeItem('Liminar', (_p = data.liminar) === null || _p === void 0 ? void 0 : _p.isLoaded, ((_q = data.liminar) === null || _q === void 0 ? void 0 : _q.message) === 'Encontrado'
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
- : '', (_r = data.liminar) === null || _r === void 0 ? void 0 : _r.error),
137
- makeItem('Potenciais Protestos Entrantes', true, ((_s = data.editalData) === null || _s === void 0 ? void 0 : _s.recentesCount)
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
- ((_t = data.liminar) === null || _t === void 0 ? void 0 : _t.message) === 'Encontrado' ||
157
- (((_u = data.editalData) === null || _u === void 0 ? void 0 : _u.recentesCount) &&
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(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,
263
- ctimeDate ? (React.createElement(StatusMessage, { type: "warning" },
264
- React.createElement(WarningCircle, { weight: "fill", size: 18, color: theme.colors.cinzaEscuro, style: { marginRight: 6, verticalAlign: 'text-bottom' } }),
265
- "Informa\u00E7\u00F5es referem-se a",
266
- ' ',
267
- format(displayDate, "dd/MM/yyyy 'às' HH:mm"))) : (React.createElement(StatusMessage, null, format(displayDate, "dd/MM/yyyy 'às' HH:mm"))),
268
- React.createElement(StatusMessage, { type: "found" }, formatDocument(documento)),
269
- isError && (ctx === null || ctx === void 0 ? void 0 : ctx.error) && (React.createElement(StatusMessage, { type: statusType }, ctx.error.message)),
270
- pendencias.map(function (item) {
271
- var _a;
272
- if (!item.loaded) {
273
- return (React.createElement(StatusMessage, { key: item.label, type: "loading" },
274
- React.createElement(Spinner, null),
275
- " ",
276
- item.label,
277
- "..."));
278
- }
279
- if ((_a = item.error) === null || _a === void 0 ? void 0 : _a.summary) {
280
- return (React.createElement(StatusMessage, { key: item.label, type: "warning" }, item.error.summary));
281
- }
282
- 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
- }),
284
- ((_v = data.editalData) === null || _v === void 0 ? void 0 : _v.isLoaded) &&
285
- !!((_w = data.editalData) === null || _w === void 0 ? void 0 : _w.vencidosCount) &&
286
- data.editalData.vencidosCount > 0 &&
287
- hasOneOfTags(tags, ['diamante', 'diamante-new']) && (React.createElement(StatusMessage, { type: "error" },
288
- React.createElement(ClickableText, { onClick: scrollToEditais, title: "Clique para ver detalhes" },
289
- "Cart\u00F3rio com dificuldade para intimar",
290
- ((_x = data.editalData) === null || _x === void 0 ? void 0 : _x.dataEditalMaisAntigo) &&
291
- " desde o: ".concat(data.editalData.dataEditalMaisAntigo))))), onClose: onClose, icon: ConsultaSimplesIcon, variant: isLoading ? 'loading' : 'default', ctx: ctx, loadingProps: {
292
- percentage: (ctx === null || ctx === void 0 ? void 0 : ctx.progress) || 0,
293
- hidden: !isLoading
294
- }, printMode: printMode }, rest), children));
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 BtnWrapper = styled.div(templateObject_2 || (templateObject_2 = __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"])));
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 _j = useProtestosClassification(protestosAll, iaOverrides), protestosDeCredito = _j.protestosDeCredito, protestosDeImposto = _j.protestosDeImposto, protestosGerais = _j.protestosGerais;
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(StatusMessage, { type: registros ? 'error' : 'default' }, registros
172
- ? registros === 1
173
- ? 'Encontrado um protesto'
174
- : "Encontrados ".concat(registros, " protestos")
175
- : 'Não ocorrência de protesto'))
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;
@@ -292,7 +292,8 @@ export var ProtestoItem = memo(function (_a) {
292
292
  }
293
293
  };
294
294
  var shouldShowExtensionPrompt = hasPremiumAccess && extensionInstalled === false;
295
- var quemProtestouValue = shouldShowExtensionPrompt ? (React.createElement(QuemProtestouClickable, { onClick: handleQuemProtestouClick }, getQuemProtestouDisplay() || 'Clique para ver')) : (getQuemProtestouDisplay());
295
+ var quemProtestouDisplay = getQuemProtestouDisplay();
296
+ var quemProtestouValue = shouldShowExtensionPrompt ? (React.createElement(QuemProtestouClickable, { onClick: handleQuemProtestouClick }, quemProtestouDisplay || '—')) : (quemProtestouDisplay);
296
297
  return (React.createElement(React.Fragment, null,
297
298
  React.createElement(ResultContent, { print: "repeat(8, 1fr)", desktop: "repeat(8, 1fr)", tablet: "repeat(4, 1fr)", mobile: "repeat(2, 1fr)" },
298
299
  React.createElement(AddItemField, { name: "Quem Protestou", value: quemProtestouValue }),
@@ -302,12 +303,13 @@ export var ProtestoItem = memo(function (_a) {
302
303
  React.createElement(AddItemField, { name: "Valor Do Protesto", value: formatMoney(protesto.valor) }),
303
304
  React.createElement(AddItemField, { name: "Custas de Cart\u00F3rio para Baixa", value: protesto.vl_custas ? formatMoney(protesto.vl_custas) : '—' }),
304
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 }) }),
305
- 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); } }))),
306
307
  React.createElement(ModalInstallExtension, { isOpen: isExtensionModalOpen, onClose: function () { return setIsExtensionModalOpen(false); } })));
307
308
  });
308
309
  export var Instrumento = function (_a) {
309
- 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;
310
311
  var client = useContext(WebService);
312
+ var shouldInterceptForExtension = hasOneOfTags(tags, PREMIUM_TAGS) && extensionInstalled === false;
311
313
  var normalizedKey = useMemo(function () { return normalizeInstrumentKey(nm_chave); }, [nm_chave]);
312
314
  // Hook para gerenciar fluxo de instrumento (fase mockada)
313
315
  var instrumentoHook = useInstrumento({
@@ -335,11 +337,11 @@ export var Instrumento = function (_a) {
335
337
  return 'invalid-key';
336
338
  return null;
337
339
  }, [hasKey, hasCpfCnpj, isValidKey]);
338
- var _b = useState(deriveErrorKind), errorKind = _b[0], setErrorKind = _b[1];
339
- var _c = useState(false), isLoading = _c[0], setIsLoading = _c[1];
340
- var _d = useState(false), isDiscoveryConfirmOpen = _d[0], setIsDiscoveryConfirmOpen = _d[1];
341
- var _e = useState(false), isMissingKeyLoading = _e[0], setIsMissingKeyLoading = _e[1];
342
- var _f = useState(false), isCheckingCache = _f[0], setIsCheckingCache = _f[1];
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];
343
345
  useEffect(function () {
344
346
  setErrorKind(deriveErrorKind());
345
347
  }, [deriveErrorKind]);
@@ -395,6 +397,10 @@ export var Instrumento = function (_a) {
395
397
  case 0:
396
398
  if (isDisabled)
397
399
  return [2 /*return*/];
400
+ if (shouldInterceptForExtension && onExtensionRequired) {
401
+ onExtensionRequired();
402
+ return [2 /*return*/];
403
+ }
398
404
  if (!(normalizedKey && cpfCnpj)) return [3 /*break*/, 5];
399
405
  setIsCheckingCache(true);
400
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.).';
@@ -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 }),