@credithub/harlan-components 1.112.1 → 1.114.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/common/modalInstrumentoProtestoSP.js +6 -6
- package/dist/components/protestos/instrumento/InstrumentoDiscoveryConfirmModal.js +8 -11
- package/dist/components/protestos/instrumento/InstrumentoEmailStatusModal.d.ts +3 -0
- package/dist/components/protestos/instrumento/InstrumentoEmailStatusModal.js +11 -3
- package/dist/components/protestos/instrumento/useInstrumento.js +2 -2
- package/dist/components/protestos/protestosList.js +33 -11
- package/lib/cjs/index.js +287 -261
- package/lib/esm/index.js +287 -261
- package/package.json +1 -1
|
@@ -2,10 +2,10 @@ 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 React, {
|
|
5
|
+
import React, { useEffect, useState } from 'react';
|
|
6
6
|
import styled, { css, keyframes } from 'styled-components';
|
|
7
|
-
import Modal from './modal';
|
|
8
7
|
import Button from './button';
|
|
8
|
+
import Modal from './modal';
|
|
9
9
|
var CheckIcon = function () { return (React.createElement("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
10
10
|
React.createElement("polyline", { points: "20 6 9 17 4 12" }))); };
|
|
11
11
|
var slideUp = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n"], ["\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n"])));
|
|
@@ -59,7 +59,7 @@ var StyledInput = styled.input(templateObject_9 || (templateObject_9 = __makeTem
|
|
|
59
59
|
return theme.colors.azulClaro;
|
|
60
60
|
}, function (_a) {
|
|
61
61
|
var $isValid = _a.$isValid, theme = _a.theme;
|
|
62
|
-
return $isValid && css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n
|
|
62
|
+
return $isValid && css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n background-color: ", ";\n border-color: ", ";\n color: ", ";\n\n &:focus {\n border-color: ", ";\n box-shadow: 0 0 0 2px ", "30;\n }\n "], ["\n background-color: ", ";\n border-color: ", ";\n color: ", ";\n\n &:focus {\n border-color: ", ";\n box-shadow: 0 0 0 2px ", "30;\n }\n "])), theme.colors.white, theme.colors.positivoApoio, theme.colors.cinzaEscuro, theme.colors.positivoApoio, theme.colors.positivoClaro);
|
|
63
63
|
});
|
|
64
64
|
var Footer = styled.div(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 12px;\n width: 100%;\n border-top: 1px solid ", ";\n"], ["\n display: flex;\n flex-direction: column;\n gap: 12px;\n width: 100%;\n border-top: 1px solid ", ";\n"])), function (_a) {
|
|
65
65
|
var theme = _a.theme;
|
|
@@ -88,11 +88,11 @@ var ModalInstrumentoProtestoSP = function (_a) {
|
|
|
88
88
|
var isProcessing = isEnviandoEmail;
|
|
89
89
|
var isFormDisabled = !isFormValid || isProcessing;
|
|
90
90
|
var footerContent = (React.createElement(Footer, null,
|
|
91
|
-
React.createElement(Button, { onClick: function () { return onEnviarEmail === null || onEnviarEmail === void 0 ? void 0 : onEnviarEmail(livro, folha); }, disabled: isFormDisabled, isLoading: isEnviandoEmail }, "SOLICITAR
|
|
91
|
+
React.createElement(Button, { onClick: function () { return onEnviarEmail === null || onEnviarEmail === void 0 ? void 0 : onEnviarEmail(livro, folha); }, disabled: isFormDisabled, isLoading: isEnviandoEmail }, "SOLICITAR INSTRUMENTO"),
|
|
92
92
|
React.createElement(GhostButton, { onClick: onClose, disabled: isProcessing }, "Cancelar")));
|
|
93
|
-
return (React.createElement(Modal, { isOpen: isOpen, onClose: onClose, title: "
|
|
93
|
+
return (React.createElement(Modal, { isOpen: isOpen, onClose: onClose, title: "Solicitar instrumento", footer: footerContent },
|
|
94
94
|
React.createElement(Wrapper, null,
|
|
95
|
-
React.createElement(Subtitle, null, "
|
|
95
|
+
React.createElement(Subtitle, null, "Para cart\u00F3rios de SP, informe Livro e Folha. Vamos iniciar o processamento e enviar por e-mail o instrumento e, quando poss\u00EDvel, as informa\u00E7\u00F5es do credor (quem protestou)."),
|
|
96
96
|
React.createElement(InputsRow, null,
|
|
97
97
|
React.createElement(InputContainer, null,
|
|
98
98
|
React.createElement(Label, { htmlFor: "livro" }, "Livro"),
|
|
@@ -2,28 +2,25 @@ 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 React from 'react';
|
|
6
|
-
import Modal from '../../../components/common/modal';
|
|
7
5
|
import Button from '../../../components/common/button';
|
|
6
|
+
import Modal from '../../../components/common/modal';
|
|
7
|
+
import React from 'react';
|
|
8
8
|
import styled from 'styled-components';
|
|
9
|
-
var Actions = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n gap: 10px;\n
|
|
10
|
-
var PrimaryButton = styled(Button)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n && {\n width:
|
|
11
|
-
var CancelButton = styled
|
|
9
|
+
var Actions = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 10px;\n"], ["\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 10px;\n"])));
|
|
10
|
+
var PrimaryButton = styled(Button)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n && {\n width: 100% !important;\n }\n"], ["\n && {\n width: 100% !important;\n }\n"])));
|
|
11
|
+
var CancelButton = styled(Button)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n && {\n width: 100% !important;\n background-color: transparent;\n color: ", ";\n\n &:hover:not(:disabled) {\n background-color: transparent;\n color: ", ";\n text-decoration: underline;\n }\n }\n"], ["\n && {\n width: 100% !important;\n background-color: transparent;\n color: ", ";\n\n &:hover:not(:disabled) {\n background-color: transparent;\n color: ", ";\n text-decoration: underline;\n }\n }\n"])), function (_a) {
|
|
12
12
|
var theme = _a.theme;
|
|
13
13
|
return theme.colors.cinzaMedio;
|
|
14
|
-
}, function (_a) {
|
|
15
|
-
var theme = _a.theme;
|
|
16
|
-
return theme.typography.strong16;
|
|
17
14
|
}, function (_a) {
|
|
18
15
|
var theme = _a.theme;
|
|
19
16
|
return theme.colors.azulCredithub;
|
|
20
17
|
});
|
|
21
18
|
var InstrumentoDiscoveryConfirmModal = function (_a) {
|
|
22
19
|
var isOpen = _a.isOpen, onClose = _a.onClose, onConfirm = _a.onConfirm, _b = _a.isLoading, isLoading = _b === void 0 ? false : _b;
|
|
23
|
-
return (React.createElement(Modal, { isOpen: isOpen, onClose: onClose, title: "Solicitar instrumento
|
|
24
|
-
React.createElement(PrimaryButton, { onClick: onConfirm, isLoading: isLoading }, "
|
|
20
|
+
return (React.createElement(Modal, { isOpen: isOpen, onClose: onClose, title: "Solicitar instrumento", footer: React.createElement(Actions, null,
|
|
21
|
+
React.createElement(PrimaryButton, { onClick: onConfirm, isLoading: isLoading }, "Solicitar instrumento"),
|
|
25
22
|
React.createElement(CancelButton, { onClick: onClose, disabled: isLoading }, "Cancelar")) },
|
|
26
|
-
React.createElement("div", { style: { textAlign: 'center' } }, "N\u00E3o encontramos o PDF do instrumento agora. Se voc\u00EA confirmar, vamos iniciar o processamento e enviar
|
|
23
|
+
React.createElement("div", { style: { textAlign: 'center' } }, "N\u00E3o encontramos o PDF do instrumento agora. Se voc\u00EA confirmar, vamos iniciar o processamento e enviar por e-mail o instrumento e, quando poss\u00EDvel, as informa\u00E7\u00F5es do credor (quem protestou).")));
|
|
27
24
|
};
|
|
28
25
|
export default InstrumentoDiscoveryConfirmModal;
|
|
29
26
|
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -4,6 +4,9 @@ interface InstrumentoEmailStatusModalProps {
|
|
|
4
4
|
onClose: () => void;
|
|
5
5
|
message: ReactNode;
|
|
6
6
|
title?: string;
|
|
7
|
+
secondaryActionLabel?: string;
|
|
8
|
+
onSecondaryAction?: () => void | Promise<void>;
|
|
9
|
+
secondaryActionDisabled?: boolean;
|
|
7
10
|
}
|
|
8
11
|
declare const InstrumentoEmailStatusModal: FC<InstrumentoEmailStatusModalProps>;
|
|
9
12
|
export default InstrumentoEmailStatusModal;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
2
5
|
import Modal from '../../../components/common/modal';
|
|
3
6
|
import React from 'react';
|
|
7
|
+
import Button from '../../../components/common/button';
|
|
8
|
+
import styled from 'styled-components';
|
|
9
|
+
var Actions = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n gap: 10px;\n flex-wrap: wrap;\n margin-top: 16px;\n"], ["\n display: flex;\n justify-content: center;\n gap: 10px;\n flex-wrap: wrap;\n margin-top: 16px;\n"])));
|
|
4
10
|
var InstrumentoEmailStatusModal = function (_a) {
|
|
5
|
-
var isOpen = _a.isOpen, onClose = _a.onClose, message = _a.message, _b = _a.title, title = _b === void 0 ? 'Instrumento de Protesto' : _b;
|
|
11
|
+
var isOpen = _a.isOpen, onClose = _a.onClose, message = _a.message, _b = _a.title, title = _b === void 0 ? 'Instrumento de Protesto' : _b, secondaryActionLabel = _a.secondaryActionLabel, onSecondaryAction = _a.onSecondaryAction, _c = _a.secondaryActionDisabled, secondaryActionDisabled = _c === void 0 ? false : _c;
|
|
6
12
|
return (React.createElement(Modal, { isOpen: isOpen, onClose: onClose, title: title },
|
|
7
13
|
React.createElement("div", { style: {
|
|
8
14
|
textAlign: 'center',
|
|
@@ -10,7 +16,9 @@ var InstrumentoEmailStatusModal = function (_a) {
|
|
|
10
16
|
fontSize: 18,
|
|
11
17
|
fontWeight: 400
|
|
12
18
|
} }, message),
|
|
13
|
-
React.createElement(
|
|
19
|
+
React.createElement(Actions, null,
|
|
20
|
+
secondaryActionLabel && onSecondaryAction && (React.createElement(Button, { onClick: onSecondaryAction, disabled: secondaryActionDisabled }, secondaryActionLabel)),
|
|
14
21
|
React.createElement(Button, { onClick: onClose }, "Fechar"))));
|
|
15
22
|
};
|
|
16
23
|
export default InstrumentoEmailStatusModal;
|
|
24
|
+
var templateObject_1;
|
|
@@ -81,7 +81,7 @@ export var useInstrumento = function (_a) {
|
|
|
81
81
|
res = _a.sent();
|
|
82
82
|
setEmailTitle('Instrumento solicitado por e-mail');
|
|
83
83
|
setEmailMessage((res === null || res === void 0 ? void 0 : res.message) ||
|
|
84
|
-
'
|
|
84
|
+
'Solicitação registrada. Vamos processar o instrumento e também agregar as informações do credor quando possível. Em alguns minutos, refaça a consulta de hoje para atualizar os dados.');
|
|
85
85
|
setIsEmailModalOpen(true);
|
|
86
86
|
setIsModalSPOpen(false);
|
|
87
87
|
return [3 /*break*/, 5];
|
|
@@ -115,7 +115,7 @@ export var useInstrumento = function (_a) {
|
|
|
115
115
|
res = _a.sent();
|
|
116
116
|
setEmailTitle('Solicitação enviada');
|
|
117
117
|
setEmailMessage((res === null || res === void 0 ? void 0 : res.message) ||
|
|
118
|
-
'
|
|
118
|
+
'Solicitação registrada. Vamos processar o instrumento e também agregar as informações do credor quando possível. Em alguns minutos, refaça a consulta de hoje para atualizar os dados.');
|
|
119
119
|
setIsEmailModalOpen(true);
|
|
120
120
|
return [3 /*break*/, 5];
|
|
121
121
|
case 3:
|
|
@@ -65,7 +65,7 @@ import AddItemField from '../common/addItem';
|
|
|
65
65
|
import Button from '../common/button';
|
|
66
66
|
import ModalInstrumentoProtestoSP from '../common/modalInstrumentoProtestoSP';
|
|
67
67
|
import { ResultContent } from '../interface/result';
|
|
68
|
-
import { WebService } from '../webservice';
|
|
68
|
+
import { Queries, WebService } from '../webservice';
|
|
69
69
|
import InstrumentoDiscoveryConfirmModal from './instrumento/InstrumentoDiscoveryConfirmModal';
|
|
70
70
|
import InstrumentoEmailStatusModal from './instrumento/InstrumentoEmailStatusModal';
|
|
71
71
|
import { useInstrumento } from './instrumento/useInstrumento';
|
|
@@ -147,15 +147,16 @@ var AIIndicator = function () { return (React.createElement("span", { title: "In
|
|
|
147
147
|
cursor: 'help'
|
|
148
148
|
} }, "*")); };
|
|
149
149
|
export var ProtestoItem = memo(function (_a) {
|
|
150
|
-
var _b;
|
|
150
|
+
var _b, _c;
|
|
151
151
|
var protesto = _a.protesto;
|
|
152
152
|
var client = useContext(WebService);
|
|
153
|
-
var
|
|
153
|
+
var _d = useGlobalData(), setData = _d.setData, globalData = _d.data;
|
|
154
154
|
var iaOverrides = ((_b = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _b === void 0 ? void 0 : _b.iaOverrides) || {};
|
|
155
|
-
var
|
|
156
|
-
var _e = useState(
|
|
157
|
-
var _f = useState(false),
|
|
158
|
-
var _g = useState(false),
|
|
155
|
+
var refreshToken = ((_c = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _c === void 0 ? void 0 : _c.refreshToken) || 0;
|
|
156
|
+
var _e = useState(null), quemApresentou = _e[0], setQuemApresentou = _e[1];
|
|
157
|
+
var _f = useState(false), loading = _f[0], setLoading = _f[1];
|
|
158
|
+
var _g = useState(false), queued = _g[0], setQueued = _g[1];
|
|
159
|
+
var _h = useState(false), isAIData = _h[0], setIsAIData = _h[1];
|
|
159
160
|
var documento = protesto.cpfCnpj;
|
|
160
161
|
var nm_chave = protesto.nm_chave;
|
|
161
162
|
var formatBooleanField = function (value) {
|
|
@@ -244,7 +245,7 @@ export var ProtestoItem = memo(function (_a) {
|
|
|
244
245
|
if (idx !== -1)
|
|
245
246
|
requestQueue.splice(idx, 1);
|
|
246
247
|
};
|
|
247
|
-
}, []);
|
|
248
|
+
}, [nm_chave, refreshToken]);
|
|
248
249
|
var getQuemProtestouDisplay = function () {
|
|
249
250
|
var original = protesto.nomeCedente;
|
|
250
251
|
var override = iaOverrides[nm_chave];
|
|
@@ -276,6 +277,7 @@ export var ProtestoItem = memo(function (_a) {
|
|
|
276
277
|
export var Instrumento = function (_a) {
|
|
277
278
|
var nm_chave = _a.nm_chave, cpfCnpj = _a.cpfCnpj;
|
|
278
279
|
var client = useContext(WebService);
|
|
280
|
+
var ctxProtestos = useContext(Queries.Protestos);
|
|
279
281
|
var _b = useGlobalData(), setData = _b.setData, globalData = _b.data;
|
|
280
282
|
var protestosData = (globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) || {};
|
|
281
283
|
var failedInstruments = protestosData.failedInstruments || {};
|
|
@@ -424,14 +426,14 @@ export var Instrumento = function (_a) {
|
|
|
424
426
|
if (errorKind === 'invalid-key')
|
|
425
427
|
return 'Chave de instrumento inválida';
|
|
426
428
|
if (errorKind === 'not-found')
|
|
427
|
-
return 'PDF indisponível. Você pode solicitar
|
|
429
|
+
return 'PDF indisponível. Você pode solicitar o instrumento.';
|
|
428
430
|
if (isPrefetching)
|
|
429
431
|
return 'Verificando disponibilidade do instrumento...';
|
|
430
432
|
return '';
|
|
431
433
|
};
|
|
432
434
|
var getButtonLabel = function () {
|
|
433
435
|
if (errorKind === 'not-found' && !isProtestoSPByNmChave(normalizedKey))
|
|
434
|
-
return 'Solicitar
|
|
436
|
+
return 'Solicitar instrumento';
|
|
435
437
|
if (errorKind === 'invalid-key' || errorKind === 'missing-doc')
|
|
436
438
|
return 'Instrumento Indisponível';
|
|
437
439
|
return 'Instrumento';
|
|
@@ -444,6 +446,20 @@ export var Instrumento = function (_a) {
|
|
|
444
446
|
pdfWindow.document.write("<iframe width='100%' height='100%' src='data:application/pdf;base64,".concat(base64, "'></iframe>"));
|
|
445
447
|
};
|
|
446
448
|
var isSP = isProtestoSPByNmChave(normalizedKey);
|
|
449
|
+
var resetInstrumentStateForKey = useCallback(function () {
|
|
450
|
+
if (!nm_chave)
|
|
451
|
+
return;
|
|
452
|
+
setData(function (prev) {
|
|
453
|
+
var base = prev || {};
|
|
454
|
+
var prevProtestosData = base.protestosData || {};
|
|
455
|
+
var _a = prevProtestosData.failedInstruments || {}, _b = nm_chave, _f1 = _a[_b], restFailed = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
|
|
456
|
+
var _c = prevProtestosData.failedInstrumentReasons || {}, _d = nm_chave, _r1 = _c[_d], restReasons = __rest(_c, [typeof _d === "symbol" ? _d : _d + ""]);
|
|
457
|
+
var _e = prevProtestosData.checkedInstruments || {}, _f = nm_chave, _c1 = _e[_f], restChecked = __rest(_e, [typeof _f === "symbol" ? _f : _f + ""]);
|
|
458
|
+
var _g = prevProtestosData.instrumentCache || {}, _h = nm_chave, _i1 = _g[_h], restCache = __rest(_g, [typeof _h === "symbol" ? _h : _h + ""]);
|
|
459
|
+
return __assign(__assign({}, base), { protestosData: __assign(__assign({}, prevProtestosData), { failedInstruments: restFailed, failedInstrumentReasons: restReasons, checkedInstruments: restChecked, instrumentCache: restCache, refreshToken: (prevProtestosData.refreshToken || 0) + 1 }) });
|
|
460
|
+
});
|
|
461
|
+
setErrorKind(null);
|
|
462
|
+
}, [nm_chave, setData]);
|
|
447
463
|
return (React.createElement(React.Fragment, null,
|
|
448
464
|
React.createElement("span", { title: tooltipMessage, style: { display: 'inline-block' } },
|
|
449
465
|
React.createElement(Button, { isLoading: isLoading || instrumentoHook.isProcessandoDescoberta, onClick: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -520,7 +536,13 @@ export var Instrumento = function (_a) {
|
|
|
520
536
|
});
|
|
521
537
|
}); }, disabled: isDisabled }, getButtonLabel())),
|
|
522
538
|
React.createElement(ModalInstrumentoProtestoSP, { isOpen: instrumentoHook.isModalSPOpen, onClose: instrumentoHook.closeModalSP, onEnviarEmail: instrumentoHook.handleEnviarEmail, isEnviandoEmail: instrumentoHook.isEnviandoEmail }),
|
|
523
|
-
React.createElement(InstrumentoEmailStatusModal, { isOpen: instrumentoHook.isEmailModalOpen, onClose: instrumentoHook.closeEmailModal, message: instrumentoHook.emailMessage, title: instrumentoHook.emailTitle
|
|
539
|
+
React.createElement(InstrumentoEmailStatusModal, { isOpen: instrumentoHook.isEmailModalOpen, onClose: instrumentoHook.closeEmailModal, message: instrumentoHook.emailMessage, title: instrumentoHook.emailTitle, secondaryActionLabel: "Atualizar consulta (hoje)", secondaryActionDisabled: isPrefetching || isLoading, onSecondaryAction: function () {
|
|
540
|
+
var _a;
|
|
541
|
+
// Permite reconsultar no mesmo dia para tentar “desocultar” instrumento/nome
|
|
542
|
+
resetInstrumentStateForKey();
|
|
543
|
+
(_a = ctxProtestos === null || ctxProtestos === void 0 ? void 0 : ctxProtestos.refetch) === null || _a === void 0 ? void 0 : _a.call(ctxProtestos);
|
|
544
|
+
instrumentoHook.closeEmailModal();
|
|
545
|
+
} }),
|
|
524
546
|
React.createElement(InstrumentoDiscoveryConfirmModal, { isOpen: isDiscoveryConfirmOpen, onClose: function () { return setIsDiscoveryConfirmOpen(false); }, isLoading: instrumentoHook.isProcessandoDescoberta, onConfirm: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
525
547
|
return __generator(this, function (_a) {
|
|
526
548
|
switch (_a.label) {
|