@credithub/harlan-components 1.11.3 → 1.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/adresses/addresses.js +1 -1
- package/lib/cjs/components/bank-accounts/bank-accounts.js +1 -1
- package/lib/cjs/components/ccf/ccf.js +1 -1
- package/lib/cjs/components/chart/customChart.js +1 -1
- package/lib/cjs/components/contacts/contacts.js +1 -1
- package/lib/cjs/components/contacts/thumbsButton.js +3 -3
- package/lib/cjs/components/interface/section.js +3 -2
- package/lib/cjs/components/interface/statusMessage.js +1 -1
- package/lib/cjs/components/partners/partners.js +1 -1
- package/lib/cjs/components/processos-juridicos/processosJuridicos.js +1 -1
- package/lib/cjs/components/protestos/protestos.js +19 -5
- package/lib/cjs/consultaSimples.js +6 -5
- package/lib/cjs/utils/string.d.ts +2 -0
- package/lib/cjs/utils/string.js +14 -1
- package/lib/esm/components/adresses/addresses.js +1 -1
- package/lib/esm/components/bank-accounts/bank-accounts.js +1 -1
- package/lib/esm/components/ccf/ccf.js +1 -1
- package/lib/esm/components/chart/customChart.js +1 -1
- package/lib/esm/components/contacts/contacts.js +1 -1
- package/lib/esm/components/contacts/thumbsButton.js +3 -3
- package/lib/esm/components/interface/section.js +3 -2
- package/lib/esm/components/interface/statusMessage.js +1 -1
- package/lib/esm/components/partners/partners.js +1 -1
- package/lib/esm/components/processos-juridicos/processosJuridicos.js +1 -1
- package/lib/esm/components/protestos/protestos.js +19 -5
- package/lib/esm/consultaSimples.js +6 -5
- package/lib/esm/utils/string.d.ts +2 -0
- package/lib/esm/utils/string.js +11 -0
- package/package.json +1 -1
|
@@ -75,6 +75,6 @@ var Addresses = function (_a) {
|
|
|
75
75
|
react_1.default.createElement("a", { href: '', hidden: true },
|
|
76
76
|
react_1.default.createElement(LazyMap, { address: address.address, apiKey: apiKey }))))); }))));
|
|
77
77
|
};
|
|
78
|
-
return (react_1.default.createElement(Section, { title: "Endere\u00E7os", subtitle: "
|
|
78
|
+
return (react_1.default.createElement(Section, { title: "Endere\u00E7os", subtitle: "Informa\u00E7\u00F5es de endere\u00E7os do documento pesquisado.", icon: endereco_1.default, minimized: false, ctx: ctx, onError: function () { return response(undefined); }, onSuccess: response }));
|
|
79
79
|
};
|
|
80
80
|
exports.default = Addresses;
|
|
@@ -15,7 +15,7 @@ var theme_1 = __importDefault(require("../interface/theme"));
|
|
|
15
15
|
var BankAccounts = function () {
|
|
16
16
|
var ctx = (0, react_2.useContext)(webservice_1.Queries.Finder);
|
|
17
17
|
var Section = ctx.Section;
|
|
18
|
-
return (react_1.default.createElement(Section, { title: "Informações de Contas Bancárias", subtitle: "Vejas as informações disponíveis de contas bancárias", icon: contasBancarias_1.default, ctx: ctx, minimized: false, onSuccess: function (data) {
|
|
18
|
+
return (react_1.default.createElement(Section, { title: "Informações de Contas Bancárias", subtitle: "Vejas as informações disponíveis de contas bancárias.", icon: contasBancarias_1.default, ctx: ctx, minimized: false, onSuccess: function (data) {
|
|
19
19
|
var accounts = xpath_1.default.selectArray("//bank-info/node", data);
|
|
20
20
|
var message = (accounts === null || accounts === void 0 ? void 0 : accounts.length) ? (accounts === null || accounts === void 0 ? void 0 : accounts.length) > 1 ? "Encontrada ".concat(accounts === null || accounts === void 0 ? void 0 : accounts.length, " contas banc\u00E1rias") : 'Encontrada 1 conta bancária' : 'Não foram encontradas ocorrências';
|
|
21
21
|
return {
|
|
@@ -43,7 +43,7 @@ var CCF = function () {
|
|
|
43
43
|
ultimaOcorrencia: xpath_1.default.select("string(./ultimo)", node),
|
|
44
44
|
motivo: xpath_1.default.select("string(./motivo)", node),
|
|
45
45
|
}); };
|
|
46
|
-
return (react_1.default.createElement(Section, { ctx: ctx, title: "Cheques
|
|
46
|
+
return (react_1.default.createElement(Section, { ctx: ctx, title: "Cheques sem Fundos em Institui\u00E7\u00E3o Banc\u00E1ria", subtitle: "Detalhes acerca de cheques sem fundos emitidos.", icon: chequesSemFundo_1.default, onSuccess: function (data) {
|
|
47
47
|
var allItems = xpath_1.default.selectArray("//list/*", data);
|
|
48
48
|
var filteredItems = allItems.filter(function (node) {
|
|
49
49
|
return node.nodeName.startsWith("item");
|
|
@@ -116,7 +116,7 @@ var ResumoDeNegativacoesChartSection = function (_a) {
|
|
|
116
116
|
return react_1.default.createElement(CustomChart, { dataInput: data });
|
|
117
117
|
};
|
|
118
118
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
119
|
-
react_1.default.createElement(header_1.default, { title: "Resumo de Negativa\u00E7\u00F5es", subtitle: "Veja a quantidade de ocorr\u00EAncias conforme o documento foi consultado ao longo do tempo", description: error && react_1.default.createElement(statusMessage_1.default, { type: "error" }, error.message), variant: isLoading ? 'loading' : 'default', actions: isLoading ? null : defaultHeaderActions }),
|
|
119
|
+
react_1.default.createElement(header_1.default, { title: "Resumo de Negativa\u00E7\u00F5es", subtitle: "Veja a quantidade de ocorr\u00EAncias conforme o documento foi consultado ao longo do tempo.", description: error && react_1.default.createElement(statusMessage_1.default, { type: "error" }, error.message), variant: isLoading ? 'loading' : 'default', actions: isLoading ? null : defaultHeaderActions }),
|
|
120
120
|
react_1.default.createElement(Content, { isOpen: isOpen }, !isLoading && (response === null || response === void 0 ? void 0 : response.document) && process(response === null || response === void 0 ? void 0 : response.document))));
|
|
121
121
|
};
|
|
122
122
|
exports.ResumoDeNegativacoesChartSection = ResumoDeNegativacoesChartSection;
|
|
@@ -53,7 +53,7 @@ var Contacts = function (_a) {
|
|
|
53
53
|
var onClickConsultarEmail = _a.onClickConsultarEmail;
|
|
54
54
|
var ctx = (0, react_1.useContext)(webservice_1.Queries.Finder);
|
|
55
55
|
var Section = ctx.Section;
|
|
56
|
-
return (react_1.default.createElement(Section, { ctx: ctx, title: "Contato", subtitle: "
|
|
56
|
+
return (react_1.default.createElement(Section, { ctx: ctx, title: "Contato", subtitle: "Informa\u00E7\u00F5es de contato do documento pesquisado.", description: "(Telefone, e-mail e outros)", minimized: false, icon: contato_1.default, onSuccess: function (data) {
|
|
57
57
|
var document = xpath_1.default.select('string(//cpf|//cnpj)', data);
|
|
58
58
|
var telefones = __spreadArray(__spreadArray([], (xpath_1.default.selectArray('//telefones/fixos/fixos', data) || []), true), (xpath_1.default.selectArray('//telefones/moveis/moveis', data) || []), true).map(function (telefone) { return ({ type: 'Telefone', value: (0, number_1.phoneMask)(xpath_1.default.select('string(./telefone)', telefone)) }); });
|
|
59
59
|
var emails = xpath_1.default.selectArray('//emails/emails', data).map(function (email) { return ({ type: 'Email', value: xpath_1.default.select('string(./email)', email) }); });
|
|
@@ -12,8 +12,8 @@ var thumbUp_1 = __importDefault(require("../../assets/btn/thumbUp"));
|
|
|
12
12
|
var react_1 = __importDefault(require("react"));
|
|
13
13
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
14
14
|
var theme_1 = __importDefault(require("../interface/theme"));
|
|
15
|
-
var ButtonContainer = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n background-color: ", ";\n border-radius: 10px;\n overflow: hidden;\n position: relative;\n font-size: 10px;\n width:
|
|
16
|
-
var Button = styled_components_1.default.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n padding:
|
|
15
|
+
var ButtonContainer = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-flex;\n background-color: ", ";\n border-radius: 10px;\n overflow: hidden;\n position: relative;\n font-size: 10px;\n width: fit-content;\n"], ["\n display: inline-flex;\n background-color: ", ";\n border-radius: 10px;\n overflow: hidden;\n position: relative;\n font-size: 10px;\n width: fit-content;\n"])), theme_1.default.colors.cinzaClaro);
|
|
16
|
+
var Button = styled_components_1.default.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 6px 8px;\n line-height: 8px;\n cursor: pointer !important;\n border: none;\n background-color: ", ";\n color: white;\n flex: none;\n width: 50%;\n margin: 0 auto;\n\n /* &:hover {\n background-color: ", ";\n } */\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 6px 8px;\n line-height: 8px;\n cursor: pointer !important;\n border: none;\n background-color: ", ";\n color: white;\n flex: none;\n width: 50%;\n margin: 0 auto;\n\n /* &:hover {\n background-color: ", ";\n } */\n"])), function (props) {
|
|
17
17
|
return props.isSelected
|
|
18
18
|
? props.action === "like"
|
|
19
19
|
? "#007aff"
|
|
@@ -28,7 +28,7 @@ var Button = styled_components_1.default.button(templateObject_2 || (templateObj
|
|
|
28
28
|
});
|
|
29
29
|
var IconWrapper = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n margin-right: 5px;\n"], ["\n margin-right: 5px;\n"])));
|
|
30
30
|
var Count = styled_components_1.default.span(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n line-height: 1;\n display: flex;\n align-items: center;\n margin-right: ", ";\n"], ["\n line-height: 1;\n display: flex;\n align-items: center;\n margin-right: ", ";\n"])), function (props) { return (props.action === "dislike" ? "5px" : "0"); });
|
|
31
|
-
var Separator = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n content: \"\";\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n height: calc(100% - 6px);\n width: 1px;\n background-color: ", ";\n z-index: 1;\n"], ["\n content: \"\";\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n height: calc(100% - 6px);\n width: 1px;\n background-color: ", ";\n z-index: 1;\n"])), theme_1.default.colors.cinzaEscuro);
|
|
31
|
+
var Separator = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n content: \"\";\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n height: calc(100% - 6px);\n width: 1px;\n background-color: ", ";\n opacity: 0.1;\n z-index: 1;\n"], ["\n content: \"\";\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n height: calc(100% - 6px);\n width: 1px;\n background-color: ", ";\n opacity: 0.1;\n z-index: 1;\n"])), theme_1.default.colors.cinzaEscuro);
|
|
32
32
|
var ThumbsButton = function (_a) {
|
|
33
33
|
var _b = _a.likes, likes = _b === void 0 ? 0 : _b, _c = _a.dislikes, dislikes = _c === void 0 ? 0 : _c, onClickLike = _a.onClickLike, onClickDislike = _a.onClickDislike;
|
|
34
34
|
return (react_1.default.createElement(ButtonContainer, null,
|
|
@@ -38,7 +38,7 @@ var chevronUp_1 = __importDefault(require("../../assets/btn/chevronUp"));
|
|
|
38
38
|
var closeIcon_1 = __importDefault(require("../../assets/btn/closeIcon"));
|
|
39
39
|
var btnWrapper_1 = __importDefault(require("../../assets/btn/btnWrapper"));
|
|
40
40
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
41
|
-
var ResultContainer = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n margin-top: 20px;\n flex-direction: column;\n row-gap: 20px;\n"], ["\n display: ", ";\n margin-top: 20px;\n flex-direction: column;\n row-gap: 20px;\n"])), function (props) { return props.hide ? 'none' : 'flex'; });
|
|
41
|
+
var ResultContainer = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n position: relative;\n margin-top: 20px;\n flex-direction: column;\n row-gap: 20px;\n"], ["\n display: ", ";\n position: relative;\n margin-top: 20px;\n flex-direction: column;\n row-gap: 20px;\n"])), function (props) { return props.hide ? 'none' : 'flex'; });
|
|
42
42
|
var Section = function (_a) {
|
|
43
43
|
var title = _a.title, subtitle = _a.subtitle, description = _a.description, _b = _a.minimized, minimized = _b === void 0 ? false : _b, onClose = _a.onClose, variant = _a.variant, loadingProps = _a.loadingProps, icon = _a.icon, actions = _a.actions, children = _a.children, className = _a.className, contentClassName = _a.contentClassName, props = __rest(_a, ["title", "subtitle", "description", "minimized", "onClose", "variant", "loadingProps", "icon", "actions", "children", "className", "contentClassName"]);
|
|
44
44
|
var _c = (0, useToggle_1.default)(!minimized), isOpen = _c[0], toggleOpen = _c[1];
|
|
@@ -46,7 +46,8 @@ var Section = function (_a) {
|
|
|
46
46
|
var sectionContentClass = (0, classnames_1.default)(contentClassName);
|
|
47
47
|
return (react_1.default.createElement("section", __assign({ className: sectionClass }, props),
|
|
48
48
|
react_1.default.createElement(header_1.default, { title: title, subtitle: subtitle, description: description, loadingProps: loadingProps, icon: icon, variant: variant, actions: react_1.default.createElement(react_1.default.Fragment, null,
|
|
49
|
-
|
|
49
|
+
children &&
|
|
50
|
+
react_1.default.createElement(btnWrapper_1.default, { hidden: variant === 'loading', onClick: toggleOpen }, isOpen ? react_1.default.createElement(chevronUp_1.default, null) : react_1.default.createElement(chevronDown_1.default, null)),
|
|
50
51
|
onClose && (react_1.default.createElement(btnWrapper_1.default, { onClick: onClose },
|
|
51
52
|
react_1.default.createElement(closeIcon_1.default, null))),
|
|
52
53
|
actions) }),
|
|
@@ -15,7 +15,7 @@ var statusColors = {
|
|
|
15
15
|
success: theme_1.default.colors.positivoClaro,
|
|
16
16
|
found: theme_1.default.colors.azulClaro
|
|
17
17
|
};
|
|
18
|
-
var StatusMessage = styled_components_1.default.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 7px 19px;\n gap: 10px;\n background: ", ";\n border-radius: 50px;\n ", "\n\n"], ["\n padding: 7px 19px;\n gap: 10px;\n background: ", ";\n border-radius: 50px;\n ", "\n\n"])), function (_a) {
|
|
18
|
+
var StatusMessage = styled_components_1.default.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 7px 19px;\n gap: 10px;\n background: ", ";\n border-radius: 50px;\n ", "\n\n & + & {\n margin-left: 10px;\n }\n\n"], ["\n padding: 7px 19px;\n gap: 10px;\n background: ", ";\n border-radius: 50px;\n ", "\n\n & + & {\n margin-left: 10px;\n }\n\n"])), function (_a) {
|
|
19
19
|
var _b = _a.type, type = _b === void 0 ? 'default' : _b;
|
|
20
20
|
return statusColors[type];
|
|
21
21
|
}, function (_a) {
|
|
@@ -72,6 +72,6 @@ var Partners = function () {
|
|
|
72
72
|
description: !(partners === null || partners === void 0 ? void 0 : partners.length) && react_1.default.createElement(statusMessage_1.default, null, "N\u00E3o h\u00E1 informa\u00E7\u00F5es de Quadro Societ\u00E1rio")
|
|
73
73
|
};
|
|
74
74
|
};
|
|
75
|
-
return (react_1.default.createElement(Section, { ctx: ctx, title: "Quadro Societ\u00E1rio", minimized: false, subtitle: "
|
|
75
|
+
return (react_1.default.createElement(Section, { ctx: ctx, title: "Quadro Societ\u00E1rio", minimized: false, subtitle: "Informa\u00E7\u00F5es sobre o quadro societ\u00E1rio da pessoa pesquisada.", icon: quadroSocietario_1.default, isError: function () { return response(undefined); }, onSuccess: response }));
|
|
76
76
|
};
|
|
77
77
|
exports.default = Partners;
|
|
@@ -36,7 +36,7 @@ var ProcessosJuridicos = function (_a) {
|
|
|
36
36
|
var onClickConsultarProcessoJuridico = _a.onClickConsultarProcessoJuridico;
|
|
37
37
|
var ctx = (0, react_1.useContext)(webservice_1.Queries.ProcessosJuridicos);
|
|
38
38
|
var Section = ctx.Section;
|
|
39
|
-
return (react_1.default.createElement(Section, { ctx: ctx, title: "Processos Jur\u00EDdicos", subtitle: "Veja os
|
|
39
|
+
return (react_1.default.createElement(Section, { ctx: ctx, title: "Processos Jur\u00EDdicos", subtitle: "Veja os processos jur\u00EDdicos para este documento.", icon: processosJuridicos_1.default, onSuccess: function (data) {
|
|
40
40
|
var _a, _b, _c, _d, _e;
|
|
41
41
|
if (!((_a = data === null || data === void 0 ? void 0 : data.empresa) === null || _a === void 0 ? void 0 : _a.length))
|
|
42
42
|
return (react_1.default.createElement(resultWithoutInformation_1.default, { value: "N\u00E3o foram econtrados processos jur\u00EDdicos para o documento pesquisado." }));
|
|
@@ -52,7 +52,7 @@ var Protestos = function () {
|
|
|
52
52
|
return regex.test(xpath_1.default.select("string(./nomeCedente)", protesto));
|
|
53
53
|
});
|
|
54
54
|
};
|
|
55
|
-
return (react_1.default.createElement(Section, { ctx: ctx, title: "Protestos", subtitle: "Consulta de
|
|
55
|
+
return (react_1.default.createElement(Section, { ctx: ctx, title: "Apontamentos na Central de Protestos (CENPROT)", subtitle: "Consulta de protestos de cr\u00E9dito, imposto e gerais.", icon: protestos_1.default, onSuccess: function (data) {
|
|
56
56
|
var registros = xpath_1.default.select("number(//registros)", data);
|
|
57
57
|
var protestosDeCredito = filterProtestos(regex_1.REGEX_PROTESTOS_DE_CREDITO, data);
|
|
58
58
|
var protestosDeImposto = filterProtestos(regex_1.REGEX_PROTESTOS_DE_IMPOSTO, data);
|
|
@@ -61,10 +61,24 @@ var Protestos = function () {
|
|
|
61
61
|
return (!regex_1.REGEX_PROTESTOS_DE_IMPOSTO.test(nomeCedente) &&
|
|
62
62
|
!regex_1.REGEX_PROTESTOS_DE_CREDITO.test(nomeCedente));
|
|
63
63
|
});
|
|
64
|
-
var
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
var elements = [
|
|
65
|
+
{
|
|
66
|
+
total: protestosDeCredito === null || protestosDeCredito === void 0 ? void 0 : protestosDeCredito.length,
|
|
67
|
+
element: react_1.default.createElement(protestosCategory_1.default, { title: "Protestos de Cr\u00E9dito", subtitle: "Protestos de cr\u00E9dito em geral.", registros: protestosDeCredito === null || protestosDeCredito === void 0 ? void 0 : protestosDeCredito.length, icon: protestosCredito_1.default }, protestosDeCredito.map(function (protesto, i) { return (react_1.default.createElement(protestosList_1.ProtestoItem, { protesto: protesto, key: i })); }))
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
total: protestosDeImposto === null || protestosDeImposto === void 0 ? void 0 : protestosDeImposto.length,
|
|
71
|
+
element: react_1.default.createElement(protestosCategory_1.default, { title: "Protestos de Imposto", subtitle: "Protestos de impostos federais, estaduais e municipais.", registros: protestosDeImposto === null || protestosDeImposto === void 0 ? void 0 : protestosDeImposto.length, icon: protestosImpostos_1.default }, protestosDeImposto.map(function (protestoElement, index) { return (react_1.default.createElement(protestosList_1.ProtestoItem, { protesto: protestoElement, key: index })); }))
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
total: protestosGerais === null || protestosGerais === void 0 ? void 0 : protestosGerais.length,
|
|
75
|
+
element: react_1.default.createElement(protestosCategory_1.default, { title: "Protestos Gerais", subtitle: "Protestos de outros tipos.", registros: protestosGerais === null || protestosGerais === void 0 ? void 0 : protestosGerais.length, icon: protestosGerais_1.default }, protestosGerais.map(function (protestoElement, index) { return (react_1.default.createElement(protestosList_1.ProtestoItem, { protesto: protestoElement, key: index })); }))
|
|
76
|
+
}
|
|
77
|
+
].sort(function (a, b) { return b.total - a.total; });
|
|
78
|
+
var children = registros ? (react_1.default.createElement(ResultProtestos, null, elements.map(function (_a) {
|
|
79
|
+
var element = _a.element;
|
|
80
|
+
return element;
|
|
81
|
+
}))) : null;
|
|
68
82
|
return {
|
|
69
83
|
children: children,
|
|
70
84
|
variant: registros ? 'error' : 'default',
|
|
@@ -62,8 +62,8 @@ var globalStyle_1 = __importDefault(require("./components/interface/globalStyle"
|
|
|
62
62
|
var consultaSimples_1 = __importDefault(require("./assets/icones/consultaSimples"));
|
|
63
63
|
var statusMessage_1 = __importDefault(require("./components/interface/statusMessage"));
|
|
64
64
|
var consultaRfb_1 = require("./components/consultaRfb");
|
|
65
|
-
var resultado_da_pesquisa_1 = __importDefault(require("./components/resultadoDaPesquisa/resultado-da-pesquisa"));
|
|
66
65
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
66
|
+
var string_1 = require("./utils/string");
|
|
67
67
|
var Wrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 20px;\n"], ["\n display: flex;\n flex-direction: column;\n gap: 20px;\n"])));
|
|
68
68
|
var ConsultaSimples = function (_a) {
|
|
69
69
|
var _documento = _a.documento, onClickConsultarProcessoJuridico = _a.onClickConsultarProcessoJuridico, apiKey = _a.apiKey, onClose = _a.onClose, hasCredits = _a.hasCredits;
|
|
@@ -77,8 +77,7 @@ var ConsultaSimples = function (_a) {
|
|
|
77
77
|
react_1.default.createElement(_1.Queries.Protestos.Request, { data: { documento: documento } },
|
|
78
78
|
react_1.default.createElement(_1.Queries.ProcessosJuridicos.Request, { data: { documento: documento } },
|
|
79
79
|
react_1.default.createElement(Wrapper, null,
|
|
80
|
-
react_1.default.createElement(
|
|
81
|
-
react_1.default.createElement(ConsultaSimplesSection, { onClose: onClose },
|
|
80
|
+
react_1.default.createElement(ConsultaSimplesSection, { documento: documento, onClose: onClose },
|
|
82
81
|
react_1.default.createElement(consultaRfb_1.ConsultaRfbProvider, { documento: documento },
|
|
83
82
|
react_1.default.createElement(_1.Dossie, { documento: documento, onOpenNewTransactionModal: console.log }),
|
|
84
83
|
react_1.default.createElement(_1.Addresses, { apiKey: apiKey }),
|
|
@@ -98,12 +97,14 @@ var ConsultaSimples = function (_a) {
|
|
|
98
97
|
react_1.default.createElement(_1.ProcessosJuridicos, { onClickConsultarProcessoJuridico: onClickConsultarProcessoJuridico })))))))))));
|
|
99
98
|
};
|
|
100
99
|
var ConsultaSimplesSection = function (_a) {
|
|
101
|
-
var children = _a.children, onClose = _a.onClose, rest = __rest(_a, ["children", "onClose"]);
|
|
100
|
+
var documento = _a.documento, children = _a.children, onClose = _a.onClose, rest = __rest(_a, ["documento", "children", "onClose"]);
|
|
102
101
|
var ctx = (0, react_1.useContext)(_1.Queries.Finder);
|
|
103
102
|
var isSuccess = (ctx === null || ctx === void 0 ? void 0 : ctx.type) === _1.RequestStatus.Success;
|
|
104
103
|
var isError = (ctx === null || ctx === void 0 ? void 0 : ctx.type) === _1.RequestStatus.Error;
|
|
105
104
|
var isLoading = (ctx === null || ctx === void 0 ? void 0 : ctx.type) === _1.RequestStatus.Loading;
|
|
106
|
-
return (react_1.default.createElement(_1.Section, __assign({ title: "Consulta Simples", subtitle: "
|
|
105
|
+
return (react_1.default.createElement(_1.Section, __assign({ title: "Consulta Simples", subtitle: "Consulta de informa\u00E7\u00F5es do documento.", description: react_1.default.createElement(react_1.default.Fragment, null,
|
|
106
|
+
react_1.default.createElement(statusMessage_1.default, { type: "found" }, (0, string_1.formatDocument)(documento)),
|
|
107
|
+
react_1.default.createElement(statusMessage_1.default, { type: isSuccess ? 'success' : 'error' }, isSuccess ? "Registro encontrado" : isError && (ctx === null || ctx === void 0 ? void 0 : ctx.error.message))), onClose: onClose, icon: consultaSimples_1.default, variant: isLoading ? 'loading' : 'default' }, rest), children));
|
|
107
108
|
};
|
|
108
109
|
exports.default = ConsultaSimples;
|
|
109
110
|
var templateObject_1;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare function formatCpf(cpf: string): string;
|
|
2
2
|
export declare function formatCnpj(cnpj: string): string;
|
|
3
|
+
export declare function formatDocument(documento: string): string;
|
|
4
|
+
export declare function isCpf(documento: string): boolean;
|
|
3
5
|
export declare function isCnpj(documento: string): boolean;
|
|
4
6
|
export declare const isDocumentoPF: (documento: string) => boolean;
|
|
5
7
|
export declare function formatDatePtBrToDate(date: string): Date;
|
package/lib/cjs/utils/string.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addNoValueContent = exports.capitalize = exports.formatDatePtBrToDate = exports.isDocumentoPF = exports.isCnpj = exports.formatCnpj = exports.formatCpf = void 0;
|
|
3
|
+
exports.addNoValueContent = exports.capitalize = exports.formatDatePtBrToDate = exports.isDocumentoPF = exports.isCnpj = exports.isCpf = exports.formatDocument = exports.formatCnpj = exports.formatCpf = void 0;
|
|
4
4
|
function formatCpf(cpf) {
|
|
5
5
|
cpf = cpf.replace(/[^0-9]/g, "");
|
|
6
6
|
if (cpf.length !== 11)
|
|
@@ -15,6 +15,19 @@ function formatCnpj(cnpj) {
|
|
|
15
15
|
return "".concat(cnpj.slice(0, 2), ".").concat(cnpj.slice(2, 5), ".").concat(cnpj.slice(5, 8), "/").concat(cnpj.slice(8, 12), "-").concat(cnpj.slice(12));
|
|
16
16
|
}
|
|
17
17
|
exports.formatCnpj = formatCnpj;
|
|
18
|
+
function formatDocument(documento) {
|
|
19
|
+
if (isCpf(documento))
|
|
20
|
+
return formatCpf(documento);
|
|
21
|
+
if (isCnpj(documento))
|
|
22
|
+
return formatCnpj(documento);
|
|
23
|
+
return documento;
|
|
24
|
+
}
|
|
25
|
+
exports.formatDocument = formatDocument;
|
|
26
|
+
function isCpf(documento) {
|
|
27
|
+
documento = documento.replace(/[^0-9]/g, "");
|
|
28
|
+
return documento.length === 11;
|
|
29
|
+
}
|
|
30
|
+
exports.isCpf = isCpf;
|
|
18
31
|
function isCnpj(documento) {
|
|
19
32
|
documento = documento.replace(/[^0-9]/g, "");
|
|
20
33
|
return documento.length === 14;
|
|
@@ -47,6 +47,6 @@ var Addresses = function (_a) {
|
|
|
47
47
|
React.createElement("a", { href: '', hidden: true },
|
|
48
48
|
React.createElement(LazyMap, { address: address.address, apiKey: apiKey }))))); }))));
|
|
49
49
|
};
|
|
50
|
-
return (React.createElement(Section, { title: "Endere\u00E7os", subtitle: "
|
|
50
|
+
return (React.createElement(Section, { title: "Endere\u00E7os", subtitle: "Informa\u00E7\u00F5es de endere\u00E7os do documento pesquisado.", icon: EnderecoIcon, minimized: false, ctx: ctx, onError: function () { return response(undefined); }, onSuccess: response }));
|
|
51
51
|
};
|
|
52
52
|
export default Addresses;
|
|
@@ -10,7 +10,7 @@ import theme from "../interface/theme";
|
|
|
10
10
|
var BankAccounts = function () {
|
|
11
11
|
var ctx = useContext(Queries.Finder);
|
|
12
12
|
var Section = ctx.Section;
|
|
13
|
-
return (React.createElement(Section, { title: "Informações de Contas Bancárias", subtitle: "Vejas as informações disponíveis de contas bancárias", icon: ContasBancariasIcon, ctx: ctx, minimized: false, onSuccess: function (data) {
|
|
13
|
+
return (React.createElement(Section, { title: "Informações de Contas Bancárias", subtitle: "Vejas as informações disponíveis de contas bancárias.", icon: ContasBancariasIcon, ctx: ctx, minimized: false, onSuccess: function (data) {
|
|
14
14
|
var accounts = XPathUtils.selectArray("//bank-info/node", data);
|
|
15
15
|
var message = (accounts === null || accounts === void 0 ? void 0 : accounts.length) ? (accounts === null || accounts === void 0 ? void 0 : accounts.length) > 1 ? "Encontrada ".concat(accounts === null || accounts === void 0 ? void 0 : accounts.length, " contas banc\u00E1rias") : 'Encontrada 1 conta bancária' : 'Não foram encontradas ocorrências';
|
|
16
16
|
return {
|
|
@@ -15,7 +15,7 @@ var CCF = function () {
|
|
|
15
15
|
ultimaOcorrencia: XPathUtils.select("string(./ultimo)", node),
|
|
16
16
|
motivo: XPathUtils.select("string(./motivo)", node),
|
|
17
17
|
}); };
|
|
18
|
-
return (React.createElement(Section, { ctx: ctx, title: "Cheques
|
|
18
|
+
return (React.createElement(Section, { ctx: ctx, title: "Cheques sem Fundos em Institui\u00E7\u00E3o Banc\u00E1ria", subtitle: "Detalhes acerca de cheques sem fundos emitidos.", icon: ChequesSemFundoIcon, onSuccess: function (data) {
|
|
19
19
|
var allItems = XPathUtils.selectArray("//list/*", data);
|
|
20
20
|
var filteredItems = allItems.filter(function (node) {
|
|
21
21
|
return node.nodeName.startsWith("item");
|
|
@@ -87,7 +87,7 @@ export var ResumoDeNegativacoesChartSection = function (_a) {
|
|
|
87
87
|
return React.createElement(CustomChart, { dataInput: data });
|
|
88
88
|
};
|
|
89
89
|
return (React.createElement(React.Fragment, null,
|
|
90
|
-
React.createElement(Header, { title: "Resumo de Negativa\u00E7\u00F5es", subtitle: "Veja a quantidade de ocorr\u00EAncias conforme o documento foi consultado ao longo do tempo", description: error && React.createElement(StatusMessage, { type: "error" }, error.message), variant: isLoading ? 'loading' : 'default', actions: isLoading ? null : defaultHeaderActions }),
|
|
90
|
+
React.createElement(Header, { title: "Resumo de Negativa\u00E7\u00F5es", subtitle: "Veja a quantidade de ocorr\u00EAncias conforme o documento foi consultado ao longo do tempo.", description: error && React.createElement(StatusMessage, { type: "error" }, error.message), variant: isLoading ? 'loading' : 'default', actions: isLoading ? null : defaultHeaderActions }),
|
|
91
91
|
React.createElement(Content, { isOpen: isOpen }, !isLoading && (response === null || response === void 0 ? void 0 : response.document) && process(response === null || response === void 0 ? void 0 : response.document))));
|
|
92
92
|
};
|
|
93
93
|
var ChartWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: 18px 30px;\n background-color: ", ";\n"], ["\n padding: 18px 30px;\n background-color: ", ";\n"])), theme.colors.white);
|
|
@@ -24,7 +24,7 @@ var Contacts = function (_a) {
|
|
|
24
24
|
var onClickConsultarEmail = _a.onClickConsultarEmail;
|
|
25
25
|
var ctx = useContext(Queries.Finder);
|
|
26
26
|
var Section = ctx.Section;
|
|
27
|
-
return (React.createElement(Section, { ctx: ctx, title: "Contato", subtitle: "
|
|
27
|
+
return (React.createElement(Section, { ctx: ctx, title: "Contato", subtitle: "Informa\u00E7\u00F5es de contato do documento pesquisado.", description: "(Telefone, e-mail e outros)", minimized: false, icon: ContatoIcon, onSuccess: function (data) {
|
|
28
28
|
var document = XPathUtils.select('string(//cpf|//cnpj)', data);
|
|
29
29
|
var telefones = __spreadArray(__spreadArray([], (XPathUtils.selectArray('//telefones/fixos/fixos', data) || []), true), (XPathUtils.selectArray('//telefones/moveis/moveis', data) || []), true).map(function (telefone) { return ({ type: 'Telefone', value: phoneMask(XPathUtils.select('string(./telefone)', telefone)) }); });
|
|
30
30
|
var emails = XPathUtils.selectArray('//emails/emails', data).map(function (email) { return ({ type: 'Email', value: XPathUtils.select('string(./email)', email) }); });
|
|
@@ -7,8 +7,8 @@ import ThumbUp from "../../assets/btn/thumbUp";
|
|
|
7
7
|
import React from "react";
|
|
8
8
|
import styled from "styled-components";
|
|
9
9
|
import theme from "../interface/theme";
|
|
10
|
-
var ButtonContainer = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n background-color: ", ";\n border-radius: 10px;\n overflow: hidden;\n position: relative;\n font-size: 10px;\n width:
|
|
11
|
-
var Button = styled.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n padding:
|
|
10
|
+
var ButtonContainer = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-flex;\n background-color: ", ";\n border-radius: 10px;\n overflow: hidden;\n position: relative;\n font-size: 10px;\n width: fit-content;\n"], ["\n display: inline-flex;\n background-color: ", ";\n border-radius: 10px;\n overflow: hidden;\n position: relative;\n font-size: 10px;\n width: fit-content;\n"])), theme.colors.cinzaClaro);
|
|
11
|
+
var Button = styled.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 6px 8px;\n line-height: 8px;\n cursor: pointer !important;\n border: none;\n background-color: ", ";\n color: white;\n flex: none;\n width: 50%;\n margin: 0 auto;\n\n /* &:hover {\n background-color: ", ";\n } */\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 6px 8px;\n line-height: 8px;\n cursor: pointer !important;\n border: none;\n background-color: ", ";\n color: white;\n flex: none;\n width: 50%;\n margin: 0 auto;\n\n /* &:hover {\n background-color: ", ";\n } */\n"])), function (props) {
|
|
12
12
|
return props.isSelected
|
|
13
13
|
? props.action === "like"
|
|
14
14
|
? "#007aff"
|
|
@@ -23,7 +23,7 @@ var Button = styled.button(templateObject_2 || (templateObject_2 = __makeTemplat
|
|
|
23
23
|
});
|
|
24
24
|
var IconWrapper = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n margin-right: 5px;\n"], ["\n margin-right: 5px;\n"])));
|
|
25
25
|
var Count = styled.span(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n line-height: 1;\n display: flex;\n align-items: center;\n margin-right: ", ";\n"], ["\n line-height: 1;\n display: flex;\n align-items: center;\n margin-right: ", ";\n"])), function (props) { return (props.action === "dislike" ? "5px" : "0"); });
|
|
26
|
-
var Separator = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n content: \"\";\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n height: calc(100% - 6px);\n width: 1px;\n background-color: ", ";\n z-index: 1;\n"], ["\n content: \"\";\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n height: calc(100% - 6px);\n width: 1px;\n background-color: ", ";\n z-index: 1;\n"])), theme.colors.cinzaEscuro);
|
|
26
|
+
var Separator = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n content: \"\";\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n height: calc(100% - 6px);\n width: 1px;\n background-color: ", ";\n opacity: 0.1;\n z-index: 1;\n"], ["\n content: \"\";\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n height: calc(100% - 6px);\n width: 1px;\n background-color: ", ";\n opacity: 0.1;\n z-index: 1;\n"])), theme.colors.cinzaEscuro);
|
|
27
27
|
var ThumbsButton = function (_a) {
|
|
28
28
|
var _b = _a.likes, likes = _b === void 0 ? 0 : _b, _c = _a.dislikes, dislikes = _c === void 0 ? 0 : _c, onClickLike = _a.onClickLike, onClickDislike = _a.onClickDislike;
|
|
29
29
|
return (React.createElement(ButtonContainer, null,
|
|
@@ -33,7 +33,7 @@ import ChevronUp from "../../assets/btn/chevronUp";
|
|
|
33
33
|
import CloseIcon from "../../assets/btn/closeIcon";
|
|
34
34
|
import BtnWrapper from "../../assets/btn/btnWrapper";
|
|
35
35
|
import styled from "styled-components";
|
|
36
|
-
var ResultContainer = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n margin-top: 20px;\n flex-direction: column;\n row-gap: 20px;\n"], ["\n display: ", ";\n margin-top: 20px;\n flex-direction: column;\n row-gap: 20px;\n"])), function (props) { return props.hide ? 'none' : 'flex'; });
|
|
36
|
+
var ResultContainer = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n position: relative;\n margin-top: 20px;\n flex-direction: column;\n row-gap: 20px;\n"], ["\n display: ", ";\n position: relative;\n margin-top: 20px;\n flex-direction: column;\n row-gap: 20px;\n"])), function (props) { return props.hide ? 'none' : 'flex'; });
|
|
37
37
|
var Section = function (_a) {
|
|
38
38
|
var title = _a.title, subtitle = _a.subtitle, description = _a.description, _b = _a.minimized, minimized = _b === void 0 ? false : _b, onClose = _a.onClose, variant = _a.variant, loadingProps = _a.loadingProps, icon = _a.icon, actions = _a.actions, children = _a.children, className = _a.className, contentClassName = _a.contentClassName, props = __rest(_a, ["title", "subtitle", "description", "minimized", "onClose", "variant", "loadingProps", "icon", "actions", "children", "className", "contentClassName"]);
|
|
39
39
|
var _c = useToggle(!minimized), isOpen = _c[0], toggleOpen = _c[1];
|
|
@@ -41,7 +41,8 @@ var Section = function (_a) {
|
|
|
41
41
|
var sectionContentClass = classNames(contentClassName);
|
|
42
42
|
return (React.createElement("section", __assign({ className: sectionClass }, props),
|
|
43
43
|
React.createElement(Header, { title: title, subtitle: subtitle, description: description, loadingProps: loadingProps, icon: icon, variant: variant, actions: React.createElement(React.Fragment, null,
|
|
44
|
-
|
|
44
|
+
children &&
|
|
45
|
+
React.createElement(BtnWrapper, { hidden: variant === 'loading', onClick: toggleOpen }, isOpen ? React.createElement(ChevronUp, null) : React.createElement(ChevronDown, null)),
|
|
45
46
|
onClose && (React.createElement(BtnWrapper, { onClick: onClose },
|
|
46
47
|
React.createElement(CloseIcon, null))),
|
|
47
48
|
actions) }),
|
|
@@ -10,7 +10,7 @@ var statusColors = {
|
|
|
10
10
|
success: theme.colors.positivoClaro,
|
|
11
11
|
found: theme.colors.azulClaro
|
|
12
12
|
};
|
|
13
|
-
var StatusMessage = styled.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 7px 19px;\n gap: 10px;\n background: ", ";\n border-radius: 50px;\n ", "\n\n"], ["\n padding: 7px 19px;\n gap: 10px;\n background: ", ";\n border-radius: 50px;\n ", "\n\n"])), function (_a) {
|
|
13
|
+
var StatusMessage = styled.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 7px 19px;\n gap: 10px;\n background: ", ";\n border-radius: 50px;\n ", "\n\n & + & {\n margin-left: 10px;\n }\n\n"], ["\n padding: 7px 19px;\n gap: 10px;\n background: ", ";\n border-radius: 50px;\n ", "\n\n & + & {\n margin-left: 10px;\n }\n\n"])), function (_a) {
|
|
14
14
|
var _b = _a.type, type = _b === void 0 ? 'default' : _b;
|
|
15
15
|
return statusColors[type];
|
|
16
16
|
}, function (_a) {
|
|
@@ -44,6 +44,6 @@ var Partners = function () {
|
|
|
44
44
|
description: !(partners === null || partners === void 0 ? void 0 : partners.length) && React.createElement(StatusMessage, null, "N\u00E3o h\u00E1 informa\u00E7\u00F5es de Quadro Societ\u00E1rio")
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
|
-
return (React.createElement(Section, { ctx: ctx, title: "Quadro Societ\u00E1rio", minimized: false, subtitle: "
|
|
47
|
+
return (React.createElement(Section, { ctx: ctx, title: "Quadro Societ\u00E1rio", minimized: false, subtitle: "Informa\u00E7\u00F5es sobre o quadro societ\u00E1rio da pessoa pesquisada.", icon: QuadroSocietarioIcon, isError: function () { return response(undefined); }, onSuccess: response }));
|
|
48
48
|
};
|
|
49
49
|
export default Partners;
|
|
@@ -8,7 +8,7 @@ var ProcessosJuridicos = function (_a) {
|
|
|
8
8
|
var onClickConsultarProcessoJuridico = _a.onClickConsultarProcessoJuridico;
|
|
9
9
|
var ctx = useContext(Queries.ProcessosJuridicos);
|
|
10
10
|
var Section = ctx.Section;
|
|
11
|
-
return (React.createElement(Section, { ctx: ctx, title: "Processos Jur\u00EDdicos", subtitle: "Veja os
|
|
11
|
+
return (React.createElement(Section, { ctx: ctx, title: "Processos Jur\u00EDdicos", subtitle: "Veja os processos jur\u00EDdicos para este documento.", icon: ProcessosJuridicosIcon, onSuccess: function (data) {
|
|
12
12
|
var _a, _b, _c, _d, _e;
|
|
13
13
|
if (!((_a = data === null || data === void 0 ? void 0 : data.empresa) === null || _a === void 0 ? void 0 : _a.length))
|
|
14
14
|
return (React.createElement(ResultWithoutInformation, { value: "N\u00E3o foram econtrados processos jur\u00EDdicos para o documento pesquisado." }));
|
|
@@ -24,7 +24,7 @@ var Protestos = function () {
|
|
|
24
24
|
return regex.test(XPathUtils.select("string(./nomeCedente)", protesto));
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
|
-
return (React.createElement(Section, { ctx: ctx, title: "Protestos", subtitle: "Consulta de
|
|
27
|
+
return (React.createElement(Section, { ctx: ctx, title: "Apontamentos na Central de Protestos (CENPROT)", subtitle: "Consulta de protestos de cr\u00E9dito, imposto e gerais.", icon: ProtestosIcon, onSuccess: function (data) {
|
|
28
28
|
var registros = XPathUtils.select("number(//registros)", data);
|
|
29
29
|
var protestosDeCredito = filterProtestos(REGEX_PROTESTOS_DE_CREDITO, data);
|
|
30
30
|
var protestosDeImposto = filterProtestos(REGEX_PROTESTOS_DE_IMPOSTO, data);
|
|
@@ -33,10 +33,24 @@ var Protestos = function () {
|
|
|
33
33
|
return (!REGEX_PROTESTOS_DE_IMPOSTO.test(nomeCedente) &&
|
|
34
34
|
!REGEX_PROTESTOS_DE_CREDITO.test(nomeCedente));
|
|
35
35
|
});
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
var elements = [
|
|
37
|
+
{
|
|
38
|
+
total: protestosDeCredito === null || protestosDeCredito === void 0 ? void 0 : protestosDeCredito.length,
|
|
39
|
+
element: React.createElement(ProtestosCategory, { title: "Protestos de Cr\u00E9dito", subtitle: "Protestos de cr\u00E9dito em geral.", registros: protestosDeCredito === null || protestosDeCredito === void 0 ? void 0 : protestosDeCredito.length, icon: ProtestosCreditoIcon }, protestosDeCredito.map(function (protesto, i) { return (React.createElement(ProtestoItem, { protesto: protesto, key: i })); }))
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
total: protestosDeImposto === null || protestosDeImposto === void 0 ? void 0 : protestosDeImposto.length,
|
|
43
|
+
element: React.createElement(ProtestosCategory, { title: "Protestos de Imposto", subtitle: "Protestos de impostos federais, estaduais e municipais.", registros: protestosDeImposto === null || protestosDeImposto === void 0 ? void 0 : protestosDeImposto.length, icon: ProtestosImpostosIcon }, protestosDeImposto.map(function (protestoElement, index) { return (React.createElement(ProtestoItem, { protesto: protestoElement, key: index })); }))
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
total: protestosGerais === null || protestosGerais === void 0 ? void 0 : protestosGerais.length,
|
|
47
|
+
element: React.createElement(ProtestosCategory, { title: "Protestos Gerais", subtitle: "Protestos de outros tipos.", registros: protestosGerais === null || protestosGerais === void 0 ? void 0 : protestosGerais.length, icon: ProtestosGeraisIcon }, protestosGerais.map(function (protestoElement, index) { return (React.createElement(ProtestoItem, { protesto: protestoElement, key: index })); }))
|
|
48
|
+
}
|
|
49
|
+
].sort(function (a, b) { return b.total - a.total; });
|
|
50
|
+
var children = registros ? (React.createElement(ResultProtestos, null, elements.map(function (_a) {
|
|
51
|
+
var element = _a.element;
|
|
52
|
+
return element;
|
|
53
|
+
}))) : null;
|
|
40
54
|
return {
|
|
41
55
|
children: children,
|
|
42
56
|
variant: registros ? 'error' : 'default',
|
|
@@ -34,8 +34,8 @@ import GlobalStyle from "./components/interface/globalStyle";
|
|
|
34
34
|
import ConsultaSimplesIcon from "./assets/icones/consultaSimples";
|
|
35
35
|
import StatusMessage from "./components/interface/statusMessage";
|
|
36
36
|
import { ConsultaRfbProvider } from "./components/consultaRfb";
|
|
37
|
-
import ResultadoDaPesquisa from "./components/resultadoDaPesquisa/resultado-da-pesquisa";
|
|
38
37
|
import styled from "styled-components";
|
|
38
|
+
import { formatDocument } from "./utils/string";
|
|
39
39
|
var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 20px;\n"], ["\n display: flex;\n flex-direction: column;\n gap: 20px;\n"])));
|
|
40
40
|
var ConsultaSimples = function (_a) {
|
|
41
41
|
var _documento = _a.documento, onClickConsultarProcessoJuridico = _a.onClickConsultarProcessoJuridico, apiKey = _a.apiKey, onClose = _a.onClose, hasCredits = _a.hasCredits;
|
|
@@ -49,8 +49,7 @@ var ConsultaSimples = function (_a) {
|
|
|
49
49
|
React.createElement(Queries.Protestos.Request, { data: { documento: documento } },
|
|
50
50
|
React.createElement(Queries.ProcessosJuridicos.Request, { data: { documento: documento } },
|
|
51
51
|
React.createElement(Wrapper, null,
|
|
52
|
-
React.createElement(
|
|
53
|
-
React.createElement(ConsultaSimplesSection, { onClose: onClose },
|
|
52
|
+
React.createElement(ConsultaSimplesSection, { documento: documento, onClose: onClose },
|
|
54
53
|
React.createElement(ConsultaRfbProvider, { documento: documento },
|
|
55
54
|
React.createElement(Dossie, { documento: documento, onOpenNewTransactionModal: console.log }),
|
|
56
55
|
React.createElement(Addresses, { apiKey: apiKey }),
|
|
@@ -70,12 +69,14 @@ var ConsultaSimples = function (_a) {
|
|
|
70
69
|
React.createElement(ProcessosJuridicos, { onClickConsultarProcessoJuridico: onClickConsultarProcessoJuridico })))))))))));
|
|
71
70
|
};
|
|
72
71
|
var ConsultaSimplesSection = function (_a) {
|
|
73
|
-
var children = _a.children, onClose = _a.onClose, rest = __rest(_a, ["children", "onClose"]);
|
|
72
|
+
var documento = _a.documento, children = _a.children, onClose = _a.onClose, rest = __rest(_a, ["documento", "children", "onClose"]);
|
|
74
73
|
var ctx = useContext(Queries.Finder);
|
|
75
74
|
var isSuccess = (ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Success;
|
|
76
75
|
var isError = (ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Error;
|
|
77
76
|
var isLoading = (ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Loading;
|
|
78
|
-
return (React.createElement(Section, __assign({ title: "Consulta Simples", subtitle: "
|
|
77
|
+
return (React.createElement(Section, __assign({ title: "Consulta Simples", subtitle: "Consulta de informa\u00E7\u00F5es do documento.", description: React.createElement(React.Fragment, null,
|
|
78
|
+
React.createElement(StatusMessage, { type: "found" }, formatDocument(documento)),
|
|
79
|
+
React.createElement(StatusMessage, { type: isSuccess ? 'success' : 'error' }, isSuccess ? "Registro encontrado" : isError && (ctx === null || ctx === void 0 ? void 0 : ctx.error.message))), onClose: onClose, icon: ConsultaSimplesIcon, variant: isLoading ? 'loading' : 'default' }, rest), children));
|
|
79
80
|
};
|
|
80
81
|
export default ConsultaSimples;
|
|
81
82
|
var templateObject_1;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare function formatCpf(cpf: string): string;
|
|
2
2
|
export declare function formatCnpj(cnpj: string): string;
|
|
3
|
+
export declare function formatDocument(documento: string): string;
|
|
4
|
+
export declare function isCpf(documento: string): boolean;
|
|
3
5
|
export declare function isCnpj(documento: string): boolean;
|
|
4
6
|
export declare const isDocumentoPF: (documento: string) => boolean;
|
|
5
7
|
export declare function formatDatePtBrToDate(date: string): Date;
|
package/lib/esm/utils/string.js
CHANGED
|
@@ -10,6 +10,17 @@ export function formatCnpj(cnpj) {
|
|
|
10
10
|
return "";
|
|
11
11
|
return "".concat(cnpj.slice(0, 2), ".").concat(cnpj.slice(2, 5), ".").concat(cnpj.slice(5, 8), "/").concat(cnpj.slice(8, 12), "-").concat(cnpj.slice(12));
|
|
12
12
|
}
|
|
13
|
+
export function formatDocument(documento) {
|
|
14
|
+
if (isCpf(documento))
|
|
15
|
+
return formatCpf(documento);
|
|
16
|
+
if (isCnpj(documento))
|
|
17
|
+
return formatCnpj(documento);
|
|
18
|
+
return documento;
|
|
19
|
+
}
|
|
20
|
+
export function isCpf(documento) {
|
|
21
|
+
documento = documento.replace(/[^0-9]/g, "");
|
|
22
|
+
return documento.length === 11;
|
|
23
|
+
}
|
|
13
24
|
export function isCnpj(documento) {
|
|
14
25
|
documento = documento.replace(/[^0-9]/g, "");
|
|
15
26
|
return documento.length === 14;
|