@credithub/harlan-components 1.121.1 → 1.121.3
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/ModalDadosCartorio.d.ts +2 -0
- package/dist/components/common/ModalDadosCartorio.js +28 -12
- package/dist/components/consultaSimplesSection/consultaSimplesSection.js +5 -13
- package/dist/components/interface/header.js +6 -4
- package/dist/components/protestos/protestos.js +10 -21
- package/dist/components/protestos/protestosList.js +63 -25
- package/dist/constants/extensionCopy.d.ts +2 -0
- package/dist/constants/extensionCopy.js +2 -0
- package/lib/cjs/index.js +561 -596
- package/lib/esm/index.js +561 -596
- package/package.json +1 -1
|
@@ -4,6 +4,8 @@ interface ModalDadosCartorioProps {
|
|
|
4
4
|
isOpen: boolean;
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
cartorio: Cartorio | null;
|
|
7
|
+
/** Quando preenchido, exibe bloco com script para ligar ao cartório (livro/folha). */
|
|
8
|
+
script?: string;
|
|
7
9
|
}
|
|
8
10
|
declare const ModalDadosCartorio: FC<ModalDadosCartorioProps>;
|
|
9
11
|
export default ModalDadosCartorio;
|
|
@@ -2,6 +2,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
2
2
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
3
|
return cooked;
|
|
4
4
|
};
|
|
5
|
+
import { SCRIPT_LIGAR_CARTORIO_LIVRO_FOLHA } from '../../constants/extensionCopy';
|
|
5
6
|
import { phoneMask } from '../../utils/number';
|
|
6
7
|
import React from 'react';
|
|
7
8
|
import styled from 'styled-components';
|
|
@@ -52,19 +53,34 @@ var EmptyMessage = styled.p(templateObject_5 || (templateObject_5 = __makeTempla
|
|
|
52
53
|
var theme = _a.theme;
|
|
53
54
|
return theme.colors.cinzaEscuro;
|
|
54
55
|
});
|
|
56
|
+
var ScriptBlock = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", ";\n color: ", ";\n margin-top: 16px;\n padding: 12px;\n background: ", ";\n border-radius: 8px;\n white-space: pre-wrap;\n"], ["\n ", ";\n color: ", ";\n margin-top: 16px;\n padding: 12px;\n background: ", ";\n border-radius: 8px;\n white-space: pre-wrap;\n"])), function (_a) {
|
|
57
|
+
var theme = _a.theme;
|
|
58
|
+
return theme.typography.body16;
|
|
59
|
+
}, function (_a) {
|
|
60
|
+
var theme = _a.theme;
|
|
61
|
+
return theme.colors.cinzaEscuro;
|
|
62
|
+
}, function (_a) {
|
|
63
|
+
var _b, _c;
|
|
64
|
+
var theme = _a.theme;
|
|
65
|
+
return (_c = (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.cinzaClaro) !== null && _c !== void 0 ? _c : '#f5f5f5';
|
|
66
|
+
});
|
|
55
67
|
var ModalDadosCartorio = function (_a) {
|
|
56
|
-
var isOpen = _a.isOpen, onClose = _a.onClose, cartorio = _a.cartorio;
|
|
68
|
+
var isOpen = _a.isOpen, onClose = _a.onClose, cartorio = _a.cartorio, script = _a.script;
|
|
57
69
|
var isEmpty = !cartorio || Object.keys(cartorio).length === 0;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
var showScript = script !== undefined;
|
|
71
|
+
var scriptText = ((script === null || script === void 0 ? void 0 : script.trim()) || SCRIPT_LIGAR_CARTORIO_LIVRO_FOLHA);
|
|
72
|
+
return (React.createElement(Modal, { isOpen: isOpen, onClose: onClose, title: "Dados do cart\u00F3rio", footer: React.createElement(Button, { onClick: onClose }, "Fechar") }, isEmpty ? (React.createElement(EmptyMessage, null, "Dados do cart\u00F3rio n\u00E3o dispon\u00EDveis.")) : (React.createElement(React.Fragment, null,
|
|
73
|
+
React.createElement(CartorioList, null, FIELDS_ORDER.map(function (key) {
|
|
74
|
+
var value = cartorio[key];
|
|
75
|
+
var raw = value != null && String(value).trim() !== ''
|
|
76
|
+
? String(value).trim()
|
|
77
|
+
: '';
|
|
78
|
+
var display = key === 'telefone' && raw ? phoneMask(raw) : raw || '—';
|
|
79
|
+
return (React.createElement(CartorioRow, { key: key },
|
|
80
|
+
React.createElement(CartorioDt, null, FIELD_LABELS[key]),
|
|
81
|
+
React.createElement(CartorioDd, null, display)));
|
|
82
|
+
})),
|
|
83
|
+
showScript && React.createElement(ScriptBlock, null, scriptText)))));
|
|
68
84
|
};
|
|
69
85
|
export default ModalDadosCartorio;
|
|
70
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
86
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -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
|
|
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
|
|
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 =
|
|
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: "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: {
|
|
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;
|
|
@@ -102,12 +102,14 @@ var Header = function (_a) {
|
|
|
102
102
|
React.createElement(IconWrapper, null, Icon && React.createElement(Icon, __assign({}, iconProps, { circleFill: variantColor }))),
|
|
103
103
|
React.createElement(TextWrapper, { printBar: printBar },
|
|
104
104
|
title && (React.createElement(Title, { className: classNames(titleClassName) }, title)),
|
|
105
|
-
React.createElement("div", { className: "text-wrapper-subtitle-description" },
|
|
106
|
-
React.createElement(Subtitle, { hidden: isLoading || !subtitle, className: subtitleClassName },
|
|
107
|
-
|
|
105
|
+
React.createElement("div", { className: "text-wrapper-subtitle-description", key: "subtitle-description-wrap" },
|
|
106
|
+
React.createElement(Subtitle, { key: "header-subtitle", hidden: isLoading || !subtitle, className: subtitleClassName },
|
|
107
|
+
React.createElement("span", null, subtitle)),
|
|
108
|
+
React.createElement(Description, { key: "header-description", hidden: isLoading || !description, className: descriptionClassName },
|
|
109
|
+
React.createElement("div", { style: { display: 'contents' } }, description))),
|
|
108
110
|
React.createElement(LoadingBarWrapper, { hidden: !isLoading },
|
|
109
111
|
React.createElement(LoadingBar, { percentage: (loadingProps === null || loadingProps === void 0 ? void 0 : loadingProps.percentage) || 0 })))),
|
|
110
|
-
|
|
112
|
+
React.createElement(ActionsList, { className: actionsClass, style: actions ? undefined : { display: 'none', visibility: 'hidden' } }, actions))));
|
|
111
113
|
};
|
|
112
114
|
/** -----------------------------
|
|
113
115
|
* Helpers
|
|
@@ -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
|
|
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
|
|
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(
|
|
181
|
-
|
|
182
|
-
?
|
|
183
|
-
|
|
184
|
-
|
|
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))))
|
|
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 há ocorrência de protesto'))
|
|
187
177
|
};
|
|
188
|
-
}, [iaOverrides, tags
|
|
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
|
|
209
|
+
var templateObject_1, templateObject_2;
|
|
@@ -43,8 +43,10 @@ import { formatMoney } from '../../utils/number';
|
|
|
43
43
|
import { isProtestoSPByNmChave } from '../../utils/protestoUf';
|
|
44
44
|
import React, { memo, useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
45
45
|
import styled from 'styled-components';
|
|
46
|
+
import { SCRIPT_LIGAR_CARTORIO_LIVRO_FOLHA } from '../../constants/extensionCopy';
|
|
46
47
|
import AddItemField from '../common/addItem';
|
|
47
48
|
import Button from '../common/button';
|
|
49
|
+
import ModalDadosCartorio from '../common/ModalDadosCartorio';
|
|
48
50
|
import ModalInstallExtension from '../common/ModalInstallExtension';
|
|
49
51
|
import ModalInstrumentoProtestoSP from '../common/modalInstrumentoProtestoSP';
|
|
50
52
|
import { ResultContent } from '../interface/result';
|
|
@@ -201,19 +203,19 @@ var UfCell = function (_a) {
|
|
|
201
203
|
return React.createElement(UfCellValueWrapper, null, content);
|
|
202
204
|
};
|
|
203
205
|
export var ProtestoItem = memo(function (_a) {
|
|
204
|
-
var _b, _c, _d;
|
|
205
|
-
var protesto = _a.protesto, showInstrumento = _a.showInstrumento, onOpenCartorioModal = _a.onOpenCartorioModal, extensionInstalled = _a.extensionInstalled,
|
|
206
|
+
var _b, _c, _d, _e;
|
|
207
|
+
var protesto = _a.protesto, showInstrumento = _a.showInstrumento, onOpenCartorioModal = _a.onOpenCartorioModal, extensionInstalled = _a.extensionInstalled, _f = _a.tags, tags = _f === void 0 ? [] : _f;
|
|
206
208
|
var hasPremiumAccess = hasOneOfTags(tags, PREMIUM_TAGS);
|
|
207
209
|
var client = useContext(WebService);
|
|
208
|
-
var
|
|
210
|
+
var _g = useGlobalData(), setData = _g.setData, globalData = _g.data;
|
|
209
211
|
var cartorio = (_b = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _b === void 0 ? void 0 : _b.cartorio;
|
|
210
212
|
var iaOverrides = ((_c = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _c === void 0 ? void 0 : _c.iaOverrides) || {};
|
|
211
213
|
var refreshToken = ((_d = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _d === void 0 ? void 0 : _d.refreshToken) || 0;
|
|
212
|
-
var
|
|
213
|
-
var
|
|
214
|
-
var
|
|
215
|
-
var
|
|
216
|
-
var
|
|
214
|
+
var _h = useState(null), quemApresentou = _h[0], setQuemApresentou = _h[1];
|
|
215
|
+
var _j = useState(false), loading = _j[0], setLoading = _j[1];
|
|
216
|
+
var _k = useState(false), queued = _k[0], setQueued = _k[1];
|
|
217
|
+
var _l = useState(false), isAIData = _l[0], setIsAIData = _l[1];
|
|
218
|
+
var _m = useState(false), isExtensionModalOpen = _m[0], setIsExtensionModalOpen = _m[1];
|
|
217
219
|
var documento = protesto.cpfCnpj;
|
|
218
220
|
var nm_chave = protesto.nm_chave;
|
|
219
221
|
var formatBooleanField = function (value) {
|
|
@@ -281,19 +283,41 @@ export var ProtestoItem = memo(function (_a) {
|
|
|
281
283
|
quemApresentou,
|
|
282
284
|
React.createElement(AIIndicator, null)));
|
|
283
285
|
if (!isQuemProtestouLookupEnabled)
|
|
284
|
-
return '
|
|
286
|
+
return (original === null || original === void 0 ? void 0 : original.trim()) || '—';
|
|
285
287
|
if ((loading || queued) && !quemApresentou)
|
|
286
288
|
return React.createElement(ThreeDotsLoader, null);
|
|
287
|
-
return quemApresentou || '';
|
|
289
|
+
return quemApresentou || (original === null || original === void 0 ? void 0 : original.trim()) || '—';
|
|
288
290
|
};
|
|
289
291
|
var handleQuemProtestouClick = function () {
|
|
290
|
-
if (extensionInstalled === false) {
|
|
292
|
+
if (extensionInstalled === false && hasPremiumAccess) {
|
|
291
293
|
setIsExtensionModalOpen(true);
|
|
292
294
|
}
|
|
293
295
|
};
|
|
294
|
-
|
|
295
|
-
var
|
|
296
|
-
|
|
296
|
+
// Regra: SEM extensão = ZERO dado inteligente. 4 combinações extensão/plano.
|
|
297
|
+
var rawNomeCedente = ((_e = protesto.nomeCedente) === null || _e === void 0 ? void 0 : _e.trim()) !== ''
|
|
298
|
+
? protesto.nomeCedente
|
|
299
|
+
: '—';
|
|
300
|
+
var quemProtestouValue;
|
|
301
|
+
if (extensionInstalled === false) {
|
|
302
|
+
if (hasPremiumAccess) {
|
|
303
|
+
// SEM ext + COM plano: só CTA clicável (nunca dado enriquecido)
|
|
304
|
+
quemProtestouValue = (React.createElement(QuemProtestouClickable, { onClick: handleQuemProtestouClick }, "CLIQUE AQUI para mais detalhes"));
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
// SEM ext + SEM plano: dado bruto
|
|
308
|
+
quemProtestouValue = rawNomeCedente;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
if (hasPremiumAccess) {
|
|
313
|
+
// COM ext + COM plano: dados enriquecidos
|
|
314
|
+
quemProtestouValue = getQuemProtestouDisplay();
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
// COM ext + SEM plano: dado bruto
|
|
318
|
+
quemProtestouValue = rawNomeCedente;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
297
321
|
return (React.createElement(React.Fragment, null,
|
|
298
322
|
React.createElement(ResultContent, { print: "repeat(8, 1fr)", desktop: "repeat(8, 1fr)", tablet: "repeat(4, 1fr)", mobile: "repeat(2, 1fr)" },
|
|
299
323
|
React.createElement(AddItemField, { name: "Quem Protestou", value: quemProtestouValue }),
|
|
@@ -307,9 +331,14 @@ export var ProtestoItem = memo(function (_a) {
|
|
|
307
331
|
React.createElement(ModalInstallExtension, { isOpen: isExtensionModalOpen, onClose: function () { return setIsExtensionModalOpen(false); } })));
|
|
308
332
|
});
|
|
309
333
|
export var Instrumento = function (_a) {
|
|
310
|
-
var
|
|
334
|
+
var _b, _c;
|
|
335
|
+
var nm_chave = _a.nm_chave, cpfCnpj = _a.cpfCnpj, extensionInstalled = _a.extensionInstalled, _d = _a.tags, tags = _d === void 0 ? [] : _d, onExtensionRequired = _a.onExtensionRequired;
|
|
311
336
|
var client = useContext(WebService);
|
|
312
|
-
var
|
|
337
|
+
var globalData = useGlobalData().data;
|
|
338
|
+
var cartorio = (_c = (_b = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _b === void 0 ? void 0 : _b.cartorio) !== null && _c !== void 0 ? _c : null;
|
|
339
|
+
var hasPremiumAccess = hasOneOfTags(tags, PREMIUM_TAGS);
|
|
340
|
+
var shouldInterceptForExtension = hasPremiumAccess && extensionInstalled === false;
|
|
341
|
+
var _e = useState(false), isCartorioModalOpen = _e[0], setIsCartorioModalOpen = _e[1];
|
|
313
342
|
var normalizedKey = useMemo(function () { return normalizeInstrumentKey(nm_chave); }, [nm_chave]);
|
|
314
343
|
// Hook para gerenciar fluxo de instrumento (fase mockada)
|
|
315
344
|
var instrumentoHook = useInstrumento({
|
|
@@ -337,11 +366,11 @@ export var Instrumento = function (_a) {
|
|
|
337
366
|
return 'invalid-key';
|
|
338
367
|
return null;
|
|
339
368
|
}, [hasKey, hasCpfCnpj, isValidKey]);
|
|
340
|
-
var
|
|
341
|
-
var
|
|
342
|
-
var
|
|
343
|
-
var
|
|
344
|
-
var
|
|
369
|
+
var _f = useState(deriveErrorKind), errorKind = _f[0], setErrorKind = _f[1];
|
|
370
|
+
var _g = useState(false), isLoading = _g[0], setIsLoading = _g[1];
|
|
371
|
+
var _h = useState(false), isDiscoveryConfirmOpen = _h[0], setIsDiscoveryConfirmOpen = _h[1];
|
|
372
|
+
var _j = useState(false), isMissingKeyLoading = _j[0], setIsMissingKeyLoading = _j[1];
|
|
373
|
+
var _k = useState(false), isCheckingCache = _k[0], setIsCheckingCache = _k[1];
|
|
345
374
|
useEffect(function () {
|
|
346
375
|
setErrorKind(deriveErrorKind());
|
|
347
376
|
}, [deriveErrorKind]);
|
|
@@ -356,12 +385,13 @@ export var Instrumento = function (_a) {
|
|
|
356
385
|
}, 800);
|
|
357
386
|
return function () { return clearTimeout(timeout); };
|
|
358
387
|
}, [errorKind]);
|
|
359
|
-
//
|
|
388
|
+
// missing-key + plano: botão "Solicitar Instrumento" é clicável (abre modal cartório+script)
|
|
389
|
+
var isMissingKeyWithPlan = errorKind === 'missing-key' && hasPremiumAccess;
|
|
360
390
|
var isDisabled = isLoading ||
|
|
361
391
|
isMissingKeyLoading ||
|
|
362
392
|
errorKind === 'invalid-key' ||
|
|
363
393
|
errorKind === 'missing-doc' ||
|
|
364
|
-
errorKind === 'missing-key';
|
|
394
|
+
(errorKind === 'missing-key' && !hasPremiumAccess);
|
|
365
395
|
var getTooltipMessage = function () {
|
|
366
396
|
if (errorKind === 'missing-doc')
|
|
367
397
|
return 'Documento não disponível para consulta';
|
|
@@ -373,10 +403,13 @@ export var Instrumento = function (_a) {
|
|
|
373
403
|
return '';
|
|
374
404
|
};
|
|
375
405
|
var getButtonLabel = function () {
|
|
376
|
-
if (errorKind === 'missing-key')
|
|
406
|
+
if (errorKind === 'missing-key') {
|
|
407
|
+
if (hasPremiumAccess)
|
|
408
|
+
return 'Solicitar Instrumento';
|
|
377
409
|
return isMissingKeyLoading
|
|
378
410
|
? 'Solicitar instrumento'
|
|
379
411
|
: 'Instrumento não localizado';
|
|
412
|
+
}
|
|
380
413
|
if (errorKind === 'invalid-key' || errorKind === 'missing-doc')
|
|
381
414
|
return 'Instrumento Indisponível';
|
|
382
415
|
if (!isProtestoSPByNmChave(normalizedKey))
|
|
@@ -397,6 +430,10 @@ export var Instrumento = function (_a) {
|
|
|
397
430
|
case 0:
|
|
398
431
|
if (isDisabled)
|
|
399
432
|
return [2 /*return*/];
|
|
433
|
+
if (isMissingKeyWithPlan) {
|
|
434
|
+
setIsCartorioModalOpen(true);
|
|
435
|
+
return [2 /*return*/];
|
|
436
|
+
}
|
|
400
437
|
if (shouldInterceptForExtension && onExtensionRequired) {
|
|
401
438
|
onExtensionRequired();
|
|
402
439
|
return [2 /*return*/];
|
|
@@ -475,6 +512,7 @@ export var Instrumento = function (_a) {
|
|
|
475
512
|
case 3: return [2 /*return*/];
|
|
476
513
|
}
|
|
477
514
|
});
|
|
478
|
-
}); } })
|
|
515
|
+
}); } }),
|
|
516
|
+
React.createElement(ModalDadosCartorio, { isOpen: isCartorioModalOpen, onClose: function () { return setIsCartorioModalOpen(false); }, cartorio: cartorio, script: SCRIPT_LIGAR_CARTORIO_LIVRO_FOLHA })));
|
|
479
517
|
};
|
|
480
518
|
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -5,3 +5,5 @@
|
|
|
5
5
|
export declare const EXTENSION_PROTESTO_LABEL = "Mais detalhes do protesto (extens\u00E3o)";
|
|
6
6
|
export declare const EXTENSION_MODAL_TITLE = "Mais detalhes do protesto (extens\u00E3o)";
|
|
7
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.).";
|
|
8
|
+
/** Script para o usuário ligar ao cartório e solicitar livro/folha (instrumento não localizado). */
|
|
9
|
+
export declare const SCRIPT_LIGAR_CARTORIO_LIVRO_FOLHA = "Ligue ao cart\u00F3rio usando os dados abaixo. Informe que voc\u00EA precisa do n\u00FAmero do livro e da folha do protesto. Anote livro e folha e preencha no sistema quando dispon\u00EDvel.";
|
|
@@ -5,3 +5,5 @@
|
|
|
5
5
|
export var EXTENSION_PROTESTO_LABEL = 'Mais detalhes do protesto (extensão)';
|
|
6
6
|
export var EXTENSION_MODAL_TITLE = 'Mais detalhes do protesto (extensão)';
|
|
7
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.).';
|
|
8
|
+
/** Script para o usuário ligar ao cartório e solicitar livro/folha (instrumento não localizado). */
|
|
9
|
+
export var SCRIPT_LIGAR_CARTORIO_LIVRO_FOLHA = 'Ligue ao cartório usando os dados abaixo. Informe que você precisa do número do livro e da folha do protesto. Anote livro e folha e preencha no sistema quando disponível.';
|