@credithub/harlan-components 1.13.5 → 1.13.7

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.
@@ -60,6 +60,7 @@ var useToggle_1 = __importDefault(require("../../hooks/useToggle"));
60
60
  var chevronDown_1 = __importDefault(require("../../assets/btn/chevronDown"));
61
61
  var theme_1 = __importDefault(require("../interface/theme"));
62
62
  var resumoNegativacoes_1 = __importDefault(require("../../assets/icones/resumoNegativacoes"));
63
+ var useDividasPublicas_1 = __importDefault(require("./useDividasPublicas"));
63
64
  var Content = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n"], ["\n display: ", ";\n"])), function (props) { return props.isOpen ? 'block' : 'none'; });
64
65
  var ResumoDeNegativacoesChartSection = function (_a) {
65
66
  var documento = _a.documento;
@@ -128,12 +129,11 @@ var CustomChart = function (_a) {
128
129
  var ultimaOcorrenciaCCF = (0, useUltimaOcorrenciaCCF_1.default)();
129
130
  var quantidadeDeProtestos = ((_c = (_b = dataInput === null || dataInput === void 0 ? void 0 : dataInput.protestos) === null || _b === void 0 ? void 0 : _b[(dataInput === null || dataInput === void 0 ? void 0 : dataInput.protestos.length) - 1]) === null || _c === void 0 ? void 0 : _c.quantidade) || 0;
130
131
  var valorTotalProtestos = (0, useCalculation_1.useCalculation)(dataInput.protestos).valorTotal;
131
- var _h = (0, useCalculation_1.useCalculation)(dataInput.dividasPublicasGrafico), quantidadeDividas = _h.quantidade, valorTotalDividas = _h.valorTotal;
132
+ var _h = (0, useDividasPublicas_1.default)(), quantidadeDividas = _h.quantidade, valorTotalDividas = _h.valorTotal;
132
133
  var _j = (0, useCalculation_1.useCalculation)(dataInput.serasa), quantidadeDeNegativacoesSerasa = _j.quantidade, valorTotalDeNegativacoesSerasa = _j.valorTotal;
133
134
  var _k = (0, useCalculation_1.useCalculation)(dataInput.boaVista), quantidadeDeNegativacoesBoaVista = _k.quantidade, valorTotalDeNegativacoesBoaVista = _k.valorTotal;
134
135
  var quantidadeCCF = (0, useCalculation_1.useCalculation)(dataInput.ccfs).quantidade;
135
136
  var ultimaOcorrenciaProtestos = (_f = (_e = dataInput === null || dataInput === void 0 ? void 0 : dataInput.protestos[((_d = dataInput === null || dataInput === void 0 ? void 0 : dataInput.protestos) === null || _d === void 0 ? void 0 : _d.length) - 1]) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.toLocaleDateString();
136
- console.log(dataInput);
137
137
  return (react_1.default.createElement(ChartWrapper, null,
138
138
  react_1.default.createElement(chartContent_1.default, { dataInput: dataInput }),
139
139
  react_1.default.createElement(quantityResult_1.default, { quantidadeProtestos: quantidadeDeProtestos, quantidadeProcessos: (_g = dataInput === null || dataInput === void 0 ? void 0 : dataInput.pieChartTotalConfig) === null || _g === void 0 ? void 0 : _g.processosJuridicos, quantidadeDividas: quantidadeDividas, quantidadeDividasSerasa: quantidadeDeNegativacoesSerasa, quantidadeDividasBoaVista: quantidadeDeNegativacoesBoaVista, quantidadeChequesSemFundos: quantidadeCCF, ultimaOcorrenciaChequesSemFundos: ultimaOcorrenciaCCF, valorTotalDividasSerasa: valorTotalDeNegativacoesSerasa, valorTotalDividasBoaVista: valorTotalDeNegativacoesBoaVista, valorTotalProtestos: valorTotalProtestos, valorTotalDividas: valorTotalDividas, ultimaOcorrenciaProtestos: ultimaOcorrenciaProtestos })));
@@ -0,0 +1,5 @@
1
+ declare const useDividasPublicas: () => {
2
+ quantidade: number;
3
+ valorTotal: number;
4
+ };
5
+ export default useDividasPublicas;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ /* eslint-disable react-hooks/exhaustive-deps */
7
+ var react_1 = require("react");
8
+ var webservice_1 = require("../webservice");
9
+ var xpath_1 = __importDefault(require("../../utils/xpath"));
10
+ var useDividasPublicas = function () {
11
+ var ctxFinder = (0, react_1.useContext)(webservice_1.Queries.Finder);
12
+ var dividasPublicasData = (0, react_1.useMemo)(function () {
13
+ if ((ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.type) === webservice_1.RequestStatus.Success) {
14
+ return {
15
+ quantidade: xpath_1.default.select("number(//dividas/resumo/quantidade_dividas)", ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.document) || 0,
16
+ valorTotal: xpath_1.default.select("number(//dividas/resumo/valor_total_dividas)", ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.document) || 0
17
+ };
18
+ }
19
+ return {
20
+ quantidade: 0,
21
+ valorTotal: 0
22
+ };
23
+ }, [ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.type]);
24
+ return dividasPublicasData;
25
+ };
26
+ exports.default = useDividasPublicas;
@@ -75,7 +75,6 @@ var Protestos = function () {
75
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
76
  }
77
77
  ].sort(function (a, b) { return b.total - a.total; });
78
- console.log(elements);
79
78
  var children = registros ? (react_1.default.createElement(ResultProtestos, null, elements.map(function (_a) {
80
79
  var element = _a.element;
81
80
  return element;
@@ -83,7 +82,7 @@ var Protestos = function () {
83
82
  return {
84
83
  children: children,
85
84
  variant: registros ? 'error' : 'default',
86
- description: (react_1.default.createElement(statusMessage_1.default, { type: registros ? "success" : "default" }, registros
85
+ description: (react_1.default.createElement(statusMessage_1.default, { type: registros ? "error" : "default" }, registros
87
86
  ? registros === 1
88
87
  ? "Encontrado um protesto"
89
88
  : "Encontrados ".concat(registros, " protestos")
@@ -45,7 +45,7 @@ var ProtestosCategory = function (_a) {
45
45
  var defaultHeaderActions = (react_1.default.createElement(react_1.default.Fragment, null,
46
46
  react_1.default.createElement(btnWrapper_1.default, { onClick: toggleOpen }, isOpen ? react_1.default.createElement(chevronUp_1.default, null) : react_1.default.createElement(chevronDown_1.default, null))));
47
47
  return (react_1.default.createElement("div", null,
48
- react_1.default.createElement(header_1.default, __assign({ title: title, subtitle: subtitle, description: react_1.default.createElement(statusMessage_1.default, { type: registros ? "success" : "default" }, !registros
48
+ react_1.default.createElement(header_1.default, __assign({ title: title, subtitle: subtitle, description: react_1.default.createElement(statusMessage_1.default, { type: registros ? "error" : "default" }, !registros
49
49
  ? "Não foram encontradas ocorrências"
50
50
  : (registros === 1 ? 'Foi encontrado um protesto' : "Foram encontrados ".concat(registros, " protestos"))), variant: registros ? 'error' : 'default', actions: registros ? defaultHeaderActions : null }, rest)),
51
51
  react_1.default.createElement(Content, { isOpen: isOpen },
@@ -31,6 +31,7 @@ import useToggle from "../../hooks/useToggle";
31
31
  import ChevronDown from "../../assets/btn/chevronDown";
32
32
  import theme from "../interface/theme";
33
33
  import ResumoDeNegativacoesIcon from "../../assets/icones/resumoNegativacoes";
34
+ import useDividasPublicas from "./useDividasPublicas";
34
35
  var Content = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n"], ["\n display: ", ";\n"])), function (props) { return props.isOpen ? 'block' : 'none'; });
35
36
  export var ResumoDeNegativacoesChartSection = function (_a) {
36
37
  var documento = _a.documento;
@@ -98,12 +99,11 @@ var CustomChart = function (_a) {
98
99
  var ultimaOcorrenciaCCF = useUltimaOcorrenciaCCF();
99
100
  var quantidadeDeProtestos = ((_c = (_b = dataInput === null || dataInput === void 0 ? void 0 : dataInput.protestos) === null || _b === void 0 ? void 0 : _b[(dataInput === null || dataInput === void 0 ? void 0 : dataInput.protestos.length) - 1]) === null || _c === void 0 ? void 0 : _c.quantidade) || 0;
100
101
  var valorTotalProtestos = useCalculation(dataInput.protestos).valorTotal;
101
- var _h = useCalculation(dataInput.dividasPublicasGrafico), quantidadeDividas = _h.quantidade, valorTotalDividas = _h.valorTotal;
102
+ var _h = useDividasPublicas(), quantidadeDividas = _h.quantidade, valorTotalDividas = _h.valorTotal;
102
103
  var _j = useCalculation(dataInput.serasa), quantidadeDeNegativacoesSerasa = _j.quantidade, valorTotalDeNegativacoesSerasa = _j.valorTotal;
103
104
  var _k = useCalculation(dataInput.boaVista), quantidadeDeNegativacoesBoaVista = _k.quantidade, valorTotalDeNegativacoesBoaVista = _k.valorTotal;
104
105
  var quantidadeCCF = useCalculation(dataInput.ccfs).quantidade;
105
106
  var ultimaOcorrenciaProtestos = (_f = (_e = dataInput === null || dataInput === void 0 ? void 0 : dataInput.protestos[((_d = dataInput === null || dataInput === void 0 ? void 0 : dataInput.protestos) === null || _d === void 0 ? void 0 : _d.length) - 1]) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.toLocaleDateString();
106
- console.log(dataInput);
107
107
  return (React.createElement(ChartWrapper, null,
108
108
  React.createElement(ChartContent, { dataInput: dataInput }),
109
109
  React.createElement(QuantidadeResultados, { quantidadeProtestos: quantidadeDeProtestos, quantidadeProcessos: (_g = dataInput === null || dataInput === void 0 ? void 0 : dataInput.pieChartTotalConfig) === null || _g === void 0 ? void 0 : _g.processosJuridicos, quantidadeDividas: quantidadeDividas, quantidadeDividasSerasa: quantidadeDeNegativacoesSerasa, quantidadeDividasBoaVista: quantidadeDeNegativacoesBoaVista, quantidadeChequesSemFundos: quantidadeCCF, ultimaOcorrenciaChequesSemFundos: ultimaOcorrenciaCCF, valorTotalDividasSerasa: valorTotalDeNegativacoesSerasa, valorTotalDividasBoaVista: valorTotalDeNegativacoesBoaVista, valorTotalProtestos: valorTotalProtestos, valorTotalDividas: valorTotalDividas, ultimaOcorrenciaProtestos: ultimaOcorrenciaProtestos })));
@@ -0,0 +1,5 @@
1
+ declare const useDividasPublicas: () => {
2
+ quantidade: number;
3
+ valorTotal: number;
4
+ };
5
+ export default useDividasPublicas;
@@ -0,0 +1,21 @@
1
+ /* eslint-disable react-hooks/exhaustive-deps */
2
+ import { useContext, useMemo } from "react";
3
+ import { Queries, RequestStatus } from "../webservice";
4
+ import XPathUtils from "../../utils/xpath";
5
+ var useDividasPublicas = function () {
6
+ var ctxFinder = useContext(Queries.Finder);
7
+ var dividasPublicasData = useMemo(function () {
8
+ if ((ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.type) === RequestStatus.Success) {
9
+ return {
10
+ quantidade: XPathUtils.select("number(//dividas/resumo/quantidade_dividas)", ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.document) || 0,
11
+ valorTotal: XPathUtils.select("number(//dividas/resumo/valor_total_dividas)", ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.document) || 0
12
+ };
13
+ }
14
+ return {
15
+ quantidade: 0,
16
+ valorTotal: 0
17
+ };
18
+ }, [ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.type]);
19
+ return dividasPublicasData;
20
+ };
21
+ export default useDividasPublicas;
@@ -47,7 +47,6 @@ var Protestos = function () {
47
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
48
  }
49
49
  ].sort(function (a, b) { return b.total - a.total; });
50
- console.log(elements);
51
50
  var children = registros ? (React.createElement(ResultProtestos, null, elements.map(function (_a) {
52
51
  var element = _a.element;
53
52
  return element;
@@ -55,7 +54,7 @@ var Protestos = function () {
55
54
  return {
56
55
  children: children,
57
56
  variant: registros ? 'error' : 'default',
58
- description: (React.createElement(StatusMessage, { type: registros ? "success" : "default" }, registros
57
+ description: (React.createElement(StatusMessage, { type: registros ? "error" : "default" }, registros
59
58
  ? registros === 1
60
59
  ? "Encontrado um protesto"
61
60
  : "Encontrados ".concat(registros, " protestos")
@@ -40,7 +40,7 @@ var ProtestosCategory = function (_a) {
40
40
  var defaultHeaderActions = (React.createElement(React.Fragment, null,
41
41
  React.createElement(BtnWrapper, { onClick: toggleOpen }, isOpen ? React.createElement(ChevronUp, null) : React.createElement(ChevronDown, null))));
42
42
  return (React.createElement("div", null,
43
- React.createElement(Header, __assign({ title: title, subtitle: subtitle, description: React.createElement(StatusMessage, { type: registros ? "success" : "default" }, !registros
43
+ React.createElement(Header, __assign({ title: title, subtitle: subtitle, description: React.createElement(StatusMessage, { type: registros ? "error" : "default" }, !registros
44
44
  ? "Não foram encontradas ocorrências"
45
45
  : (registros === 1 ? 'Foi encontrado um protesto' : "Foram encontrados ".concat(registros, " protestos"))), variant: registros ? 'error' : 'default', actions: registros ? defaultHeaderActions : null }, rest)),
46
46
  React.createElement(Content, { isOpen: isOpen },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credithub/harlan-components",
3
- "version": "1.13.5",
3
+ "version": "1.13.7",
4
4
  "description": "Provide a set of web components to be used in Harlan and other projects",
5
5
  "keywords": [
6
6
  "harlan",