@credithub/harlan-components 1.62.5 → 1.62.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.
|
@@ -6,21 +6,17 @@ export declare function useRefinSerasa(documento: string): {
|
|
|
6
6
|
pendencias: {
|
|
7
7
|
valor: string;
|
|
8
8
|
totalvalor: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
categoria: string;
|
|
10
|
+
avalista: boolean;
|
|
11
|
+
comprador: boolean;
|
|
12
|
+
fiador: boolean;
|
|
13
13
|
contrato: string;
|
|
14
|
-
|
|
14
|
+
data_ocorrencia: string;
|
|
15
|
+
origem: string;
|
|
16
|
+
titulo_ocorrencia: string;
|
|
17
|
+
base_origem: string;
|
|
15
18
|
cidade: string;
|
|
16
19
|
uf: string;
|
|
17
|
-
situacao: string;
|
|
18
|
-
credor: string;
|
|
19
|
-
orgaoemissor: string;
|
|
20
|
-
totalpendencias: string;
|
|
21
|
-
totalcredores: string;
|
|
22
|
-
categoria: "PEND\u00CANCIAS FINANCEIRAS" | "RESTRI\u00C7\u00D5ES FINANCEIRAS" | "D\u00CDVIDAS VENCIDAS";
|
|
23
|
-
modalidade: string;
|
|
24
20
|
}[];
|
|
25
21
|
consultaRealizada: boolean;
|
|
26
22
|
loadingProgress: number;
|
|
@@ -9,6 +9,15 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
+
if (ar || !(i in from)) {
|
|
15
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
+
ar[i] = from[i];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
+
};
|
|
12
21
|
import PefinRefinSerasaIcon from '../../assets/icones/pefinRefinSerasa';
|
|
13
22
|
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
14
23
|
import { formatMoney } from '../../utils/number';
|
|
@@ -36,12 +45,18 @@ export function useRefinSerasa(documento) {
|
|
|
36
45
|
return isNaN(parsed) ? '0' : valorFinal;
|
|
37
46
|
};
|
|
38
47
|
var pendenciasData = useMemo(function () {
|
|
39
|
-
var _a, _b, _c;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
49
|
+
if (!response)
|
|
50
|
+
return [];
|
|
51
|
+
var pefin = ((_d = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.document) === null || _a === void 0 ? void 0 : _a.dados) === null || _b === void 0 ? void 0 : _b.pefin) === null || _c === void 0 ? void 0 : _c.registro) === null || _d === void 0 ? void 0 : _d.map(function (registro) { return (__assign(__assign({}, registro), { categoria: 'PENDÊNCIAS FINANCEIRAS' })); })) || [];
|
|
52
|
+
var refin = ((_h = (_g = (_f = (_e = response === null || response === void 0 ? void 0 : response.document) === null || _e === void 0 ? void 0 : _e.dados) === null || _f === void 0 ? void 0 : _f.refin) === null || _g === void 0 ? void 0 : _g.registro) === null || _h === void 0 ? void 0 : _h.map(function (registro) { return (__assign(__assign({}, registro), { categoria: 'RESTRIÇÕES FINANCEIRAS' })); })) || [];
|
|
53
|
+
var pendenciasVencidas = ((_m = (_l = (_k = (_j = response === null || response === void 0 ? void 0 : response.document) === null || _j === void 0 ? void 0 : _j.dados) === null || _k === void 0 ? void 0 : _k.pendencias_vencidas) === null || _l === void 0 ? void 0 : _l.registro) === null || _m === void 0 ? void 0 : _m.map(function (registro) { return (__assign(__assign({}, registro), { categoria: 'DÍVIDAS VENCIDAS' })); })) || [];
|
|
54
|
+
return __spreadArray(__spreadArray(__spreadArray([], pefin, true), refin, true), pendenciasVencidas, true).map(addNoValueContent)
|
|
55
|
+
.map(function (pendencia) { return (__assign(__assign({}, pendencia), { valor: clearValue(pendencia.valor), totalvalor: clearValue(pendencia.valor) })); })
|
|
56
|
+
.sort(function (a, b) {
|
|
57
|
+
var _a = a.data_ocorrencia.split('/').map(Number), mesA = _a[0], anoA = _a[1];
|
|
58
|
+
var _b = b.data_ocorrencia.split('/').map(Number), mesB = _b[0], anoB = _b[1];
|
|
59
|
+
return anoB - anoA || mesB - mesA;
|
|
45
60
|
});
|
|
46
61
|
}, [response]);
|
|
47
62
|
var pendencias = pendenciasData.filter(function (_a) {
|
|
@@ -87,8 +102,20 @@ var RefinSerasa = function (_a) {
|
|
|
87
102
|
behavior: 'smooth'
|
|
88
103
|
});
|
|
89
104
|
}, [consultaRealizada]);
|
|
90
|
-
var totalPendencias = useMemo(function () {
|
|
91
|
-
|
|
105
|
+
var totalPendencias = useMemo(function () {
|
|
106
|
+
var _a, _b, _c, _d, _e;
|
|
107
|
+
var resumo = (_b = (_a = response === null || response === void 0 ? void 0 : response.document) === null || _a === void 0 ? void 0 : _a.dados) === null || _b === void 0 ? void 0 : _b.resumo;
|
|
108
|
+
return (((_c = resumo === null || resumo === void 0 ? void 0 : resumo.pefin) === null || _c === void 0 ? void 0 : _c.quantidade) || 0) +
|
|
109
|
+
(((_d = resumo === null || resumo === void 0 ? void 0 : resumo.refin) === null || _d === void 0 ? void 0 : _d.quantidade) || 0) +
|
|
110
|
+
(((_e = resumo === null || resumo === void 0 ? void 0 : resumo.pendencias_vencidas) === null || _e === void 0 ? void 0 : _e.quantidade) || 0);
|
|
111
|
+
}, [response === null || response === void 0 ? void 0 : response.document]);
|
|
112
|
+
var valorTotalPendencias = useMemo(function () {
|
|
113
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
114
|
+
var resumo = (_b = (_a = response === null || response === void 0 ? void 0 : response.document) === null || _a === void 0 ? void 0 : _a.dados) === null || _b === void 0 ? void 0 : _b.resumo;
|
|
115
|
+
return (Number((_d = (_c = resumo === null || resumo === void 0 ? void 0 : resumo.pefin) === null || _c === void 0 ? void 0 : _c.valor_total) === null || _d === void 0 ? void 0 : _d.replace('.', '').replace(',', '.')) || 0) +
|
|
116
|
+
(Number((_f = (_e = resumo === null || resumo === void 0 ? void 0 : resumo.refin) === null || _e === void 0 ? void 0 : _e.valor_total) === null || _f === void 0 ? void 0 : _f.replace('.', '').replace(',', '.')) || 0) +
|
|
117
|
+
(Number((_h = (_g = resumo === null || resumo === void 0 ? void 0 : resumo.pendencias_vencidas) === null || _g === void 0 ? void 0 : _g.valor_total) === null || _h === void 0 ? void 0 : _h.replace('.', '').replace(',', '.')) || 0);
|
|
118
|
+
}, [response === null || response === void 0 ? void 0 : response.document]);
|
|
92
119
|
var description = totalPendencias === 0
|
|
93
120
|
? 'Não há ocorrência de Pefin/Refin Serasa'
|
|
94
121
|
: totalPendencias === 1
|
|
@@ -107,21 +134,20 @@ var RefinSerasa = function (_a) {
|
|
|
107
134
|
Section: Section,
|
|
108
135
|
progress: loadingProgress
|
|
109
136
|
}, title: "Pefin/Refin e Contratos Vencidos Serasa", subtitle: "Confira as Pend\u00EAncias Financeiras deste documento", icon: PefinRefinSerasaIcon, description: !error && (React.createElement(StatusMessage, { type: totalPendencias === 0 ? 'default' : 'error' }, description)), variant: totalPendencias === 0 ? 'default' : 'error', onSuccess: function () { return (React.createElement(Result, null, pendencias.map(function (pendencia, i) { return (React.createElement(ResultContent, { key: i, desktop: "repeat(5, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" },
|
|
110
|
-
React.createElement(AddItemField, { name: "Tipo de Ocorr\u00EAncia", value: pendencia.
|
|
111
|
-
React.createElement(AddItemField, { name: "Credor", value: pendencia.
|
|
112
|
-
React.createElement(AddItemField, { name: "Data de Entrada", value: pendencia.
|
|
113
|
-
React.createElement(AddItemField, { name: "
|
|
114
|
-
React.createElement(AddItemField, { name: "
|
|
115
|
-
React.createElement(AddItemField, { name: "
|
|
116
|
-
React.createElement(AddItemField, { name: "
|
|
117
|
-
React.createElement(AddItemField, { name: "
|
|
118
|
-
React.createElement(AddItemField, { name: "Cidade", value: pendencia.cidade }),
|
|
119
|
-
React.createElement(AddItemField, { name: "UF", value: pendencia.uf }),
|
|
120
|
-
React.createElement(AddItemField, { name: "
|
|
121
|
-
React.createElement(AddItemField, { name: "
|
|
122
|
-
React.createElement(AddItemField, { name: "Total
|
|
123
|
-
React.createElement(AddItemField, { name: "
|
|
124
|
-
React.createElement(AddItemField, { name: "Categoria", value: pendencia.categoria }))); }))); }, isError: function (err) { return ({
|
|
137
|
+
React.createElement(AddItemField, { name: "Tipo de Ocorr\u00EAncia", value: pendencia === null || pendencia === void 0 ? void 0 : pendencia.titulo_ocorrencia }),
|
|
138
|
+
React.createElement(AddItemField, { name: "Credor", value: pendencia === null || pendencia === void 0 ? void 0 : pendencia.origem }),
|
|
139
|
+
React.createElement(AddItemField, { name: "Data de Entrada", value: pendencia === null || pendencia === void 0 ? void 0 : pendencia.data_ocorrencia }),
|
|
140
|
+
React.createElement(AddItemField, { name: "Valor", value: formatMoney(pendencia === null || pendencia === void 0 ? void 0 : pendencia.valor) }),
|
|
141
|
+
React.createElement(AddItemField, { name: "N\u00FAmero de Contrato", value: pendencia === null || pendencia === void 0 ? void 0 : pendencia.contrato }),
|
|
142
|
+
React.createElement(AddItemField, { name: "Avalista", value: (pendencia === null || pendencia === void 0 ? void 0 : pendencia.avalista) ? 'Sim' : 'Não' }),
|
|
143
|
+
React.createElement(AddItemField, { name: "Comprador", value: (pendencia === null || pendencia === void 0 ? void 0 : pendencia.comprador) ? 'Sim' : 'Não' }),
|
|
144
|
+
React.createElement(AddItemField, { name: "Fiador", value: (pendencia === null || pendencia === void 0 ? void 0 : pendencia.fiador) ? 'Sim' : 'Não' }),
|
|
145
|
+
React.createElement(AddItemField, { name: "Cidade", value: pendencia === null || pendencia === void 0 ? void 0 : pendencia.cidade }),
|
|
146
|
+
React.createElement(AddItemField, { name: "UF", value: pendencia === null || pendencia === void 0 ? void 0 : pendencia.uf }),
|
|
147
|
+
React.createElement(AddItemField, { name: "Org\u00E3o Emissor", value: "SerasaExperian-Pefin" }),
|
|
148
|
+
React.createElement(AddItemField, { name: "Total de Pend\u00EAncias", value: "1" }),
|
|
149
|
+
React.createElement(AddItemField, { name: "Valor Total", value: formatMoney(pendencia === null || pendencia === void 0 ? void 0 : pendencia.totalvalor) }),
|
|
150
|
+
React.createElement(AddItemField, { name: "Categoria", value: pendencia === null || pendencia === void 0 ? void 0 : pendencia.categoria }))); }))); }, isError: function (err) { return ({
|
|
125
151
|
children: React.createElement(React.Fragment, null),
|
|
126
152
|
description: (React.createElement(StatusMessage, { type: "error" },
|
|
127
153
|
"Erro ao realizar a consulta: ",
|