@credithub/harlan-components 1.92.0 → 1.93.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.
@@ -6,17 +6,21 @@ export declare function useRefinSerasa(documento: string): {
6
6
  pendencias: {
7
7
  valor: string;
8
8
  totalvalor: string;
9
- categoria: string;
10
- avalista: boolean;
11
- comprador: boolean;
12
- fiador: boolean;
9
+ vencimento: string;
10
+ ocorrencia: string;
11
+ entrada: string;
12
+ informante: string;
13
13
  contrato: string;
14
- data_ocorrencia: string;
15
- origem: string;
16
- titulo_ocorrencia: string;
17
- base_origem: string;
14
+ avalista: string;
18
15
  cidade: string;
19
16
  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;
20
24
  }[];
21
25
  consultaRealizada: boolean;
22
26
  loadingProgress: number;
@@ -9,15 +9,6 @@ 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
- };
21
12
  import PefinRefinSerasaIcon from '../../assets/icones/pefinRefinSerasa';
22
13
  import { useGlobalData } from '../../contexts/globalDataContext';
23
14
  import { formatMoney } from '../../utils/number';
@@ -46,18 +37,12 @@ export function useRefinSerasa(documento) {
46
37
  return isNaN(parsed) ? '0' : valorFinal;
47
38
  };
48
39
  var pendenciasData = useMemo(function () {
49
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
50
- if (!response)
51
- return [];
52
- 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' })); })) || [];
53
- 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' })); })) || [];
54
- 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' })); })) || [];
55
- return __spreadArray(__spreadArray(__spreadArray([], pefin, true), refin, true), pendenciasVencidas, true).map(addNoValueContent)
56
- .map(function (pendencia) { return (__assign(__assign({}, pendencia), { valor: clearValue(pendencia.valor), totalvalor: clearValue(pendencia.valor) })); })
57
- .sort(function (a, b) {
58
- var _a = a.data_ocorrencia.split('/').map(Number), mesA = _a[0], anoA = _a[1];
59
- var _b = b.data_ocorrencia.split('/').map(Number), mesB = _b[0], anoB = _b[1];
60
- return anoB - anoA || mesB - mesA;
40
+ var _a, _b, _c;
41
+ return ((response && ((_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.bello)) || [])
42
+ .map(addNoValueContent)
43
+ .map(function (pendencia) {
44
+ var _a;
45
+ return (__assign(__assign({}, pendencia), { valor: clearValue(pendencia.valor), totalvalor: clearValue(pendencia.totalvalor), vencimento: (_a = pendencia === null || pendencia === void 0 ? void 0 : pendencia.vencimento) === null || _a === void 0 ? void 0 : _a.slice(0, 10) }));
61
46
  });
62
47
  }, [response]);
63
48
  var pendencias = pendenciasData.filter(function (_a) {
@@ -103,22 +88,8 @@ var RefinSerasa = function (_a) {
103
88
  behavior: 'smooth'
104
89
  });
105
90
  }, [consultaRealizada]);
106
- var totalPendencias = useMemo(function () {
107
- var _a, _b, _c, _d, _e;
108
- 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;
109
- return ((((_c = resumo === null || resumo === void 0 ? void 0 : resumo.pefin) === null || _c === void 0 ? void 0 : _c.quantidade) || 0) +
110
- (((_d = resumo === null || resumo === void 0 ? void 0 : resumo.refin) === null || _d === void 0 ? void 0 : _d.quantidade) || 0) +
111
- (((_e = resumo === null || resumo === void 0 ? void 0 : resumo.pendencias_vencidas) === null || _e === void 0 ? void 0 : _e.quantidade) || 0));
112
- }, [response === null || response === void 0 ? void 0 : response.document]);
113
- var valorTotalPendencias = useMemo(function () {
114
- var _a, _b, _c, _d, _e, _f, _g, _h;
115
- 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;
116
- 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(/\./g, '').replace(',', '.')) ||
117
- 0) +
118
- (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(/\./g, '').replace(',', '.')) ||
119
- 0) +
120
- (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(/\./g, '').replace(',', '.')) || 0));
121
- }, [response === null || response === void 0 ? void 0 : response.document]);
91
+ 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]);
92
+ 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]);
122
93
  var description = totalPendencias === 0
123
94
  ? 'Não há ocorrência de Pefin/Refin Serasa'
124
95
  : totalPendencias === 1
