@credithub/harlan-components 1.40.3 → 1.40.5
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/adresses/addresses.js +1 -1
- package/dist/components/bank-accounts/bank-accounts.js +1 -1
- package/dist/components/ccf/ccf.js +1 -1
- package/dist/components/chart/chartSystem.js +1 -1
- package/dist/components/contacts/contacts.js +1 -1
- package/dist/components/dividasPublicas/dividasPublicas.js +1 -1
- package/dist/components/dominios/dominios.js +1 -1
- package/dist/components/dossie/dossie.js +1 -1
- package/dist/components/dossie/generativeAi/generativeAi.js +17 -10
- package/dist/components/dossie/summary/cardsAndProducts.d.ts +2 -8
- package/dist/components/dossie/summary/cardsAndProducts.js +11 -10
- package/dist/components/imoveis/imoveisService.js +11 -7
- package/dist/components/liminar/liminar.js +1 -1
- package/dist/components/partners/partners.js +5 -3
- package/dist/components/pep/pep.js +1 -1
- package/dist/components/processos-juridicos/processosJuridicos.js +1 -1
- package/dist/components/protestos/protestos.js +1 -1
- package/dist/components/refinBoaVista/refinBoaVista.js +7 -3
- package/dist/components/refinSerasa/refinSerasa.js +7 -3
- package/dist/components/score/scoreService.js +11 -10
- package/dist/components/scr/scr.js +15 -25
- package/dist/components/section.d.ts +4 -2
- package/dist/components/section.js +7 -6
- package/dist/components/veiculos/veiculos.js +12 -11
- package/dist/components/webservice.d.ts +7 -7
- package/dist/components/webservice.js +15 -3
- package/lib/cjs/index.js +147 -120
- package/lib/esm/index.js +148 -121
- package/package.json +1 -1
|
@@ -26,7 +26,7 @@ import React, { useContext, useEffect, useState } from 'react';
|
|
|
26
26
|
import { uniq } from 'underscore';
|
|
27
27
|
import AddItemField from '../common/addItem';
|
|
28
28
|
import { Result, ResultContent } from '../interface/result';
|
|
29
|
-
import
|
|
29
|
+
import Section from '../section';
|
|
30
30
|
import { Queries, RequestStatus } from '../webservice';
|
|
31
31
|
var Addresses = function () {
|
|
32
32
|
var ctx = useContext(Queries.Finder);
|
|
@@ -17,7 +17,7 @@ import { useTheme } from 'styled-components';
|
|
|
17
17
|
import AddItemField from '../common/addItem';
|
|
18
18
|
import { Result, ResultContent } from '../interface/result';
|
|
19
19
|
import StatusMessage from '../interface/statusMessage';
|
|
20
|
-
import
|
|
20
|
+
import Section from '../section';
|
|
21
21
|
import { Queries, RequestStatus } from '../webservice';
|
|
22
22
|
var BankAccounts = function () {
|
|
23
23
|
var ctx = useContext(Queries.Finder);
|
|
@@ -15,7 +15,7 @@ import XPathUtils from '../../utils/xpath';
|
|
|
15
15
|
import React, { useCallback, useContext, useState } from 'react';
|
|
16
16
|
import { Result } from '../interface/result';
|
|
17
17
|
import StatusMessage from '../interface/statusMessage';
|
|
18
|
-
import
|
|
18
|
+
import Section from '../section';
|
|
19
19
|
import { Queries } from '../webservice';
|
|
20
20
|
import CCFList from './ccfList';
|
|
21
21
|
var CCF = function () {
|
|
@@ -21,7 +21,7 @@ import styled from 'styled-components';
|
|
|
21
21
|
import useToggle from '../../hooks/useToggle';
|
|
22
22
|
import { ConsultasComplementaresContext } from '../consultasComplementares';
|
|
23
23
|
import StatusMessage from '../interface/statusMessage';
|
|
24
|
-
import
|
|
24
|
+
import Section from '../section';
|
|
25
25
|
import { RequestStatus } from '../webservice';
|
|
26
26
|
import ChartContent from './chartContent';
|
|
27
27
|
import useChartData, { useDividasPublicas } from './hooks/useChartData';
|
|
@@ -31,7 +31,7 @@ import React, { useCallback, useContext, useEffect } from 'react';
|
|
|
31
31
|
import styled from 'styled-components';
|
|
32
32
|
import Button from '../common/button';
|
|
33
33
|
import { Result, ResultContent } from '../interface/result';
|
|
34
|
-
import
|
|
34
|
+
import Section from '../section';
|
|
35
35
|
import { Queries, RequestStatus } from '../webservice';
|
|
36
36
|
import ContactLikeDislikeSection from './contactLikeDislikeSection';
|
|
37
37
|
export var ContactType;
|
|
@@ -16,7 +16,7 @@ import XPathUtils from '../../utils/xpath';
|
|
|
16
16
|
import React, { useContext, useEffect, useState } from 'react';
|
|
17
17
|
import { Result } from '../interface/result';
|
|
18
18
|
import StatusMessage from '../interface/statusMessage';
|
|
19
|
-
import
|
|
19
|
+
import Section from '../section';
|
|
20
20
|
import { Queries, RequestStatus } from '../webservice';
|
|
21
21
|
import DividasPublicasList from './dividasPublicasList';
|
|
22
22
|
var dividaTypes = [
|
|
@@ -8,7 +8,7 @@ import styled from 'styled-components';
|
|
|
8
8
|
import AddItemField from '../common/addItem';
|
|
9
9
|
import { Result, ResultContent } from '../interface/result';
|
|
10
10
|
import StatusMessage from '../interface/statusMessage';
|
|
11
|
-
import
|
|
11
|
+
import Section from '../section';
|
|
12
12
|
import { Queries } from '../webservice';
|
|
13
13
|
var Link = styled.a(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: inherit;\n text-decoration: none;\n"], ["\n color: inherit;\n text-decoration: none;\n"])));
|
|
14
14
|
var Dominios = function () {
|
|
@@ -20,7 +20,7 @@ import XPathUtils from '../../utils/xpath';
|
|
|
20
20
|
import React, { useContext, useEffect, useState } from 'react';
|
|
21
21
|
import styled from 'styled-components';
|
|
22
22
|
import { ReclameAquiCarousel } from '../reclameAqui/reclameAquiCarousel';
|
|
23
|
-
import
|
|
23
|
+
import Section from '../section';
|
|
24
24
|
import { Queries, RequestStatus } from '../webservice';
|
|
25
25
|
import { Carrousel } from './carrousel/carrousel';
|
|
26
26
|
import { createDossieData } from './dossieData';
|
|
@@ -113,16 +113,25 @@ var GenerativeAI = function (_a) {
|
|
|
113
113
|
var newContent = nonEmptyFragments
|
|
114
114
|
.map(function (e) { return e.message.content; })
|
|
115
115
|
.join('');
|
|
116
|
-
incrementalResponseRef.current
|
|
117
|
-
|
|
116
|
+
incrementalResponseRef.current += newContent;
|
|
117
|
+
setMessageHistory(function (prevMessages) {
|
|
118
|
+
var updatedMessages = __spreadArray([], prevMessages, true);
|
|
119
|
+
var lastMessage = updatedMessages[updatedMessages.length - 1];
|
|
120
|
+
if (lastMessage && lastMessage.role === 'assistant') {
|
|
121
|
+
lastMessage.content = incrementalResponseRef.current;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
updatedMessages.push({
|
|
125
|
+
role: 'assistant',
|
|
126
|
+
content: incrementalResponseRef.current
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return updatedMessages;
|
|
130
|
+
});
|
|
118
131
|
}
|
|
119
132
|
if (response.some(function (e) { return e.done; })) {
|
|
120
|
-
var aiMessage_1 = incrementalResponseRef.current;
|
|
121
|
-
setQueryEnabled(false);
|
|
122
133
|
incrementalResponseRef.current = '';
|
|
123
|
-
|
|
124
|
-
{ role: 'assistant', content: aiMessage_1 }
|
|
125
|
-
], false); });
|
|
134
|
+
setQueryEnabled(false);
|
|
126
135
|
}
|
|
127
136
|
};
|
|
128
137
|
useEffect(function () {
|
|
@@ -153,9 +162,7 @@ var GenerativeAI = function (_a) {
|
|
|
153
162
|
var query = createQueryAndMessages(serializedData, messageHistory);
|
|
154
163
|
return query;
|
|
155
164
|
}, [queryEnabled, serializedData, messageHistory]);
|
|
156
|
-
var _r = useStreamQuery(
|
|
157
|
-
// Trocar endpoint na API
|
|
158
|
-
"SELECT FROM 'LlamaApi'.'Consulta'", queryData, !!queryData), response = _r.response, error = _r.error, isLoading = _r.isLoading, refetch = _r.refetch;
|
|
165
|
+
var _r = useStreamQuery("SELECT FROM 'LlamaApi'.'Consulta'", queryData, !!queryData), response = _r.response, error = _r.error, isLoading = _r.isLoading, refetch = _r.refetch;
|
|
159
166
|
useEffect(function () {
|
|
160
167
|
abortControllerRef.current = new AbortController();
|
|
161
168
|
return function () {
|
|
@@ -6,18 +6,12 @@ declare const useCardsAndProducts: ({ finderResponse, rfbResponse }: {
|
|
|
6
6
|
title: string | false;
|
|
7
7
|
header: string;
|
|
8
8
|
}[];
|
|
9
|
-
products:
|
|
9
|
+
products: {
|
|
10
10
|
title: string;
|
|
11
11
|
onClick: () => Promise<void>;
|
|
12
12
|
price: number;
|
|
13
|
-
isLoading: boolean;
|
|
14
|
-
hide?: undefined;
|
|
15
|
-
} | {
|
|
16
|
-
title: string;
|
|
17
|
-
price: number;
|
|
18
|
-
onClick: () => Promise<void>;
|
|
19
13
|
hide: boolean;
|
|
20
14
|
isLoading: boolean;
|
|
21
|
-
}
|
|
15
|
+
}[];
|
|
22
16
|
};
|
|
23
17
|
export default useCardsAndProducts;
|
|
@@ -51,10 +51,10 @@ import XPathUtils from '../../../utils/xpath';
|
|
|
51
51
|
import { useState } from 'react';
|
|
52
52
|
import { getAtividadesEconomicasSecundarias, getField, getFieldRfb, getProductsPrices } from './utils';
|
|
53
53
|
var useCardsAndProducts = function (_a) {
|
|
54
|
-
var _b, _c, _d, _e, _f;
|
|
54
|
+
var _b, _c, _d, _e, _f, _g;
|
|
55
55
|
var finderResponse = _a.finderResponse, rfbResponse = _a.rfbResponse;
|
|
56
|
-
var
|
|
57
|
-
var
|
|
56
|
+
var _h = useConsultasComplementares(), consultasComplementares = _h.consultasComplementares, setConsultasComplementares = _h.setConsultasComplementares, hasCredits = _h.hasCredits;
|
|
57
|
+
var _j = useState({}), loadingButtons = _j[0], setLoadingButtons = _j[1];
|
|
58
58
|
var isPF = !!getField('cpf', finderResponse);
|
|
59
59
|
var productsPrices = getProductsPrices(isPF);
|
|
60
60
|
var handleOnClick = function (key) {
|
|
@@ -99,7 +99,7 @@ var useCardsAndProducts = function (_a) {
|
|
|
99
99
|
});
|
|
100
100
|
}); };
|
|
101
101
|
};
|
|
102
|
-
var
|
|
102
|
+
var _k = {
|
|
103
103
|
cards: [
|
|
104
104
|
{
|
|
105
105
|
title: getField('sexo', finderResponse, function (value) { return (isPF && (value == 'M' ? 'Masculino' : 'Feminino')) || ''; }),
|
|
@@ -241,45 +241,46 @@ var useCardsAndProducts = function (_a) {
|
|
|
241
241
|
title: 'Consultar SCR',
|
|
242
242
|
onClick: handleOnClick('scr'),
|
|
243
243
|
price: productsPrices === null || productsPrices === void 0 ? void 0 : productsPrices.scr,
|
|
244
|
+
hide: (_b = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.scr) === null || _b === void 0 ? void 0 : _b.consultaRealizada,
|
|
244
245
|
isLoading: loadingButtons['scr']
|
|
245
246
|
},
|
|
246
247
|
{
|
|
247
248
|
title: 'Consultar Veículos',
|
|
248
249
|
price: productsPrices === null || productsPrices === void 0 ? void 0 : productsPrices.veiculos,
|
|
249
250
|
onClick: handleOnClick('veiculos'),
|
|
250
|
-
hide: (
|
|
251
|
+
hide: (_c = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.veiculos) === null || _c === void 0 ? void 0 : _c.consultaRealizada,
|
|
251
252
|
isLoading: loadingButtons['veiculos']
|
|
252
253
|
},
|
|
253
254
|
{
|
|
254
255
|
title: 'Consultar Pefin/Refin Boa Vista',
|
|
255
256
|
price: productsPrices === null || productsPrices === void 0 ? void 0 : productsPrices.refinBoaVista,
|
|
256
257
|
onClick: handleOnClick('refinBoaVista'),
|
|
257
|
-
hide: (
|
|
258
|
+
hide: (_d = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.refinBoaVista) === null || _d === void 0 ? void 0 : _d.consultaRealizada,
|
|
258
259
|
isLoading: loadingButtons['refinBoaVista']
|
|
259
260
|
},
|
|
260
261
|
{
|
|
261
262
|
title: 'Consultar Score Boa Vista',
|
|
262
263
|
price: productsPrices === null || productsPrices === void 0 ? void 0 : productsPrices.scoreBoaVista,
|
|
263
264
|
onClick: handleOnClick('scoreBoaVista'),
|
|
264
|
-
hide: (
|
|
265
|
+
hide: (_e = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.scoreBoaVista) === null || _e === void 0 ? void 0 : _e.consultaRealizada,
|
|
265
266
|
isLoading: loadingButtons['scoreBoaVista']
|
|
266
267
|
},
|
|
267
268
|
{
|
|
268
269
|
title: 'Consultar Pefin/Refin Serasa',
|
|
269
270
|
price: productsPrices === null || productsPrices === void 0 ? void 0 : productsPrices.refinSerasa,
|
|
270
271
|
onClick: handleOnClick('refinSerasa'),
|
|
271
|
-
hide: (
|
|
272
|
+
hide: (_f = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.refinSerasa) === null || _f === void 0 ? void 0 : _f.consultaRealizada,
|
|
272
273
|
isLoading: loadingButtons['refinSerasa']
|
|
273
274
|
},
|
|
274
275
|
{
|
|
275
276
|
title: 'Consultar Imóveis SP Capital',
|
|
276
277
|
price: productsPrices === null || productsPrices === void 0 ? void 0 : productsPrices.imoveis,
|
|
277
278
|
onClick: handleOnClick('imoveis'),
|
|
278
|
-
hide: !isPF || ((
|
|
279
|
+
hide: !isPF || ((_g = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.imoveis) === null || _g === void 0 ? void 0 : _g.consultaRealizada),
|
|
279
280
|
isLoading: loadingButtons['imoveis']
|
|
280
281
|
}
|
|
281
282
|
]
|
|
282
|
-
}, cards =
|
|
283
|
+
}, cards = _k.cards, products = _k.products;
|
|
283
284
|
return { cards: cards, products: products };
|
|
284
285
|
};
|
|
285
286
|
export default useCardsAndProducts;
|
|
@@ -17,7 +17,7 @@ import AddItemField from '../common/addItem';
|
|
|
17
17
|
import { ConsultasComplementaresContext } from '../consultasComplementares';
|
|
18
18
|
import { Result, ResultContent } from '../interface/result';
|
|
19
19
|
import StatusMessage from '../interface/statusMessage';
|
|
20
|
-
import
|
|
20
|
+
import Section from '../section';
|
|
21
21
|
import { RequestStatus, useQuery } from '../webservice';
|
|
22
22
|
var ConsultaImoveis = function (_a) {
|
|
23
23
|
var _b, _c, _d, _e, _f;
|
|
@@ -28,7 +28,7 @@ var ConsultaImoveis = function (_a) {
|
|
|
28
28
|
var _h = useState(false), dataUpdated = _h[0], setDataUpdated = _h[1];
|
|
29
29
|
var iptus = ((_d = response === null || response === void 0 ? void 0 : response.document) === null || _d === void 0 ? void 0 : _d.IPTUS) || [];
|
|
30
30
|
var consultaImoveisRef = useRef(null);
|
|
31
|
-
var
|
|
31
|
+
var consultaRealizada = useMemo(function () {
|
|
32
32
|
var _a, _b;
|
|
33
33
|
return (_b = (_a = consultasComplementaresContext === null || consultasComplementaresContext === void 0 ? void 0 : consultasComplementaresContext.consultasComplementares) === null || _a === void 0 ? void 0 : _a.imoveis) === null || _b === void 0 ? void 0 : _b.consultaRealizada;
|
|
34
34
|
}, [
|
|
@@ -36,17 +36,21 @@ var ConsultaImoveis = function (_a) {
|
|
|
36
36
|
]);
|
|
37
37
|
useEffect(function () {
|
|
38
38
|
var _a;
|
|
39
|
-
(_a = consultaImoveisRef.current) === null || _a === void 0 ? void 0 : _a.
|
|
40
|
-
|
|
39
|
+
var topOffset = ((_a = consultaImoveisRef.current) === null || _a === void 0 ? void 0 : _a.offsetTop) || 0;
|
|
40
|
+
window.scrollTo({
|
|
41
|
+
top: topOffset,
|
|
42
|
+
behavior: 'smooth'
|
|
43
|
+
});
|
|
44
|
+
}, [consultaRealizada]);
|
|
41
45
|
useEffect(function () {
|
|
42
46
|
var _a;
|
|
43
47
|
(_a = consultaImoveisRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
|
|
44
|
-
if (!
|
|
48
|
+
if (!consultaRealizada && response && !dataUpdated) {
|
|
45
49
|
setData(function (prevState) { return (__assign(__assign({}, prevState), { imoveis: response.document })); });
|
|
46
50
|
setDataUpdated(true);
|
|
47
51
|
}
|
|
48
|
-
}, [response, dataUpdated, setData,
|
|
49
|
-
return
|
|
52
|
+
}, [response, dataUpdated, setData, consultaRealizada]);
|
|
53
|
+
return consultaRealizada ? (React.createElement(Section, { ref: consultaImoveisRef, ctx: {
|
|
50
54
|
type: isLoading
|
|
51
55
|
? RequestStatus.Loading
|
|
52
56
|
: error
|
|
@@ -13,7 +13,7 @@ import ProtestosIcon from '../../assets/icones/protestos';
|
|
|
13
13
|
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
14
14
|
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
15
15
|
import StatusMessage from '../interface/statusMessage';
|
|
16
|
-
import
|
|
16
|
+
import Section from '../section';
|
|
17
17
|
import { Queries, RequestStatus } from '../webservice';
|
|
18
18
|
var Liminar = function () {
|
|
19
19
|
var ctx = useContext(Queries.Liminar);
|
|
@@ -37,7 +37,7 @@ import XPathUtils from '../../utils/xpath';
|
|
|
37
37
|
import React, { useContext, useEffect, useState } from 'react';
|
|
38
38
|
import { Result } from '../interface/result';
|
|
39
39
|
import StatusMessage from '../interface/statusMessage';
|
|
40
|
-
import
|
|
40
|
+
import Section from '../section';
|
|
41
41
|
import { Queries, RequestStatus } from '../webservice';
|
|
42
42
|
import PartnerDividasPublicas from './partner-dividas-publicas';
|
|
43
43
|
import PartnerProtestos from './partner-protestos';
|
|
@@ -68,10 +68,12 @@ var Partners = function (_a) {
|
|
|
68
68
|
};
|
|
69
69
|
});
|
|
70
70
|
if (partners_1.length > 0) {
|
|
71
|
-
setData(function (prevState) { return (__assign(__assign({}, prevState), { partners: {
|
|
71
|
+
setData(function (prevState) { return (__assign(__assign({}, prevState), { partners: {
|
|
72
|
+
partners: partners_1 === null || partners_1 === void 0 ? void 0 : partners_1.map(function (_a) {
|
|
72
73
|
var cpf = _a.cpf, partner = __rest(_a, ["cpf"]);
|
|
73
74
|
return partner;
|
|
74
|
-
})
|
|
75
|
+
})
|
|
76
|
+
} })); });
|
|
75
77
|
setDataUpdated(true);
|
|
76
78
|
}
|
|
77
79
|
}
|
|
@@ -14,7 +14,7 @@ import XPathUtils from '../../utils/xpath';
|
|
|
14
14
|
import React, { useContext, useState } from 'react';
|
|
15
15
|
import AddItemField from '../common/addItem';
|
|
16
16
|
import { Result } from '../interface/result';
|
|
17
|
-
import
|
|
17
|
+
import Section from '../section';
|
|
18
18
|
import { Queries } from '../webservice';
|
|
19
19
|
var PessoaPoliticamenteExposta = function () {
|
|
20
20
|
var ctx = useContext(Queries.Finder);
|
|
@@ -13,7 +13,7 @@ import ProcessosJuridicosIcon from '../../assets/icones/processosJuridicos';
|
|
|
13
13
|
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
14
14
|
import React, { useContext, useEffect, useState } from 'react';
|
|
15
15
|
import StatusMessage from '../interface/statusMessage';
|
|
16
|
-
import
|
|
16
|
+
import Section from '../section';
|
|
17
17
|
import { Queries, RequestStatus } from '../webservice';
|
|
18
18
|
import ProcessosJuridicosList from './processosJuridicosList';
|
|
19
19
|
var ProcessosJuridicos = function (_a) {
|
|
@@ -25,7 +25,7 @@ import XPathUtils from '../../utils/xpath';
|
|
|
25
25
|
import React, { useContext, useEffect, useState } from 'react';
|
|
26
26
|
import styled from 'styled-components';
|
|
27
27
|
import StatusMessage from '../interface/statusMessage';
|
|
28
|
-
import
|
|
28
|
+
import Section from '../section';
|
|
29
29
|
import { Queries, RequestStatus } from '../webservice';
|
|
30
30
|
import ProtestosCategory from './protestosCategory';
|
|
31
31
|
import { ProtestoItem } from './protestosList';
|
|
@@ -18,7 +18,7 @@ import AddItemField from '../common/addItem';
|
|
|
18
18
|
import { ConsultasComplementaresContext } from '../consultasComplementares';
|
|
19
19
|
import { Result, ResultContent } from '../interface/result';
|
|
20
20
|
import StatusMessage from '../interface/statusMessage';
|
|
21
|
-
import
|
|
21
|
+
import Section from '../section';
|
|
22
22
|
import { RequestStatus, useQuery } from '../webservice';
|
|
23
23
|
export function useRefinBoaVista(documento) {
|
|
24
24
|
var _a;
|
|
@@ -71,14 +71,18 @@ function RefinBoaVista(_a) {
|
|
|
71
71
|
var _b = useRefinBoaVista(documento), isLoading = _b.isLoading, error = _b.error, pendencias = _b.pendencias, consultaRealizada = _b.consultaRealizada, loadingProgress = _b.loadingProgress;
|
|
72
72
|
useEffect(function () {
|
|
73
73
|
var _a;
|
|
74
|
-
(_a = refinBoaVistaRef.current) === null || _a === void 0 ? void 0 : _a.
|
|
74
|
+
var topOffset = ((_a = refinBoaVistaRef.current) === null || _a === void 0 ? void 0 : _a.offsetTop) || 0;
|
|
75
|
+
window.scrollTo({
|
|
76
|
+
top: topOffset,
|
|
77
|
+
behavior: 'smooth'
|
|
78
|
+
});
|
|
75
79
|
}, [consultaRealizada]);
|
|
76
80
|
var description = pendencias.length
|
|
77
81
|
? "Foram encontrados ".concat(pendencias.length, " ocorr\u00EAncias")
|
|
78
82
|
: 'Não há ocorrência de Pefin/Refin Boa Vista';
|
|
79
83
|
if (!consultaRealizada)
|
|
80
84
|
return null;
|
|
81
|
-
return (React.createElement(Section, { ctx: {
|
|
85
|
+
return (React.createElement(Section, { ref: refinBoaVistaRef, ctx: {
|
|
82
86
|
type: isLoading
|
|
83
87
|
? RequestStatus.Loading
|
|
84
88
|
: error
|
|
@@ -18,7 +18,7 @@ import AddItemField from '../common/addItem';
|
|
|
18
18
|
import { ConsultasComplementaresContext } from '../consultasComplementares';
|
|
19
19
|
import { Result, ResultContent } from '../interface/result';
|
|
20
20
|
import StatusMessage from '../interface/statusMessage';
|
|
21
|
-
import
|
|
21
|
+
import Section from '../section';
|
|
22
22
|
import { RequestStatus, useQuery } from '../webservice';
|
|
23
23
|
export function useRefinSerasa(documento) {
|
|
24
24
|
var _a;
|
|
@@ -80,7 +80,11 @@ var RefinSerasa = function (_a) {
|
|
|
80
80
|
var _b = useRefinSerasa(documento), isLoading = _b.isLoading, error = _b.error, pendencias = _b.pendencias, consultaRealizada = _b.consultaRealizada, loadingProgress = _b.loadingProgress;
|
|
81
81
|
useEffect(function () {
|
|
82
82
|
var _a;
|
|
83
|
-
(_a = refinSerasaRef.current) === null || _a === void 0 ? void 0 : _a.
|
|
83
|
+
var topOffset = ((_a = refinSerasaRef.current) === null || _a === void 0 ? void 0 : _a.offsetTop) || 0;
|
|
84
|
+
window.scrollTo({
|
|
85
|
+
top: topOffset,
|
|
86
|
+
behavior: 'smooth'
|
|
87
|
+
});
|
|
84
88
|
}, [consultaRealizada]);
|
|
85
89
|
var totalPendencias = pendencias.length;
|
|
86
90
|
var valorTotalPendencias = pendencias.reduce(function (acc, curr) { return acc + (parseFloat(curr.valor) || 0); }, 0);
|
|
@@ -89,7 +93,7 @@ var RefinSerasa = function (_a) {
|
|
|
89
93
|
: totalPendencias === 1
|
|
90
94
|
? "Foi encontrada 1 ocorr\u00EAncia no valor de ".concat(formatMoney(valorTotalPendencias))
|
|
91
95
|
: "Foram encontradas ".concat(totalPendencias, " ocorr\u00EAncias no valor total de ").concat(formatMoney(valorTotalPendencias));
|
|
92
|
-
return consultaRealizada ? (React.createElement(Section, { ctx: {
|
|
96
|
+
return consultaRealizada ? (React.createElement(Section, { ref: refinSerasaRef, ctx: {
|
|
93
97
|
type: isLoading
|
|
94
98
|
? RequestStatus.Loading
|
|
95
99
|
: error
|
|
@@ -16,7 +16,7 @@ import AddItemField from '../common/addItem';
|
|
|
16
16
|
import { ConsultasComplementaresContext } from '../consultasComplementares';
|
|
17
17
|
import { Result, ResultContent } from '../interface/result';
|
|
18
18
|
import StatusMessage from '../interface/statusMessage';
|
|
19
|
-
import
|
|
19
|
+
import Section from '../section';
|
|
20
20
|
import { RequestStatus, useQuery } from '../webservice';
|
|
21
21
|
var ConsultaScore = function (_a) {
|
|
22
22
|
var _b, _c, _d, _e, _f;
|
|
@@ -27,7 +27,7 @@ var ConsultaScore = function (_a) {
|
|
|
27
27
|
var _h = useQuery("SELECT FROM 'SPCNet'.'ScoreBoaVista'", { documento: documento }, (_c = (_b = consultasComplementaresContext === null || consultasComplementaresContext === void 0 ? void 0 : consultasComplementaresContext.consultasComplementares) === null || _b === void 0 ? void 0 : _b.scoreBoaVista) === null || _c === void 0 ? void 0 : _c.consultaRealizada), response = _h.response, isLoading = _h.isLoading, error = _h.error, loadingProgress = _h.loadingProgress;
|
|
28
28
|
var scoreData = (_d = response === null || response === void 0 ? void 0 : response.document) === null || _d === void 0 ? void 0 : _d.score[0];
|
|
29
29
|
var scoreRef = useRef(null);
|
|
30
|
-
var
|
|
30
|
+
var consultaRealizada = useMemo(function () {
|
|
31
31
|
var _a, _b;
|
|
32
32
|
return (_b = (_a = consultasComplementaresContext === null || consultasComplementaresContext === void 0 ? void 0 : consultasComplementaresContext.consultasComplementares) === null || _a === void 0 ? void 0 : _a.scoreBoaVista) === null || _b === void 0 ? void 0 : _b.consultaRealizada;
|
|
33
33
|
}, [
|
|
@@ -38,19 +38,20 @@ var ConsultaScore = function (_a) {
|
|
|
38
38
|
: 'Não há informação de score disponível para este documento.';
|
|
39
39
|
useEffect(function () {
|
|
40
40
|
var _a;
|
|
41
|
-
(_a = scoreRef.current) === null || _a === void 0 ? void 0 : _a.
|
|
42
|
-
|
|
41
|
+
var topOffset = ((_a = scoreRef.current) === null || _a === void 0 ? void 0 : _a.offsetTop) || 0;
|
|
42
|
+
window.scrollTo({
|
|
43
|
+
top: topOffset,
|
|
44
|
+
behavior: 'smooth'
|
|
45
|
+
});
|
|
46
|
+
}, [consultaRealizada]);
|
|
43
47
|
useEffect(function () {
|
|
44
|
-
if (!
|
|
45
|
-
!dataUpdated &&
|
|
46
|
-
response &&
|
|
47
|
-
response.document) {
|
|
48
|
+
if (!consultaRealizada && !dataUpdated && response && response.document) {
|
|
48
49
|
var scoreData_1 = { scoreData: response.document.score };
|
|
49
50
|
setData(function (prevState) { return (__assign(__assign({}, prevState), { score: scoreData_1 })); });
|
|
50
51
|
setDataUpdated(true);
|
|
51
52
|
}
|
|
52
|
-
}, [response,
|
|
53
|
-
return
|
|
53
|
+
}, [response, consultaRealizada, dataUpdated, setData]);
|
|
54
|
+
return consultaRealizada ? (React.createElement(Section, { ref: scoreRef, ctx: {
|
|
54
55
|
type: isLoading
|
|
55
56
|
? RequestStatus.Loading
|
|
56
57
|
: error
|
|
@@ -13,17 +13,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
};
|
|
14
14
|
return __assign.apply(this, arguments);
|
|
15
15
|
};
|
|
16
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
17
|
-
var t = {};
|
|
18
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
19
|
-
t[p] = s[p];
|
|
20
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
21
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
22
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
23
|
-
t[p[i]] = s[p[i]];
|
|
24
|
-
}
|
|
25
|
-
return t;
|
|
26
|
-
};
|
|
27
16
|
import ScrIcon from '../../assets/icones/scr';
|
|
28
17
|
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
29
18
|
import useToggle from '../../hooks/useToggle';
|
|
@@ -35,7 +24,7 @@ import Content from '../common/content';
|
|
|
35
24
|
import { ConsultasComplementaresContext } from '../consultasComplementares';
|
|
36
25
|
import { Result, ResultContent } from '../interface/result';
|
|
37
26
|
import StatusMessage from '../interface/statusMessage';
|
|
38
|
-
import
|
|
27
|
+
import Section from '../section';
|
|
39
28
|
import { RequestStatus, useQuery } from '../webservice';
|
|
40
29
|
import getResumoDeCreditos from './getResumoDeCreditos';
|
|
41
30
|
import getResumoDeModalidades from './getResumoDeModalidades';
|
|
@@ -54,20 +43,21 @@ function ConsultaSCR(_a) {
|
|
|
54
43
|
var isOpen = useToggle()[0];
|
|
55
44
|
var scr = (_d = (_c = response === null || response === void 0 ? void 0 : response.document) === null || _c === void 0 ? void 0 : _c.ns2getResumoDoClienteResponse) === null || _d === void 0 ? void 0 : _d.return;
|
|
56
45
|
var scrRef = useRef(null);
|
|
57
|
-
var
|
|
46
|
+
var consultaRealizada = useMemo(function () { var _a; return (_a = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.scr) === null || _a === void 0 ? void 0 : _a.consultaRealizada; }, [(_e = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.scr) === null || _e === void 0 ? void 0 : _e.consultaRealizada]);
|
|
58
47
|
var resumoDeCreditos = (scr && getResumoDeCreditos(scr)) || [];
|
|
59
48
|
var description = scr
|
|
60
49
|
? 'Resumo do Cliente'
|
|
61
50
|
: 'Não há informação disponível para este documento.';
|
|
62
51
|
useEffect(function () {
|
|
63
52
|
var _a;
|
|
64
|
-
(_a = scrRef.current) === null || _a === void 0 ? void 0 : _a.
|
|
65
|
-
|
|
53
|
+
var topOffset = ((_a = scrRef.current) === null || _a === void 0 ? void 0 : _a.offsetTop) || 0;
|
|
54
|
+
window.scrollTo({
|
|
55
|
+
top: topOffset,
|
|
56
|
+
behavior: 'smooth'
|
|
57
|
+
});
|
|
58
|
+
}, [consultaRealizada]);
|
|
66
59
|
useEffect(function () {
|
|
67
|
-
if (!
|
|
68
|
-
!dataUpdated &&
|
|
69
|
-
response &&
|
|
70
|
-
response.document) {
|
|
60
|
+
if (!consultaRealizada && !dataUpdated && response && response.document) {
|
|
71
61
|
setConsultasComplementares &&
|
|
72
62
|
setConsultasComplementares(function (prev) { return (__assign(__assign({}, prev), { scr: __assign(__assign({}, prev.scr), { data: response }) })); });
|
|
73
63
|
var scrData_1 = {
|
|
@@ -76,8 +66,8 @@ function ConsultaSCR(_a) {
|
|
|
76
66
|
setData(function (prevState) { return (__assign(__assign({}, prevState), { scr: scrData_1 })); });
|
|
77
67
|
setDataUpdated(true);
|
|
78
68
|
}
|
|
79
|
-
}, [response,
|
|
80
|
-
return
|
|
69
|
+
}, [response, consultaRealizada, dataUpdated, setData]);
|
|
70
|
+
return consultaRealizada ? (React.createElement(Section, { ref: scrRef, ctx: {
|
|
81
71
|
type: isLoading
|
|
82
72
|
? RequestStatus.Loading
|
|
83
73
|
: error
|
|
@@ -149,11 +139,11 @@ var FluxosDeVencimentosConsolidados = function (_a) {
|
|
|
149
139
|
}); } }));
|
|
150
140
|
};
|
|
151
141
|
var ResumoList = function (_a) {
|
|
152
|
-
var isLoading = _a.isLoading, className = _a.className, error = _a.error, resumos = _a.resumos, loadingProgress = _a.loadingProgress
|
|
142
|
+
var isLoading = _a.isLoading, className = _a.className, error = _a.error, resumos = _a.resumos, loadingProgress = _a.loadingProgress;
|
|
153
143
|
var isOpen = useToggle(true)[0];
|
|
154
144
|
if (!isLoading && !resumos.length)
|
|
155
145
|
return null;
|
|
156
|
-
return (React.createElement(Section,
|
|
146
|
+
return (React.createElement(Section, { ctx: {
|
|
157
147
|
type: isLoading
|
|
158
148
|
? RequestStatus.Loading
|
|
159
149
|
: error
|
|
@@ -165,7 +155,7 @@ var ResumoList = function (_a) {
|
|
|
165
155
|
refetch: function () { },
|
|
166
156
|
Section: Section,
|
|
167
157
|
progress: loadingProgress
|
|
168
|
-
}
|
|
158
|
+
}, icon: ScrIcon, description: !error && (React.createElement(StatusMessage, { type: resumos.length ? 'success' : 'default' }, "Resumo de cr\u00E9ditos dispon\u00EDvel.")), onSuccess: function () { return (React.createElement(Content, { isOpen: isOpen },
|
|
169
159
|
React.createElement(Result, null,
|
|
170
160
|
React.createElement(ResultContent, { desktop: "repeat(4, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" }, resumos.map(function (item, index) { return (React.createElement(AddItemField, { key: "".concat(item.descricao, "-").concat(index), name: item.descricao, value: item.valor })); }))))); }, isError: function (err) { return ({
|
|
171
161
|
children: React.createElement(React.Fragment, null),
|
|
@@ -173,7 +163,7 @@ var ResumoList = function (_a) {
|
|
|
173
163
|
"Erro ao realizar a consulta: ",
|
|
174
164
|
err.message)),
|
|
175
165
|
variant: 'error'
|
|
176
|
-
}); } }))
|
|
166
|
+
}); } }));
|
|
177
167
|
};
|
|
178
168
|
var ResumoModalidades = function (_a) {
|
|
179
169
|
var scr = _a.scr, isLoading = _a.isLoading, error = _a.error, loadingProgress = _a.loadingProgress;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ISectionProps, RequestStatus } from './webservice';
|
|
3
|
+
declare const Section: React.ForwardRefExoticComponent<Omit<ISectionProps<unknown>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
3
4
|
export declare const headerStatus: Record<RequestStatus, string>;
|
|
5
|
+
export default Section;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// No arquivo section.tsx
|
|
1
2
|
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
3
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
4
|
return cooked;
|
|
@@ -25,13 +26,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
25
26
|
return t;
|
|
26
27
|
};
|
|
27
28
|
var _a;
|
|
28
|
-
/* eslint-disable react-hooks/rules-of-hooks */
|
|
29
29
|
import BtnWrapper from '../assets/btn/btnWrapper';
|
|
30
30
|
import ChevronDown from '../assets/btn/chevronDown';
|
|
31
31
|
import ChevronUp from '../assets/btn/chevronUp';
|
|
32
32
|
import useToggle from '../hooks/useToggle';
|
|
33
33
|
import cn from 'classnames';
|
|
34
|
-
import React, { useCallback, useMemo } from 'react';
|
|
34
|
+
import React, { forwardRef, useCallback, useMemo } from 'react';
|
|
35
35
|
import styled from 'styled-components';
|
|
36
36
|
import Button from './common/button';
|
|
37
37
|
import { PrintSectionWrapper } from './common/printSectionWrapper';
|
|
@@ -39,7 +39,7 @@ import Header from './interface/header';
|
|
|
39
39
|
import StatusMessage from './interface/statusMessage';
|
|
40
40
|
import { RequestStatus } from './webservice';
|
|
41
41
|
var ButtonWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n justify-content: center;\n width: 100%;\n height: 40%;\n max-height: 52px;\n max-width: 300px;\n margin: 0 auto;\n"], ["\n justify-content: center;\n width: 100%;\n height: 40%;\n max-height: 52px;\n max-width: 300px;\n margin: 0 auto;\n"])));
|
|
42
|
-
|
|
42
|
+
var Section = forwardRef(function (_a, ref) {
|
|
43
43
|
var onSuccess = _a.onSuccess, _b = _a.isError, isError = _b === void 0 ? function (err, ctx) { return ({
|
|
44
44
|
children: React.createElement(React.Fragment, null),
|
|
45
45
|
description: (React.createElement(React.Fragment, null,
|
|
@@ -77,14 +77,14 @@ export var Section = function (_a) {
|
|
|
77
77
|
if (React.isValidElement(renderedResponse)) {
|
|
78
78
|
return (React.createElement(PrintSectionWrapper, { enabled: !hideHeader },
|
|
79
79
|
!hideHeader && renderHeader(headerProps),
|
|
80
|
-
React.createElement(ShowRenderedChildren, { isOpen: isOpen }, renderedResponse)));
|
|
80
|
+
React.createElement(ShowRenderedChildren, { ref: ref, isOpen: isOpen }, renderedResponse)));
|
|
81
81
|
}
|
|
82
82
|
var _g = (renderedResponse !== null && renderedResponse !== void 0 ? renderedResponse : {}), renderedChildren = _g.children, headerReplaceProps = __rest(_g, ["children"]);
|
|
83
83
|
var unifiedHeaderProps = __assign(__assign(__assign({}, headerProps), headerReplaceProps), { printBar: renderedChildren !== null && isOpen });
|
|
84
84
|
return (React.createElement(PrintSectionWrapper, { enabled: !hideHeader },
|
|
85
85
|
!hideHeader && renderHeader(unifiedHeaderProps),
|
|
86
|
-
React.createElement(ShowRenderedChildren, { isOpen: isOpen }, renderedChildren)));
|
|
87
|
-
};
|
|
86
|
+
React.createElement(ShowRenderedChildren, { ref: ref, isOpen: isOpen }, renderedChildren)));
|
|
87
|
+
});
|
|
88
88
|
var ShowRenderedChildren = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: ", ";\n"], ["\n display: ", ";\n"])), function (props) { return (props.isOpen ? 'block' : 'none'); });
|
|
89
89
|
export var headerStatus = (_a = {},
|
|
90
90
|
_a[RequestStatus === null || RequestStatus === void 0 ? void 0 : RequestStatus.Loading] = 'external-source loading',
|
|
@@ -92,4 +92,5 @@ export var headerStatus = (_a = {},
|
|
|
92
92
|
_a[RequestStatus === null || RequestStatus === void 0 ? void 0 : RequestStatus.Error] = 'external-source error',
|
|
93
93
|
_a[RequestStatus === null || RequestStatus === void 0 ? void 0 : RequestStatus.Empty] = 'external-source error',
|
|
94
94
|
_a);
|
|
95
|
+
export default Section;
|
|
95
96
|
var templateObject_1, templateObject_2;
|