@credithub/harlan-components 1.111.2 → 1.112.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/instrumentoProtesto/ieptbInstrumento.d.ts +16 -0
- package/dist/adapters/instrumentoProtesto/ieptbInstrumento.js +72 -0
- package/dist/components/common/modalInstrumentoProtestoSP.d.ts +9 -0
- package/dist/components/common/modalInstrumentoProtestoSP.js +109 -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/useInstrumento.d.ts +29 -0
- package/dist/components/protestos/instrumento/useInstrumento.js +147 -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 +749 -395
- package/lib/esm/index.js +749 -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("INSERT INTO 'IEPTB'.'InstrumentoManualSendmail'", {
|
|
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("INSERT INTO 'IEPTB'.'InstrumentoDiscoverySendmail'", {
|
|
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,9 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface ModalInstrumentoProtestoSPProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onEnviarEmail?: (livro: string, folha: string) => void;
|
|
6
|
+
isEnviandoEmail?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const ModalInstrumentoProtestoSP: FC<ModalInstrumentoProtestoSPProps>;
|
|
9
|
+
export default ModalInstrumentoProtestoSP;
|
|
@@ -0,0 +1,109 @@
|
|
|
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, onEnviarEmail = _a.onEnviarEmail, _b = _a.isEnviandoEmail, isEnviandoEmail = _b === void 0 ? false : _b;
|
|
77
|
+
var _c = useState(''), livro = _c[0], setLivro = _c[1];
|
|
78
|
+
var _d = useState(''), folha = _d[0], setFolha = _d[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 = isEnviandoEmail;
|
|
89
|
+
var isFormDisabled = !isFormValid || isProcessing;
|
|
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 POR E-MAIL"),
|
|
92
|
+
React.createElement(GhostButton, { onClick: onClose, disabled: isProcessing }, "Cancelar")));
|
|
93
|
+
return (React.createElement(Modal, { isOpen: isOpen, onClose: onClose, title: "INSTRUMENTO DE PROTESTO - SP", footer: footerContent },
|
|
94
|
+
React.createElement(Wrapper, null,
|
|
95
|
+
React.createElement(Subtitle, null, "Utilize os dados constantes no cart\u00F3rio para localizar o instrumento de protesto correspondente."),
|
|
96
|
+
React.createElement(InputsRow, null,
|
|
97
|
+
React.createElement(InputContainer, null,
|
|
98
|
+
React.createElement(Label, { htmlFor: "livro" }, "Livro"),
|
|
99
|
+
React.createElement(StyledInput, { id: "livro", value: livro, onChange: function (e) { return setLivro(e.target.value); }, placeholder: "000", "$isValid": hasLivro, autoFocus: true, autoComplete: "off" }),
|
|
100
|
+
hasLivro && (React.createElement(IconWrapper, null,
|
|
101
|
+
React.createElement(CheckIcon, null)))),
|
|
102
|
+
React.createElement(InputContainer, null,
|
|
103
|
+
React.createElement(Label, { htmlFor: "folha" }, "Folha"),
|
|
104
|
+
React.createElement(StyledInput, { id: "folha", value: folha, onChange: function (e) { return setFolha(e.target.value); }, placeholder: "000", "$isValid": hasFolha, autoComplete: "off" }),
|
|
105
|
+
hasFolha && (React.createElement(IconWrapper, null,
|
|
106
|
+
React.createElement(CheckIcon, null))))))));
|
|
107
|
+
};
|
|
108
|
+
export default ModalInstrumentoProtestoSP;
|
|
109
|
+
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,29 @@
|
|
|
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
|
+
isEnviandoEmail: boolean;
|
|
14
|
+
isProcessandoDescoberta: boolean;
|
|
15
|
+
openModalSP: () => void;
|
|
16
|
+
closeModalSP: () => void;
|
|
17
|
+
handleEnviarEmail: (livro: string, folha: string) => Promise<void>;
|
|
18
|
+
handleDescobertaAutomatica: () => Promise<void>;
|
|
19
|
+
closeEmailModal: () => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Hook para gerenciar o fluxo de instrumento de protesto (fase mockada)
|
|
23
|
+
*
|
|
24
|
+
* Gerencia estados dos modais, handlers mockados e transições de estado.
|
|
25
|
+
* Na fase de integração real, os handlers mockados serão substituídos
|
|
26
|
+
* por chamadas ao InstrumentoService.
|
|
27
|
+
*/
|
|
28
|
+
export declare const useInstrumento: ({ nmChave, cpfCnpj, client }: UseInstrumentoParams) => UseInstrumentoReturn;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,147 @@
|
|
|
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
|
+
import { sendInstrumentoDiscoveryEmail, sendInstrumentoManualEmail } from '../../../adapters/instrumentoProtesto/ieptbInstrumento';
|
|
38
|
+
import { useCallback, useState } from 'react';
|
|
39
|
+
/**
|
|
40
|
+
* Hook para gerenciar o fluxo de instrumento de protesto (fase mockada)
|
|
41
|
+
*
|
|
42
|
+
* Gerencia estados dos modais, handlers mockados e transições de estado.
|
|
43
|
+
* Na fase de integração real, os handlers mockados serão substituídos
|
|
44
|
+
* por chamadas ao InstrumentoService.
|
|
45
|
+
*/
|
|
46
|
+
export var useInstrumento = function (_a) {
|
|
47
|
+
var nmChave = _a.nmChave, cpfCnpj = _a.cpfCnpj, client = _a.client;
|
|
48
|
+
var _b = useState(false), isModalSPOpen = _b[0], setIsModalSPOpen = _b[1];
|
|
49
|
+
var _c = useState(false), isEmailModalOpen = _c[0], setIsEmailModalOpen = _c[1];
|
|
50
|
+
var _d = useState(''), emailMessage = _d[0], setEmailMessage = _d[1];
|
|
51
|
+
var _e = useState('Instrumento de Protesto'), emailTitle = _e[0], setEmailTitle = _e[1];
|
|
52
|
+
var _f = useState(false), isEnviandoEmail = _f[0], setIsEnviandoEmail = _f[1];
|
|
53
|
+
var _g = useState(false), isProcessandoDescoberta = _g[0], setIsProcessandoDescoberta = _g[1];
|
|
54
|
+
var openModalSP = useCallback(function () {
|
|
55
|
+
setIsModalSPOpen(true);
|
|
56
|
+
}, []);
|
|
57
|
+
var closeModalSP = useCallback(function () {
|
|
58
|
+
setIsModalSPOpen(false);
|
|
59
|
+
}, []);
|
|
60
|
+
var closeEmailModal = useCallback(function () {
|
|
61
|
+
setIsEmailModalOpen(false);
|
|
62
|
+
setEmailMessage('');
|
|
63
|
+
setEmailTitle('Instrumento de Protesto');
|
|
64
|
+
}, []);
|
|
65
|
+
var handleEnviarEmail = useCallback(function (livro, folha) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
+
var res, error_1;
|
|
67
|
+
return __generator(this, function (_a) {
|
|
68
|
+
switch (_a.label) {
|
|
69
|
+
case 0:
|
|
70
|
+
setIsEnviandoEmail(true);
|
|
71
|
+
_a.label = 1;
|
|
72
|
+
case 1:
|
|
73
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
74
|
+
return [4 /*yield*/, sendInstrumentoManualEmail(client, {
|
|
75
|
+
documento: cpfCnpj,
|
|
76
|
+
nm_chave: nmChave,
|
|
77
|
+
livro: livro,
|
|
78
|
+
folha: folha
|
|
79
|
+
})];
|
|
80
|
+
case 2:
|
|
81
|
+
res = _a.sent();
|
|
82
|
+
setEmailTitle('Instrumento solicitado por e-mail');
|
|
83
|
+
setEmailMessage((res === null || res === void 0 ? void 0 : res.message) ||
|
|
84
|
+
'Ok! Vamos processar e enviar o instrumento para seu e-mail assim que estiver disponível.');
|
|
85
|
+
setIsEmailModalOpen(true);
|
|
86
|
+
setIsModalSPOpen(false);
|
|
87
|
+
return [3 /*break*/, 5];
|
|
88
|
+
case 3:
|
|
89
|
+
error_1 = _a.sent();
|
|
90
|
+
setEmailTitle('Erro ao Enviar E-mail');
|
|
91
|
+
setEmailMessage('Não foi possível solicitar o instrumento por e-mail agora. Tente novamente em instantes.');
|
|
92
|
+
setIsEmailModalOpen(true);
|
|
93
|
+
return [3 /*break*/, 5];
|
|
94
|
+
case 4:
|
|
95
|
+
setIsEnviandoEmail(false);
|
|
96
|
+
return [7 /*endfinally*/];
|
|
97
|
+
case 5: return [2 /*return*/];
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}); }, [client, cpfCnpj, nmChave]);
|
|
101
|
+
var handleDescobertaAutomatica = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
102
|
+
var res, error_2;
|
|
103
|
+
return __generator(this, function (_a) {
|
|
104
|
+
switch (_a.label) {
|
|
105
|
+
case 0:
|
|
106
|
+
setIsProcessandoDescoberta(true);
|
|
107
|
+
_a.label = 1;
|
|
108
|
+
case 1:
|
|
109
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
110
|
+
return [4 /*yield*/, sendInstrumentoDiscoveryEmail(client, {
|
|
111
|
+
documento: cpfCnpj,
|
|
112
|
+
nm_chave: nmChave
|
|
113
|
+
})];
|
|
114
|
+
case 2:
|
|
115
|
+
res = _a.sent();
|
|
116
|
+
setEmailTitle('Solicitação enviada');
|
|
117
|
+
setEmailMessage((res === null || res === void 0 ? void 0 : res.message) ||
|
|
118
|
+
'Pronto! Iniciamos o processamento e você receberá o instrumento por e-mail assim que estiver disponível.');
|
|
119
|
+
setIsEmailModalOpen(true);
|
|
120
|
+
return [3 /*break*/, 5];
|
|
121
|
+
case 3:
|
|
122
|
+
error_2 = _a.sent();
|
|
123
|
+
setEmailTitle('Erro na solicitação');
|
|
124
|
+
setEmailMessage('Não foi possível iniciar a solicitação por e-mail agora. Tente novamente em instantes.');
|
|
125
|
+
setIsEmailModalOpen(true);
|
|
126
|
+
return [3 /*break*/, 5];
|
|
127
|
+
case 4:
|
|
128
|
+
setIsProcessandoDescoberta(false);
|
|
129
|
+
return [7 /*endfinally*/];
|
|
130
|
+
case 5: return [2 /*return*/];
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}); }, [client, nmChave, cpfCnpj]);
|
|
134
|
+
return {
|
|
135
|
+
isModalSPOpen: isModalSPOpen,
|
|
136
|
+
isEmailModalOpen: isEmailModalOpen,
|
|
137
|
+
emailMessage: emailMessage,
|
|
138
|
+
emailTitle: emailTitle,
|
|
139
|
+
isEnviandoEmail: isEnviandoEmail,
|
|
140
|
+
isProcessandoDescoberta: isProcessandoDescoberta,
|
|
141
|
+
openModalSP: openModalSP,
|
|
142
|
+
closeModalSP: closeModalSP,
|
|
143
|
+
handleEnviarEmail: handleEnviarEmail,
|
|
144
|
+
handleDescobertaAutomatica: handleDescobertaAutomatica,
|
|
145
|
+
closeEmailModal: closeEmailModal
|
|
146
|
+
};
|
|
147
|
+
};
|