@@ -136,26 +107,22 @@ var RefinSerasa = function (_a) {
136
107
  refetch: function () { },
137
108
  Section: Section,
138
109
  progress: loadingProgress
139
- }, 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) {
140
- var _a;
141
- return (React.createElement(ResultContent, { key: i, desktop: "repeat(5, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" },
142
- React.createElement(AddItemField, { name: "Tipo de Ocorr\u00EAncia", value: pendencia === null || pendencia === void 0 ? void 0 : pendencia.titulo_ocorrencia }),
143
- React.createElement(AddItemField, { name: "Credor", value: pendencia === null || pendencia === void 0 ? void 0 : pendencia.origem }),
144
- React.createElement(AddItemField, { name: "Data de Entrada", value: pendencia === null || pendencia === void 0 ? void 0 : pendencia.data_ocorrencia }),
145
- React.createElement(AddItemField, { name: "Valor", value: formatMoney(pendencia === null || pendencia === void 0 ? void 0 : pendencia.valor) }),
146
- React.createElement(AddItemField, { name: "N\u00FAmero de Contrato", value: pendencia === null || pendencia === void 0 ? void 0 : pendencia.contrato }),
147
- React.createElement(AddItemField, { name: "Avalista", value: (pendencia === null || pendencia === void 0 ? void 0 : pendencia.avalista) ? 'Sim' : 'Não' }),
148
- React.createElement(AddItemField, { name: "Comprador", value: (pendencia === null || pendencia === void 0 ? void 0 : pendencia.comprador) ? 'Sim' : 'Não' }),
149
- React.createElement(AddItemField, { name: "Fiador", value: (pendencia === null || pendencia === void 0 ? void 0 : pendencia.fiador) ? 'Sim' : 'Não' }),
150
- React.createElement(AddItemField, { name: "Cidade", value: pendencia === null || pendencia === void 0 ? void 0 : pendencia.cidade }),
151
- React.createElement(AddItemField, { name: "UF", value: pendencia === null || pendencia === void 0 ? void 0 : pendencia.uf }),
152
- React.createElement(AddItemField, { name: "Org\u00E3o Emissor", value: ((_a = pendencia === null || pendencia === void 0 ? void 0 : pendencia.base_origem) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'base ii'
153
- ? 'Serasa'
154
- : 'SPC' }),
155
- React.createElement(AddItemField, { name: "Total de Pend\u00EAncias", value: "1" }),
156
- React.createElement(AddItemField, { name: "Valor Total", value: formatMoney(pendencia === null || pendencia === void 0 ? void 0 : pendencia.totalvalor) }),
157
- React.createElement(AddItemField, { name: "Categoria", value: pendencia === null || pendencia === void 0 ? void 0 : pendencia.categoria })));
158
- }))); }, isError: function (err) { return ({
110
+ }, 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" },
111
+ React.createElement(AddItemField, { name: "Tipo de Ocorr\u00EAncia", value: pendencia.ocorrencia }),
112
+ React.createElement(AddItemField, { name: "Credor", value: pendencia.credor }),
113
+ React.createElement(AddItemField, { name: "Data de Entrada", value: pendencia.entrada }),
114
+ React.createElement(AddItemField, { name: "Data de Vencimento", value: pendencia.vencimento }),
115
+ React.createElement(AddItemField, { name: "Valor", value: formatMoney(pendencia.valor) }),
116
+ React.createElement(AddItemField, { name: "Informante", value: pendencia.informante }),
117
+ React.createElement(AddItemField, { name: "N\u00FAmero de Contrato", value: pendencia.contrato }),
118
+ React.createElement(AddItemField, { name: "Avalista", value: pendencia.avalista }),
119
+ React.createElement(AddItemField, { name: "Cidade", value: pendencia.cidade }),
120
+ React.createElement(AddItemField, { name: "UF", value: pendencia.uf }),
121
+ React.createElement(AddItemField, { name: "Situa\u00E7\u00E3o", value: pendencia.situacao }),
122
+ React.createElement(AddItemField, { name: "Org\u00E3o Emissor", value: pendencia.orgaoemissor }),
123
+ React.createElement(AddItemField, { name: "Total de Pend\u00EAncias", value: pendencia.totalpendencias }),
124
+ React.createElement(AddItemField, { name: "Valor Total", value: formatMoney(pendencia.totalvalor) }),
125
+ React.createElement(AddItemField, { name: "Categoria", value: pendencia.categoria }))); }))); }, isError: function (err) { return ({
159
126
  children: React.createElement(React.Fragment, null),
160
127
  description: (React.createElement(StatusMessage, { type: "error" },
161
128
  "Erro ao realizar a consulta: ",