@credithub/harlan-components 1.86.1 → 1.86.3

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.
@@ -39,7 +39,7 @@ var spin = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObjec
39
39
  // Componente Spinner sutil
40
40
  var Spinner = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border: 1px solid rgba(0, 0, 0, 0.1);\n border-left-color: #222;\n border-radius: 50%;\n width: 9px;\n height: 9px;\n animation: ", " 1s linear infinite;\n margin-right: 8px;\n display: inline-block;\n vertical-align: middle;\n"], ["\n border: 1px solid rgba(0, 0, 0, 0.1);\n border-left-color: #222;\n border-radius: 50%;\n width: 9px;\n height: 9px;\n animation: ", " 1s linear infinite;\n margin-right: 8px;\n display: inline-block;\n vertical-align: middle;\n"])), spin);
41
41
  var ConsultaSimplesSection = function (_a) {
42
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
42
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
43
43
  var documento = _a.documento, children = _a.children, onClose = _a.onClose, isFinancial = _a.isFinancial, rest = __rest(_a, ["documento", "children", "onClose", "isFinancial"]);
44
44
  var ctx = useContext(Queries.Finder);
45
45
  var data = useGlobalData().data;
@@ -84,17 +84,18 @@ var ConsultaSimplesSection = function (_a) {
84
84
  ? "".concat(data.processosJuridicos, " ").concat(data.processosJuridicos === 1 ? 'Processo Jurídico' : 'Processos Jurídicos')
85
85
  : '',
86
86
  loaded: (_l = (_k = data.processosJuridicosData) === null || _k === void 0 ? void 0 : _k.isLoaded) !== null && _l !== void 0 ? _l : false
87
- },
88
- {
89
- label: 'Liminar',
90
- text: data.liminar &&
91
- (data.liminar.totalProtestos === 'NADA CONSTA' ||
92
- data.liminar.message === 'Encontrado')
93
- ? 'Indício de Liminar'
94
- : '',
95
- loaded: (_o = (_m = data.liminar) === null || _m === void 0 ? void 0 : _m.isLoaded) !== null && _o !== void 0 ? _o : false
96
87
  }
97
- ].filter(function (e) { return e.label === 'Liminar' ? isFinancial : e; });
88
+ // {
89
+ // label: 'Liminar',
90
+ // text:
91
+ // data.liminar &&
92
+ // (data.liminar.totalProtestos === 'NADA CONSTA' ||
93
+ // data.liminar.message === 'Encontrado')
94
+ // ? 'Indício de Liminar'
95
+ // : '',
96
+ // loaded: data.liminar?.isLoaded ?? false
97
+ // }
98
+ ].filter(function (e) { return (e.label === 'Liminar' ? isFinancial : e); });
98
99
  var isError = (ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Error;
99
100
  var isLoading = (ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Loading;
100
101
  var hasPendencias = data.ccf ||
@@ -102,12 +103,8 @@ var ConsultaSimplesSection = function (_a) {
102
103
  data.dividasPublicas ||
103
104
  data.processosJuridicos ||
104
105
  receitaStatus ||
105
- ((_p = data.liminar) === null || _p === void 0 ? void 0 : _p.message) === 'Encontrado';
106
- var statusType = isError
107
- ? 'warning'
108
- : hasPendencias
109
- ? 'error'
110
- : 'success';
106
+ ((_m = data.liminar) === null || _m === void 0 ? void 0 : _m.message) === 'Encontrado';
107
+ var statusType = isError ? 'warning' : hasPendencias ? 'error' : 'success';
111
108
  return (React.createElement(Section, __assign({ title: "Consulta Simples", subtitle: "Consulta de informa\u00E7\u00F5es do documento.", description: React.createElement(React.Fragment, null,
112
109
  React.createElement(StatusMessage, null, format(new Date(), "dd/MM/yyyy 'às' HH:mm")),
113
110
  React.createElement(StatusMessage, { type: "found" }, formatDocument(documento)),
@@ -65,7 +65,6 @@ import StatusMessage from '../../../components/interface/statusMessage';
65
65
  import { useStreamQuery } from '../../../components/streamQuery';
66
66
  import { useGlobalData } from '../../../contexts/globalDataContext';
67
67
  import useToggle from '../../../hooks/useToggle';
68
- import { isDocumentHistoryReady, isGlobalReady } from '../../../utils/isGlobalReady';
69
68
  import React, { useEffect, useMemo, useRef, useState } from 'react';
70
69
  import ReactMarkdown from 'react-markdown';
71
70
  import remarkGfm from 'remark-gfm';
@@ -90,11 +89,14 @@ var GenerativeAI = function (_a) {
90
89
  var lastQueryRef = useRef(null);
91
90
  var lastUserMessageRef = useRef(null);
92
91
  var messageHistoryRef = useRef(null);
92
+ // const isGlobalDataReady = useMemo(() => {
93
+ // return isFinancial
94
+ // ? isGlobalReady(globalData) // clientes financeiros
95
+ // : isDocumentHistoryReady(globalData); // demais clientes
96
+ // }, [globalData, isFinancial]);
93
97
  var isGlobalDataReady = useMemo(function () {
94
- return isFinancial
95
- ? isGlobalReady(globalData) // clientes financeiros
96
- : isDocumentHistoryReady(globalData); // demais clientes
97
- }, [globalData, isFinancial]);
98
+ return !!globalData.documentHistory; // verificação direta
99
+ }, [globalData]);
98
100
  // Atualiza o payload serializado sempre que os dados globais mudarem
99
101
  useEffect(function () {
100
102
  if (globalData && documento && isGlobalDataReady) {
@@ -11,6 +11,8 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import ScoreBoaVistaIcon from '../../assets/icones/scoreBoaVista';
13
13
  import { useGlobalData } from '../../contexts/globalDataContext';
14
+ import { useSafeQuery } from '../../hooks/useSafeQuery';
15
+ import { isDocumentoPF } from '../../utils/string';
14
16
  import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
15
17
  import AddItemField from '../common/addItem';
16
18
  import { ConsultasComplementaresContext } from '../consultasComplementares';
@@ -18,8 +20,12 @@ import { Result, ResultContent } from '../interface/result';
18
20
  import StatusMessage from '../interface/statusMessage';
19
21
  import Section from '../section';
20
22
  import { RequestStatus } from '../webservice';
21
- import { isDocumentoPF } from '../../utils/string';
22
- import { useSafeQuery } from '../../hooks/useSafeQuery';
23
+ var parseProb = function (raw) {
24
+ if (raw === null || raw === undefined)
25
+ return 0;
26
+ var str = String(raw).replace(',', '.');
27
+ return Number(str) || 0;
28
+ };
23
29
  var ConsultaScoreSerasa = function (_a) {
24
30
  var _b, _c, _d, _e, _f, _g, _h;
25
31
  var documento = _a.documento;
@@ -66,11 +72,11 @@ var ConsultaScoreSerasa = function (_a) {
66
72
  Section: Section,
67
73
  progress: loadingProgress
68
74
  }, title: "Score Serasa", subtitle: "Consulta de Score", icon: ScoreBoaVistaIcon, description: !error && (React.createElement(StatusMessage, { type: scoreData ? 'success' : 'default' }, description)), onSuccess: function () {
69
- var _a, _b, _c, _d;
75
+ var _a, _b, _c;
70
76
  return (React.createElement(Result, null, scoreData && (React.createElement(ResultContent, { desktop: "repeat(4, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" },
71
77
  React.createElement(AddItemField, { name: "Score", value: String((_a = scoreData.score) === null || _a === void 0 ? void 0 : _a.pontuacao) }),
72
- React.createElement(AddItemField, { name: "Probabilidade de Inadimpl\u00EAncia", value: "".concat((_b = scoreData.score) === null || _b === void 0 ? void 0 : _b.probabilidade_inadimplencia, "%") }),
73
- React.createElement(AddItemField, { name: "An\u00E1lise", value: "\n DE CADA 100 ".concat(isDocumentoPF(documento) ? 'PESSOAS' : 'EMPRESAS', " \n CLASSIFICADAS NESTA CLASSE DE SCORE, \u00C9 PROV\u00C1VEL QUE \n ").concat(Math.floor(Number((_d = (_c = scoreData.score) === null || _c === void 0 ? void 0 : _c.probabilidade_inadimplencia) === null || _d === void 0 ? void 0 : _d.replace(',', '.'))), " APRESENTEM D\u00C9BITOS NO MERCADO NOS PR\u00D3XIMOS 6 MESES.") })))));
78
+ React.createElement(AddItemField, { name: "Probabilidade de Inadimpl\u00EAncia", value: "".concat(parseProb((_b = scoreData.score) === null || _b === void 0 ? void 0 : _b.probabilidade_inadimplencia), "%") }),
79
+ React.createElement(AddItemField, { name: "An\u00E1lise", value: "\n DE CADA 100 ".concat(isDocumentoPF(documento) ? 'PESSOAS' : 'EMPRESAS', "\n CLASSIFICADAS NESTA CLASSE DE SCORE, \u00C9 PROV\u00C1VEL QUE\n ").concat(Math.floor(parseProb((_c = scoreData.score) === null || _c === void 0 ? void 0 : _c.probabilidade_inadimplencia)), " APRESENTEM D\u00C9BITOS NO MERCADO NOS PR\u00D3XIMOS 6 MESES.") })))));
74
80
  }, isError: function (err) { return ({
75
81
  children: React.createElement(React.Fragment, null),
76
82
  description: (React.createElement(StatusMessage, { type: "error" },
@@ -11,7 +11,6 @@ import ConsultaSimplesSection from './components/consultaSimplesSection/consulta
11
11
  import { ConsultasComplementaresProvider } from './components/consultasComplementares';
12
12
  import Dominios from './components/dominios/dominios';
13
13
  import ConsultaImoveis from './components/imoveis/imoveisService';
14
- import Liminar from './components/liminar/liminar';
15
14
  import ProtestosSP from './components/protestos/protestosSp';
16
15
  import ConsultaScore from './components/score/scoreService';
17
16
  import ConsultaScoreSerasa from './components/scoreSerasa/scoreSerasa';
@@ -73,7 +72,6 @@ var ConsultaSimples = function (_a) {
73
72
  React.createElement(ConsultaSimplesSection, { documento: documento, onClose: onClose, onClickPrint: onClickPrint, isFinancial: isFinancial },
74
73
  React.createElement(ConsultaRfbProvider, { documento: documento },
75
74
  React.createElement(Dossie, { documento: documento, printMode: printMode, isFinancial: isFinancial }),
76
- React.createElement(Liminar, { isFinancial: isFinancial, hasCredits: hasCredits, tags: tags }),
77
75
  React.createElement(Addresses, { apiKey: apiKey }),
78
76
  React.createElement(Contacts, null),
79
77
  React.createElement(Partners, { onClickQSA: onClickQSA })),