@credithub/harlan-components 1.84.2 → 1.85.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.
- package/dist/components/dossie/dossie.d.ts +1 -0
- package/dist/components/dossie/dossie.js +17 -8
- package/dist/components/dossie/generativeAi/generativeAi.d.ts +1 -0
- package/dist/components/dossie/generativeAi/generativeAi.js +16 -12
- package/dist/consultaSimples.js +2 -2
- package/dist/utils/isGlobalReady.js +2 -6
- package/lib/cjs/index.js +94 -85
- package/lib/esm/index.js +94 -85
- package/package.json +1 -1
|
@@ -48,19 +48,21 @@ var getCompanyName = function (isPF, finderDoc, rfbDoc) {
|
|
|
48
48
|
'');
|
|
49
49
|
};
|
|
50
50
|
var Dossie = function (_a) {
|
|
51
|
-
var documento = _a.documento, printMode = _a.printMode
|
|
51
|
+
var documento = _a.documento, printMode = _a.printMode, _b = _a.isFinancial // default
|
|
52
|
+
, isFinancial = _b === void 0 ? false : _b // default
|
|
53
|
+
;
|
|
52
54
|
var ctx = useContext(Queries.Finder);
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
+
var _c = useConsultaRfb(), rfbResponse = _c.rfbResponse, updatedOnce = _c.updatedOnce;
|
|
56
|
+
var _d = useGlobalData(), globalData = _d.data, setData = _d.setData;
|
|
55
57
|
var lastDossieRef = useRef();
|
|
56
58
|
// Ref para guardar o status de receita anterior
|
|
57
59
|
var prevReceitaStatusRef = useRef(undefined);
|
|
58
60
|
// Estado para sinalizar que houve mudança relevante no rfbResponse
|
|
59
|
-
var
|
|
61
|
+
var _e = useState(false), refreshQuery = _e[0], setRefreshQuery = _e[1];
|
|
60
62
|
// Consulta ReclameAqui
|
|
61
|
-
var
|
|
63
|
+
var _f = useQuery("SELECT FROM 'RECLAMEAQUI'.'CONSULTA'", {
|
|
62
64
|
documento: documento
|
|
63
|
-
}), reclameAquiResponse =
|
|
65
|
+
}), reclameAquiResponse = _f.response, reclameAquiLoading = _f.isLoading, reclameAquiError = _f.error;
|
|
64
66
|
// Processa os dados do ReclameAqui
|
|
65
67
|
var reclameAquiCompanies = useMemo(function () {
|
|
66
68
|
var _a;
|
|
@@ -133,9 +135,16 @@ var Dossie = function (_a) {
|
|
|
133
135
|
React.createElement(Summary, { finderResponse: data, document: document })),
|
|
134
136
|
React.createElement(TransactionsTable, { events: XPathUtils.select('//historico/consulta', data) || [] })),
|
|
135
137
|
!printMode && (React.createElement(GenerativeAIContainer, null,
|
|
136
|
-
React.createElement(GenerativeAI, { documento: document, refreshQuery: refreshQuery })))));
|
|
138
|
+
React.createElement(GenerativeAI, { documento: document, refreshQuery: refreshQuery, isFinancial: isFinancial })))));
|
|
137
139
|
};
|
|
138
|
-
}, [
|
|
140
|
+
}, [
|
|
141
|
+
documento,
|
|
142
|
+
printMode,
|
|
143
|
+
rfbResponse,
|
|
144
|
+
reclameAquiCompanies,
|
|
145
|
+
refreshQuery,
|
|
146
|
+
isFinancial
|
|
147
|
+
]);
|
|
139
148
|
return (React.createElement(Section, { ctx: ctx, hideHeader: true, minimized: false, isError: function (e) { return response(e); }, onSuccess: response }));
|
|
140
149
|
};
|
|
141
150
|
export default React.memo(Dossie);
|
|
@@ -65,7 +65,7 @@ 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 { isGlobalReady } from '../../../utils/isGlobalReady';
|
|
68
|
+
import { isDocumentHistoryReady, isGlobalReady } from '../../../utils/isGlobalReady';
|
|
69
69
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
70
70
|
import ReactMarkdown from 'react-markdown';
|
|
71
71
|
import remarkGfm from 'remark-gfm';
|
|
@@ -75,22 +75,26 @@ import { createQueryAndMessages } from './queryUtils';
|
|
|
75
75
|
import { BetaTag, ChatInput, ChatInputContainer, Container, ContainerInput, GenerativeAi, Header, HeaderContent, InitialMessageBox, InitialMessageContent, LoadingDots, Message, MessageHistory, SendButton, Title } from './styles';
|
|
76
76
|
var GenerativeAI = function (_a) {
|
|
77
77
|
var _b, _c, _d;
|
|
78
|
-
var documento = _a.documento, refreshQuery = _a.refreshQuery;
|
|
78
|
+
var documento = _a.documento, refreshQuery = _a.refreshQuery, _e = _a.isFinancial, isFinancial = _e === void 0 ? false : _e;
|
|
79
79
|
var globalData = useGlobalData().data;
|
|
80
|
-
var
|
|
81
|
-
var
|
|
82
|
-
var
|
|
83
|
-
var
|
|
84
|
-
var
|
|
80
|
+
var _f = useState('{}'), serializedData = _f[0], setSerializedData = _f[1];
|
|
81
|
+
var _g = useState(''), userInput = _g[0], setUserInput = _g[1];
|
|
82
|
+
var _h = useState([]), messageHistory = _h[0], setMessageHistory = _h[1];
|
|
83
|
+
var _j = useToggle(), isOpen = _j[0], toggleOpen = _j[1];
|
|
84
|
+
var _k = useState('summary'), streamMode = _k[0], setStreamMode = _k[1];
|
|
85
85
|
// Estado para a query de chat (inicia como undefined)
|
|
86
|
-
var
|
|
86
|
+
var _l = useState(undefined), chatQueryData = _l[0], setChatQueryData = _l[1];
|
|
87
87
|
// Estado para forçar o refresh da query summary
|
|
88
|
-
var
|
|
88
|
+
var _m = useState(0), refreshKey = _m[0], setRefreshKey = _m[1];
|
|
89
89
|
// Refs para guardar a última mensagem (evita refetch repetido)
|
|
90
90
|
var lastQueryRef = useRef(null);
|
|
91
91
|
var lastUserMessageRef = useRef(null);
|
|
92
92
|
var messageHistoryRef = useRef(null);
|
|
93
|
-
var isGlobalDataReady = useMemo(function () {
|
|
93
|
+
var isGlobalDataReady = useMemo(function () {
|
|
94
|
+
return isFinancial
|
|
95
|
+
? isGlobalReady(globalData) // clientes financeiros
|
|
96
|
+
: isDocumentHistoryReady(globalData); // demais clientes
|
|
97
|
+
}, [globalData, isFinancial]);
|
|
94
98
|
// Atualiza o payload serializado sempre que os dados globais mudarem
|
|
95
99
|
useEffect(function () {
|
|
96
100
|
if (globalData && documento && isGlobalDataReady) {
|
|
@@ -118,9 +122,9 @@ var GenerativeAI = function (_a) {
|
|
|
118
122
|
return undefined;
|
|
119
123
|
}, [serializedData, streamMode, refreshKey]);
|
|
120
124
|
// Configura a query summary com o hook useStreamQuery
|
|
121
|
-
var
|
|
125
|
+
var _o = useStreamQuery("SELECT FROM 'LlamaApi'.'Consulta'", summaryQueryData, streamMode === 'summary' && !!summaryQueryData), summaryIterator = _o.responseIterator, summaryError = _o.error, summaryLoading = _o.isLoading, refetchSummary = _o.refetch, abortSummary = _o.abort;
|
|
122
126
|
// Configura a query chat
|
|
123
|
-
var
|
|
127
|
+
var _p = useStreamQuery("SELECT FROM 'LlamaApi'.'Consulta'", chatQueryData, streamMode === 'chat' && !!chatQueryData), chatIterator = _p.responseIterator, chatError = _p.error, chatLoading = _p.isLoading, refetchChat = _p.refetch, abortChat = _p.abort;
|
|
124
128
|
// Dispara o refetch inicial quando summaryQueryData estiver definido
|
|
125
129
|
useEffect(function () {
|
|
126
130
|
if (summaryQueryData) {
|
package/dist/consultaSimples.js
CHANGED
|
@@ -12,6 +12,7 @@ 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 ConsultaScoreSerasa from './components/scoreSerasa/scoreSerasa';
|
|
17
18
|
import ConsultaSCR from './components/scr/scr';
|
|
@@ -19,7 +20,6 @@ import { ErrorModalProvider } from './contexts/errorModalContext';
|
|
|
19
20
|
import { GlobalDataProvider } from './contexts/globalDataContext';
|
|
20
21
|
import GlobalStyle from './styles/globalStyle';
|
|
21
22
|
import theme from './styles/theme';
|
|
22
|
-
import ProtestosSP from './components/protestos/protestosSp';
|
|
23
23
|
Chart.register.apply(Chart, registerables);
|
|
24
24
|
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 margin-bottom: 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 margin-bottom: 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"])));
|
|
25
25
|
var FinderDependency = function (_a) {
|
|
@@ -52,7 +52,7 @@ var ConsultaSimples = function (_a) {
|
|
|
52
52
|
React.createElement(GlobalDataProvider, null,
|
|
53
53
|
React.createElement(ConsultaSimplesSection, { documento: documento, onClose: onClose, onClickPrint: onClickPrint, isFinancial: isFinancial },
|
|
54
54
|
React.createElement(ConsultaRfbProvider, { documento: documento },
|
|
55
|
-
React.createElement(Dossie, { documento: documento, printMode: printMode }),
|
|
55
|
+
React.createElement(Dossie, { documento: documento, printMode: printMode, isFinancial: isFinancial }),
|
|
56
56
|
React.createElement(Liminar, { isFinancial: isFinancial, hasCredits: hasCredits, tags: tags }),
|
|
57
57
|
React.createElement(Addresses, { apiKey: apiKey }),
|
|
58
58
|
React.createElement(Contacts, null),
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
export var isGlobalReady = function (g) {
|
|
2
|
-
var _a
|
|
2
|
+
var _a;
|
|
3
3
|
return !!g.documentHistory && // veio do dossiê
|
|
4
|
-
((_a = g.liminar) === null || _a === void 0 ? void 0 : _a.isLoaded)
|
|
5
|
-
((_b = g.processosJuridicosData) === null || _b === void 0 ? void 0 : _b.isLoaded) &&
|
|
6
|
-
((_c = g.protestosData) === null || _c === void 0 ? void 0 : _c.isLoaded) &&
|
|
7
|
-
((_d = g.ccfData) === null || _d === void 0 ? void 0 : _d.isLoaded) &&
|
|
8
|
-
((_e = g.divida) === null || _e === void 0 ? void 0 : _e.isLoaded);
|
|
4
|
+
((_a = g.liminar) === null || _a === void 0 ? void 0 : _a.isLoaded);
|
|
9
5
|
};
|
|
10
6
|
export var areModulesLoaded = function (g) {
|
|
11
7
|
var _a, _b, _c, _d;
|