@credithub/harlan-components 1.50.0 → 1.51.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.
@@ -1,3 +1,14 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
13
  import { normalizeName, similarNames } from '../../../utils/similarNames';
3
14
  import { safeStringify } from './responseUtils';
@@ -109,31 +120,10 @@ export var selectRelevantData = function (data) {
109
120
  // updated_at: processo.updated_at
110
121
  // }));
111
122
  var resumoDaEmpresa = dossie.summary;
112
- var dadosOrganizados = {
113
- protestosDeCredito: protestosDeCredito,
114
- processosJuridicosPassivos: processosPassivos,
115
- chequesSemFundo: chequesSemFundo,
116
- dividasPublicas: dividasPublicas,
117
- contasBancarias: contasBancarias,
118
- dadosDeChequesSemFundo: dadosDeChequesSemFundo,
119
- dividas: dividas,
120
- resumoDaEmpresa: resumoDaEmpresa,
121
- liminar: liminar
122
- ? liminar.totalProtestos === 'NADA CONSTA'
123
- ? 'Indício de Liminar para Ocultar Protestos'
124
- : 'Sem Indício de Liminar'
125
- : undefined,
126
- socios: sociosAnonimizados,
127
- dadosPessoasExpostasPoliticamente: dadosPessoasExpostasPoliticamente,
128
- dadosReclameAqui: dadosReclameAqui,
129
- relatoriosRefinBoaVista: relatoriosRefinBoaVista,
130
- relatoriosRefinSerasa: relatoriosRefinSerasa,
131
- dadosScore: dadosScore,
132
- relatoriosSCR: relatoriosSCR,
133
- registrosDeVeiculos: registrosDeVeiculos,
134
- ResumoDosDados: ResumoDosDados,
135
- tipoPessoa: tipoPessoa
136
- };
123
+ var statusLiminar = (liminar === null || liminar === void 0 ? void 0 : liminar.indiciosDeLiminar)
124
+ ? 'Indício de Liminar para Ocultar Protestos'
125
+ : undefined;
126
+ var dadosOrganizados = __assign(__assign({ protestosDeCredito: protestosDeCredito, processosJuridicosPassivos: processosPassivos, chequesSemFundo: chequesSemFundo, dividasPublicas: dividasPublicas, contasBancarias: contasBancarias, dadosDeChequesSemFundo: dadosDeChequesSemFundo, dividas: dividas, resumoDaEmpresa: resumoDaEmpresa }, (statusLiminar && { liminar: statusLiminar })), { socios: sociosAnonimizados, dadosPessoasExpostasPoliticamente: dadosPessoasExpostasPoliticamente, dadosReclameAqui: dadosReclameAqui, relatoriosRefinBoaVista: relatoriosRefinBoaVista, relatoriosRefinSerasa: relatoriosRefinSerasa, dadosScore: dadosScore, relatoriosSCR: relatoriosSCR, registrosDeVeiculos: registrosDeVeiculos, ResumoDosDados: ResumoDosDados, tipoPessoa: tipoPessoa });
137
127
  var dadosFiltrados = deepCleanData(dadosOrganizados);
138
128
  return {
139
129
  dadosFiltrados: dadosFiltrados
@@ -17,12 +17,12 @@ import StatusMessage from '../interface/statusMessage';
17
17
  import Section from '../section';
18
18
  import { Queries, RequestStatus } from '../webservice';
19
19
  var Liminar = function () {
20
- var ctx = useContext(Queries.Liminar);
20
+ var ctx = useContext(Queries.LiminarCenprot);
21
21
  var _a = useGlobalData(), globalData = _a.data, setData = _a.setData;
22
22
  var _b = useState(false), dataUpdated = _b[0], setDataUpdated = _b[1];
23
23
  var _c = useState(false), hideSection = _c[0], setHideSection = _c[1];
24
24
  useEffect(function () {
25
- var _a, _b, _c, _d, _e, _f, _g;
25
+ var _a, _b, _c, _d, _e, _f;
26
26
  if (!dataUpdated &&
27
27
  ((_a = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _a === void 0 ? void 0 : _a.carousel) &&
28
28
  ((_b = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _b === void 0 ? void 0 : _b.isLoaded)) {
@@ -45,33 +45,24 @@ var Liminar = function () {
45
45
  similarNames(assuntoNormalizado, normalizeName('inclusão indevida em cadastro de inadimplentes')));
46
46
  });
47
47
  });
48
- var possuiLiminar = false;
49
- var totalProtestos = 'NÃO CONSTAM PROTESTOS';
48
+ var indiciosDeLiminar_1 = false;
50
49
  // Se o serviço falhou, logar erro
51
50
  if (ctx.type === RequestStatus.Error) {
52
51
  console.error('Erro na requisição de liminares:', ctx.error || 'Erro desconhecido');
53
52
  }
54
53
  else if (ctx.type === RequestStatus.Success) {
55
- possuiLiminar = ((_f = ctx.document) === null || _f === void 0 ? void 0 : _f.totalProtestos) === 'NADA CONSTA';
56
- totalProtestos =
57
- ((_g = ctx.document) === null || _g === void 0 ? void 0 : _g.totalProtestos) || 'NÃO CONSTAM PROTESTOS';
54
+ indiciosDeLiminar_1 = ((_f = ctx.document) === null || _f === void 0 ? void 0 : _f.indiciosDeLiminar) === true;
58
55
  }
59
56
  var hasLiminarFromProcessos = processosAtivo && processosAtivo.length > 0;
60
- var finalStatus_1 = possuiLiminar || hasLiminarFromProcessos
57
+ var finalStatus_1 = indiciosDeLiminar_1 || hasLiminarFromProcessos
61
58
  ? 'Encontrado'
62
59
  : 'Não encontrado';
63
- setData(function (prevState) {
64
- var _a;
65
- return (__assign(__assign({}, prevState), { liminar: {
66
- totalProtestos: (ctx.type === RequestStatus.Success &&
67
- ((_a = ctx.document) === null || _a === void 0 ? void 0 : _a.totalProtestos)
68
- ? ctx.document.totalProtestos
69
- : 'NÃO CONSTAM PROTESTOS'),
70
- message: finalStatus_1
71
- } }));
72
- });
60
+ setData(function (prevState) { return (__assign(__assign({}, prevState), { liminar: {
61
+ indiciosDeLiminar: indiciosDeLiminar_1,
62
+ message: finalStatus_1
63
+ } })); });
73
64
  setDataUpdated(true);
74
- if (!possuiLiminar && !hasLiminarFromProcessos) {
65
+ if (!indiciosDeLiminar_1 && !hasLiminarFromProcessos) {
75
66
  setHideSection(true);
76
67
  }
77
68
  }
@@ -80,7 +71,7 @@ var Liminar = function () {
80
71
  return null;
81
72
  // Interceptar ctx e substituir por fallback silencioso em caso de erro
82
73
  var fallbackCtx = __assign(__assign({}, ctx), { type: ctx.type === RequestStatus.Error ? RequestStatus.Success : ctx.type, document: ctx.type === RequestStatus.Error
83
- ? { totalProtestos: 'NÃO CONSTAM PROTESTOS' }
74
+ ? { indiciosDeLiminar: false }
84
75
  : ctx.document });
85
76
  return (React.createElement(Section, { title: "Liminares para Remo\u00E7\u00E3o de Protesto", subtitle: "Ind\u00EDcios de liminares para oculta\u00E7\u00E3o de registros.", icon: ProtestosIcon, ctx: fallbackCtx, onSuccess: function (doc) {
86
77
  var _a;
@@ -44,7 +44,7 @@ var Protestos = function () {
44
44
  var total = useMemo(function () {
45
45
  var _a, _b;
46
46
  if ((ctxLiminar === null || ctxLiminar === void 0 ? void 0 : ctxLiminar.type) === RequestStatus.Success)
47
- return ((_b = (_a = ctxLiminar === null || ctxLiminar === void 0 ? void 0 : ctxLiminar.document) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.reduce(function (carry, e) { return carry + Number(e === null || e === void 0 ? void 0 : e[9]); }, 0)) || 0;
47
+ return (((_b = (_a = ctxLiminar === null || ctxLiminar === void 0 ? void 0 : ctxLiminar.document) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.reduce(function (carry, e) { return carry + Number(e === null || e === void 0 ? void 0 : e[9]); }, 0)) || 0);
48
48
  return 0;
49
49
  }, [ctxLiminar === null || ctxLiminar === void 0 ? void 0 : ctxLiminar.type]);
50
50
  useEffect(function () {
@@ -54,7 +54,9 @@ var Protestos = function () {
54
54
  var data = ctx.document;
55
55
  var registrosText = XPathUtils.select('string(//registros)', data);
56
56
  var haveException = /Falha na integra/gi.test(XPathUtils.select('string(//raw)', data));
57
- var registros = haveException ? extractIntegerFromText(registrosText) + total : extractIntegerFromText(registrosText);
57
+ var registros = haveException
58
+ ? extractIntegerFromText(registrosText) + total
59
+ : extractIntegerFromText(registrosText);
58
60
  var filterProtestos = function (regex, data) {
59
61
  return XPathUtils.selectArray('//body//protesto', data).filter(function (protesto) {
60
62
  return regex.test(XPathUtils.select('string(./nomeCedente)', protesto));
@@ -81,7 +83,9 @@ var Protestos = function () {
81
83
  return (React.createElement(Section, { ctx: ctx, title: "Apontamentos na Central de Protestos (CENPROT)", subtitle: "Consulta de protestos de cr\u00E9dito, imposto e gerais.", icon: ProtestosIcon, onSuccess: function (data) {
82
84
  var registrosText = XPathUtils.select('string(//registros)', data);
83
85
  var haveException = /Falha na integra/gi.test(XPathUtils.select('string(//raw)', data));
84
- var registros = haveException ? extractIntegerFromText(registrosText) + total : extractIntegerFromText(registrosText);
86
+ var registros = haveException
87
+ ? extractIntegerFromText(registrosText) + total
88
+ : extractIntegerFromText(registrosText);
85
89
  var protestosDeCredito = XPathUtils.selectArray('//body//protesto', data).filter(function (protesto) {
86
90
  return REGEX_PROTESTOS_DE_CREDITO.test(XPathUtils.select('string(./nomeCedente)', protesto));
87
91
  });
@@ -1,3 +1,3 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  declare const ProtestosSP: React.FC;
3
3
  export default ProtestosSP;
@@ -1,12 +1,12 @@
1
- import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
2
- import { Queries, RequestStatus } from "../webservice";
1
+ import ProtestosIcon from '../../assets/icones/protestos';
2
+ import { useGlobalData } from '../../contexts/globalDataContext';
3
+ import { formatMoney } from '../../utils/number';
4
+ import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
5
+ import AddItemField from '../common/addItem';
6
+ import { ResultContent } from '../interface/result';
7
+ import StatusMessage from '../interface/statusMessage';
3
8
  import Section from '../section';
4
- import ProtestosIcon from "../../assets/icones/protestos";
5
- import StatusMessage from "../interface/statusMessage";
6
- import { useGlobalData } from "../../contexts/globalDataContext";
7
- import { ResultContent } from "../interface/result";
8
- import AddItemField from "../common/addItem";
9
- import { formatMoney } from "../../utils/number";
9
+ import { Queries, RequestStatus } from '../webservice';
10
10
  var ProtestosSP = function () {
11
11
  var ctxLiminar = useContext(Queries.Liminar);
12
12
  var setData = useGlobalData().setData;
@@ -22,10 +22,10 @@ var ProtestosSP = function () {
22
22
  var possuiProtestos = doc.totalProtestos === 'CONSTAM PROTESTOS';
23
23
  var message = possuiProtestos ? 'Encontrado' : 'Não encontrado';
24
24
  /*setData((prevState: GlobalState) => ({
25
- ...prevState,
26
- liminar: { totalProtestos: doc.totalProtestos },
27
- message: message
28
- }));*/
25
+ ...prevState,
26
+ liminar: { totalProtestos: doc.totalProtestos },
27
+ message: message
28
+ }));*/
29
29
  //setDataUpdated(true);
30
30
  if (!possuiProtestos) {
31
31
  setHideSection(true);
@@ -39,24 +39,31 @@ var ProtestosSP = function () {
39
39
  return ['NADA CONSTA', 'CONSTAM PROTESTOS'].includes(((_a = ctxLiminar === null || ctxLiminar === void 0 ? void 0 : ctxLiminar.document) === null || _a === void 0 ? void 0 : _a.totalProtestos) || '');
40
40
  return false;
41
41
  }, [ctxLiminar === null || ctxLiminar === void 0 ? void 0 : ctxLiminar.type]);
42
- return React.createElement(Section, { ctx: ctxLiminar, title: "Protestos SP", subtitle: "Consulta de protestos nos cart\u00F3rios de SP", icon: ProtestosIcon, onSuccess: function (_a) {
42
+ return (React.createElement(Section, { ctx: ctxLiminar, title: "Protestos SP", subtitle: "Consulta de protestos nos cart\u00F3rios de SP", icon: ProtestosIcon, onSuccess: function (_a) {
43
43
  var data = _a.data, totalProtestos = _a.totalProtestos;
44
- var registros = (data === null || data === void 0 ? void 0 : data.reduce(function (carry, cartorio) { return Number(cartorio === null || cartorio === void 0 ? void 0 : cartorio[9]) + carry; }, 0)) || 0;
44
+ var registros = (data === null || data === void 0 ? void 0 : data.reduce(function (carry, cartorio) { return Number(cartorio === null || cartorio === void 0 ? void 0 : cartorio[9]) + carry; }, 0)) ||
45
+ 0;
45
46
  return {
46
47
  children: data === null || data === void 0 ? void 0 : data.map(function (e) {
47
48
  var _a, _b, _c, _d, _e;
48
49
  return (React.createElement(ResultContent, { print: "repeat(7, 1fr)", desktop: "repeat(8, 1fr)", tablet: "repeat(4, 1fr)", mobile: "repeat(2, 1fr)" },
49
50
  React.createElement(AddItemField, { name: "Cartorio", value: e === null || e === void 0 ? void 0 : e[2] }),
50
51
  React.createElement(AddItemField, { name: "Quantidade", value: (_a = e === null || e === void 0 ? void 0 : e[10]) !== null && _a !== void 0 ? _a : e === null || e === void 0 ? void 0 : e[9] }),
51
- React.createElement(AddItemField, { name: "Valor Total", value: formatMoney((_e = (_d = (_c = (_b = e === null || e === void 0 ? void 0 : e[7]) === null || _b === void 0 ? void 0 : _b.match(/[\d,.]+/g)) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.replace('.', "")) === null || _e === void 0 ? void 0 : _e.replace(',', '.')) })));
52
+ React.createElement(AddItemField, { name: "Valor Total", value: formatMoney((_e = (_d = (_c = (_b = e === null || e === void 0 ? void 0 : e[7]) === null || _b === void 0 ? void 0 : _b.match(/[\d,.]+/g)) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.replace('.', '')) === null || _e === void 0 ? void 0 : _e.replace(',', '.')) })));
52
53
  }),
53
- variant: registros || (possuiProtestosSp && !registros) ? 'error' : 'default',
54
- description: (React.createElement(StatusMessage, { type: registros || (possuiProtestosSp && !registros) ? 'error' : 'default' }, possuiProtestosSp && !registros ? 'Existem protestos' : registros
55
- ? registros === 1
56
- ? 'Encontrado um protesto'
57
- : "Encontrados ".concat(registros, " protestos")
58
- : 'Não ocorrência de protesto'))
54
+ variant: registros || (possuiProtestosSp && !registros)
55
+ ? 'error'
56
+ : 'default',
57
+ description: (React.createElement(StatusMessage, { type: registros || (possuiProtestosSp && !registros)
58
+ ? 'error'
59
+ : 'default' }, possuiProtestosSp && !registros
60
+ ? 'Existem protestos'
61
+ : registros
62
+ ? registros === 1
63
+ ? 'Encontrado um protesto'
64
+ : "Encontrados ".concat(registros, " protestos")
65
+ : 'Não há ocorrência de protesto'))
59
66
  };
60
- } });
67
+ } }));
61
68
  };
62
69
  export default ProtestosSP;
@@ -116,6 +116,15 @@ export declare const Queries: {
116
116
  urlData?: Client.Form;
117
117
  }>>;
118
118
  };
119
+ LiminarCenprot: React.Context<RequestContext<LiminarResponse>> & {
120
+ Request: React.FC<React.PropsWithChildren<{
121
+ data?: {
122
+ documento: string;
123
+ } | undefined;
124
+ depends?: RequestContext<unknown>[];
125
+ urlData?: Client.Form;
126
+ }>>;
127
+ };
119
128
  ReclameAqui: React.Context<RequestContext<Document>> & {
120
129
  Request: React.FC<React.PropsWithChildren<{
121
130
  data?: {
@@ -293,6 +293,7 @@ export var Queries = {
293
293
  CCF: query("SELECT FROM 'SEEKLOC'.'CCF'"),
294
294
  ProcessosJuridicos: query("SELECT FROM 'PROCESSOSJURIDICOS'.'PROCESSOS'"),
295
295
  Liminar: query("SELECT FROM 'LIMINAR'.'CONSULTA'"),
296
+ LiminarCenprot: query("SELECT FROM 'LIMINAR'.'CENPROT'"),
296
297
  ReclameAqui: query("SELECT FROM 'RECLAMEAQUI'.'CONSULTA'"),
297
298
  Dominios: query("SELECT FROM 'DOMINIOS'.'CONSULTA'"),
298
299
  GraficosAnaliticos: query("SELECT FROM 'DOCUMENTHISTORY'.'BASICHISTORY'")
@@ -12,12 +12,12 @@ import { ConsultasComplementaresProvider } from './components/consultasComplemen
12
12
  import Dominios from './components/dominios/dominios';
13
13
  import ConsultaImoveis from './components/imoveis/imoveisService';
14
14
  import Liminar from './components/liminar/liminar';
15
+ import ProtestosSP from './components/protestos/protestosSp';
15
16
  import ConsultaScore from './components/score/scoreService';
16
17
  import ConsultaSCR from './components/scr/scr';
17
18
  import { GlobalDataProvider } from './contexts/globalDataContext';
18
19
  import GlobalStyle from './styles/globalStyle';
19
20
  import theme from './styles/theme';
20
- import ProtestosSP from './components/protestos/protestosSp';
21
21
  Chart.register.apply(Chart, registerables);
22
22
  var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: 'Open Sans Condensed';\n display: flex;\n flex-direction: column;\n gap: 20px;\n\n * {\n -webkit-print-color-adjust: exact !important;\n print-color-adjust: exact !important;\n }\n\n @media print {\n @page {\n size: auto;\n margin: 5mm;\n }\n }\n"], ["\n font-family: 'Open Sans Condensed';\n display: flex;\n flex-direction: column;\n gap: 20px;\n\n * {\n -webkit-print-color-adjust: exact !important;\n print-color-adjust: exact !important;\n }\n\n @media print {\n @page {\n size: auto;\n margin: 5mm;\n }\n }\n"])));
23
23
  var FinderDependency = function (_a) {
@@ -37,30 +37,31 @@ var ConsultaSimples = function (_a) {
37
37
  React.createElement(FinderDependency, { documento: documento },
38
38
  React.createElement(Queries.ProcessosJuridicos.Request, { data: { documento: documento } },
39
39
  React.createElement(Queries.Liminar.Request, { data: { documento: documento } },
40
- React.createElement(Wrapper, null,
41
- React.createElement(GlobalDataProvider, null,
42
- React.createElement(ConsultaSimplesSection, { documento: documento, onClose: onClose, onClickPrint: onClickPrint },
43
- React.createElement(ConsultaRfbProvider, { documento: documento },
44
- React.createElement(Dossie, { documento: documento, printMode: printMode }),
45
- React.createElement(Liminar, null),
46
- React.createElement(Addresses, { apiKey: apiKey }),
47
- React.createElement(Contacts, null),
48
- React.createElement(Partners, { onClickQSA: onClickQSA })),
49
- React.createElement(Dominios, null),
50
- React.createElement(BankAccounts, null),
51
- React.createElement(Queries.GraficosAnaliticos.Request, { data: { documento: documento } },
52
- React.createElement(ChartSystem, { documento: documento }),
53
- React.createElement(ConsultaSCR, { documento: documento }),
54
- React.createElement(RefinBoaVista, { documento: documento }),
55
- React.createElement(RefinSerasa, { documento: documento }),
56
- React.createElement(ConsultaScore, { documento: documento }),
57
- React.createElement(ConsultaImoveis, { documento: documento }),
58
- React.createElement(Veiculos, { documento: documento })),
59
- React.createElement(ProtestosSP, null),
60
- React.createElement(Protestos, null),
61
- React.createElement(CCF, null),
62
- React.createElement(DividasPublicas, null),
63
- React.createElement(ProcessosJuridicos, { onClickConsultarProcessoJuridico: onClickConsultarProcessoJuridico }))))))))))),
40
+ React.createElement(Queries.LiminarCenprot.Request, { data: { documento: documento } },
41
+ React.createElement(Wrapper, null,
42
+ React.createElement(GlobalDataProvider, null,
43
+ React.createElement(ConsultaSimplesSection, { documento: documento, onClose: onClose, onClickPrint: onClickPrint },
44
+ React.createElement(ConsultaRfbProvider, { documento: documento },
45
+ React.createElement(Dossie, { documento: documento, printMode: printMode }),
46
+ React.createElement(Liminar, null),
47
+ React.createElement(Addresses, { apiKey: apiKey }),
48
+ React.createElement(Contacts, null),
49
+ React.createElement(Partners, { onClickQSA: onClickQSA })),
50
+ React.createElement(Dominios, null),
51
+ React.createElement(BankAccounts, null),
52
+ React.createElement(Queries.GraficosAnaliticos.Request, { data: { documento: documento } },
53
+ React.createElement(ChartSystem, { documento: documento }),
54
+ React.createElement(ConsultaSCR, { documento: documento }),
55
+ React.createElement(RefinBoaVista, { documento: documento }),
56
+ React.createElement(RefinSerasa, { documento: documento }),
57
+ React.createElement(ConsultaScore, { documento: documento }),
58
+ React.createElement(ConsultaImoveis, { documento: documento }),
59
+ React.createElement(Veiculos, { documento: documento })),
60
+ React.createElement(ProtestosSP, null),
61
+ React.createElement(Protestos, null),
62
+ React.createElement(CCF, null),
63
+ React.createElement(DividasPublicas, null),
64
+ React.createElement(ProcessosJuridicos, { onClickConsultarProcessoJuridico: onClickConsultarProcessoJuridico })))))))))))),
64
65
  React.createElement(GlobalStyle, null)));
65
66
  };
66
67
  export default ConsultaSimples;