@credithub/harlan-components 1.23.1 → 1.23.2

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.
@@ -20,6 +20,7 @@ import ContactLikeDislikeSection from './contactLikeDislikeSection';
20
20
  import ContatoIcon from '../../assets/icones/contato';
21
21
  import Button from '../common/button';
22
22
  import styled from 'styled-components';
23
+ import { useConsultaRfb } from '../../hooks/useConsultaRfb';
23
24
  export var ContactType;
24
25
  (function (ContactType) {
25
26
  ContactType["TELEFONE"] = "Telefone";
@@ -29,17 +30,24 @@ var BtnWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTempla
29
30
  var Contacts = function (_a) {
30
31
  var onClickConsultarEmail = _a.onClickConsultarEmail;
31
32
  var ctx = useContext(Queries.Finder);
33
+ var rfbResponse = useConsultaRfb().rfbResponse;
32
34
  var Section = ctx.Section;
33
35
  return (React.createElement(Section, { ctx: ctx, title: "Contato", subtitle: "Informa\u00E7\u00F5es de contato do documento pesquisado.", description: "(Telefone, e-mail e outros)", minimized: false, icon: ContatoIcon, onSuccess: function (data) {
36
+ var _a;
34
37
  var document = XPathUtils.select('string(//cpf|//cnpj)', data);
35
38
  var telefones = __spreadArray(__spreadArray([], (XPathUtils.selectArray('//telefones/fixos/fixos', data) || []), true), (XPathUtils.selectArray('//telefones/moveis/moveis', data) || []), true).map(function (telefone) { return ({
36
39
  type: 'Telefone',
37
40
  value: phoneMask(XPathUtils.select('string(./telefone)', telefone))
38
41
  }); });
39
- var emails = XPathUtils.selectArray('//emails/emails', data).map(function (email) { return ({
42
+ var emails = __spreadArray([
43
+ {
44
+ type: 'Email',
45
+ value: (_a = XPathUtils.select('string(//RFB/email)', rfbResponse)) === null || _a === void 0 ? void 0 : _a.toLowerCase()
46
+ }
47
+ ], XPathUtils.selectArray('//emails/emails', data).map(function (email) { return ({
40
48
  type: 'Email',
41
49
  value: XPathUtils.select('string(./email)', email)
42
- }); });
50
+ }); }), true).filter(function (e) { return e.value; });
43
51
  var children = (React.createElement(Result, { resultContentStriped: false },
44
52
  React.createElement(ResultContent, { desktop: "1fr 1fr 1fr", tablet: "1fr 1fr", mobile: "1fr 1fr" }, telefones.map(function (_a, key) {
45
53
  var type = _a.type, value = _a.value;
@@ -1,11 +1,15 @@
1
+ import React from 'react';
1
2
  declare const useCardsAndProducts: ({ finderResponse, rfbResponse }: {
2
3
  finderResponse?: Document | undefined;
3
4
  rfbResponse?: Document | undefined;
4
5
  }) => {
5
- cards: {
6
+ cards: ({
6
7
  title: string | false;
7
8
  header: string;
8
- }[];
9
+ } | {
10
+ title: React.JSX.Element[];
11
+ header: string;
12
+ })[];
9
13
  products: ({
10
14
  title: string;
11
15
  onClick: () => void;
@@ -9,7 +9,8 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { getField, getFieldRfb, getProductsPrices } from './utils';
12
+ import React from 'react';
13
+ import { getAtividadesEconomicasSecundarias, getField, getFieldRfb, getProductsPrices } from './utils';
13
14
  import { useConsultasComplementares } from '../../../hooks/useConsultasComplementares';
14
15
  import { formatMoney } from '../../../utils/number';
15
16
  import XPathUtils from '../../../utils/xpath';
@@ -131,6 +132,13 @@ var useCardsAndProducts = function (_a) {
131
132
  getFieldRfb('atividade-economica', rfbResponse),
132
133
  header: 'Atividade Econômica'
133
134
  },
135
+ {
136
+ title: getAtividadesEconomicasSecundarias(rfbResponse).map(function (e) { return (React.createElement(React.Fragment, null,
137
+ e,
138
+ ".",
139
+ React.createElement("br", null))); }),
140
+ header: 'Atividades Econômicas Secundárias'
141
+ },
134
142
  {
135
143
  title: getField('naturezaJuridica', finderResponse),
136
144
  header: 'Natureza Jurídica'
@@ -1,5 +1,6 @@
1
1
  export declare const getField: (path: string, response?: Document, formatter?: ((value: string | number) => string) | undefined) => string;
2
2
  export declare const getFieldRfb: (path: string, response?: Document | null, formatter?: ((value: string | number) => string) | undefined) => string;
3
+ export declare const getAtividadesEconomicasSecundarias: (response?: Document | null) => string[];
3
4
  export declare const getProductsPrices: (isPF: boolean) => {
4
5
  refinBoaVista: number;
5
6
  scoreBoaVista: number;
@@ -19,6 +19,16 @@ export var getFieldRfb = function (path, response, formatter) {
19
19
  var value = XPathUtils.select("string(".concat(path, ")"), rfb);
20
20
  return formatter ? formatter(value) : value;
21
21
  };
22
+ export var getAtividadesEconomicasSecundarias = function (response) {
23
+ var _a;
24
+ if (!response)
25
+ return [];
26
+ var rfb = (_a = XPathUtils.selectArray('//RFB', response)) === null || _a === void 0 ? void 0 : _a[0];
27
+ if (!rfb)
28
+ return [];
29
+ var values = XPathUtils.selectArray('//atividade-secundaria', rfb);
30
+ return values.map(function (value) { var _a; return (_a = value.firstChild) === null || _a === void 0 ? void 0 : _a.nodeValue; });
31
+ };
22
32
  export var getProductsPrices = function (isPF) { return ({
23
33
  refinBoaVista: isPF ? 1.2 : 2.7,
24
34
  scoreBoaVista: isPF ? 3 : 6,