@credithub/harlan-components 1.13.6 → 1.13.8

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;
@@ -123,19 +124,19 @@ var ResumoDeNegativacoesChartSection = function (_a) {
123
124
  exports.ResumoDeNegativacoesChartSection = ResumoDeNegativacoesChartSection;
124
125
  var ChartWrapper = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: 20px 30px;\n //background-color: ", ";\n"], ["\n padding: 20px 30px;\n //background-color: ", ";\n"])), theme_1.default.colors.white);
125
126
  var CustomChart = function (_a) {
126
- var _b, _c, _d, _e, _f, _g;
127
+ var _b, _c, _d, _e, _f, _g, _h, _j;
127
128
  var dataInput = _a.dataInput;
128
129
  var ultimaOcorrenciaCCF = (0, useUltimaOcorrenciaCCF_1.default)();
130
+ var _k = (0, useDividasPublicas_1.default)(), quantidadeDividas = _k.quantidade, valorTotalDividas = _k.valorTotal;
129
131
  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
- 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 _j = (0, useCalculation_1.useCalculation)(dataInput.serasa), quantidadeDeNegativacoesSerasa = _j.quantidade, valorTotalDeNegativacoesSerasa = _j.valorTotal;
133
- var _k = (0, useCalculation_1.useCalculation)(dataInput.boaVista), quantidadeDeNegativacoesBoaVista = _k.quantidade, valorTotalDeNegativacoesBoaVista = _k.valorTotal;
132
+ var valorTotalProtestos = ((_e = (_d = dataInput === null || dataInput === void 0 ? void 0 : dataInput.protestos) === null || _d === void 0 ? void 0 : _d[(dataInput === null || dataInput === void 0 ? void 0 : dataInput.protestos.length) - 1]) === null || _e === void 0 ? void 0 : _e.valorTotal) || 0;
133
+ var _l = (0, useCalculation_1.useCalculation)(dataInput.serasa), quantidadeDeNegativacoesSerasa = _l.quantidade, valorTotalDeNegativacoesSerasa = _l.valorTotal;
134
+ var _m = (0, useCalculation_1.useCalculation)(dataInput.boaVista), quantidadeDeNegativacoesBoaVista = _m.quantidade, valorTotalDeNegativacoesBoaVista = _m.valorTotal;
134
135
  var quantidadeCCF = (0, useCalculation_1.useCalculation)(dataInput.ccfs).quantidade;
135
- 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
+ var ultimaOcorrenciaProtestos = (_h = (_g = dataInput === null || dataInput === void 0 ? void 0 : dataInput.protestos[((_f = dataInput === null || dataInput === void 0 ? void 0 : dataInput.protestos) === null || _f === void 0 ? void 0 : _f.length) - 1]) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h.toLocaleDateString();
136
137
  return (react_1.default.createElement(ChartWrapper, null,
137
138
  react_1.default.createElement(chartContent_1.default, { dataInput: dataInput }),
138
- 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 })));
139
+ react_1.default.createElement(quantityResult_1.default, { quantidadeProtestos: quantidadeDeProtestos, quantidadeProcessos: (_j = dataInput === null || dataInput === void 0 ? void 0 : dataInput.pieChartTotalConfig) === null || _j === void 0 ? void 0 : _j.processosJuridicos, quantidadeDividas: quantidadeDividas, quantidadeDividasSerasa: quantidadeDeNegativacoesSerasa, quantidadeDividasBoaVista: quantidadeDeNegativacoesBoaVista, quantidadeChequesSemFundos: quantidadeCCF, ultimaOcorrenciaChequesSemFundos: ultimaOcorrenciaCCF, valorTotalDividasSerasa: valorTotalDeNegativacoesSerasa, valorTotalDividasBoaVista: valorTotalDeNegativacoesBoaVista, valorTotalProtestos: valorTotalProtestos, valorTotalDividas: valorTotalDividas, ultimaOcorrenciaProtestos: ultimaOcorrenciaProtestos })));
139
140
  };
140
141
  exports.default = CustomChart;
141
142
  var templateObject_1, templateObject_2;
