@credithub/harlan-components 1.58.3 → 1.59.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.
@@ -6,7 +6,7 @@ export var ConsultaRfbProvider = function (_a) {
6
6
  var _b, _c, _d, _e;
7
7
  var children = _a.children, documento = _a.documento;
8
8
  var _f = useState(false), enableFallback = _f[0], setEnableFallback = _f[1];
9
- var query = useQuery("SELECT FROM 'RFB'.'CERTIDAO'", { documento: documento }, documento.length > 11);
9
+ var query = useQuery("SELECT FROM 'RFB'.'CERTIDAO'", { documento: documento });
10
10
  var queryFallback = useQuery("SELECT FROM 'RECEITAWS'.'CNPJ'", { documento: documento }, enableFallback);
11
11
  var executeFallback = function () { return setEnableFallback(true); };
12
12
  useEffect(function () {
@@ -69,7 +69,7 @@ var Dossie = function (_a) {
69
69
  React.createElement(DossieContainer, null,
70
70
  React.createElement(DossieContent, null,
71
71
  React.createElement(DossieCarrousel, null),
72
- React.createElement(Summary, { finderResponse: data, rfbResponse: rfbResponse, document: document })),
72
+ React.createElement(Summary, { finderResponse: data, document: document })),
73
73
  React.createElement(TransactionsTable, { events: XPathUtils.select('//historico/consulta', data) || [] })),
74
74
  !printMode && (React.createElement(GenerativeAIContainer, null,
75
75
  React.createElement(GenerativeAI, { documento: document })))));
@@ -1,11 +1,14 @@
1
- declare const useCardsAndProducts: ({ finderResponse, rfbResponse }: {
1
+ import React from 'react';
2
+ declare const useCardsAndProducts: ({ finderResponse, }: {
2
3
  finderResponse?: Document;
3
- rfbResponse?: Document;
4
4
  }) => {
5
- cards: {
5
+ cards: ({
6
6
  title: string | false;
7
7
  header: string;
8
- }[];
8
+ } | {
9
+ title: string | React.JSX.Element;
10
+ header: string;
11
+ })[];
9
12
  products: {
10
13
  title: string;
11
14
  onClick: () => Promise<void>;
@@ -45,17 +45,21 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
+ import React from 'react';
48
49
  import { useConsultasComplementares } from '../../../hooks/useConsultasComplementares';
49
50
  import { formatMoney } from '../../../utils/number';
50
51
  import XPathUtils from '../../../utils/xpath';
51
52
  import { useState } from 'react';
52
53
  import { getAtividadesEconomicasSecundarias, getField, getFieldRfb, getProductsPrices } from './utils';
54
+ import { useConsultaRfb } from '../../../hooks/useConsultaRfb';
55
+ import { LoadingDots } from '../generativeAi/styles';
53
56
  var useCardsAndProducts = function (_a) {
54
57
  var _b, _c, _d, _e, _f;
55
- var finderResponse = _a.finderResponse, rfbResponse = _a.rfbResponse;
56
- var _g = useState(false), isModalOpen = _g[0], setModalOpen = _g[1];
57
- var _h = useConsultasComplementares(), consultasComplementares = _h.consultasComplementares, setConsultasComplementares = _h.setConsultasComplementares, hasCredits = _h.hasCredits;
58
- var _j = useState({}), loadingButtons = _j[0], setLoadingButtons = _j[1];
58
+ var finderResponse = _a.finderResponse;
59
+ var _g = useConsultaRfb(), rfbResponse = _g.rfbResponse, rfbIsLoading = _g.isLoading;
60
+ var _h = useState(false), isModalOpen = _h[0], setModalOpen = _h[1];
61
+ var _j = useConsultasComplementares(), consultasComplementares = _j.consultasComplementares, setConsultasComplementares = _j.setConsultasComplementares, hasCredits = _j.hasCredits;
62
+ var _k = useState({}), loadingButtons = _k[0], setLoadingButtons = _k[1];
59
63
  var handleModalClick = function () { return setModalOpen(true); };
60
64
  var closeModal = function () { return setModalOpen(false); };
61
65
  var isPF = !!getField('cpf', finderResponse);
@@ -102,7 +106,7 @@ var useCardsAndProducts = function (_a) {
102
106
  });
103
107
  }); };
104
108
  };
105
- var _k = {
109
+ var _l = {
106
110
  cards: [
107
111
  {
108
112
  title: getField('sexo', finderResponse, function (value) {
@@ -141,7 +145,7 @@ var useCardsAndProducts = function (_a) {
141
145
  header: 'UF do RG'
142
146
  },
143
147
  {
144
- title: getField('status', finderResponse),
148
+ title: rfbIsLoading ? React.createElement(LoadingDots, null) : getFieldRfb('situacao', rfbResponse) || getField('status', finderResponse),
145
149
  header: 'Situação'
146
150
  },
147
151
  {
@@ -291,7 +295,7 @@ var useCardsAndProducts = function (_a) {
291
295
  isLoading: loadingButtons['imoveis']
292
296
  }*/
293
297
  ]
294
- }, cards = _k.cards, products = _k.products;
298
+ }, cards = _l.cards, products = _l.products;
295
299
  return { cards: cards, products: products, isModalOpen: isModalOpen, closeModal: closeModal };
296
300
  };
297
301
  export default useCardsAndProducts;
@@ -12,7 +12,6 @@ export type CardsAndProducts = {
12
12
  };
13
13
  interface SummaryProps {
14
14
  finderResponse?: Document;
15
- rfbResponse?: Document;
16
15
  document: string;
17
16
  }
18
17
  export declare const Summary: React.FC<SummaryProps>;
@@ -6,10 +6,9 @@ import React from 'react';
6
6
  import useCardsAndProducts from './cardsAndProducts';
7
7
  import { ButtonsSummary, ButtonsWrapper, ContainerSummary, ContentSummary, FieldSummary, Spinner, SummaryButton } from './styles';
8
8
  export var Summary = function (_a) {
9
- var finderResponse = _a.finderResponse, rfbResponse = _a.rfbResponse;
9
+ var finderResponse = _a.finderResponse;
10
10
  var _b = useCardsAndProducts({
11
11
  finderResponse: finderResponse,
12
- rfbResponse: rfbResponse
13
12
  }), cards = _b.cards, products = _b.products, isModalOpen = _b.isModalOpen, closeModal = _b.closeModal;
14
13
  return (React.createElement(React.Fragment, null,
15
14
  React.createElement(ContainerSummary, { className: "credithub-container-summary" },