@credithub/harlan-components 1.2.0 → 1.3.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/lib/cjs/components/adresses/adresses.js +1 -1
- package/lib/cjs/components/adresses/getGeocode.js +15 -16
- package/lib/cjs/components/bank-accounts/bank-accounts.d.ts +1 -1
- package/lib/cjs/components/bank-accounts/bank-accounts.js +8 -10
- package/lib/cjs/components/ccf/ccf.d.ts +2 -5
- package/lib/cjs/components/ccf/ccf.js +59 -22
- package/lib/cjs/components/ccf/ccfList.d.ts +1 -2
- package/lib/cjs/components/ccf/ccfList.js +2 -3
- package/lib/cjs/components/contacts/contactLikeDislikeSection.d.ts +8 -0
- package/lib/cjs/components/contacts/contactLikeDislikeSection.js +89 -0
- package/lib/cjs/components/contacts/contacts.d.ts +6 -2
- package/lib/cjs/components/contacts/contacts.js +15 -12
- package/lib/cjs/components/dossie/dossie.d.ts +1 -1
- package/lib/cjs/components/dossie/dossie.js +9 -5
- package/lib/cjs/components/interface/loading.d.ts +2 -0
- package/lib/cjs/components/interface/loading.js +14 -0
- package/lib/cjs/components/interface/section.js +1 -1
- package/lib/cjs/components/partners/partner-dividas-publicas.d.ts +5 -0
- package/lib/cjs/components/partners/partner-dividas-publicas.js +15 -0
- package/lib/cjs/components/partners/partner-protestos.d.ts +5 -0
- package/lib/cjs/components/partners/partner-protestos.js +15 -0
- package/lib/cjs/components/partners/partner-rfb-status.d.ts +5 -0
- package/lib/cjs/components/partners/partner-rfb-status.js +15 -0
- package/lib/cjs/components/partners/partnerList.d.ts +4 -4
- package/lib/cjs/components/partners/partnerList.js +2 -2
- package/lib/cjs/components/partners/partners.js +13 -6
- package/lib/cjs/components/processos-juridicos/envolvidosList.d.ts +2 -1
- package/lib/cjs/components/processos-juridicos/envolvidosList.js +1 -1
- package/lib/cjs/components/processos-juridicos/processosJuridicos.d.ts +2 -4
- package/lib/cjs/components/processos-juridicos/processosJuridicos.js +40 -14
- package/lib/cjs/components/processos-juridicos/processosJuridicosList.d.ts +3 -11
- package/lib/cjs/components/processos-juridicos/processosJuridicosList.js +34 -8
- package/lib/cjs/components/processos-juridicos/types.d.ts +27 -0
- package/lib/cjs/components/processos-juridicos/types.js +2 -0
- package/lib/cjs/components/protestos/protestos.js +7 -6
- package/lib/cjs/components/reclameAqui/reclameAquiCarousel.js +9 -9
- package/lib/cjs/components/webservice.d.ts +40 -0
- package/lib/cjs/components/webservice.js +102 -17
- package/lib/cjs/consultaSimples.d.ts +8 -0
- package/lib/cjs/consultaSimples.js +25 -0
- package/lib/cjs/index.d.ts +7 -3
- package/lib/cjs/index.js +7 -1
- package/lib/cjs/utils/number.d.ts +1 -0
- package/lib/cjs/utils/number.js +10 -1
- package/lib/esm/components/adresses/adresses.js +1 -1
- package/lib/esm/components/adresses/getGeocode.js +15 -13
- package/lib/esm/components/bank-accounts/bank-accounts.d.ts +1 -1
- package/lib/esm/components/bank-accounts/bank-accounts.js +11 -13
- package/lib/esm/components/ccf/ccf.d.ts +2 -5
- package/lib/esm/components/ccf/ccf.js +38 -24
- package/lib/esm/components/ccf/ccfList.d.ts +1 -2
- package/lib/esm/components/ccf/ccfList.js +2 -3
- package/lib/esm/components/contacts/contactLikeDislikeSection.d.ts +8 -0
- package/lib/esm/components/contacts/contactLikeDislikeSection.js +61 -0
- package/lib/esm/components/contacts/contacts.d.ts +6 -2
- package/lib/esm/components/contacts/contacts.js +15 -13
- package/lib/esm/components/dossie/dossie.d.ts +1 -1
- package/lib/esm/components/dossie/dossie.js +10 -6
- package/lib/esm/components/interface/loading.d.ts +2 -0
- package/lib/esm/components/interface/loading.js +8 -0
- package/lib/esm/components/interface/section.js +1 -1
- package/lib/esm/components/partners/partner-dividas-publicas.d.ts +5 -0
- package/lib/esm/components/partners/partner-dividas-publicas.js +10 -0
- package/lib/esm/components/partners/partner-protestos.d.ts +5 -0
- package/lib/esm/components/partners/partner-protestos.js +10 -0
- package/lib/esm/components/partners/partner-rfb-status.d.ts +5 -0
- package/lib/esm/components/partners/partner-rfb-status.js +10 -0
- package/lib/esm/components/partners/partnerList.d.ts +4 -4
- package/lib/esm/components/partners/partnerList.js +2 -2
- package/lib/esm/components/partners/partners.js +13 -6
- package/lib/esm/components/processos-juridicos/envolvidosList.d.ts +2 -1
- package/lib/esm/components/processos-juridicos/envolvidosList.js +1 -1
- package/lib/esm/components/processos-juridicos/processosJuridicos.d.ts +2 -4
- package/lib/esm/components/processos-juridicos/processosJuridicos.js +19 -16
- package/lib/esm/components/processos-juridicos/processosJuridicosList.d.ts +3 -11
- package/lib/esm/components/processos-juridicos/processosJuridicosList.js +33 -7
- package/lib/esm/components/processos-juridicos/types.d.ts +27 -0
- package/lib/esm/components/processos-juridicos/types.js +1 -0
- package/lib/esm/components/protestos/protestos.js +7 -6
- package/lib/esm/components/reclameAqui/reclameAquiCarousel.js +9 -9
- package/lib/esm/components/webservice.d.ts +40 -0
- package/lib/esm/components/webservice.js +100 -17
- package/lib/esm/consultaSimples.d.ts +8 -0
- package/lib/esm/consultaSimples.js +20 -0
- package/lib/esm/index.d.ts +7 -3
- package/lib/esm/index.js +7 -3
- package/lib/esm/utils/number.d.ts +1 -0
- package/lib/esm/utils/number.js +8 -0
- package/package.json +1 -2
- /package/lib/cjs/components/{resultWithoutInformation/ResultWithoutInformation.d.ts → interface/resultWithoutInformation.d.ts} +0 -0
- /package/lib/cjs/components/{resultWithoutInformation/ResultWithoutInformation.js → interface/resultWithoutInformation.js} +0 -0
- /package/lib/esm/components/{resultWithoutInformation/ResultWithoutInformation.d.ts → interface/resultWithoutInformation.d.ts} +0 -0
- /package/lib/esm/components/{resultWithoutInformation/ResultWithoutInformation.js → interface/resultWithoutInformation.js} +0 -0
|
@@ -12,6 +12,6 @@ var EnvolvidosList = function (_a) {
|
|
|
12
12
|
open && envolvidos.map(function (envolvido, i) { return (React.createElement("div", { key: i, className: "envolvidos-list" },
|
|
13
13
|
React.createElement("div", { className: "content" },
|
|
14
14
|
React.createElement(AddItemField, { name: "Nome", value: envolvido.nome }),
|
|
15
|
-
React.createElement(AddItemField, { name: "Envolvimento", value: envolvido.
|
|
15
|
+
React.createElement(AddItemField, { name: "Envolvimento", value: envolvido.envolvido_tipo || 'Não Informado' })))); })));
|
|
16
16
|
};
|
|
17
17
|
export default EnvolvidosList;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { ProcessosJuridicosData } from './processosJuridicosList';
|
|
1
|
+
import React from "react";
|
|
3
2
|
declare const ProcessosJuridicos: React.FC<{
|
|
4
|
-
|
|
5
|
-
onClickConsultarProcessoJuridico: () => void;
|
|
3
|
+
onClickConsultarProcessoJuridico: (processo: string) => void;
|
|
6
4
|
}>;
|
|
7
5
|
export default ProcessosJuridicos;
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import HeaderAction from '../common/headerAction';
|
|
7
|
-
import useToggle from '../../hooks/useToggle';
|
|
1
|
+
import React, { useContext } from "react";
|
|
2
|
+
import { Result } from "../interface/result";
|
|
3
|
+
import ProcessosJuridicosList from "./processosJuridicosList";
|
|
4
|
+
import { Queries } from "../webservice";
|
|
5
|
+
import ResultWithoutInformation from "../interface/resultWithoutInformation";
|
|
8
6
|
var ProcessosJuridicos = function (_a) {
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
var onClickConsultarProcessoJuridico = _a.onClickConsultarProcessoJuridico;
|
|
8
|
+
var ctx = useContext(Queries.ProcessosJuridicos);
|
|
9
|
+
var Section = ctx.Section;
|
|
10
|
+
return (React.createElement(Section, { ctx: ctx, title: "Processos Jur\u00EDdicos", subtitle: "Veja os Processos Jur\u00EDdicos para este documento.", onSuccess: function (data) {
|
|
11
|
+
var _a;
|
|
12
|
+
if (!((_a = data === null || data === void 0 ? void 0 : data.empresa) === null || _a === void 0 ? void 0 : _a.length))
|
|
13
|
+
return (React.createElement(ResultWithoutInformation, { value: "N\u00E3o foram econtrados processos jur\u00EDdicos para o documento pesquisado." }));
|
|
14
|
+
var children = (React.createElement(Result, null,
|
|
15
|
+
React.createElement(ProcessosJuridicosList, { processos: data === null || data === void 0 ? void 0 : data.empresa, onClickConsultarProcessoJuridico: onClickConsultarProcessoJuridico })));
|
|
16
|
+
return {
|
|
17
|
+
children: children,
|
|
18
|
+
description: "Pesquisa concluída",
|
|
19
|
+
};
|
|
20
|
+
} }));
|
|
18
21
|
};
|
|
19
22
|
export default ProcessosJuridicos;
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
export type ProcessosJuridicosData = {
|
|
4
|
-
numeroCnj: string;
|
|
5
|
-
assuntos: string;
|
|
6
|
-
classeProcessual: string;
|
|
7
|
-
siglaDoDiario: string;
|
|
8
|
-
estado: string;
|
|
9
|
-
envolvidosUltimaMovimentacao: Envolvido[];
|
|
10
|
-
};
|
|
2
|
+
import { ProcessoJuridicoResume } from "./types";
|
|
11
3
|
declare const ProcessosJuridicosList: React.FC<{
|
|
12
|
-
processos:
|
|
13
|
-
onClickConsultarProcessoJuridico: () => void;
|
|
4
|
+
processos: ProcessoJuridicoResume[];
|
|
5
|
+
onClickConsultarProcessoJuridico: (processo: string) => void;
|
|
14
6
|
}>;
|
|
15
7
|
export default ProcessosJuridicosList;
|
|
@@ -1,24 +1,50 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
1
23
|
import React, { memo } from "react";
|
|
2
24
|
import { Result } from "../interface/result";
|
|
3
|
-
import
|
|
25
|
+
import AddItem from "../common/addItem";
|
|
4
26
|
import Button from "../common/button";
|
|
5
27
|
import EnvolvidosList from "./envolvidosList";
|
|
28
|
+
var AddProcessoJuridicoField = function (_a) {
|
|
29
|
+
var value = _a.value, props = __rest(_a, ["value"]);
|
|
30
|
+
return (React.createElement(AddItem, __assign({}, props, { value: value || "Não Informado" })));
|
|
31
|
+
};
|
|
6
32
|
var ProcessoJuridicoItem = memo(function (_a) {
|
|
7
33
|
var processo = _a.processo, children = _a.children;
|
|
8
34
|
return (React.createElement("div", { className: "content-layout" },
|
|
9
|
-
React.createElement(AddProcessoJuridicoField, { name: "N\u00FAmero CNJ", value: processo.
|
|
35
|
+
React.createElement(AddProcessoJuridicoField, { name: "N\u00FAmero CNJ", value: processo.numero_novo }),
|
|
10
36
|
React.createElement(AddProcessoJuridicoField, { name: "Assunto(s)", value: processo.assuntos }),
|
|
11
|
-
React.createElement(AddProcessoJuridicoField, { name: "Classe Processual", value: processo.
|
|
12
|
-
React.createElement(AddProcessoJuridicoField, { name: "Sigla do Di\u00E1rio", value: processo.
|
|
37
|
+
React.createElement(AddProcessoJuridicoField, { name: "Classe Processual", value: processo.classe_processual }),
|
|
38
|
+
React.createElement(AddProcessoJuridicoField, { name: "Sigla do Di\u00E1rio", value: processo.diario_sigla }),
|
|
13
39
|
React.createElement(AddProcessoJuridicoField, { name: "Estado", value: processo.estado }),
|
|
14
40
|
children));
|
|
15
41
|
});
|
|
16
42
|
var ProcessosJuridicosList = function (_a) {
|
|
17
43
|
var processos = _a.processos, onClickConsultarProcessoJuridico = _a.onClickConsultarProcessoJuridico;
|
|
18
|
-
return
|
|
44
|
+
return processos.map(function (processo, i) { return (React.createElement(React.Fragment, null,
|
|
19
45
|
React.createElement(Result, { isContainer: true, contentClassName: 'container-layout' },
|
|
20
46
|
React.createElement(ProcessoJuridicoItem, { key: i, processo: processo },
|
|
21
|
-
React.createElement(Button, { onClick: function () { return onClickConsultarProcessoJuridico(); }, price: "R$ 1" }, "Consultar Processo Jur\u00EDdico"))),
|
|
22
|
-
React.createElement(EnvolvidosList, { envolvidos: processo === null || processo === void 0 ? void 0 : processo.
|
|
47
|
+
React.createElement(Button, { onClick: function () { return onClickConsultarProcessoJuridico(processo.numero_novo); }, price: "R$ 1" }, "Consultar Processo Jur\u00EDdico"))),
|
|
48
|
+
React.createElement(EnvolvidosList, { envolvidos: processo === null || processo === void 0 ? void 0 : processo.envolvidos_ultima_movimentacao }))); });
|
|
23
49
|
};
|
|
24
50
|
export default ProcessosJuridicosList;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface ProcessoJuridicoResponse {
|
|
2
|
+
empresa: ProcessoJuridicoResume[];
|
|
3
|
+
}
|
|
4
|
+
export interface ProcessoJuridicoResume {
|
|
5
|
+
id: string;
|
|
6
|
+
numero_antigo: string;
|
|
7
|
+
numero_novo: string;
|
|
8
|
+
created_at: string;
|
|
9
|
+
updated_at: string;
|
|
10
|
+
tipo_envolvido: string;
|
|
11
|
+
diario_sigla: string;
|
|
12
|
+
diario_nome: string;
|
|
13
|
+
estado: string;
|
|
14
|
+
data_movimentacoes: string;
|
|
15
|
+
quantidade_movimentacoes: string;
|
|
16
|
+
classe_processual: string;
|
|
17
|
+
assuntos: string;
|
|
18
|
+
envolvidos_ultima_movimentacao: EnvolvidoUltimaMovimentacao[];
|
|
19
|
+
}
|
|
20
|
+
export interface EnvolvidoUltimaMovimentacao {
|
|
21
|
+
nome: string;
|
|
22
|
+
nome_sem_filtro: string;
|
|
23
|
+
envolvido_tipo: string;
|
|
24
|
+
envolvido_extra_nome: string;
|
|
25
|
+
oab: string;
|
|
26
|
+
advogado_de: string;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -6,7 +6,7 @@ import ProtestosCategory from "./protestosCategory";
|
|
|
6
6
|
import { ProtestoItem } from "./protestosList";
|
|
7
7
|
import XPathUtils from "../../utils/xpath";
|
|
8
8
|
import { REGEX_PROTESTOS_DE_CREDITO, REGEX_PROTESTOS_DE_IMPOSTO, } from "../../constants/regex";
|
|
9
|
-
import ResultWithoutInformation from "../resultWithoutInformation
|
|
9
|
+
import ResultWithoutInformation from "../interface/resultWithoutInformation";
|
|
10
10
|
var Protestos = function () {
|
|
11
11
|
var ctx = useContext(Queries.Protestos);
|
|
12
12
|
var Section = ctx.Section;
|
|
@@ -15,7 +15,7 @@ var Protestos = function () {
|
|
|
15
15
|
return regex.test(XPathUtils.select("string(./nomeCedente)", protesto));
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
|
-
return (React.createElement(Section, { ctx: ctx, title: "Protestos", subtitle: "Consulta de Protestos ao CENPROT", onError: function () { return React.createElement(React.Fragment, null, "Erro"); },
|
|
18
|
+
return (React.createElement(Section, { ctx: ctx, title: "Protestos", subtitle: "Consulta de Protestos ao CENPROT", onError: function () { return React.createElement(React.Fragment, null, "Erro"); }, onSuccess: function (data) {
|
|
19
19
|
var registros = XPathUtils.select("number(//registros)", data);
|
|
20
20
|
var protestosDeCredito = filterProtestos(REGEX_PROTESTOS_DE_CREDITO, data);
|
|
21
21
|
var protestosDeImposto = filterProtestos(REGEX_PROTESTOS_DE_IMPOSTO, data);
|
|
@@ -26,14 +26,15 @@ var Protestos = function () {
|
|
|
26
26
|
});
|
|
27
27
|
var children = registros ? (React.createElement(Result, null,
|
|
28
28
|
React.createElement(ProtestosCategory, { title: "Protestos de Cr\u00E9dito", registros: protestosDeCredito === null || protestosDeCredito === void 0 ? void 0 : protestosDeCredito.length }, protestosDeCredito.map(function (protesto, i) { return (React.createElement(ProtestoItem, { protesto: protesto, key: i })); })),
|
|
29
|
-
React.createElement(ProtestosCategory, { title: "Protestos de Cr\u00E9dito", subtitle: "Confira os protestos da Categoria Cr\u00E9dito deste Documento", registros: protestosDeCredito === null || protestosDeCredito === void 0 ? void 0 : protestosDeCredito.length }, protestosDeCredito.map(function (protestoElement, index) { return (React.createElement(ProtestoItem, { protesto: protestoElement, key: index })); })),
|
|
30
29
|
React.createElement(ProtestosCategory, { title: "Protestos de Imposto", subtitle: "Confira os protestos da Categoria Imposto deste Documento", registros: protestosDeImposto === null || protestosDeImposto === void 0 ? void 0 : protestosDeImposto.length }, protestosDeImposto.map(function (protestoElement, index) { return (React.createElement(ProtestoItem, { protesto: protestoElement, key: index })); })),
|
|
31
|
-
React.createElement(ProtestosCategory, { title: "Protestos Gerais", subtitle: "Confira os protestos da Categoria Geral deste Documento", registros: protestosGerais === null || protestosGerais === void 0 ? void 0 : protestosGerais.length }, protestosGerais.map(function (protestoElement, index) { return (React.createElement(ProtestoItem, { protesto: protestoElement, key: index })); })))) : React.createElement(ResultWithoutInformation, null);
|
|
30
|
+
React.createElement(ProtestosCategory, { title: "Protestos Gerais", subtitle: "Confira os protestos da Categoria Geral deste Documento", registros: protestosGerais === null || protestosGerais === void 0 ? void 0 : protestosGerais.length }, protestosGerais.map(function (protestoElement, index) { return (React.createElement(ProtestoItem, { protesto: protestoElement, key: index })); })))) : (React.createElement(ResultWithoutInformation, null));
|
|
32
31
|
return {
|
|
33
32
|
children: children,
|
|
34
|
-
className: registros &&
|
|
33
|
+
className: (registros && "gradient-error") || "",
|
|
35
34
|
description: registros
|
|
36
|
-
?
|
|
35
|
+
? registros === 1
|
|
36
|
+
? "Encontrado um protesto."
|
|
37
|
+
: "Encontrados ".concat(registros, " protestos.")
|
|
37
38
|
: "Não há ocorrência de protesto.",
|
|
38
39
|
};
|
|
39
40
|
} }));
|
|
@@ -12,15 +12,15 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import React from "react";
|
|
13
13
|
import Carousel from "../common/carousel";
|
|
14
14
|
var statusMap = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
GREAT: "Ótimo",
|
|
16
|
+
GOOD: "Bom",
|
|
17
|
+
REGULAR: "Regular",
|
|
18
|
+
NOT_RECOMMENDED: "Não Recomendado",
|
|
19
|
+
NO_INDEX: "--",
|
|
20
|
+
BAD: "Ruim",
|
|
21
21
|
};
|
|
22
22
|
var translateStatus = function (status) {
|
|
23
|
-
return statusMap[status] ||
|
|
23
|
+
return statusMap[status] || "--";
|
|
24
24
|
};
|
|
25
25
|
var ProblemasResolvidos = function (_a) {
|
|
26
26
|
var value = _a.value;
|
|
@@ -44,7 +44,7 @@ var ReclameAquiStats = function (_a) {
|
|
|
44
44
|
React.createElement("span", null,
|
|
45
45
|
score,
|
|
46
46
|
"/10")),
|
|
47
|
-
React.createElement(ProblemasResolvidos, { value: percentualProblemasResolvidos +
|
|
47
|
+
React.createElement(ProblemasResolvidos, { value: percentualProblemasResolvidos + "%" }))));
|
|
48
48
|
};
|
|
49
49
|
export var ReclameAquiCarousel = function (_a) {
|
|
50
50
|
var data = _a.data;
|
|
@@ -52,6 +52,6 @@ export var ReclameAquiCarousel = function (_a) {
|
|
|
52
52
|
React.createElement("div", { className: "carrossel-content" },
|
|
53
53
|
React.createElement(Carousel, { pagination: false, isRTL: false, showArrows: (data === null || data === void 0 ? void 0 : data.length) > 1, renderArrow: function (_a) {
|
|
54
54
|
var type = _a.type, onClick = _a.onClick;
|
|
55
|
-
return (React.createElement("i", { className: "fa fa-angle-".concat(type ==
|
|
55
|
+
return (React.createElement("i", { className: "fa fa-angle-".concat(type == "PREV" ? "left" : "right", " reclame-aqui-carousel-btn"), onClick: onClick }));
|
|
56
56
|
} }, data === null || data === void 0 ? void 0 : data.map(function (empresa, index) { return (React.createElement(ReclameAquiStats, __assign({ key: index }, empresa))); })))));
|
|
57
57
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Client } from "@credithub/webservice";
|
|
2
2
|
import React, { PropsWithChildren, FC } from "react";
|
|
3
3
|
import Header from "./interface/header";
|
|
4
|
+
import { ProcessoJuridicoResponse } from "./processos-juridicos/types";
|
|
4
5
|
export declare const WebService: React.Context<Client.WebService>;
|
|
5
6
|
export declare const WebServiceProvider: FC<PropsWithChildren<{
|
|
6
7
|
credential: string;
|
|
@@ -40,6 +41,18 @@ type ISection<T> = React.FC<{
|
|
|
40
41
|
onLoading?: (ctx: RequestContext<T>) => RenderedResponse;
|
|
41
42
|
hideHeader?: boolean;
|
|
42
43
|
} & React.ComponentProps<typeof Header>>;
|
|
44
|
+
export declare function useQuery<R = unknown, T extends Client.Form = Client.Form>(query: string, data?: T): {
|
|
45
|
+
response: ParsedResponse<R> | null;
|
|
46
|
+
error: Error | null;
|
|
47
|
+
isLoading: boolean;
|
|
48
|
+
refetch: () => void;
|
|
49
|
+
};
|
|
50
|
+
export declare function useMutation<R = unknown, T extends Client.Form = Client.Form>(query: string, data?: T): {
|
|
51
|
+
isLoading: boolean;
|
|
52
|
+
error: Error | null;
|
|
53
|
+
response: ParsedResponse<R> | null;
|
|
54
|
+
mutate: () => void;
|
|
55
|
+
};
|
|
43
56
|
export declare function query<T extends Client.Form = Client.Form, R = unknown>(query: string): React.Context<RequestContext<R>> & {
|
|
44
57
|
Request: React.FC<React.PropsWithChildren<{
|
|
45
58
|
data?: T | undefined;
|
|
@@ -63,5 +76,32 @@ export declare const Queries: {
|
|
|
63
76
|
urlData?: Client.Form | undefined;
|
|
64
77
|
}>>;
|
|
65
78
|
};
|
|
79
|
+
CCF: React.Context<RequestContext<Document>> & {
|
|
80
|
+
Request: React.FC<React.PropsWithChildren<{
|
|
81
|
+
data?: {
|
|
82
|
+
documento: string;
|
|
83
|
+
} | undefined;
|
|
84
|
+
urlData?: Client.Form | undefined;
|
|
85
|
+
}>>;
|
|
86
|
+
};
|
|
87
|
+
ProcessosJuridicos: React.Context<RequestContext<ProcessoJuridicoResponse>> & {
|
|
88
|
+
Request: React.FC<React.PropsWithChildren<{
|
|
89
|
+
data?: {
|
|
90
|
+
documento: string;
|
|
91
|
+
nome?: string | undefined;
|
|
92
|
+
estado?: string | undefined;
|
|
93
|
+
pf?: string | undefined;
|
|
94
|
+
} | undefined;
|
|
95
|
+
urlData?: Client.Form | undefined;
|
|
96
|
+
}>>;
|
|
97
|
+
};
|
|
98
|
+
ReclameAqui: React.Context<RequestContext<Document>> & {
|
|
99
|
+
Request: React.FC<React.PropsWithChildren<{
|
|
100
|
+
data?: {
|
|
101
|
+
documento: string;
|
|
102
|
+
} | undefined;
|
|
103
|
+
urlData?: Client.Form | undefined;
|
|
104
|
+
}>>;
|
|
105
|
+
};
|
|
66
106
|
};
|
|
67
107
|
export {};
|
|
@@ -22,11 +22,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
var _a;
|
|
24
24
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
25
|
-
/* eslint-disable react-hooks/rules-of-hooks */
|
|
26
|
-
import
|
|
25
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
26
|
+
import { Client } from "@credithub/webservice";
|
|
27
|
+
import React, { createContext, useState, useContext, useEffect, useMemo, useCallback, } from "react";
|
|
27
28
|
import Header from "./interface/header";
|
|
28
29
|
import cn from "classnames";
|
|
29
|
-
export var WebService = createContext(new Client.WebService);
|
|
30
|
+
export var WebService = createContext(new Client.WebService());
|
|
30
31
|
export var WebServiceProvider = function (_a) {
|
|
31
32
|
var credential = _a.credential, children = _a.children;
|
|
32
33
|
return (React.createElement(WebService.Provider, { value: new Client.WebService(credential) }, children));
|
|
@@ -42,18 +43,32 @@ function CustomProvider(Provider, query) {
|
|
|
42
43
|
return function (_a) {
|
|
43
44
|
var children = _a.children, data = _a.data, urlData = _a.urlData;
|
|
44
45
|
var client = useContext(WebService);
|
|
45
|
-
var abortController = useMemo(function () { return new AbortController; }, []);
|
|
46
|
+
var abortController = useMemo(function () { return new AbortController(); }, []);
|
|
46
47
|
var _b = useState(null), response = _b[0], setResponse = _b[1];
|
|
47
48
|
var _c = useState(null), error = _c[0], setError = _c[1];
|
|
48
49
|
useEffect(function () {
|
|
49
|
-
client
|
|
50
|
-
.
|
|
50
|
+
client
|
|
51
|
+
.request(query, data, urlData, abortController.signal)
|
|
52
|
+
.then(function (response) {
|
|
53
|
+
return Client.WebService.parse(response).then(function (document) { return ({
|
|
54
|
+
response: response,
|
|
55
|
+
document: document,
|
|
56
|
+
}); });
|
|
57
|
+
})
|
|
51
58
|
.then(function (document) { return setResponse(document); })
|
|
52
|
-
.catch(function (requestError) {
|
|
59
|
+
.catch(function (requestError) {
|
|
60
|
+
return setError(requestError instanceof Error
|
|
61
|
+
? requestError
|
|
62
|
+
: new Error(requestError));
|
|
63
|
+
});
|
|
53
64
|
return function () { return abortController.abort(); };
|
|
54
65
|
}, [abortController, client, data, urlData]);
|
|
55
66
|
var value = {
|
|
56
|
-
type: error
|
|
67
|
+
type: error
|
|
68
|
+
? RequestStatus.Error
|
|
69
|
+
: response
|
|
70
|
+
? RequestStatus.Success
|
|
71
|
+
: RequestStatus.Loading,
|
|
57
72
|
error: error,
|
|
58
73
|
data: data,
|
|
59
74
|
urlData: urlData,
|
|
@@ -61,19 +76,84 @@ function CustomProvider(Provider, query) {
|
|
|
61
76
|
document: response === null || response === void 0 ? void 0 : response.document,
|
|
62
77
|
Section: function (_a) {
|
|
63
78
|
var props = __rest(_a, []);
|
|
64
|
-
return React.createElement(Section, __assign({}, props, { ctx: value }));
|
|
65
|
-
}
|
|
79
|
+
return (React.createElement(Section, __assign({}, props, { ctx: value })));
|
|
80
|
+
},
|
|
66
81
|
};
|
|
67
82
|
return React.createElement(Provider.Provider, { value: value }, children);
|
|
68
83
|
};
|
|
69
84
|
}
|
|
85
|
+
export function useQuery(query, data) {
|
|
86
|
+
var client = useContext(WebService);
|
|
87
|
+
var abortController = useMemo(function () { return new AbortController(); }, []);
|
|
88
|
+
var _a = useState(null), response = _a[0], setResponse = _a[1];
|
|
89
|
+
var _b = useState(null), error = _b[0], setError = _b[1];
|
|
90
|
+
var _c = useState(true), isLoading = _c[0], setIsLoading = _c[1];
|
|
91
|
+
var fetch = useCallback(function () {
|
|
92
|
+
setIsLoading(true);
|
|
93
|
+
client
|
|
94
|
+
.request(query, data, undefined, abortController.signal)
|
|
95
|
+
.then(function (response) {
|
|
96
|
+
return Client.WebService.parse(response).then(function (document) { return ({
|
|
97
|
+
response: response,
|
|
98
|
+
document: document,
|
|
99
|
+
}); });
|
|
100
|
+
})
|
|
101
|
+
.then(function (document) { return setResponse(document); })
|
|
102
|
+
.catch(function (requestError) {
|
|
103
|
+
return setError(requestError instanceof Error && requestError.name !== "AbortError"
|
|
104
|
+
? requestError
|
|
105
|
+
: new Error(requestError));
|
|
106
|
+
})
|
|
107
|
+
.finally(function () { return setIsLoading(false); });
|
|
108
|
+
}, [client, query, data, abortController.signal]);
|
|
109
|
+
useEffect(function () {
|
|
110
|
+
fetch();
|
|
111
|
+
}, [fetch]);
|
|
112
|
+
return {
|
|
113
|
+
response: response,
|
|
114
|
+
error: error,
|
|
115
|
+
isLoading: isLoading,
|
|
116
|
+
refetch: fetch,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export function useMutation(query, data) {
|
|
120
|
+
var client = useContext(WebService);
|
|
121
|
+
var abortController = useMemo(function () { return new AbortController(); }, []);
|
|
122
|
+
var _a = useState(null), response = _a[0], setResponse = _a[1];
|
|
123
|
+
var _b = useState(null), error = _b[0], setError = _b[1];
|
|
124
|
+
var _c = useState(true), isLoading = _c[0], setIsLoading = _c[1];
|
|
125
|
+
var mutate = useCallback(function () {
|
|
126
|
+
setIsLoading(true);
|
|
127
|
+
client
|
|
128
|
+
.request(query, data, undefined, abortController.signal)
|
|
129
|
+
.then(function (response) {
|
|
130
|
+
return Client.WebService.parse(response).then(function (document) { return ({
|
|
131
|
+
response: response,
|
|
132
|
+
document: document,
|
|
133
|
+
}); });
|
|
134
|
+
})
|
|
135
|
+
.then(function (document) { return setResponse(document); })
|
|
136
|
+
.catch(function (requestError) {
|
|
137
|
+
return setError(requestError instanceof Error && requestError.name !== "AbortError"
|
|
138
|
+
? requestError
|
|
139
|
+
: new Error(requestError));
|
|
140
|
+
})
|
|
141
|
+
.finally(function () { return setIsLoading(false); });
|
|
142
|
+
}, [client, query, data, abortController.signal]);
|
|
143
|
+
return {
|
|
144
|
+
isLoading: isLoading,
|
|
145
|
+
error: error,
|
|
146
|
+
response: response,
|
|
147
|
+
mutate: mutate,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
70
150
|
export function query(query) {
|
|
71
151
|
var RequestContext = createContext({
|
|
72
152
|
type: RequestStatus.Empty,
|
|
73
153
|
Section: function (_a) {
|
|
74
154
|
var props = __rest(_a, []);
|
|
75
155
|
return React.createElement(Section, __assign({}, props));
|
|
76
|
-
}
|
|
156
|
+
},
|
|
77
157
|
});
|
|
78
158
|
return Object.assign(RequestContext, {
|
|
79
159
|
Request: CustomProvider(RequestContext, query),
|
|
@@ -81,10 +161,13 @@ export function query(query) {
|
|
|
81
161
|
}
|
|
82
162
|
export var Queries = {
|
|
83
163
|
Finder: query("SELECT FROM 'FINDER'.'BILLING'"),
|
|
84
|
-
Protestos: query("SELECT FROM 'APICENPROT'.'PRINT'")
|
|
164
|
+
Protestos: query("SELECT FROM 'APICENPROT'.'PRINT'"),
|
|
165
|
+
CCF: query("SELECT FROM 'SEEKLOC'.'CCF'"),
|
|
166
|
+
ProcessosJuridicos: query("SELECT FROM 'PROCESSOSJURIDICOS'.'PROCESSOS'"),
|
|
167
|
+
ReclameAqui: query("SELECT FROM 'RECLAMEAQUI'.'CONSULTA'"),
|
|
85
168
|
};
|
|
86
169
|
var Section = function (_a) {
|
|
87
|
-
var onSuccess = _a.onSuccess, _b = _a.onError, onError = _b === void 0 ? function () { return React.createElement(React.Fragment, null, "Erro"); } : _b, _c = _a.onLoading, onLoading = _c === void 0 ? function () { return React.createElement(React.Fragment, null
|
|
170
|
+
var onSuccess = _a.onSuccess, _b = _a.onError, onError = _b === void 0 ? function () { return React.createElement(React.Fragment, null, "Erro"); } : _b, _c = _a.onLoading, onLoading = _c === void 0 ? function () { return React.createElement(React.Fragment, null); } : _c, ctx = _a.ctx, children = _a.children, className = _a.className, _d = _a.hideHeader, hideHeader = _d === void 0 ? false : _d, headerProps = __rest(_a, ["onSuccess", "onError", "onLoading", "ctx", "children", "className", "hideHeader"]);
|
|
88
171
|
if (!ctx)
|
|
89
172
|
return null;
|
|
90
173
|
var renderResponse = function () {
|
|
@@ -112,8 +195,8 @@ var Section = function (_a) {
|
|
|
112
195
|
renderedChildren));
|
|
113
196
|
};
|
|
114
197
|
var headerStatus = (_a = {},
|
|
115
|
-
_a[RequestStatus.Loading] =
|
|
116
|
-
_a[RequestStatus.Success] =
|
|
117
|
-
_a[RequestStatus.Error] =
|
|
118
|
-
_a[RequestStatus.Empty] =
|
|
198
|
+
_a[RequestStatus.Loading] = "external-source loading",
|
|
199
|
+
_a[RequestStatus.Success] = "success",
|
|
200
|
+
_a[RequestStatus.Error] = "external-source error",
|
|
201
|
+
_a[RequestStatus.Empty] = "external-source error",
|
|
119
202
|
_a);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Section, Contacts, Partners, Dossie, Addresses, CCF, Protestos, ProcessosJuridicos, BankAccounts, WebServiceProvider, Queries, } from "./";
|
|
3
|
+
var ConsultaSimples = function (_a) {
|
|
4
|
+
var documento = _a.documento, apiKey = _a.apiKey, onClose = _a.onClose;
|
|
5
|
+
return (React.createElement(WebServiceProvider, { credential: apiKey },
|
|
6
|
+
React.createElement(Section, { title: "Consulta Simples", subtitle: "Informa\u00E7\u00F5es agregadas do CPF ou CNPJ", description: "Registro encontrado", onClose: onClose },
|
|
7
|
+
React.createElement(Queries.Finder.Request, { data: { documento: documento } },
|
|
8
|
+
React.createElement(Dossie, { onOpenNewTransactionModal: console.log }),
|
|
9
|
+
React.createElement(Addresses, { apiKey: apiKey }),
|
|
10
|
+
React.createElement(Contacts, { onClickConsutarEmail: console.log }),
|
|
11
|
+
React.createElement(Partners, null),
|
|
12
|
+
React.createElement(BankAccounts, null)),
|
|
13
|
+
React.createElement(Queries.CCF.Request, { data: { documento: documento } },
|
|
14
|
+
React.createElement(CCF, null)),
|
|
15
|
+
React.createElement(Queries.Protestos.Request, { data: { documento: documento } },
|
|
16
|
+
React.createElement(Protestos, null)),
|
|
17
|
+
React.createElement(Queries.ProcessosJuridicos.Request, { data: { documento: documento } },
|
|
18
|
+
React.createElement(ProcessosJuridicos, { onClickConsultarProcessoJuridico: console.log })))));
|
|
19
|
+
};
|
|
20
|
+
export default ConsultaSimples;
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
export { default as Section } from "./components/interface/section";
|
|
2
2
|
export { default as Header } from "./components/interface/header";
|
|
3
|
+
export { default as Loading } from "./components/interface/loading";
|
|
3
4
|
export { default as AddItemField } from "./components/common/addItem";
|
|
4
5
|
export { default as Contacts } from "./components/contacts/contacts";
|
|
5
6
|
export { default as Partners } from "./components/partners/partners";
|
|
6
7
|
export { default as Protestos } from "./components/protestos/protestos";
|
|
7
|
-
export { default as CCF } from
|
|
8
|
+
export { default as CCF } from "./components/ccf/ccf";
|
|
8
9
|
export { default as Dossie } from "./components/dossie/dossie";
|
|
9
|
-
export { default as ProcessosJuridicos } from
|
|
10
|
+
export { default as ProcessosJuridicos } from "./components/processos-juridicos/processosJuridicos";
|
|
10
11
|
export { default as Addresses } from "./components/adresses/adresses";
|
|
11
|
-
export { default as BankAccounts } from
|
|
12
|
+
export { default as BankAccounts } from "./components/bank-accounts/bank-accounts";
|
|
13
|
+
export { default as ResultWithoutInformation } from "./components/interface/resultWithoutInformation";
|
|
14
|
+
export * from "./components/webservice";
|
|
12
15
|
export * from "./components/interface/result";
|
|
16
|
+
export * from "./consultaSimples";
|
package/lib/esm/index.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
export { default as Section } from "./components/interface/section";
|
|
2
2
|
export { default as Header } from "./components/interface/header";
|
|
3
|
+
export { default as Loading } from "./components/interface/loading";
|
|
3
4
|
export { default as AddItemField } from "./components/common/addItem";
|
|
4
5
|
export { default as Contacts } from "./components/contacts/contacts";
|
|
5
6
|
export { default as Partners } from "./components/partners/partners";
|
|
6
7
|
export { default as Protestos } from "./components/protestos/protestos";
|
|
7
|
-
export { default as CCF } from
|
|
8
|
+
export { default as CCF } from "./components/ccf/ccf";
|
|
8
9
|
export { default as Dossie } from "./components/dossie/dossie";
|
|
9
|
-
export { default as ProcessosJuridicos } from
|
|
10
|
+
export { default as ProcessosJuridicos } from "./components/processos-juridicos/processosJuridicos";
|
|
10
11
|
export { default as Addresses } from "./components/adresses/adresses";
|
|
11
|
-
export { default as BankAccounts } from
|
|
12
|
+
export { default as BankAccounts } from "./components/bank-accounts/bank-accounts";
|
|
13
|
+
export { default as ResultWithoutInformation } from "./components/interface/resultWithoutInformation";
|
|
14
|
+
export * from "./components/webservice";
|
|
12
15
|
export * from "./components/interface/result";
|
|
16
|
+
export * from "./consultaSimples";
|
package/lib/esm/utils/number.js
CHANGED
|
@@ -4,3 +4,11 @@ export var formatMoney = function (value) {
|
|
|
4
4
|
currency: 'BRL'
|
|
5
5
|
}).format(Number(value));
|
|
6
6
|
};
|
|
7
|
+
export var phoneMask = function (value) {
|
|
8
|
+
if (!value)
|
|
9
|
+
return "";
|
|
10
|
+
value = value.replace(/\D/g, '');
|
|
11
|
+
value = value.replace(/(\d{2})(\d)/, "($1) $2");
|
|
12
|
+
value = value.replace(/(\d)(\d{4})$/, "$1-$2");
|
|
13
|
+
return value;
|
|
14
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@credithub/harlan-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Provide a set of web components to be used in Harlan and other projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"harlan",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"@babel/preset-react": "^7.23.3",
|
|
41
41
|
"@babel/preset-typescript": "^7.23.3",
|
|
42
42
|
"@babel/runtime": "^7.23.2",
|
|
43
|
-
"@types/axios": "^0.14.0",
|
|
44
43
|
"@types/node": "^20.8.10",
|
|
45
44
|
"@types/react": "^18.2.0",
|
|
46
45
|
"@types/react-dom": "^18.2.0",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|