@credithub/harlan-components 1.111.2 → 1.112.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/adapters/instrumentoProtesto/ieptbInstrumento.d.ts +16 -0
- package/dist/adapters/instrumentoProtesto/ieptbInstrumento.js +72 -0
- package/dist/components/common/modalInstrumentoProtestoSP.d.ts +12 -0
- package/dist/components/common/modalInstrumentoProtestoSP.js +110 -0
- package/dist/components/protestos/instrumento/InstrumentoDiscoveryConfirmModal.d.ts +9 -0
- package/dist/components/protestos/instrumento/InstrumentoDiscoveryConfirmModal.js +29 -0
- package/dist/components/protestos/instrumento/InstrumentoEmailStatusModal.d.ts +9 -0
- package/dist/components/protestos/instrumento/InstrumentoEmailStatusModal.js +16 -0
- package/dist/components/protestos/instrumento/mocks/instrumentoMocks.d.ts +33 -0
- package/dist/components/protestos/instrumento/mocks/instrumentoMocks.js +142 -0
- package/dist/components/protestos/instrumento/useInstrumento.d.ts +31 -0
- package/dist/components/protestos/instrumento/useInstrumento.js +213 -0
- package/dist/components/protestos/protestosList.js +107 -65
- package/dist/styles/globalStyle.js +4 -1
- package/dist/styles/theme.d.ts +1 -0
- package/dist/styles/theme.js +1 -0
- package/dist/utils/protestoUf.d.ts +10 -0
- package/dist/utils/protestoUf.js +17 -0
- package/lib/cjs/index.js +955 -395
- package/lib/esm/index.js +955 -395
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Client } from '@credithub/webservice';
|
|
2
|
+
export type InstrumentoSendmailResponse = {
|
|
3
|
+
message?: string;
|
|
4
|
+
_warning?: string;
|
|
5
|
+
jobId?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function sendInstrumentoManualEmail(client: Client.WebService, payload: {
|
|
8
|
+
documento: string;
|
|
9
|
+
nm_chave: string;
|
|
10
|
+
livro: string;
|
|
11
|
+
folha: string;
|
|
12
|
+
}): Promise<InstrumentoSendmailResponse>;
|
|
13
|
+
export declare function sendInstrumentoDiscoveryEmail(client: Client.WebService, payload: {
|
|
14
|
+
documento: string;
|
|
15
|
+
nm_chave: string;
|
|
16
|
+
}): Promise<InstrumentoSendmailResponse>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
export function sendInstrumentoManualEmail(client, payload) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
39
|
+
var res;
|
|
40
|
+
return __generator(this, function (_a) {
|
|
41
|
+
switch (_a.label) {
|
|
42
|
+
case 0: return [4 /*yield*/, client.request("SELECT FROM 'IEPTB'.'INSTRUMENTO_MANUAL_SENDMAIL'", {
|
|
43
|
+
documento: payload.documento,
|
|
44
|
+
nm_chave: payload.nm_chave,
|
|
45
|
+
livro: payload.livro,
|
|
46
|
+
folha: payload.folha
|
|
47
|
+
})];
|
|
48
|
+
case 1: return [4 /*yield*/, (_a.sent()).json()];
|
|
49
|
+
case 2:
|
|
50
|
+
res = _a.sent();
|
|
51
|
+
return [2 /*return*/, (res !== null && res !== void 0 ? res : {})];
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export function sendInstrumentoDiscoveryEmail(client, payload) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
58
|
+
var res;
|
|
59
|
+
return __generator(this, function (_a) {
|
|
60
|
+
switch (_a.label) {
|
|
61
|
+
case 0: return [4 /*yield*/, client.request("SELECT FROM 'IEPTB'.'INSTRUMENTO_DISCOVERY_SENDMAIL'", {
|
|
62
|
+
documento: payload.documento,
|
|
63
|
+
nm_chave: payload.nm_chave
|
|
64
|
+
})];
|
|
65
|
+
case 1: return [4 /*yield*/, (_a.sent()).json()];
|
|
66
|
+
case 2:
|
|
67
|
+
res = _a.sent();
|
|
68
|
+
return [2 /*return*/, (res !== null && res !== void 0 ? res : {})];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface ModalInstrumentoProtestoSPProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onDescobrir?: (livro: string, folha: string) => void;
|
|
6
|
+
onEnviarEmail?: (livro: string, folha: string) => void;
|
|
7
|
+
canDescobrir?: boolean;
|
|
8
|
+
isDescobrindo?: boolean;
|
|
9
|
+
isEnviandoEmail?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const ModalInstrumentoProtestoSP: FC<ModalInstrumentoProtestoSPProps>;
|
|
12
|
+
export default ModalInstrumentoProtestoSP;
|
|
@@ -0,0 +1,110 @@
|
|
|
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
|
+
};
|
|
5
|
+
import React, { useState, useEffect } from 'react';
|
|
6
|
+
import styled, { css, keyframes } from 'styled-components';
|
|
7
|
+
import Modal from './modal';
|
|
8
|
+
import Button from './button';
|
|
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
|
+
React.createElement("polyline", { points: "20 6 9 17 4 12" }))); };
|
|
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"])));
|
|
12
|
+
var Wrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n"], ["\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n"])));
|
|
13
|
+
var Subtitle = styled.p(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", ";\n color: ", ";\n margin: 0 0 24px 0;\n line-height: 1.5;\n"], ["\n ", ";\n color: ", ";\n margin: 0 0 24px 0;\n line-height: 1.5;\n"])), function (_a) {
|
|
14
|
+
var theme = _a.theme;
|
|
15
|
+
return theme.typography.body18;
|
|
16
|
+
}, function (_a) {
|
|
17
|
+
var theme = _a.theme;
|
|
18
|
+
return theme.colors.cinzaMedio;
|
|
19
|
+
});
|
|
20
|
+
var InputsRow = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 16px;\n width: 100%;\n"], ["\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 16px;\n width: 100%;\n"])));
|
|
21
|
+
var InputContainer = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 6px;\n position: relative;\n"], ["\n display: flex;\n flex-direction: column;\n gap: 6px;\n position: relative;\n"])));
|
|
22
|
+
var Label = styled.label(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", ";\n color: ", ";\n font-weight: 700;\n font-size: 12px;\n text-transform: uppercase;\n"], ["\n ", ";\n color: ", ";\n font-weight: 700;\n font-size: 12px;\n text-transform: uppercase;\n"])), function (_a) {
|
|
23
|
+
var theme = _a.theme;
|
|
24
|
+
return theme.typography.label14;
|
|
25
|
+
}, function (_a) {
|
|
26
|
+
var theme = _a.theme;
|
|
27
|
+
return theme.colors.cinzaEscuro;
|
|
28
|
+
});
|
|
29
|
+
var IconWrapper = styled.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n position: absolute;\n right: 12px;\n bottom: 12px;\n color: ", ";\n animation: ", " 0.3s ease-out;\n pointer-events: none;\n display: flex;\n align-items: center;\n justify-content: center;\n"], ["\n position: absolute;\n right: 12px;\n bottom: 12px;\n color: ", ";\n animation: ", " 0.3s ease-out;\n pointer-events: none;\n display: flex;\n align-items: center;\n justify-content: center;\n"])), function (_a) {
|
|
30
|
+
var theme = _a.theme;
|
|
31
|
+
return theme.colors.positivoApoio;
|
|
32
|
+
}, slideUp);
|
|
33
|
+
var StyledInput = styled.input(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n ", ";\n font-family: ", ";\n\n width: 100%;\n height: 48px;\n padding: 0 16px;\n padding-right: 40px;\n\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 8px;\n color: ", ";\n transition: all 0.2s ease-in-out;\n\n &::placeholder {\n color: ", ";\n font-weight: 400;\n }\n\n &:focus {\n outline: none;\n background-color: ", ";\n border-color: ", ";\n box-shadow: 0 0 0 2px ", "30;\n }\n\n ", "\n"], ["\n ", ";\n font-family: ", ";\n\n width: 100%;\n height: 48px;\n padding: 0 16px;\n padding-right: 40px;\n\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 8px;\n color: ", ";\n transition: all 0.2s ease-in-out;\n\n &::placeholder {\n color: ", ";\n font-weight: 400;\n }\n\n &:focus {\n outline: none;\n background-color: ", ";\n border-color: ", ";\n box-shadow: 0 0 0 2px ", "30;\n }\n\n ", "\n"])), function (_a) {
|
|
34
|
+
var theme = _a.theme;
|
|
35
|
+
return theme.typography.body16;
|
|
36
|
+
}, function (_a) {
|
|
37
|
+
var theme = _a.theme;
|
|
38
|
+
return theme.typography.defaultFontFamily;
|
|
39
|
+
}, function (_a) {
|
|
40
|
+
var theme = _a.theme;
|
|
41
|
+
return theme.colors.cinzaBase;
|
|
42
|
+
}, function (_a) {
|
|
43
|
+
var theme = _a.theme;
|
|
44
|
+
return theme.colors.cinzaClaro;
|
|
45
|
+
}, function (_a) {
|
|
46
|
+
var theme = _a.theme;
|
|
47
|
+
return theme.colors.cinzaEscuro;
|
|
48
|
+
}, function (_a) {
|
|
49
|
+
var theme = _a.theme;
|
|
50
|
+
return theme.colors.cinzaClaro;
|
|
51
|
+
}, function (_a) {
|
|
52
|
+
var theme = _a.theme;
|
|
53
|
+
return theme.colors.white;
|
|
54
|
+
}, function (_a) {
|
|
55
|
+
var theme = _a.theme;
|
|
56
|
+
return theme.colors.azulCredithub;
|
|
57
|
+
}, function (_a) {
|
|
58
|
+
var theme = _a.theme;
|
|
59
|
+
return theme.colors.azulClaro;
|
|
60
|
+
}, function (_a) {
|
|
61
|
+
var $isValid = _a.$isValid, theme = _a.theme;
|
|
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
|
+
});
|
|
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
|
+
var theme = _a.theme;
|
|
66
|
+
return theme.colors.cinzaBase;
|
|
67
|
+
});
|
|
68
|
+
var GhostButton = styled(Button)(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n && {\n background-color: transparent;\n color: ", ";\n margin-top: 4px;\n\n &:hover:not(:disabled) {\n background-color: transparent;\n color: ", ";\n text-decoration: underline;\n }\n }\n"], ["\n && {\n background-color: transparent;\n color: ", ";\n margin-top: 4px;\n\n &:hover:not(:disabled) {\n background-color: transparent;\n color: ", ";\n text-decoration: underline;\n }\n }\n"])), function (_a) {
|
|
69
|
+
var theme = _a.theme;
|
|
70
|
+
return theme.colors.cinzaMedio;
|
|
71
|
+
}, function (_a) {
|
|
72
|
+
var theme = _a.theme;
|
|
73
|
+
return theme.colors.azulCredithub;
|
|
74
|
+
});
|
|
75
|
+
var ModalInstrumentoProtestoSP = function (_a) {
|
|
76
|
+
var isOpen = _a.isOpen, onClose = _a.onClose, onDescobrir = _a.onDescobrir, onEnviarEmail = _a.onEnviarEmail, _b = _a.canDescobrir, canDescobrir = _b === void 0 ? true : _b, _c = _a.isDescobrindo, isDescobrindo = _c === void 0 ? false : _c, _d = _a.isEnviandoEmail, isEnviandoEmail = _d === void 0 ? false : _d;
|
|
77
|
+
var _e = useState(''), livro = _e[0], setLivro = _e[1];
|
|
78
|
+
var _f = useState(''), folha = _f[0], setFolha = _f[1];
|
|
79
|
+
useEffect(function () {
|
|
80
|
+
if (!isOpen) {
|
|
81
|
+
setLivro('');
|
|
82
|
+
setFolha('');
|
|
83
|
+
}
|
|
84
|
+
}, [isOpen]);
|
|
85
|
+
var hasLivro = livro.trim().length > 0;
|
|
86
|
+
var hasFolha = folha.trim().length > 0;
|
|
87
|
+
var isFormValid = hasLivro && hasFolha;
|
|
88
|
+
var isProcessing = isDescobrindo || isEnviandoEmail;
|
|
89
|
+
var isFormDisabled = !isFormValid || isProcessing;
|
|
90
|
+
var footerContent = (React.createElement(Footer, null,
|
|
91
|
+
canDescobrir && (React.createElement(Button, { onClick: function () { return onDescobrir === null || onDescobrir === void 0 ? void 0 : onDescobrir(livro, folha); }, disabled: isFormDisabled, isLoading: isDescobrindo }, "DESCOBRIR INSTRUMENTO")),
|
|
92
|
+
React.createElement(Button, { onClick: function () { return onEnviarEmail === null || onEnviarEmail === void 0 ? void 0 : onEnviarEmail(livro, folha); }, disabled: isFormDisabled, isLoading: isEnviandoEmail }, "ENVIAR POR E-MAIL"),
|
|
93
|
+
React.createElement(GhostButton, { onClick: onClose, disabled: isProcessing }, "Cancelar")));
|
|
94
|
+
return (React.createElement(Modal, { isOpen: isOpen, onClose: onClose, title: "INSTRUMENTO DE PROTESTO - SP", footer: footerContent },
|
|
95
|
+
React.createElement(Wrapper, null,
|
|
96
|
+
React.createElement(Subtitle, null, "Utilize os dados constantes no cart\u00F3rio para localizar o instrumento de protesto correspondente."),
|
|
97
|
+
React.createElement(InputsRow, null,
|
|
98
|
+
React.createElement(InputContainer, null,
|
|
99
|
+
React.createElement(Label, { htmlFor: "livro" }, "Livro"),
|
|
100
|
+
React.createElement(StyledInput, { id: "livro", value: livro, onChange: function (e) { return setLivro(e.target.value); }, placeholder: "000", "$isValid": hasLivro, autoFocus: true, autoComplete: "off" }),
|
|
101
|
+
hasLivro && (React.createElement(IconWrapper, null,
|
|
102
|
+
React.createElement(CheckIcon, null)))),
|
|
103
|
+
React.createElement(InputContainer, null,
|
|
104
|
+
React.createElement(Label, { htmlFor: "folha" }, "Folha"),
|
|
105
|
+
React.createElement(StyledInput, { id: "folha", value: folha, onChange: function (e) { return setFolha(e.target.value); }, placeholder: "000", "$isValid": hasFolha, autoComplete: "off" }),
|
|
106
|
+
hasFolha && (React.createElement(IconWrapper, null,
|
|
107
|
+
React.createElement(CheckIcon, null))))))));
|
|
108
|
+
};
|
|
109
|
+
export default ModalInstrumentoProtestoSP;
|
|
110
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface InstrumentoDiscoveryConfirmModalProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onConfirm: () => void | Promise<void>;
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const InstrumentoDiscoveryConfirmModal: FC<InstrumentoDiscoveryConfirmModalProps>;
|
|
9
|
+
export default InstrumentoDiscoveryConfirmModal;
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
};
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import Modal from '../../../components/common/modal';
|
|
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"], ["\n display: flex;\n justify-content: center;\n gap: 10px;\n flex-wrap: wrap;\n"])));
|
|
10
|
+
var PrimaryButton = styled(Button)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n && {\n width: auto !important;\n min-width: 190px;\n white-space: nowrap;\n }\n"], ["\n && {\n width: auto !important;\n min-width: 190px;\n white-space: nowrap;\n }\n"])));
|
|
11
|
+
var CancelButton = styled.button(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n all: unset;\n cursor: pointer;\n padding: 10px 14px;\n border-radius: 10px;\n color: ", ";\n ", ";\n\n &:hover {\n color: ", ";\n text-decoration: underline;\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n text-decoration: none;\n }\n"], ["\n all: unset;\n cursor: pointer;\n padding: 10px 14px;\n border-radius: 10px;\n color: ", ";\n ", ";\n\n &:hover {\n color: ", ";\n text-decoration: underline;\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n text-decoration: none;\n }\n"])), function (_a) {
|
|
12
|
+
var theme = _a.theme;
|
|
13
|
+
return theme.colors.cinzaMedio;
|
|
14
|
+
}, function (_a) {
|
|
15
|
+
var theme = _a.theme;
|
|
16
|
+
return theme.typography.strong16;
|
|
17
|
+
}, function (_a) {
|
|
18
|
+
var theme = _a.theme;
|
|
19
|
+
return theme.colors.azulCredithub;
|
|
20
|
+
});
|
|
21
|
+
var InstrumentoDiscoveryConfirmModal = function (_a) {
|
|
22
|
+
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 por e-mail", footer: React.createElement(Actions, null,
|
|
24
|
+
React.createElement(PrimaryButton, { onClick: onConfirm, isLoading: isLoading }, "Enviar por e-mail"),
|
|
25
|
+
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 o instrumento por e-mail assim que estiver dispon\u00EDvel.")));
|
|
27
|
+
};
|
|
28
|
+
export default InstrumentoDiscoveryConfirmModal;
|
|
29
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
interface InstrumentoEmailStatusModalProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
message: ReactNode;
|
|
6
|
+
title?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const InstrumentoEmailStatusModal: FC<InstrumentoEmailStatusModalProps>;
|
|
9
|
+
export default InstrumentoEmailStatusModal;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Button from '../../../components/common/button';
|
|
2
|
+
import Modal from '../../../components/common/modal';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
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;
|
|
6
|
+
return (React.createElement(Modal, { isOpen: isOpen, onClose: onClose, title: title },
|
|
7
|
+
React.createElement("div", { style: {
|
|
8
|
+
textAlign: 'center',
|
|
9
|
+
display: 'block',
|
|
10
|
+
fontSize: 18,
|
|
11
|
+
fontWeight: 400
|
|
12
|
+
} }, message),
|
|
13
|
+
React.createElement("div", { style: { textAlign: 'center', marginTop: '16px' } },
|
|
14
|
+
React.createElement(Button, { onClick: onClose }, "Fechar"))));
|
|
15
|
+
};
|
|
16
|
+
export default InstrumentoEmailStatusModal;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Funções mockadas para simular o comportamento do backend
|
|
3
|
+
* durante o desenvolvimento da fase mockada.
|
|
4
|
+
*
|
|
5
|
+
* Estas funções serão substituídas por chamadas reais ao Client.WebService
|
|
6
|
+
* na fase de integração.
|
|
7
|
+
*/
|
|
8
|
+
export interface MockInstrumentoResult {
|
|
9
|
+
success: boolean;
|
|
10
|
+
message: string;
|
|
11
|
+
jobId?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Simula a descoberta automática do instrumento de protesto
|
|
15
|
+
* @param livro - Número do livro
|
|
16
|
+
* @param folha - Número da folha
|
|
17
|
+
* @returns Promise com resultado mockado
|
|
18
|
+
*/
|
|
19
|
+
export declare const mockDescobrirInstrumento: (livro: string, folha: string) => Promise<MockInstrumentoResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Simula o envio do instrumento por e-mail (SP manual)
|
|
22
|
+
* @param livro - Número do livro
|
|
23
|
+
* @param folha - Número da folha
|
|
24
|
+
* @returns Promise com resultado mockado
|
|
25
|
+
*/
|
|
26
|
+
export declare const mockEnviarEmailSP: (livro: string, folha: string) => Promise<MockInstrumentoResult>;
|
|
27
|
+
/**
|
|
28
|
+
* Simula a descoberta automática e envio por e-mail (não-SP)
|
|
29
|
+
* @param nmChave - Chave do instrumento
|
|
30
|
+
* @param cpfCnpj - CPF/CNPJ do devedor
|
|
31
|
+
* @returns Promise com resultado mockado
|
|
32
|
+
*/
|
|
33
|
+
export declare const mockDescobertaAutomaticaEmail: (nmChave: string, cpfCnpj: string) => Promise<MockInstrumentoResult>;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Funções mockadas para simular o comportamento do backend
|
|
3
|
+
* durante o desenvolvimento da fase mockada.
|
|
4
|
+
*
|
|
5
|
+
* Estas funções serão substituídas por chamadas reais ao Client.WebService
|
|
6
|
+
* na fase de integração.
|
|
7
|
+
*/
|
|
8
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
13
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
18
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
19
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
20
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
21
|
+
function step(op) {
|
|
22
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
23
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
24
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
25
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
26
|
+
switch (op[0]) {
|
|
27
|
+
case 0: case 1: t = op; break;
|
|
28
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
29
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
30
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
31
|
+
default:
|
|
32
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
33
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
34
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
35
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
36
|
+
if (t[2]) _.ops.pop();
|
|
37
|
+
_.trys.pop(); continue;
|
|
38
|
+
}
|
|
39
|
+
op = body.call(thisArg, _);
|
|
40
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
41
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Simula a descoberta automática do instrumento de protesto
|
|
46
|
+
* @param livro - Número do livro
|
|
47
|
+
* @param folha - Número da folha
|
|
48
|
+
* @returns Promise com resultado mockado
|
|
49
|
+
*/
|
|
50
|
+
export var mockDescobrirInstrumento = function (livro, folha) { return __awaiter(void 0, void 0, void 0, function () {
|
|
51
|
+
var delay, success;
|
|
52
|
+
return __generator(this, function (_a) {
|
|
53
|
+
switch (_a.label) {
|
|
54
|
+
case 0:
|
|
55
|
+
delay = Math.random() * 1000 + 1000;
|
|
56
|
+
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, delay); })];
|
|
57
|
+
case 1:
|
|
58
|
+
_a.sent();
|
|
59
|
+
success = Math.random() > 0.2;
|
|
60
|
+
if (success) {
|
|
61
|
+
return [2 /*return*/, {
|
|
62
|
+
success: true,
|
|
63
|
+
message: "Instrumento localizado com sucesso! Livro: ".concat(livro, ", Folha: ").concat(folha),
|
|
64
|
+
jobId: "job-".concat(Date.now())
|
|
65
|
+
}];
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
return [2 /*return*/, {
|
|
69
|
+
success: false,
|
|
70
|
+
message: 'Não foi possível localizar o instrumento com os dados fornecidos. Verifique os dados e tente novamente.'
|
|
71
|
+
}];
|
|
72
|
+
}
|
|
73
|
+
return [2 /*return*/];
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}); };
|
|
77
|
+
/**
|
|
78
|
+
* Simula o envio do instrumento por e-mail (SP manual)
|
|
79
|
+
* @param livro - Número do livro
|
|
80
|
+
* @param folha - Número da folha
|
|
81
|
+
* @returns Promise com resultado mockado
|
|
82
|
+
*/
|
|
83
|
+
export var mockEnviarEmailSP = function (livro, folha) { return __awaiter(void 0, void 0, void 0, function () {
|
|
84
|
+
var delay, success;
|
|
85
|
+
return __generator(this, function (_a) {
|
|
86
|
+
switch (_a.label) {
|
|
87
|
+
case 0:
|
|
88
|
+
delay = Math.random() * 1000 + 1000;
|
|
89
|
+
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, delay); })];
|
|
90
|
+
case 1:
|
|
91
|
+
_a.sent();
|
|
92
|
+
success = Math.random() > 0.1;
|
|
93
|
+
if (success) {
|
|
94
|
+
return [2 /*return*/, {
|
|
95
|
+
success: true,
|
|
96
|
+
message: "O instrumento de protesto foi enviado para seu e-mail com sucesso. Livro: ".concat(livro, ", Folha: ").concat(folha),
|
|
97
|
+
jobId: "email-job-".concat(Date.now())
|
|
98
|
+
}];
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
return [2 /*return*/, {
|
|
102
|
+
success: false,
|
|
103
|
+
message: 'Falha ao enviar o instrumento por e-mail. Tente novamente mais tarde.'
|
|
104
|
+
}];
|
|
105
|
+
}
|
|
106
|
+
return [2 /*return*/];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}); };
|
|
110
|
+
/**
|
|
111
|
+
* Simula a descoberta automática e envio por e-mail (não-SP)
|
|
112
|
+
* @param nmChave - Chave do instrumento
|
|
113
|
+
* @param cpfCnpj - CPF/CNPJ do devedor
|
|
114
|
+
* @returns Promise com resultado mockado
|
|
115
|
+
*/
|
|
116
|
+
export var mockDescobertaAutomaticaEmail = function (nmChave, cpfCnpj) { return __awaiter(void 0, void 0, void 0, function () {
|
|
117
|
+
var delay, success;
|
|
118
|
+
return __generator(this, function (_a) {
|
|
119
|
+
switch (_a.label) {
|
|
120
|
+
case 0:
|
|
121
|
+
delay = Math.random() * 1000 + 2000;
|
|
122
|
+
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, delay); })];
|
|
123
|
+
case 1:
|
|
124
|
+
_a.sent();
|
|
125
|
+
success = Math.random() > 0.15;
|
|
126
|
+
if (success) {
|
|
127
|
+
return [2 /*return*/, {
|
|
128
|
+
success: true,
|
|
129
|
+
message: 'O instrumento de protesto será processado e enviado para seu e-mail em breve. Você receberá uma notificação quando estiver disponível.',
|
|
130
|
+
jobId: "discovery-job-".concat(Date.now())
|
|
131
|
+
}];
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
return [2 /*return*/, {
|
|
135
|
+
success: false,
|
|
136
|
+
message: 'Não foi possível processar a descoberta automática do instrumento. Tente novamente mais tarde ou entre em contato com o suporte.'
|
|
137
|
+
}];
|
|
138
|
+
}
|
|
139
|
+
return [2 /*return*/];
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}); };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Client } from '@credithub/webservice';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
interface UseInstrumentoParams {
|
|
4
|
+
nmChave: string;
|
|
5
|
+
cpfCnpj?: string;
|
|
6
|
+
client?: Client.WebService;
|
|
7
|
+
}
|
|
8
|
+
interface UseInstrumentoReturn {
|
|
9
|
+
isModalSPOpen: boolean;
|
|
10
|
+
isEmailModalOpen: boolean;
|
|
11
|
+
emailMessage: ReactNode;
|
|
12
|
+
emailTitle: string;
|
|
13
|
+
isDescobrindo: boolean;
|
|
14
|
+
isEnviandoEmail: boolean;
|
|
15
|
+
isProcessandoDescoberta: boolean;
|
|
16
|
+
openModalSP: () => void;
|
|
17
|
+
closeModalSP: () => void;
|
|
18
|
+
handleDescobrir: (livro: string, folha: string) => Promise<void>;
|
|
19
|
+
handleEnviarEmail: (livro: string, folha: string) => Promise<void>;
|
|
20
|
+
handleDescobertaAutomatica: () => Promise<void>;
|
|
21
|
+
closeEmailModal: () => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Hook para gerenciar o fluxo de instrumento de protesto (fase mockada)
|
|
25
|
+
*
|
|
26
|
+
* Gerencia estados dos modais, handlers mockados e transições de estado.
|
|
27
|
+
* Na fase de integração real, os handlers mockados serão substituídos
|
|
28
|
+
* por chamadas ao InstrumentoService.
|
|
29
|
+
*/
|
|
30
|
+
export declare const useInstrumento: ({ nmChave, cpfCnpj, client }: UseInstrumentoParams) => UseInstrumentoReturn;
|
|
31
|
+
export {};
|