@credithub/harlan-components 1.13.6 → 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,7 +129,7 @@ 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;
@@ -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;
@@ -98,7 +99,7 @@ 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;
@@ -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.7",
4
4
  "description": "Provide a set of web components to be used in Harlan and other projects",
5
5
  "keywords": [
6
6
  "harlan",