@credithub/harlan-components 1.121.2 → 1.121.4

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.
@@ -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 { EXTENSION_PROTESTO_LABEL } from '../../constants/extensionCopy';
29
28
  import { useGlobalData } from '../../contexts/globalDataContext';
30
29
  import { usePostHog } from '../../contexts/PostHogContext';
31
30
  import usePrintWhenStable from '../../hooks/usePrintWhenStable';
@@ -35,13 +34,11 @@ import { formatDocument } from '../../utils/string';
35
34
  import { hasOneOfTags } from '../../utils/tags';
36
35
  import { format } from 'date-fns';
37
36
  import { WarningCircle } from 'phosphor-react';
38
- import React, { useContext, useEffect, useState } from 'react';
37
+ import React, { useContext, useEffect } from 'react';
39
38
  import styled, { keyframes } from 'styled-components';
40
39
  import Section from '../interface/section';
41
40
  import StatusMessage from '../interface/statusMessage';
42
41
  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'];
45
42
  // Animação do spinner
46
43
  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"])));
47
44
  // Componente Spinner sutil
@@ -56,13 +53,10 @@ var ConsultaSimplesSection = function (_a) {
56
53
  var ctx = useContext(Queries.Finder);
57
54
  var data = useGlobalData().data;
58
55
  var posthog = usePostHog().posthog;
59
- var _2 = useState(false), isExtensionModalOpen = _2[0], setIsExtensionModalOpen = _2[1];
60
56
  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
57
  ((_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;
64
58
  // Hook para observar mutações no DOM e chamar callback quando estável
65
- var _3 = usePrintWhenStable({
59
+ var _2 = usePrintWhenStable({
66
60
  debounceTime: 500,
67
61
  maxWaitTime: 30000,
68
62
  onStart: function () {
@@ -73,7 +67,7 @@ var ConsultaSimplesSection = function (_a) {
73
67
  // Chama o callback externo (Harlan decide como imprimir)
74
68
  onClickPrint === null || onClickPrint === void 0 ? void 0 : onClickPrint();
75
69
  }
76
- }), printWhenStable = _3.printWhenStable, isWaiting = _3.isWaiting;
70
+ }), printWhenStable = _2.printWhenStable, isWaiting = _2.isWaiting;
77
71
  // Handler que usa o observer ao invés de imprimir diretamente
78
72
  var handlePrint = function () {
79
73
  printWhenStable();
@@ -297,12 +291,10 @@ var ConsultaSimplesSection = function (_a) {
297
291
  React.createElement(ClickableText, { onClick: scrollToEditais, title: "Clique para ver detalhes" },
298
292
  "Cart\u00F3rio com dificuldade para intimar",
299
293
  ((_0 = data.editalData) === null || _0 === void 0 ? void 0 : _0.dataEditalMaisAntigo) &&
300
- " desde o: ".concat(data.editalData.dataEditalMaisAntigo)))),
301
- showExtensionLabel && (React.createElement(ClickableStatusMessage, { type: "found", 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: {
294
+ " desde o: ".concat(data.editalData.dataEditalMaisAntigo))))), onClose: onClose, icon: ConsultaSimplesIcon, variant: isLoading ? 'loading' : 'default', ctx: ctx, loadingProps: {
302
295
  percentage: (ctx === null || ctx === void 0 ? void 0 : ctx.progress) || 0,
303
296
  hidden: !isLoading
304
- }, printMode: printMode }, rest), children),
305
- React.createElement(ModalInstallExtension, { isOpen: isExtensionModalOpen, onClose: function () { return setIsExtensionModalOpen(false); } })));
297
+ }, printMode: printMode }, rest), children)));
306
298
  };
307
299
  export default ConsultaSimplesSection;
308
300
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
@@ -34,10 +34,8 @@ 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';
38
37
  import Button from '../common/button';
39
38
  import ModalDadosCartorio from '../common/ModalDadosCartorio';
40
- import ModalInstallExtension from '../common/ModalInstallExtension';
41
39
  import StatusMessage from '../interface/statusMessage';
42
40
  import Section from '../section';
43
41
  import { Queries, RequestStatus } from '../webservice';
@@ -46,8 +44,7 @@ import { ProtestoItem } from './protestosList';
46
44
  import { hasOneOfTags } from '../../utils/tags';
47
45
  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"])));
48
46
  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
+ 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"])));
51
48
  // Função utilitária para extrair as chaves dos protestos
52
49
  var getChaves = function (arr) { return arr.map(function (p) { return p.nm_chave; }); };
53
50
  var PROTESTOS_ERROR_SUMMARY = 'Falha ao consultar protestos, tente novamente mais tarde.';
@@ -60,8 +57,6 @@ var Protestos = function (_a) {
60
57
  var _f = useGlobalData(), globalData = _f.data, setData = _f.setData;
61
58
  var _g = useState(false), dataUpdated = _g[0], setDataUpdated = _g[1];
62
59
  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); }, []);
65
60
  var showInstrumento = !hasOneOfTags(tags, [/flex/, 'bronze']);
