@credithub/harlan-components 1.1.1
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/README.md +44 -0
- package/lib/cjs/components/adresses/adresses.d.ts +18 -0
- package/lib/cjs/components/adresses/adresses.js +68 -0
- package/lib/cjs/components/adresses/getGeocode.d.ts +6 -0
- package/lib/cjs/components/adresses/getGeocode.js +74 -0
- package/lib/cjs/components/adresses/map.d.ts +11 -0
- package/lib/cjs/components/adresses/map.js +50 -0
- package/lib/cjs/components/bank-accounts/bank-accounts.d.ts +3 -0
- package/lib/cjs/components/bank-accounts/bank-accounts.js +28 -0
- package/lib/cjs/components/ccf/ccf.d.ts +6 -0
- package/lib/cjs/components/ccf/ccf.js +31 -0
- package/lib/cjs/components/ccf/ccfList.d.ts +13 -0
- package/lib/cjs/components/ccf/ccfList.js +46 -0
- package/lib/cjs/components/common/addItem.d.ts +11 -0
- package/lib/cjs/components/common/addItem.js +40 -0
- package/lib/cjs/components/common/button.d.ts +5 -0
- package/lib/cjs/components/common/button.js +15 -0
- package/lib/cjs/components/common/carousel.d.ts +4 -0
- package/lib/cjs/components/common/carousel.js +24 -0
- package/lib/cjs/components/common/headerAction.d.ts +9 -0
- package/lib/cjs/components/common/headerAction.js +15 -0
- package/lib/cjs/components/contacts/contacts.d.ts +14 -0
- package/lib/cjs/components/contacts/contacts.js +68 -0
- package/lib/cjs/components/contacts/contactsLikeDislike.d.ts +9 -0
- package/lib/cjs/components/contacts/contactsLikeDislike.js +14 -0
- package/lib/cjs/components/contacts/thumbsButton.d.ts +10 -0
- package/lib/cjs/components/contacts/thumbsButton.js +22 -0
- package/lib/cjs/components/dossie/carrousel/carrousel.d.ts +8 -0
- package/lib/cjs/components/dossie/carrousel/carrousel.js +15 -0
- package/lib/cjs/components/dossie/companyLogo/companyLogo.d.ts +7 -0
- package/lib/cjs/components/dossie/companyLogo/companyLogo.js +19 -0
- package/lib/cjs/components/dossie/dossie.d.ts +35 -0
- package/lib/cjs/components/dossie/dossie.js +66 -0
- package/lib/cjs/components/dossie/summary/summary.d.ts +17 -0
- package/lib/cjs/components/dossie/summary/summary.js +187 -0
- package/lib/cjs/components/dossie/transactionTable/transactionTable.d.ts +6 -0
- package/lib/cjs/components/dossie/transactionTable/transactionTable.js +39 -0
- package/lib/cjs/components/interface/header.d.ts +16 -0
- package/lib/cjs/components/interface/header.js +56 -0
- package/lib/cjs/components/interface/result.d.ts +7 -0
- package/lib/cjs/components/interface/result.js +38 -0
- package/lib/cjs/components/interface/section.d.ts +14 -0
- package/lib/cjs/components/interface/section.js +45 -0
- package/lib/cjs/components/partners/partnerField.d.ts +9 -0
- package/lib/cjs/components/partners/partnerField.js +14 -0
- package/lib/cjs/components/partners/partnerList.d.ts +16 -0
- package/lib/cjs/components/partners/partnerList.js +43 -0
- package/lib/cjs/components/partners/partners.d.ts +3 -0
- package/lib/cjs/components/partners/partners.js +55 -0
- package/lib/cjs/components/processos-juridicos/envolvidosList.d.ts +9 -0
- package/lib/cjs/components/processos-juridicos/envolvidosList.js +22 -0
- package/lib/cjs/components/processos-juridicos/processosJuridicos.d.ts +7 -0
- package/lib/cjs/components/processos-juridicos/processosJuridicos.js +24 -0
- package/lib/cjs/components/processos-juridicos/processosJuridicosList.d.ts +15 -0
- package/lib/cjs/components/processos-juridicos/processosJuridicosList.js +52 -0
- package/lib/cjs/components/protestos/protestos.d.ts +3 -0
- package/lib/cjs/components/protestos/protestos.js +69 -0
- package/lib/cjs/components/protestos/protestosCategory.d.ts +7 -0
- package/lib/cjs/components/protestos/protestosCategory.js +21 -0
- package/lib/cjs/components/protestos/protestosList.d.ts +33 -0
- package/lib/cjs/components/protestos/protestosList.js +73 -0
- package/lib/cjs/components/reclameAqui/reclameAquiCarousel.d.ts +26 -0
- package/lib/cjs/components/reclameAqui/reclameAquiCarousel.js +64 -0
- package/lib/cjs/components/resultWithoutInformation/ResultWithoutInformation.d.ts +4 -0
- package/lib/cjs/components/resultWithoutInformation/ResultWithoutInformation.js +37 -0
- package/lib/cjs/components/webservice.d.ts +67 -0
- package/lib/cjs/components/webservice.js +150 -0
- package/lib/cjs/constants/regex.d.ts +2 -0
- package/lib/cjs/constants/regex.js +5 -0
- package/lib/cjs/hooks/useToggle.d.ts +10 -0
- package/lib/cjs/hooks/useToggle.js +26 -0
- package/lib/cjs/index.d.ts +12 -0
- package/lib/cjs/index.js +43 -0
- package/lib/cjs/mock/dossie.d.ts +207 -0
- package/lib/cjs/mock/dossie.js +630 -0
- package/lib/cjs/utils/number.d.ts +1 -0
- package/lib/cjs/utils/number.js +10 -0
- package/lib/cjs/utils/string.d.ts +3 -0
- package/lib/cjs/utils/string.js +22 -0
- package/lib/cjs/utils/xpath.d.ts +4 -0
- package/lib/cjs/utils/xpath.js +12 -0
- package/lib/esm/components/adresses/adresses.d.ts +18 -0
- package/lib/esm/components/adresses/adresses.js +40 -0
- package/lib/esm/components/adresses/getGeocode.d.ts +6 -0
- package/lib/esm/components/adresses/getGeocode.js +67 -0
- package/lib/esm/components/adresses/map.d.ts +11 -0
- package/lib/esm/components/adresses/map.js +25 -0
- package/lib/esm/components/bank-accounts/bank-accounts.d.ts +3 -0
- package/lib/esm/components/bank-accounts/bank-accounts.js +23 -0
- package/lib/esm/components/ccf/ccf.d.ts +6 -0
- package/lib/esm/components/ccf/ccf.js +26 -0
- package/lib/esm/components/ccf/ccfList.d.ts +13 -0
- package/lib/esm/components/ccf/ccfList.js +18 -0
- package/lib/esm/components/common/addItem.d.ts +11 -0
- package/lib/esm/components/common/addItem.js +35 -0
- package/lib/esm/components/common/button.d.ts +5 -0
- package/lib/esm/components/common/button.js +10 -0
- package/lib/esm/components/common/carousel.d.ts +4 -0
- package/lib/esm/components/common/carousel.js +19 -0
- package/lib/esm/components/common/headerAction.d.ts +9 -0
- package/lib/esm/components/common/headerAction.js +10 -0
- package/lib/esm/components/contacts/contacts.d.ts +14 -0
- package/lib/esm/components/contacts/contacts.js +40 -0
- package/lib/esm/components/contacts/contactsLikeDislike.d.ts +9 -0
- package/lib/esm/components/contacts/contactsLikeDislike.js +9 -0
- package/lib/esm/components/contacts/thumbsButton.d.ts +10 -0
- package/lib/esm/components/contacts/thumbsButton.js +17 -0
- package/lib/esm/components/dossie/carrousel/carrousel.d.ts +8 -0
- package/lib/esm/components/dossie/carrousel/carrousel.js +8 -0
- package/lib/esm/components/dossie/companyLogo/companyLogo.d.ts +7 -0
- package/lib/esm/components/dossie/companyLogo/companyLogo.js +14 -0
- package/lib/esm/components/dossie/dossie.d.ts +35 -0
- package/lib/esm/components/dossie/dossie.js +38 -0
- package/lib/esm/components/dossie/summary/summary.d.ts +17 -0
- package/lib/esm/components/dossie/summary/summary.js +180 -0
- package/lib/esm/components/dossie/transactionTable/transactionTable.d.ts +6 -0
- package/lib/esm/components/dossie/transactionTable/transactionTable.js +32 -0
- package/lib/esm/components/interface/header.d.ts +16 -0
- package/lib/esm/components/interface/header.js +51 -0
- package/lib/esm/components/interface/result.d.ts +7 -0
- package/lib/esm/components/interface/result.js +31 -0
- package/lib/esm/components/interface/section.d.ts +14 -0
- package/lib/esm/components/interface/section.js +40 -0
- package/lib/esm/components/partners/partnerField.d.ts +9 -0
- package/lib/esm/components/partners/partnerField.js +9 -0
- package/lib/esm/components/partners/partnerList.d.ts +16 -0
- package/lib/esm/components/partners/partnerList.js +15 -0
- package/lib/esm/components/partners/partners.d.ts +3 -0
- package/lib/esm/components/partners/partners.js +27 -0
- package/lib/esm/components/processos-juridicos/envolvidosList.d.ts +9 -0
- package/lib/esm/components/processos-juridicos/envolvidosList.js +17 -0
- package/lib/esm/components/processos-juridicos/processosJuridicos.d.ts +7 -0
- package/lib/esm/components/processos-juridicos/processosJuridicos.js +19 -0
- package/lib/esm/components/processos-juridicos/processosJuridicosList.d.ts +15 -0
- package/lib/esm/components/processos-juridicos/processosJuridicosList.js +24 -0
- package/lib/esm/components/protestos/protestos.d.ts +3 -0
- package/lib/esm/components/protestos/protestos.js +41 -0
- package/lib/esm/components/protestos/protestosCategory.d.ts +7 -0
- package/lib/esm/components/protestos/protestosCategory.js +16 -0
- package/lib/esm/components/protestos/protestosList.d.ts +33 -0
- package/lib/esm/components/protestos/protestosList.js +43 -0
- package/lib/esm/components/reclameAqui/reclameAquiCarousel.d.ts +26 -0
- package/lib/esm/components/reclameAqui/reclameAquiCarousel.js +57 -0
- package/lib/esm/components/resultWithoutInformation/ResultWithoutInformation.d.ts +4 -0
- package/lib/esm/components/resultWithoutInformation/ResultWithoutInformation.js +32 -0
- package/lib/esm/components/webservice.d.ts +67 -0
- package/lib/esm/components/webservice.js +119 -0
- package/lib/esm/constants/regex.d.ts +2 -0
- package/lib/esm/constants/regex.js +2 -0
- package/lib/esm/hooks/useToggle.d.ts +10 -0
- package/lib/esm/hooks/useToggle.js +24 -0
- package/lib/esm/index.d.ts +12 -0
- package/lib/esm/index.js +12 -0
- package/lib/esm/mock/dossie.d.ts +207 -0
- package/lib/esm/mock/dossie.js +628 -0
- package/lib/esm/utils/number.d.ts +1 -0
- package/lib/esm/utils/number.js +6 -0
- package/lib/esm/utils/string.d.ts +3 -0
- package/lib/esm/utils/string.js +16 -0
- package/lib/esm/utils/xpath.d.ts +4 -0
- package/lib/esm/utils/xpath.js +10 -0
- package/package.json +79 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Header from "../interface/header";
|
|
3
|
+
import useToggle from "../../hooks/useToggle";
|
|
4
|
+
import classNames from "classnames";
|
|
5
|
+
import HeaderAction from "../common/headerAction";
|
|
6
|
+
import { Result } from "../interface/result";
|
|
7
|
+
var ProtestosCategory = function (_a) {
|
|
8
|
+
var registros = _a.registros, title = _a.title, subtitle = _a.subtitle, children = _a.children;
|
|
9
|
+
var _b = useToggle(true), isOpen = _b[0], toggleOpen = _b[1];
|
|
10
|
+
return (React.createElement(React.Fragment, null,
|
|
11
|
+
React.createElement(Header, { title: title, subtitle: subtitle, description: !registros
|
|
12
|
+
? "Não foram encontradas ocorrências."
|
|
13
|
+
: (registros === 1 ? 'Foi encontrado um protesto.' : "Foram encontrados ".concat(registros, " protestos.")), className: classNames({ error: registros }), actions: registros ? (React.createElement(HeaderAction, { iconClass: isOpen ? "minus-square-o" : "plus-square-o", onClick: toggleOpen })) : null }),
|
|
14
|
+
React.createElement(Result, { hidden: !isOpen, isContainer: true, contentClassName: "container-layout" }, children)));
|
|
15
|
+
};
|
|
16
|
+
export default ProtestosCategory;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type ProtestoData = {
|
|
3
|
+
quemProtestou: string;
|
|
4
|
+
atravesDe: string;
|
|
5
|
+
cpfCnpjProtestado: string;
|
|
6
|
+
dataDoProtestos: string;
|
|
7
|
+
possuiAnuencia: string;
|
|
8
|
+
anuenciaVencida: string;
|
|
9
|
+
valorDoProtesto: string;
|
|
10
|
+
valor?: number;
|
|
11
|
+
tipo: "CREDITO" | "IMPOSTO" | "GERAL";
|
|
12
|
+
};
|
|
13
|
+
export declare const ProtestoItem: React.MemoExoticComponent<({ protesto }: {
|
|
14
|
+
protesto: Node;
|
|
15
|
+
}) => React.JSX.Element>;
|
|
16
|
+
export declare const ProtestosList: React.FC<{
|
|
17
|
+
protestos: Node[];
|
|
18
|
+
}>;
|
|
19
|
+
/**
|
|
20
|
+
* const ProtestosList: React.FC<{
|
|
21
|
+
protestos: ProtestoData[]
|
|
22
|
+
}> = ({ protestos }) => {
|
|
23
|
+
return (
|
|
24
|
+
<Result isContainer contentClassName='container-layout'>
|
|
25
|
+
{protestos?.length ? protestos.map((protesto, i) => (
|
|
26
|
+
<ProtestoItem key={i} protesto={protesto} />
|
|
27
|
+
)) : (
|
|
28
|
+
<AddItemField name="Informação" value="Não foi encontrado registros de protestos para o documento consultado." />
|
|
29
|
+
)}
|
|
30
|
+
</Result>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
*/
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { memo } from "react";
|
|
2
|
+
import AddItemField from "../common/addItem";
|
|
3
|
+
import XPathUtils from "../../utils/xpath";
|
|
4
|
+
import { formatMoney } from "../../utils/number";
|
|
5
|
+
import { Result } from "../interface/result";
|
|
6
|
+
export var ProtestoItem = memo(function (_a) {
|
|
7
|
+
var protesto = _a.protesto;
|
|
8
|
+
var getField = function (path, formatter) {
|
|
9
|
+
var value = XPathUtils.select("string(".concat(path, ")"), protesto);
|
|
10
|
+
return formatter ? formatter(value) : value;
|
|
11
|
+
};
|
|
12
|
+
var formatBooleanField = function (value) {
|
|
13
|
+
return value === "true" ? "Sim" : "Não";
|
|
14
|
+
};
|
|
15
|
+
return (React.createElement("div", { className: "content-layout" },
|
|
16
|
+
React.createElement(AddItemField, { name: "Cart\u00F3rio", value: getField("../nome") }),
|
|
17
|
+
React.createElement(AddItemField, { name: "QUEM PROTESTOU", value: getField("./nomeCedente") }),
|
|
18
|
+
React.createElement(AddItemField, { name: "ATRAV\u00C9S DE", value: getField("./nomeApresentante") }),
|
|
19
|
+
React.createElement(AddItemField, { name: "CPF/CNPJ PROTESTADO", value: getField("./cpfCnpj") }),
|
|
20
|
+
React.createElement(AddItemField, { name: "DATA DO PROTESTO", value: getField("./dataProtesto") }),
|
|
21
|
+
React.createElement(AddItemField, { name: "POSSUI ANU\u00CANCIA", value: formatBooleanField(getField("./temAnuencia")) }),
|
|
22
|
+
React.createElement(AddItemField, { name: "ANU\u00CANCIA VENCIDA", value: formatBooleanField(getField("./anuenciaVencida")) }),
|
|
23
|
+
React.createElement(AddItemField, { name: "VALOR DO PROTESTO", value: formatMoney(getField("./valor")) })));
|
|
24
|
+
});
|
|
25
|
+
export var ProtestosList = function (_a) {
|
|
26
|
+
var protestos = _a.protestos;
|
|
27
|
+
return (React.createElement(Result, { isContainer: true, contentClassName: "container-layout" }, (protestos === null || protestos === void 0 ? void 0 : protestos.length) ? (protestos.map(function (protesto, i) { return (React.createElement(ProtestoItem, { key: i, protesto: protesto })); })) : (React.createElement(AddItemField, { name: "Informa\u00E7\u00E3o", value: "N\u00E3o h\u00E1 registros de protestos." }))));
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* const ProtestosList: React.FC<{
|
|
31
|
+
protestos: ProtestoData[]
|
|
32
|
+
}> = ({ protestos }) => {
|
|
33
|
+
return (
|
|
34
|
+
<Result isContainer contentClassName='container-layout'>
|
|
35
|
+
{protestos?.length ? protestos.map((protesto, i) => (
|
|
36
|
+
<ProtestoItem key={i} protesto={protesto} />
|
|
37
|
+
)) : (
|
|
38
|
+
<AddItemField name="Informação" value="Não foi encontrado registros de protestos para o documento consultado." />
|
|
39
|
+
)}
|
|
40
|
+
</Result>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
*/
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface ReclameAquiCarouselProps extends ReclameAquiStatsProps {
|
|
3
|
+
}
|
|
4
|
+
declare const statusMap: {
|
|
5
|
+
GREAT: string;
|
|
6
|
+
GOOD: string;
|
|
7
|
+
REGULAR: string;
|
|
8
|
+
NOT_RECOMMENDED: string;
|
|
9
|
+
NO_INDEX: string;
|
|
10
|
+
BAD: string;
|
|
11
|
+
};
|
|
12
|
+
type StatusMapType = keyof typeof statusMap;
|
|
13
|
+
type ReclameAquiStatsProps = {
|
|
14
|
+
nome: string;
|
|
15
|
+
cnpj: string;
|
|
16
|
+
score: string;
|
|
17
|
+
status: string | StatusMapType;
|
|
18
|
+
shortname: string;
|
|
19
|
+
imageUrl: string;
|
|
20
|
+
quantidadeProblemasResolvidos: string;
|
|
21
|
+
percentualProblemasResolvidos: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const ReclameAquiCarousel: React.FC<{
|
|
24
|
+
data: ReclameAquiCarouselProps[];
|
|
25
|
+
}>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
import React from "react";
|
|
13
|
+
import Carousel from "../common/carousel";
|
|
14
|
+
var statusMap = {
|
|
15
|
+
'GREAT': 'Ótimo',
|
|
16
|
+
'GOOD': 'Bom',
|
|
17
|
+
'REGULAR': 'Regular',
|
|
18
|
+
'NOT_RECOMMENDED': 'Não Recomendado',
|
|
19
|
+
'NO_INDEX': '--',
|
|
20
|
+
'BAD': 'Ruim',
|
|
21
|
+
};
|
|
22
|
+
var translateStatus = function (status) {
|
|
23
|
+
return statusMap[status] || '--';
|
|
24
|
+
};
|
|
25
|
+
var ProblemasResolvidos = function (_a) {
|
|
26
|
+
var value = _a.value;
|
|
27
|
+
return (React.createElement("div", { className: "reclame-aqui-problemas-resolvidos" },
|
|
28
|
+
React.createElement("span", null, "Problemas Resolvidos"),
|
|
29
|
+
React.createElement("span", null, value)));
|
|
30
|
+
};
|
|
31
|
+
var ReclameAquiStats = function (_a) {
|
|
32
|
+
var nome = _a.nome, cnpj = _a.cnpj, status = _a.status, shortname = _a.shortname, imageUrl = _a.imageUrl, quantidadeProblemasResolvidos = _a.quantidadeProblemasResolvidos, score = _a.score, percentualProblemasResolvidos = _a.percentualProblemasResolvidos;
|
|
33
|
+
return (React.createElement("div", { className: "reclame-aqui-stats-container" },
|
|
34
|
+
React.createElement("div", { className: "container-reclame-aqui-header" },
|
|
35
|
+
React.createElement("img", { src: imageUrl }),
|
|
36
|
+
React.createElement("span", { className: "bold" }, nome),
|
|
37
|
+
React.createElement("span", { className: "bold" }, cnpj)),
|
|
38
|
+
React.createElement("div", { className: "container-reclame-aqui-stats" },
|
|
39
|
+
React.createElement(ProblemasResolvidos, { value: quantidadeProblemasResolvidos }),
|
|
40
|
+
React.createElement("div", { className: "reclame-aqui-nota" },
|
|
41
|
+
React.createElement("a", { href: "https://www.reclameaqui.com.br/empresa/".concat(shortname), rel: "noreferrer", target: "_blank" },
|
|
42
|
+
React.createElement("img", { src: "https://painel.credithub.com.br/images/RA-small.png" })),
|
|
43
|
+
React.createElement("span", null, translateStatus(status)),
|
|
44
|
+
React.createElement("span", null,
|
|
45
|
+
score,
|
|
46
|
+
"/10")),
|
|
47
|
+
React.createElement(ProblemasResolvidos, { value: percentualProblemasResolvidos + '%' }))));
|
|
48
|
+
};
|
|
49
|
+
export var ReclameAquiCarousel = function (_a) {
|
|
50
|
+
var data = _a.data;
|
|
51
|
+
return (React.createElement("div", { className: "reclame-aqui-carousel" },
|
|
52
|
+
React.createElement("div", { className: "carrossel-content" },
|
|
53
|
+
React.createElement(Carousel, { pagination: false, isRTL: false, showArrows: (data === null || data === void 0 ? void 0 : data.length) > 1, renderArrow: function (_a) {
|
|
54
|
+
var type = _a.type, onClick = _a.onClick;
|
|
55
|
+
return (React.createElement("i", { className: "fa fa-angle-".concat(type == 'PREV' ? 'left' : 'right', " reclame-aqui-carousel-btn"), onClick: onClick }));
|
|
56
|
+
} }, data === null || data === void 0 ? void 0 : data.map(function (empresa, index) { return (React.createElement(ReclameAquiStats, __assign({ key: index }, empresa))); })))));
|
|
57
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
};
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import { Result } from '../interface/result';
|
|
25
|
+
import AddItemField from '../common/addItem';
|
|
26
|
+
var ResultWithoutInformation = function (_a) {
|
|
27
|
+
var _b = _a.name, name = _b === void 0 ? "Informação" : _b, _c = _a.value, value = _c === void 0 ? "Não foram encontradas informações para o documento pesquisado." : _c, props = __rest(_a, ["name", "value"]);
|
|
28
|
+
return (React.createElement(Result, null,
|
|
29
|
+
React.createElement(Result, { isContainer: true },
|
|
30
|
+
React.createElement(AddItemField, __assign({ name: name, value: value }, props)))));
|
|
31
|
+
};
|
|
32
|
+
export default ResultWithoutInformation;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Client } from "@credithub/webservice";
|
|
2
|
+
import React, { PropsWithChildren, FC } from "react";
|
|
3
|
+
import Header from "./interface/header";
|
|
4
|
+
export declare const WebService: React.Context<Client.WebService>;
|
|
5
|
+
export declare const WebServiceProvider: FC<PropsWithChildren<{
|
|
6
|
+
credential: string;
|
|
7
|
+
}>>;
|
|
8
|
+
export declare enum RequestStatus {
|
|
9
|
+
Empty = 0,
|
|
10
|
+
Loading = 1,
|
|
11
|
+
Success = 2,
|
|
12
|
+
Error = 3
|
|
13
|
+
}
|
|
14
|
+
type ParsedResponse<T> = {
|
|
15
|
+
response: Response;
|
|
16
|
+
document: T;
|
|
17
|
+
};
|
|
18
|
+
export type RequestContext<T> = {
|
|
19
|
+
data?: Client.Form;
|
|
20
|
+
urlData?: Client.Form;
|
|
21
|
+
Section: ISection<T>;
|
|
22
|
+
} & ({
|
|
23
|
+
type: RequestStatus.Empty;
|
|
24
|
+
} | {
|
|
25
|
+
type: RequestStatus.Loading;
|
|
26
|
+
} | {
|
|
27
|
+
type: RequestStatus.Error;
|
|
28
|
+
error: Error;
|
|
29
|
+
} | ({
|
|
30
|
+
type: RequestStatus.Success;
|
|
31
|
+
} & ParsedResponse<T>));
|
|
32
|
+
type HeaderReplaceResponse = {
|
|
33
|
+
children: React.ReactNode;
|
|
34
|
+
} & React.ComponentProps<typeof Header>;
|
|
35
|
+
type RenderedResponse = HeaderReplaceResponse | React.ReactNode;
|
|
36
|
+
type ISection<T> = React.FC<{
|
|
37
|
+
ctx?: RequestContext<T>;
|
|
38
|
+
onSuccess?: (data: T, ctx: RequestContext<T>) => RenderedResponse;
|
|
39
|
+
onError?: (data: Error, ctx: RequestContext<T>) => RenderedResponse;
|
|
40
|
+
onLoading?: (ctx: RequestContext<T>) => RenderedResponse;
|
|
41
|
+
hideHeader?: boolean;
|
|
42
|
+
} & React.ComponentProps<typeof Header>>;
|
|
43
|
+
export declare function query<T extends Client.Form = Client.Form, R = unknown>(query: string): React.Context<RequestContext<R>> & {
|
|
44
|
+
Request: React.FC<React.PropsWithChildren<{
|
|
45
|
+
data?: T | undefined;
|
|
46
|
+
urlData?: Client.Form | undefined;
|
|
47
|
+
}>>;
|
|
48
|
+
};
|
|
49
|
+
export declare const Queries: {
|
|
50
|
+
Finder: React.Context<RequestContext<Document>> & {
|
|
51
|
+
Request: React.FC<React.PropsWithChildren<{
|
|
52
|
+
data?: {
|
|
53
|
+
documento: string;
|
|
54
|
+
} | undefined;
|
|
55
|
+
urlData?: Client.Form | undefined;
|
|
56
|
+
}>>;
|
|
57
|
+
};
|
|
58
|
+
Protestos: React.Context<RequestContext<Document>> & {
|
|
59
|
+
Request: React.FC<React.PropsWithChildren<{
|
|
60
|
+
data?: {
|
|
61
|
+
documento: string;
|
|
62
|
+
} | undefined;
|
|
63
|
+
urlData?: Client.Form | undefined;
|
|
64
|
+
}>>;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
};
|
|
23
|
+
var _a;
|
|
24
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
25
|
+
/* eslint-disable react-hooks/rules-of-hooks */ import { Client } from "@credithub/webservice";
|
|
26
|
+
import React, { createContext, useState, useContext, useEffect, useMemo } from "react";
|
|
27
|
+
import Header from "./interface/header";
|
|
28
|
+
import cn from "classnames";
|
|
29
|
+
export var WebService = createContext(new Client.WebService);
|
|
30
|
+
export var WebServiceProvider = function (_a) {
|
|
31
|
+
var credential = _a.credential, children = _a.children;
|
|
32
|
+
return (React.createElement(WebService.Provider, { value: new Client.WebService(credential) }, children));
|
|
33
|
+
};
|
|
34
|
+
export var RequestStatus;
|
|
35
|
+
(function (RequestStatus) {
|
|
36
|
+
RequestStatus[RequestStatus["Empty"] = 0] = "Empty";
|
|
37
|
+
RequestStatus[RequestStatus["Loading"] = 1] = "Loading";
|
|
38
|
+
RequestStatus[RequestStatus["Success"] = 2] = "Success";
|
|
39
|
+
RequestStatus[RequestStatus["Error"] = 3] = "Error";
|
|
40
|
+
})(RequestStatus || (RequestStatus = {}));
|
|
41
|
+
function CustomProvider(Provider, query) {
|
|
42
|
+
return function (_a) {
|
|
43
|
+
var children = _a.children, data = _a.data, urlData = _a.urlData;
|
|
44
|
+
var client = useContext(WebService);
|
|
45
|
+
var abortController = useMemo(function () { return new AbortController; }, []);
|
|
46
|
+
var _b = useState(null), response = _b[0], setResponse = _b[1];
|
|
47
|
+
var _c = useState(null), error = _c[0], setError = _c[1];
|
|
48
|
+
useEffect(function () {
|
|
49
|
+
client.request(query, data, urlData, abortController.signal)
|
|
50
|
+
.then(function (response) { return Client.WebService.parse(response).then(function (document) { return ({ response: response, document: document }); }); })
|
|
51
|
+
.then(function (document) { return setResponse(document); })
|
|
52
|
+
.catch(function (requestError) { return setError(requestError instanceof Error ? requestError : new Error(requestError)); });
|
|
53
|
+
return function () { return abortController.abort(); };
|
|
54
|
+
}, [abortController, client, data, urlData]);
|
|
55
|
+
var value = {
|
|
56
|
+
type: error ? RequestStatus.Error : (response ? RequestStatus.Success : RequestStatus.Loading),
|
|
57
|
+
error: error,
|
|
58
|
+
data: data,
|
|
59
|
+
urlData: urlData,
|
|
60
|
+
response: response === null || response === void 0 ? void 0 : response.response,
|
|
61
|
+
document: response === null || response === void 0 ? void 0 : response.document,
|
|
62
|
+
Section: function (_a) {
|
|
63
|
+
var props = __rest(_a, []);
|
|
64
|
+
return React.createElement(Section, __assign({}, props, { ctx: value }));
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
return React.createElement(Provider.Provider, { value: value }, children);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export function query(query) {
|
|
71
|
+
var RequestContext = createContext({
|
|
72
|
+
type: RequestStatus.Empty,
|
|
73
|
+
Section: function (_a) {
|
|
74
|
+
var props = __rest(_a, []);
|
|
75
|
+
return React.createElement(Section, __assign({}, props));
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return Object.assign(RequestContext, {
|
|
79
|
+
Request: CustomProvider(RequestContext, query),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
export var Queries = {
|
|
83
|
+
Finder: query("SELECT FROM 'FINDER'.'BILLING'"),
|
|
84
|
+
Protestos: query("SELECT FROM 'APICENPROT'.'PRINT'")
|
|
85
|
+
};
|
|
86
|
+
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, "Loading"); } : _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
|
+
if (!ctx)
|
|
89
|
+
return null;
|
|
90
|
+
var renderResponse = function () {
|
|
91
|
+
switch (ctx.type) {
|
|
92
|
+
case RequestStatus.Success:
|
|
93
|
+
return onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(ctx.document, ctx);
|
|
94
|
+
case RequestStatus.Error:
|
|
95
|
+
return onError === null || onError === void 0 ? void 0 : onError(ctx.error, ctx);
|
|
96
|
+
case RequestStatus.Loading:
|
|
97
|
+
return onLoading === null || onLoading === void 0 ? void 0 : onLoading(ctx);
|
|
98
|
+
default:
|
|
99
|
+
return children;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
var renderedResponse = renderResponse();
|
|
103
|
+
if (React.isValidElement(renderedResponse)) {
|
|
104
|
+
return (React.createElement(React.Fragment, null,
|
|
105
|
+
React.createElement(Header, __assign({}, headerProps, { className: cn(className, headerStatus[ctx.type]), hidden: hideHeader })),
|
|
106
|
+
renderedResponse));
|
|
107
|
+
}
|
|
108
|
+
var _e = renderedResponse, renderedChildren = _e.children, headerReplaceProps = __rest(_e, ["children"]);
|
|
109
|
+
var headerPropsUnified = Object.assign(headerProps, headerReplaceProps);
|
|
110
|
+
return (React.createElement(React.Fragment, null,
|
|
111
|
+
React.createElement(Header, __assign({}, headerPropsUnified, { className: cn(className, headerStatus[ctx.type], headerPropsUnified.className), hidden: hideHeader })),
|
|
112
|
+
renderedChildren));
|
|
113
|
+
};
|
|
114
|
+
var headerStatus = (_a = {},
|
|
115
|
+
_a[RequestStatus.Loading] = 'external-source loading',
|
|
116
|
+
_a[RequestStatus.Success] = 'success',
|
|
117
|
+
_a[RequestStatus.Error] = 'external-source error',
|
|
118
|
+
_a[RequestStatus.Empty] = 'external-source error',
|
|
119
|
+
_a);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export var REGEX_PROTESTOS_DE_CREDITO = /(banco|ativo|securitizadora|factoring|fidc|esc|psc|fomento|mercantil|cheque|sicredi|bco|santander|caixa|bradesco|itaú|itau)/i;
|
|
2
|
+
export var REGEX_PROTESTOS_DE_IMPOSTO = /(procuradoria|secretaria|estado|sefaz|municipio|prefeitura|fazenda|ipva)/i;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook to toggle a boolean state.
|
|
3
|
+
* Can be used for toggling visibility, state, etc.
|
|
4
|
+
*
|
|
5
|
+
* @param {boolean} initOpen Initial state value. Defaults to `true`.
|
|
6
|
+
* @param {Function} [onChange] Callback function to be called after state change.
|
|
7
|
+
* @return {[boolean, () => void]} Current state and a toggle function.
|
|
8
|
+
*/
|
|
9
|
+
declare function useToggle(initialState?: boolean, onChange?: (state: boolean) => void): [boolean, () => void];
|
|
10
|
+
export default useToggle;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook to toggle a boolean state.
|
|
4
|
+
* Can be used for toggling visibility, state, etc.
|
|
5
|
+
*
|
|
6
|
+
* @param {boolean} initOpen Initial state value. Defaults to `true`.
|
|
7
|
+
* @param {Function} [onChange] Callback function to be called after state change.
|
|
8
|
+
* @return {[boolean, () => void]} Current state and a toggle function.
|
|
9
|
+
*/
|
|
10
|
+
function useToggle(initialState, onChange) {
|
|
11
|
+
if (initialState === void 0) { initialState = true; }
|
|
12
|
+
var _a = useState(initialState), state = _a[0], setState = _a[1];
|
|
13
|
+
var toggle = useCallback(function () {
|
|
14
|
+
setState(function (prevState) {
|
|
15
|
+
var newState = !prevState;
|
|
16
|
+
if (onChange) {
|
|
17
|
+
onChange(newState);
|
|
18
|
+
}
|
|
19
|
+
return newState;
|
|
20
|
+
});
|
|
21
|
+
}, [onChange]);
|
|
22
|
+
return [state, toggle];
|
|
23
|
+
}
|
|
24
|
+
export default useToggle;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as Section } from "./components/interface/section";
|
|
2
|
+
export { default as Header } from "./components/interface/header";
|
|
3
|
+
export { default as AddItemField } from "./components/common/addItem";
|
|
4
|
+
export { default as Contacts } from "./components/contacts/contacts";
|
|
5
|
+
export { default as Partners } from "./components/partners/partners";
|
|
6
|
+
export { default as Protestos } from "./components/protestos/protestos";
|
|
7
|
+
export { default as CCF } from './components/ccf/ccf';
|
|
8
|
+
export { default as Dossie } from "./components/dossie/dossie";
|
|
9
|
+
export { default as ProcessosJuridicos } from './components/processos-juridicos/processosJuridicos';
|
|
10
|
+
export { default as Addresses } from "./components/adresses/adresses";
|
|
11
|
+
export { default as BankAccounts } from './components/bank-accounts/bank-accounts';
|
|
12
|
+
export * from "./components/interface/result";
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { default as Section } from "./components/interface/section";
|
|
2
|
+
export { default as Header } from "./components/interface/header";
|
|
3
|
+
export { default as AddItemField } from "./components/common/addItem";
|
|
4
|
+
export { default as Contacts } from "./components/contacts/contacts";
|
|
5
|
+
export { default as Partners } from "./components/partners/partners";
|
|
6
|
+
export { default as Protestos } from "./components/protestos/protestos";
|
|
7
|
+
export { default as CCF } from './components/ccf/ccf';
|
|
8
|
+
export { default as Dossie } from "./components/dossie/dossie";
|
|
9
|
+
export { default as ProcessosJuridicos } from './components/processos-juridicos/processosJuridicos';
|
|
10
|
+
export { default as Addresses } from "./components/adresses/adresses";
|
|
11
|
+
export { default as BankAccounts } from './components/bank-accounts/bank-accounts';
|
|
12
|
+
export * from "./components/interface/result";
|