@@ -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;
@@ -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;
@@ -93,19 +94,19 @@ export var ResumoDeNegativacoesChartSection = function (_a) {
93
94
  };
94
95
  var ChartWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: 20px 30px;\n //background-color: ", ";\n"], ["\n padding: 20px 30px;\n //background-color: ", ";\n"])), theme.colors.white);
95
96
  var CustomChart = function (_a) {
96
- var _b, _c, _d, _e, _f, _g;
97
+ var _b, _c, _d, _e, _f, _g, _h, _j;
97
98
  var dataInput = _a.dataInput;
98
99
  var ultimaOcorrenciaCCF = useUltimaOcorrenciaCCF();
100
+ var _k = useDividasPublicas(), quantidadeDividas = _k.quantidade, valorTotalDividas = _k.valorTotal;
99
101
  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
- var valorTotalProtestos = useCalculation(dataInput.protestos).valorTotal;
101
- var _h = useCalculation(dataInput.dividasPublicasGrafico), quantidadeDividas = _h.quantidade, valorTotalDividas = _h.valorTotal;
102
- var _j = useCalculation(dataInput.serasa), quantidadeDeNegativacoesSerasa = _j.quantidade, valorTotalDeNegativacoesSerasa = _j.valorTotal;
103
- var _k = useCalculation(dataInput.boaVista), quantidadeDeNegativacoesBoaVista = _k.quantidade, valorTotalDeNegativacoesBoaVista = _k.valorTotal;
102
+ var valorTotalProtestos = ((_e = (_d = dataInput === null || dataInput === void 0 ? void 0 : dataInput.protestos) === null || _d === void 0 ? void 0 : _d[(dataInput === null || dataInput === void 0 ? void 0 : dataInput.protestos.length) - 1]) === null || _e === void 0 ? void 0 : _e.valorTotal) || 0;
103
+ var _l = useCalculation(dataInput.serasa), quantidadeDeNegativacoesSerasa = _l.quantidade, valorTotalDeNegativacoesSerasa = _l.valorTotal;
104
+ var _m = useCalculation(dataInput.boaVista), quantidadeDeNegativacoesBoaVista = _m.quantidade, valorTotalDeNegativacoesBoaVista = _m.valorTotal;
104
105
  var quantidadeCCF = useCalculation(dataInput.ccfs).quantidade;
105
- 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
+ var ultimaOcorrenciaProtestos = (_h = (_g = dataInput === null || dataInput === void 0 ? void 0 : dataInput.protestos[((_f = dataInput === null || dataInput === void 0 ? void 0 : dataInput.protestos) === null || _f === void 0 ? void 0 : _f.length) - 1]) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h.toLocaleDateString();
106
107
  return (React.createElement(ChartWrapper, null,
107
108
  React.createElement(ChartContent, { dataInput: dataInput }),
108
- 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 })));
109
+ React.createElement(QuantidadeResultados, { quantidadeProtestos: quantidadeDeProtestos, quantidadeProcessos: (_j = dataInput === null || dataInput === void 0 ? void 0 : dataInput.pieChartTotalConfig) === null || _j === void 0 ? void 0 : _j.processosJuridicos, quantidadeDividas: quantidadeDividas, quantidadeDividasSerasa: quantidadeDeNegativacoesSerasa, quantidadeDividasBoaVista: quantidadeDeNegativacoesBoaVista, quantidadeChequesSemFundos: quantidadeCCF, ultimaOcorrenciaChequesSemFundos: ultimaOcorrenciaCCF, valorTotalDividasSerasa: valorTotalDeNegativacoesSerasa, valorTotalDividasBoaVista: valorTotalDeNegativacoesBoaVista, valorTotalProtestos: valorTotalProtestos, valorTotalDividas: valorTotalDividas, ultimaOcorrenciaProtestos: ultimaOcorrenciaProtestos })));
109
110
  };
110
111
  export default CustomChart;
111
112
  var templateObject_1, templateObject_2;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credithub/harlan-components",
3
- "version": "1.13.6",
3
+ "version": "1.13.8",
4
4
  "description": "Provide a set of web components to be used in Harlan and other projects",
5
5
  "keywords": [
6
6
  "harlan",