@credithub/harlan-components 1.40.4 → 1.41.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.
Files changed (29) hide show
  1. package/dist/components/adresses/addresses.js +1 -1
  2. package/dist/components/bank-accounts/bank-accounts.js +1 -1
  3. package/dist/components/ccf/ccf.js +1 -1
  4. package/dist/components/chart/chartSystem.js +1 -1
  5. package/dist/components/consultaSimplesSection/consultaSimplesSection.js +7 -5
  6. package/dist/components/contacts/contacts.js +1 -1
  7. package/dist/components/dividasPublicas/dividasPublicas.js +1 -1
  8. package/dist/components/dominios/dominios.js +1 -1
  9. package/dist/components/dossie/dossie.js +1 -1
  10. package/dist/components/dossie/summary/cardsAndProducts.d.ts +2 -8
  11. package/dist/components/dossie/summary/cardsAndProducts.js +11 -10
  12. package/dist/components/imoveis/imoveisService.js +11 -7
  13. package/dist/components/liminar/liminar.js +1 -1
  14. package/dist/components/partners/partners.js +5 -3
  15. package/dist/components/pep/pep.js +1 -1
  16. package/dist/components/processos-juridicos/processosJuridicos.js +1 -1
  17. package/dist/components/protestos/protestos.js +1 -1
  18. package/dist/components/refinBoaVista/refinBoaVista.js +7 -3
  19. package/dist/components/refinSerasa/refinSerasa.js +7 -3
  20. package/dist/components/score/scoreService.js +11 -10
  21. package/dist/components/scr/scr.js +15 -25
  22. package/dist/components/section.d.ts +4 -2
  23. package/dist/components/section.js +7 -6
  24. package/dist/components/veiculos/veiculos.js +12 -11
  25. package/dist/components/webservice.d.ts +7 -7
  26. package/dist/components/webservice.js +15 -3
  27. package/lib/cjs/index.js +137 -115
  28. package/lib/esm/index.js +138 -116
  29. 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 { Section } from '../section';
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 { Section } from '../section';
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 { Section } from '../section';
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 { Section } from '../section';
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';
@@ -30,7 +30,7 @@ import Section from '../interface/section';
30
30
  import StatusMessage from '../interface/statusMessage';
31
31
  import { Queries, RequestStatus } from '../webservice';
32
32
  var getPossuiPendenciaText = function (_a) {
33
- var ccf = _a.ccf, ultimoRegistroCCF = _a.ultimoRegistroCCF, dividasPublicas = _a.dividasPublicas, protestos = _a.protestos, processosJuridicos = _a.processosJuridicos, receitaStatus = _a.receitaStatus;
33
+ var ccf = _a.ccf, ultimoRegistroCCF = _a.ultimoRegistroCCF, dividasPublicas = _a.dividasPublicas, protestos = _a.protestos, processosJuridicos = _a.processosJuridicos, receitaStatus = _a.receitaStatus, liminar = _a.liminar;
34
34
  return [
35
35
  receitaStatus ? "".concat(receitaStatus) : '',
36
36
  dividasPublicas
@@ -48,11 +48,12 @@ var getPossuiPendenciaText = function (_a) {
48
48
  ? processosJuridicos === 1
49
49
  ? 'Processo Jurídico'
50
50
  : "".concat(processosJuridicos, " Processos Jur\u00EDdicos")
51
- : ''
51
+ : '',
52
+ (liminar === null || liminar === void 0 ? void 0 : liminar.totalProtestos) === 'NADA CONSTA' ? 'Liminar Encontrada' : ''
52
53
  ].filter(function (x) { return !!x; });
53
54
  };
54
55
  var ConsultaSimplesSection = function (_a) {
55
- var _b, _c;
56
+ var _b, _c, _d;
56
57
  var documento = _a.documento, children = _a.children, onClose = _a.onClose, rest = __rest(_a, ["documento", "children", "onClose"]);
57
58
  var ctx = useContext(Queries.Finder);
58
59
  var data = useGlobalData().data;
@@ -64,8 +65,9 @@ var ConsultaSimplesSection = function (_a) {
64
65
  data.protestos ||
65
66
  data.dividasPublicas ||
66
67
  data.processosJuridicos ||
67
- receitaStatus;
68
- var possuiPendenciaText = getPossuiPendenciaText(__assign(__assign({}, data), { receitaStatus: receitaStatus }));
68
+ receitaStatus ||
69
+ ((_d = data.liminar) === null || _d === void 0 ? void 0 : _d.message) === 'Encontrado';
70
+ var possuiPendenciaText = getPossuiPendenciaText(__assign(__assign({}, data), { receitaStatus: receitaStatus, liminar: data.liminar }));
69
71
  var isError = (ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Error;
70
72
  var isLoading = (ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Loading;
71
73
  var statusType = isError
@@ -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 { Section } from '../section';
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 { Section } from '../section';
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 { Section } from '../section';
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 { Section } from '../section';
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';
@@ -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 _g = useConsultasComplementares(), consultasComplementares = _g.consultasComplementares, setConsultasComplementares = _g.setConsultasComplementares, hasCredits = _g.hasCredits;
57
- var _h = useState({}), loadingButtons = _h[0], setLoadingButtons = _h[1];
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 _j = {
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: (_b = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.veiculos) === null || _b === void 0 ? void 0 : _b.consultaRealizada,
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: (_c = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.refinBoaVista) === null || _c === void 0 ? void 0 : _c.consultaRealizada,
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: (_d = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.scoreBoaVista) === null || _d === void 0 ? void 0 : _d.consultaRealizada,
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: (_e = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.refinSerasa) === null || _e === void 0 ? void 0 : _e.consultaRealizada,
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 || ((_f = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.imoveis) === null || _f === void 0 ? void 0 : _f.consultaRealizada),
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 = _j.cards, products = _j.products;
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 { Section } from '../section';
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 consultaImoveisRealizada = useMemo(function () {
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.scrollIntoView();
40
- }, [consultaImoveisRealizada]);
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 (!consultaImoveisRealizada && response && !dataUpdated) {
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, consultaImoveisRealizada]);
49
- return consultaImoveisRealizada ? (React.createElement(Section, { ctx: {
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 { Section } from '../section';
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 { Section } from '../section';
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: { partners: partners_1 === null || partners_1 === void 0 ? void 0 : partners_1.map(function (_a) {
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 { Section } from '../section';
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 { Section } from '../section';
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 { Section } from '../section';
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 { Section } from '../section';
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.scrollIntoView();
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 { Section } from '../section';
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.scrollIntoView();
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 { Section } from '../section';
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 consultaRefinRealizada = useMemo(function () {
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.scrollIntoView();
42
- }, [consultaRefinRealizada]);
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 (!consultaRefinRealizada &&
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, consultaRefinRealizada, dataUpdated, setData]);
53
- return consultaRefinRealizada ? (React.createElement(Section, { ctx: {
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 { Section } from '../section';
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 consultaSCRRealizada = 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]);
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.scrollIntoView();
65
- }, [consultaSCRRealizada]);
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 (!consultaSCRRealizada &&
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, consultaSCRRealizada, dataUpdated, setData]);
80
- return consultaSCRRealizada ? (React.createElement(Section, { ctx: {
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, props = __rest(_a, ["isLoading", "className", "error", "resumos", "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, __assign({ ctx: {
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
- } }, props, { 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 },
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 { ISection, RequestStatus } from './webservice';
2
- export declare const Section: ISection<unknown>;
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
- export var Section = function (_a) {
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;