66
61
  var protestosAll = useMemo(function () {
67
62
  if (!ctx.document)
@@ -69,7 +64,7 @@ var Protestos = function (_a) {
69
64
  return XPathUtils.selectArray('//body//protesto', ctx.document).map(parseProtesto);
70
65
  }, [ctx.document]);
71
66
  var iaOverrides = (_b = globalData.protestosData) === null || _b === void 0 ? void 0 : _b.iaOverrides;
72
- var _k = useProtestosClassification(protestosAll, iaOverrides), protestosDeCredito = _k.protestosDeCredito, protestosDeImposto = _k.protestosDeImposto, protestosGerais = _k.protestosGerais;
67
+ var _j = useProtestosClassification(protestosAll, iaOverrides), protestosDeCredito = _j.protestosDeCredito, protestosDeImposto = _j.protestosDeImposto, protestosGerais = _j.protestosGerais;
73
68
  useEffect(function () {
74
69
  var _a;
75
70
  var prevProtestos = globalData.protestosData;
@@ -171,21 +166,16 @@ var Protestos = function (_a) {
171
166
  return (React.createElement("div", { key: i }, element));
172
167
  }))) : null;
173
168
  var variant = registros ? 'error' : 'default';
174
- var showExtensionLabel = registros > 0 &&
175
- hasOneOfTags(tags, PREMIUM_TAGS) &&
176
- extensionInstalled === false;
177
169
  return {
178
170
  children: React.createElement(React.Fragment, null, children),
179
171
  variant: variant,
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: "found", onClick: openExtensionModal, title: "Clique para instalar a extens\u00E3o e ver mais detalhes" }, EXTENSION_PROTESTO_LABEL))))
172
+ description: (React.createElement(StatusMessage, { type: registros ? 'error' : 'default' }, registros
173
+ ? registros === 1
174
+ ? 'Encontrado um protesto'
175
+ : "Encontrados ".concat(registros, " protestos")
176
+ : 'Não ocorrência de protesto'))
187
177
  };
188
- }, [iaOverrides, tags, extensionInstalled, openExtensionModal]);
178
+ }, [iaOverrides, tags]);
189
179
  var effectiveCtx = useMemo(function () {
190
180
  var _a, _b;
191
181
  if (!ctx)
@@ -213,8 +203,7 @@ var Protestos = function (_a) {
213
203
  document: formattedDoc
214
204
  });
215
205
  } }, "Apontar Protesto"))) : 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
+ 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 })));
218
207
  };
219
208
  export default React.memo(Protestos);
220
- var templateObject_1, templateObject_2, templateObject_3;
209
+ var templateObject_1, templateObject_2;
@@ -326,8 +326,7 @@ export var ProtestoItem = memo(function (_a) {
326
326
  React.createElement(AddItemField, { name: "Possui Anu\u00EAncia / Protesto Pago", value: formatBooleanField(String(protesto.temAnuencia)) }),
327
327
  React.createElement(AddItemField, { name: "Valor Do Protesto", value: formatMoney(protesto.valor) }),
328
328
  React.createElement(AddItemField, { name: "Custas de Cart\u00F3rio para Baixa", value: protesto.vl_custas ? formatMoney(protesto.vl_custas) : '—' }),
329
- React.createElement(AddItemField, { name: "UF", value: React.createElement(UfCell, { uf: cartorio === null || cartorio === void 0 ? void 0 : cartorio.uf, hasCartorio: Boolean(cartorio), onOpenCartorio: onOpenCartorioModal }) }),
330
- showInstrumento && (React.createElement(Instrumento, { nm_chave: nm_chave, cpfCnpj: documento, extensionInstalled: extensionInstalled, tags: tags, onExtensionRequired: function () { return setIsExtensionModalOpen(true); } }))),
329
+ React.createElement(AddItemField, { name: "UF", value: React.createElement(UfCell, { uf: cartorio === null || cartorio === void 0 ? void 0 : cartorio.uf, hasCartorio: Boolean(cartorio), onOpenCartorio: onOpenCartorioModal }) })),
331
330
  React.createElement(ModalInstallExtension, { isOpen: isExtensionModalOpen, onClose: function () { return setIsExtensionModalOpen(false); } })));
332
331
  });
333
332
  export var Instrumento = function (_a) {
@@ -385,7 +384,7 @@ export var Instrumento = function (_a) {
385
384
  }, 800);
386
385
  return function () { return clearTimeout(timeout); };
387
386
  }, [errorKind]);
388
- // missing-key + plano: botão "CLIQUE AQUI" é clicável (abre modal cartório+script)
387
+ // missing-key + plano: botão "Solicitar Instrumento" é clicável (abre modal cartório+script)
389
388
  var isMissingKeyWithPlan = errorKind === 'missing-key' && hasPremiumAccess;
390
389
  var isDisabled = isLoading ||
391
390
  isMissingKeyLoading ||
@@ -405,7 +404,7 @@ export var Instrumento = function (_a) {
405
404
  var getButtonLabel = function () {
406
405
  if (errorKind === 'missing-key') {
407
406
  if (hasPremiumAccess)
408
- return 'CLIQUE AQUI';
407
+ return 'Solicitar Instrumento';
409
408
  return isMissingKeyLoading
410
409
  ? 'Solicitar instrumento'
411
410
  : 'Instrumento não localizado';