@credithub/harlan-components 1.44.3 → 1.44.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.
@@ -1,3 +1,4 @@
1
+ import { PefinRefinSerasaResponse } from '../../@types/domain';
1
2
  import React from 'react';
2
3
  export declare function useRefinSerasa(documento: string): {
3
4
  isLoading: boolean;
@@ -23,6 +24,7 @@ export declare function useRefinSerasa(documento: string): {
23
24
  }[];
24
25
  consultaRealizada: boolean;
25
26
  loadingProgress: number;
27
+ response: import("../webservice").ParsedResponse<PefinRefinSerasaResponse> | null;
26
28
  };
27
29
  declare const RefinSerasa: React.FC<{
28
30
  documento: string;
@@ -71,13 +71,14 @@ export function useRefinSerasa(documento) {
71
71
  error: error,
72
72
  pendencias: pendencias,
73
73
  consultaRealizada: !!response,
74
- loadingProgress: loadingProgress
74
+ loadingProgress: loadingProgress,
75
+ response: response
75
76
  };
76
77
  }
77
78
  var RefinSerasa = function (_a) {
78
79
  var documento = _a.documento;
79
80
  var refinSerasaRef = useRef(null);
80
- var _b = useRefinSerasa(documento), isLoading = _b.isLoading, error = _b.error, pendencias = _b.pendencias, consultaRealizada = _b.consultaRealizada, loadingProgress = _b.loadingProgress;
81
+ var _b = useRefinSerasa(documento), isLoading = _b.isLoading, error = _b.error, pendencias = _b.pendencias, consultaRealizada = _b.consultaRealizada, loadingProgress = _b.loadingProgress, response = _b.response;
81
82
  useEffect(function () {
82
83
  var _a;
83
84
  var topOffset = ((_a = refinSerasaRef.current) === null || _a === void 0 ? void 0 : _a.offsetTop) || 0;
@@ -86,8 +87,8 @@ var RefinSerasa = function (_a) {
86
87
  behavior: 'smooth'
87
88
  });
88
89
  }, [consultaRealizada]);
89
- var totalPendencias = pendencias.length;
90
- var valorTotalPendencias = pendencias.reduce(function (acc, curr) { return acc + (parseFloat(curr.valor) || 0); }, 0);
90
+ var totalPendencias = useMemo(function () { var _a, _b, _c; return ((_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.document) === null || _a === void 0 ? void 0 : _a.informacoes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.total) || 0; }, [response === null || response === void 0 ? void 0 : response.document]);
91
+ var valorTotalPendencias = useMemo(function () { var _a, _b, _c; return ((_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.document) === null || _a === void 0 ? void 0 : _a.informacoes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.valorTotalPendencias) || 0; }, [response === null || response === void 0 ? void 0 : response.document]);
91
92
  var description = totalPendencias === 0
92
93
  ? 'Não há ocorrência de Pefin/Refin Serasa'
93
94
  : totalPendencias === 1