@credithub/harlan-components 1.87.0 → 1.88.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/assets/icones/falenciaIcon.d.ts +8 -0
- package/dist/assets/icones/falenciaIcon.js +21 -0
- package/dist/components/falencia/falencia.d.ts +5 -0
- package/dist/components/falencia/falencia.js +64 -0
- package/dist/components/webservice.d.ts +9 -0
- package/dist/components/webservice.js +2 -1
- package/dist/consultaSimples.d.ts +1 -1
- package/dist/consultaSimples.js +8 -5
- package/lib/cjs/index.js +235 -50
- package/lib/esm/index.js +235 -50
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TrendDown } from 'phosphor-react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useTheme } from 'styled-components';
|
|
4
|
+
/**
|
|
5
|
+
* Ícone TrendDown com círculo colorido, compatível com a
|
|
6
|
+
* API `circleFill` usada pelo Header.
|
|
7
|
+
*/
|
|
8
|
+
var FalenciaIcon = function (_a) {
|
|
9
|
+
var _b = _a.size, size = _b === void 0 ? 30 : _b, _c = _a.className, className = _c === void 0 ? '' : _c, circleFill = _a.circleFill;
|
|
10
|
+
var theme = useTheme();
|
|
11
|
+
var fill = circleFill || theme.colors.azulCredithub;
|
|
12
|
+
var sizeNumber = Number(size);
|
|
13
|
+
// espaço interno para o desenho da seta
|
|
14
|
+
var inner = Math.floor(sizeNumber * 0.6);
|
|
15
|
+
var offset = (sizeNumber - inner) / 2;
|
|
16
|
+
return (React.createElement("svg", { width: sizeNumber, height: sizeNumber, viewBox: "0 0 ".concat(sizeNumber, " ").concat(sizeNumber), className: className, xmlns: "http://www.w3.org/2000/svg" },
|
|
17
|
+
React.createElement("circle", { cx: sizeNumber / 2, cy: sizeNumber / 2, r: sizeNumber / 2, fill: fill }),
|
|
18
|
+
React.createElement("g", { transform: "translate(".concat(offset, " ").concat(offset, ")") },
|
|
19
|
+
React.createElement(TrendDown, { size: inner, color: "white", weight: "bold" }))));
|
|
20
|
+
};
|
|
21
|
+
export default FalenciaIcon;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import FalenciaIcon from '../../assets/icones/falenciaIcon';
|
|
3
|
+
import Section from '../section';
|
|
4
|
+
import { RequestStatus, useQuery } from '../webservice';
|
|
5
|
+
function parseFalencia(document) {
|
|
6
|
+
var _a;
|
|
7
|
+
if (!document)
|
|
8
|
+
return [];
|
|
9
|
+
if (Array.isArray(document)) {
|
|
10
|
+
return document;
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
var raw = (_a = document.textContent) === null || _a === void 0 ? void 0 : _a.trim();
|
|
14
|
+
if (raw) {
|
|
15
|
+
var json = JSON.parse(raw);
|
|
16
|
+
if (Array.isArray(json))
|
|
17
|
+
return json;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
catch (_b) { }
|
|
21
|
+
try {
|
|
22
|
+
var items = document.querySelectorAll('item');
|
|
23
|
+
if (items === null || items === void 0 ? void 0 : items.length) {
|
|
24
|
+
return Array.from(items).map(function (item) {
|
|
25
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
26
|
+
return ({
|
|
27
|
+
title: (_c = (_b = (_a = item.querySelector('title')) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '',
|
|
28
|
+
description: (_e = (_d = item.querySelector('description')) === null || _d === void 0 ? void 0 : _d.textContent) !== null && _e !== void 0 ? _e : '',
|
|
29
|
+
link: (_g = (_f = item.querySelector('link')) === null || _f === void 0 ? void 0 : _f.textContent) !== null && _g !== void 0 ? _g : ''
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (_c) { }
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
var Falencia = function (_a) {
|
|
38
|
+
var documento = _a.documento;
|
|
39
|
+
var _b = useQuery("SELECT FROM 'ValorEconomico'.'Falencia'", { documento: documento }), response = _b.response, error = _b.error, isLoading = _b.isLoading, refetch = _b.refetch;
|
|
40
|
+
var items = useMemo(function () { return parseFalencia(response === null || response === void 0 ? void 0 : response.document); }, [response]);
|
|
41
|
+
var shouldRender = isLoading || items.length > 0;
|
|
42
|
+
if (!shouldRender)
|
|
43
|
+
return null;
|
|
44
|
+
// 🔴 cora a seção de vermelho se houver falência
|
|
45
|
+
var variant = isLoading
|
|
46
|
+
? 'loading'
|
|
47
|
+
: items.length > 0
|
|
48
|
+
? 'error'
|
|
49
|
+
: 'default';
|
|
50
|
+
/** ------------------------------------------------------------
|
|
51
|
+
* ctx precisa ter `Section` e `refetch`
|
|
52
|
+
* ----------------------------------------------------------- */
|
|
53
|
+
var ctx = {
|
|
54
|
+
type: isLoading ? RequestStatus.Loading : RequestStatus.Success,
|
|
55
|
+
error: error,
|
|
56
|
+
document: response === null || response === void 0 ? void 0 : response.document,
|
|
57
|
+
response: response === null || response === void 0 ? void 0 : response.response,
|
|
58
|
+
refetch: refetch, // ← agora existe
|
|
59
|
+
Section: Section // ← pode ser o próprio componente (não é usado)
|
|
60
|
+
};
|
|
61
|
+
// Passa o variant para colorir header/icon de acordo
|
|
62
|
+
return (React.createElement(Section, { title: "Fal\u00EAncias", subtitle: "Movimentos falimentares encontrados.", icon: FalenciaIcon, variant: variant, minimized: false, ctx: ctx }));
|
|
63
|
+
};
|
|
64
|
+
export default Falencia;
|
|
@@ -159,4 +159,13 @@ export declare const Queries: {
|
|
|
159
159
|
urlData?: Client.Form;
|
|
160
160
|
}>>;
|
|
161
161
|
};
|
|
162
|
+
Falencia: React.Context<RequestContext<Document>> & {
|
|
163
|
+
Request: React.FC<React.PropsWithChildren<{
|
|
164
|
+
data?: {
|
|
165
|
+
documento: string;
|
|
166
|
+
} | undefined;
|
|
167
|
+
depends?: RequestContext<unknown>[];
|
|
168
|
+
urlData?: Client.Form;
|
|
169
|
+
}>>;
|
|
170
|
+
};
|
|
162
171
|
};
|
|
@@ -365,5 +365,6 @@ export var Queries = {
|
|
|
365
365
|
LiminarCenprot: query("SELECT FROM 'LIMINAR'.'CENPROT'"),
|
|
366
366
|
ReclameAqui: query("SELECT FROM 'RECLAMEAQUI'.'CONSULTA'"),
|
|
367
367
|
Dominios: query("SELECT FROM 'DOMINIOS'.'CONSULTA'"),
|
|
368
|
-
GraficosAnaliticos: query("SELECT FROM 'DOCUMENTHISTORY'.'BASICHISTORY'")
|
|
368
|
+
GraficosAnaliticos: query("SELECT FROM 'DOCUMENTHISTORY'.'BASICHISTORY'"),
|
|
369
|
+
Falencia: query("SELECT FROM 'ValorEconomico'.'Falencia'")
|
|
369
370
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { PostHog } from 'posthog-js';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { HasCreditsType } from './components/consultasComplementares';
|
|
3
|
-
import { PostHog } from 'posthog-js';
|
|
4
4
|
type ConsultaSimplesPosthog = PostHog;
|
|
5
5
|
type ConsultaSimplesProps = {
|
|
6
6
|
onClickQSA: (cpfCnpj: string) => void;
|
package/dist/consultaSimples.js
CHANGED
|
@@ -6,24 +6,25 @@ import { Chart, registerables } from 'chart.js';
|
|
|
6
6
|
import React, { useContext } from 'react';
|
|
7
7
|
import styled, { ThemeProvider } from 'styled-components';
|
|
8
8
|
import { Addresses, BankAccounts, CCF, ChartSystem, Contacts, DividasPublicas, Dossie, Partners, ProcessosJuridicos, Protestos, Queries, RefinBoaVista, RefinSerasa, useQuery, Veiculos, WebServiceProvider } from './';
|
|
9
|
+
import Modal from './components/common/modal';
|
|
9
10
|
import { ConsultaRfbProvider } from './components/consultaRfb';
|
|
10
11
|
import ConsultaSimplesSection from './components/consultaSimplesSection/consultaSimplesSection';
|
|
11
12
|
import { ConsultasComplementaresProvider } from './components/consultasComplementares';
|
|
12
13
|
import Dominios from './components/dominios/dominios';
|
|
14
|
+
import Falencia from './components/falencia/falencia';
|
|
13
15
|
import ConsultaImoveis from './components/imoveis/imoveisService';
|
|
14
16
|
import Liminar from './components/liminar/liminar';
|
|
15
17
|
import ProtestosSP from './components/protestos/protestosSp';
|
|
18
|
+
import ProtestosPagosBaixados from './components/protestosPagosBaixados';
|
|
16
19
|
import ConsultaScore from './components/score/scoreService';
|
|
17
20
|
import ConsultaScoreSerasa from './components/scoreSerasa/scoreSerasa';
|
|
18
21
|
import ConsultaSCR from './components/scr/scr';
|
|
22
|
+
import { PostHogProvider } from './contexts/PostHogContext';
|
|
19
23
|
import { ErrorModalProvider } from './contexts/errorModalContext';
|
|
20
24
|
import { GlobalDataProvider } from './contexts/globalDataContext';
|
|
25
|
+
import useToggle from './hooks/useToggle';
|
|
21
26
|
import GlobalStyle from './styles/globalStyle';
|
|
22
27
|
import theme from './styles/theme';
|
|
23
|
-
import useToggle from './hooks/useToggle';
|
|
24
|
-
import Modal from './components/common/modal';
|
|
25
|
-
import ProtestosPagosBaixados from './components/protestosPagosBaixados';
|
|
26
|
-
import { PostHogProvider } from './contexts/PostHogContext';
|
|
27
28
|
Chart.register.apply(Chart, registerables);
|
|
28
29
|
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"])));
|
|
29
30
|
var FinderDependency = function (_a) {
|
|
@@ -52,7 +53,8 @@ var HasCreditsVerification = function (_a) {
|
|
|
52
53
|
React.createElement("p", { style: { fontSize: 18 } },
|
|
53
54
|
"Voc\u00EA n\u00E3o possui cr\u00E9ditos para realizar esta consulta.",
|
|
54
55
|
React.createElement("br", null),
|
|
55
|
-
"Para adquirir cr\u00E9ditos, fa\u00E7a recarga no
|
|
56
|
+
"Para adquirir cr\u00E9ditos, fa\u00E7a recarga no",
|
|
57
|
+
' ',
|
|
56
58
|
React.createElement("a", { href: "https://painel.credithub.com.br/?apiKey=".concat(apiKey), target: "_blank", rel: "noopener noreferrer" }, "painel.credithub.com.br"),
|
|
57
59
|
".")));
|
|
58
60
|
};
|
|
@@ -77,6 +79,7 @@ var ConsultaSimples = function (_a) {
|
|
|
77
79
|
React.createElement(ConsultaRfbProvider, { documento: documento },
|
|
78
80
|
React.createElement(Dossie, { documento: documento, printMode: printMode, isFinancial: isFinancial }),
|
|
79
81
|
React.createElement(Liminar, { isFinancial: isFinancial, hasCredits: hasCredits, tags: tags }),
|
|
82
|
+
React.createElement(Falencia, { documento: documento }),
|
|
80
83
|
React.createElement(Addresses, { apiKey: apiKey }),
|
|
81
84
|
React.createElement(Contacts, null),
|
|
82
85
|
React.createElement(Partners, { onClickQSA: onClickQSA })),
|