@credithub/harlan-components 1.24.5 → 1.25.0

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.
@@ -16,7 +16,7 @@ import ChevronDown from '../../assets/btn/chevronDown';
16
16
  import useChartData from './hooks/useChartData';
17
17
  import ResumoDeNegativacoesIcon from '../../assets/icones/resumoNegativacoes';
18
18
  import { ConsultasComplementaresContext } from '../consultasComplementares';
19
- import { converterParaFormatoValido } from '../../utils/string';
19
+ import { converterParaFormatoValido } from '../../utils/date';
20
20
  import { PrintSectionWrapper } from '../common/printSectionWrapper';
21
21
  var Content = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n padding: 0px 30px;\n\n @media print {\n display: block;\n }\n"], ["\n display: ", ";\n padding: 0px 30px;\n\n @media print {\n display: block;\n }\n"])), function (props) { return (props.isOpen ? 'block' : 'none'); });
22
22
  var ChartSystem = function (_a) {
@@ -9,10 +9,10 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { converterParaFormatoValido, formatDatePtBrToDate } from '../../../utils/string';
13
- import { groupBy, sortBy, unique } from 'underscore';
14
- import XPathUtils from '../../../utils/xpath';
15
12
  import { REGEX_PROTESTOS_DE_CREDITO, REGEX_PROTESTOS_DE_IMPOSTO } from '../../../constants/regex';
13
+ import { converterParaFormatoValido, formatDatePtBrToDate } from '../../../utils/date';
14
+ import XPathUtils from '../../../utils/xpath';
15
+ import { groupBy, sortBy, unique } from 'underscore';
16
16
  export var processData = function (data, quantidadeProcessosJuridicos) {
17
17
  var removeZeros = function (current, index, arr) {
18
18
  return index === 0 || index === arr.length - 1
@@ -28,6 +28,7 @@ import React, { useContext } from 'react';
28
28
  import Section from '../interface/section';
29
29
  import StatusMessage from '../interface/statusMessage';
30
30
  import { Queries, RequestStatus } from '../webservice';
31
+ import { formatDate } from 'date-fns';
31
32
  var getPossuiPendenciaText = function (_a) {
32
33
  var ccf = _a.ccf, ultimoRegistroCCF = _a.ultimoRegistroCCF, dividasPublicas = _a.dividasPublicas, protestos = _a.protestos, processosJuridicos = _a.processosJuridicos;
33
34
  return [
@@ -66,6 +67,7 @@ var ConsultaSimplesSection = function (_a) {
66
67
  ? 'error'
67
68
  : 'success';
68
69
  return (React.createElement(Section, __assign({ title: "Consulta Simples", subtitle: "Consulta de informa\u00E7\u00F5es do documento.", description: React.createElement(React.Fragment, null,
70
+ React.createElement(StatusMessage, null, formatDate(new Date(), "d/MM/Y 'às' H:mm")),
69
71
  React.createElement(StatusMessage, { type: "found" }, formatDocument(documento)),
70
72
  isError && (React.createElement(StatusMessage, { type: statusType }, ctx === null || ctx === void 0 ? void 0 : ctx.error.message)),
71
73
  possuiPendenciaText.length ? (possuiPendenciaText.map(function (text) { return (React.createElement(StatusMessage, { key: text, type: "error" }, text)); })) : (React.createElement(StatusMessage, { type: statusType }, "Nenhum registro encontrado"))), onClose: onClose, icon: ConsultaSimplesIcon, variant: isLoading ? 'loading' : 'default' }, rest), children));
@@ -20,6 +20,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
20
20
  };
21
21
  import DividasVencidasSerasaIcon from '../../assets/icones/dividasVencidasSerasa';
22
22
  import { useGlobalData } from '../../contexts/globalDataContext';
23
+ import { parseDate } from '../../utils/date';
23
24
  import { formatMoney } from '../../utils/number';
24
25
  import XPathUtils from '../../utils/xpath';
25
26
  import React, { memo, useContext } from 'react';
@@ -47,6 +48,10 @@ var DividasPublicas = function () {
47
48
  tipoDeDivida: tipo
48
49
  }); }; };
49
50
  var dividas = __spreadArray(__spreadArray(__spreadArray([], XPathUtils.selectArray('//dividas/fgts/divida', document).map(parseDividas('FGTS')), true), XPathUtils.selectArray('//dividas/previdenciaria/divida', document).map(parseDividas('Previdenciária')), true), XPathUtils.selectArray('//dividas/ativa-geral/divida', document).map(parseDividas('Divida Ativa União')), true);
51
+ dividas.sort(function (a, b) {
52
+ return parseDate(b.dataDeInscricao).getTime() -
53
+ parseDate(a.dataDeInscricao).getTime();
54
+ });
50
55
  var dividasPublicas = XPathUtils.select('number(//dividas/resumo/valor_total_dividas)', document);
51
56
  setData(function (prevState) { return (__assign(__assign({}, prevState), { dividasPublicas: dividasPublicas || 0 })); });
52
57
  var totalOcorrencias = dividas === null || dividas === void 0 ? void 0 : dividas.length;
@@ -21,7 +21,7 @@ import ProtestosImpostosIcon from '../../assets/icones/protestosImpostos';
21
21
  import { REGEX_PROTESTOS_DE_CREDITO, REGEX_PROTESTOS_DE_IMPOSTO } from '../../constants/regex';
22
22
  import { useGlobalData } from '../../contexts/globalDataContext';
23
23
  import { extractIntegerFromText } from '../../utils/number';
24
- import { formatDatePtBrToDate } from '../../utils/string';
24
+ import { formatDatePtBrToDate } from '../../utils/date';
25
25
  import XPathUtils from '../../utils/xpath';
26
26
  import React, { useContext } from 'react';
27
27
  import styled from 'styled-components';
@@ -89,7 +89,6 @@ var PendenciasList = function (_a) {
89
89
  : pendencias.length === 0
90
90
  ? 'success'
91
91
  : 'error';
92
- pendencias.map(function (pendencia, i) { });
93
92
  return (React.createElement("div", null,
94
93
  React.createElement(Header, __assign({ variant: isLoading
95
94
  ? 'loading'
@@ -1 +1,4 @@
1
1
  export declare function isDate(date: string | Date): boolean;
2
+ export declare function parseDate(dateStr: string): Date;
3
+ export declare function converterParaFormatoValido(data: string): string;
4
+ export declare function formatDatePtBrToDate(date: string): Date;
@@ -4,3 +4,15 @@ export function isDate(date) {
4
4
  return false;
5
5
  return !isNaN(new Date(date).getTime());
6
6
  }
7
+ export function parseDate(dateStr) {
8
+ var _a = dateStr.split('/').map(Number), day = _a[0], month = _a[1], year = _a[2];
9
+ return new Date(year, month - 1, day);
10
+ }
11
+ export function converterParaFormatoValido(data) {
12
+ var _a = data.split('/'), dia = _a[0], mes = _a[1], ano = _a[2];
13
+ return "".concat(mes, "/").concat(dia, "/").concat(ano);
14
+ }
15
+ export function formatDatePtBrToDate(date) {
16
+ var _a, _b;
17
+ return new Date((_b = (_a = date === null || date === void 0 ? void 0 : date.split('/')) === null || _a === void 0 ? void 0 : _a.reverse()) === null || _b === void 0 ? void 0 : _b.join('-'));
18
+ }
@@ -4,8 +4,6 @@ export declare function formatDocument(documento: string): string;
4
4
  export declare function isCpf(documento: string): boolean;
5
5
  export declare function isCnpj(documento: string): boolean;
6
6
  export declare const isDocumentoPF: (documento: string) => boolean;
7
- export declare const converterParaFormatoValido: (data: string) => string;
8
- export declare function formatDatePtBrToDate(date: string): Date;
9
7
  export declare function capitalize(value: string): string | null;
10
8
  export declare function capitalizeFirstLetter(value: string): string | null;
11
9
  export declare function addNoValueContent<T>(obj: T): T;
@@ -29,14 +29,6 @@ export var isDocumentoPF = function (documento) {
29
29
  var cleanDocument = documento.replace(/\D/g, '');
30
30
  return cleanDocument.length === 11;
31
31
  };
32
- export var converterParaFormatoValido = function (data) {
33
- var _a = data.split('/'), dia = _a[0], mes = _a[1], ano = _a[2];
34
- return "".concat(mes, "/").concat(dia, "/").concat(ano);
35
- };
36
- export function formatDatePtBrToDate(date) {
37
- var _a, _b;
38
- return new Date((_b = (_a = date === null || date === void 0 ? void 0 : date.split('/')) === null || _a === void 0 ? void 0 : _a.reverse()) === null || _b === void 0 ? void 0 : _b.join('-'));
39
- }
40
32
  export function capitalize(value) {
41
33
  var _a, _b, _c;
42
34
  if (!value)