@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.
Files changed (162) hide show
  1. package/README.md +44 -0
  2. package/lib/cjs/components/adresses/adresses.d.ts +18 -0
  3. package/lib/cjs/components/adresses/adresses.js +68 -0
  4. package/lib/cjs/components/adresses/getGeocode.d.ts +6 -0
  5. package/lib/cjs/components/adresses/getGeocode.js +74 -0
  6. package/lib/cjs/components/adresses/map.d.ts +11 -0
  7. package/lib/cjs/components/adresses/map.js +50 -0
  8. package/lib/cjs/components/bank-accounts/bank-accounts.d.ts +3 -0
  9. package/lib/cjs/components/bank-accounts/bank-accounts.js +28 -0
  10. package/lib/cjs/components/ccf/ccf.d.ts +6 -0
  11. package/lib/cjs/components/ccf/ccf.js +31 -0
  12. package/lib/cjs/components/ccf/ccfList.d.ts +13 -0
  13. package/lib/cjs/components/ccf/ccfList.js +46 -0
  14. package/lib/cjs/components/common/addItem.d.ts +11 -0
  15. package/lib/cjs/components/common/addItem.js +40 -0
  16. package/lib/cjs/components/common/button.d.ts +5 -0
  17. package/lib/cjs/components/common/button.js +15 -0
  18. package/lib/cjs/components/common/carousel.d.ts +4 -0
  19. package/lib/cjs/components/common/carousel.js +24 -0
  20. package/lib/cjs/components/common/headerAction.d.ts +9 -0
  21. package/lib/cjs/components/common/headerAction.js +15 -0
  22. package/lib/cjs/components/contacts/contacts.d.ts +14 -0
  23. package/lib/cjs/components/contacts/contacts.js +68 -0
  24. package/lib/cjs/components/contacts/contactsLikeDislike.d.ts +9 -0
  25. package/lib/cjs/components/contacts/contactsLikeDislike.js +14 -0
  26. package/lib/cjs/components/contacts/thumbsButton.d.ts +10 -0
  27. package/lib/cjs/components/contacts/thumbsButton.js +22 -0
  28. package/lib/cjs/components/dossie/carrousel/carrousel.d.ts +8 -0
  29. package/lib/cjs/components/dossie/carrousel/carrousel.js +15 -0
  30. package/lib/cjs/components/dossie/companyLogo/companyLogo.d.ts +7 -0
  31. package/lib/cjs/components/dossie/companyLogo/companyLogo.js +19 -0
  32. package/lib/cjs/components/dossie/dossie.d.ts +35 -0
  33. package/lib/cjs/components/dossie/dossie.js +66 -0
  34. package/lib/cjs/components/dossie/summary/summary.d.ts +17 -0
  35. package/lib/cjs/components/dossie/summary/summary.js +187 -0
  36. package/lib/cjs/components/dossie/transactionTable/transactionTable.d.ts +6 -0
  37. package/lib/cjs/components/dossie/transactionTable/transactionTable.js +39 -0
  38. package/lib/cjs/components/interface/header.d.ts +16 -0
  39. package/lib/cjs/components/interface/header.js +56 -0
  40. package/lib/cjs/components/interface/result.d.ts +7 -0
  41. package/lib/cjs/components/interface/result.js +38 -0
  42. package/lib/cjs/components/interface/section.d.ts +14 -0
  43. package/lib/cjs/components/interface/section.js +45 -0
  44. package/lib/cjs/components/partners/partnerField.d.ts +9 -0
  45. package/lib/cjs/components/partners/partnerField.js +14 -0
  46. package/lib/cjs/components/partners/partnerList.d.ts +16 -0
  47. package/lib/cjs/components/partners/partnerList.js +43 -0
  48. package/lib/cjs/components/partners/partners.d.ts +3 -0
  49. package/lib/cjs/components/partners/partners.js +55 -0
  50. package/lib/cjs/components/processos-juridicos/envolvidosList.d.ts +9 -0
  51. package/lib/cjs/components/processos-juridicos/envolvidosList.js +22 -0
  52. package/lib/cjs/components/processos-juridicos/processosJuridicos.d.ts +7 -0
  53. package/lib/cjs/components/processos-juridicos/processosJuridicos.js +24 -0
  54. package/lib/cjs/components/processos-juridicos/processosJuridicosList.d.ts +15 -0
  55. package/lib/cjs/components/processos-juridicos/processosJuridicosList.js +52 -0
  56. package/lib/cjs/components/protestos/protestos.d.ts +3 -0
  57. package/lib/cjs/components/protestos/protestos.js +69 -0
  58. package/lib/cjs/components/protestos/protestosCategory.d.ts +7 -0
  59. package/lib/cjs/components/protestos/protestosCategory.js +21 -0
  60. package/lib/cjs/components/protestos/protestosList.d.ts +33 -0
  61. package/lib/cjs/components/protestos/protestosList.js +73 -0
  62. package/lib/cjs/components/reclameAqui/reclameAquiCarousel.d.ts +26 -0
  63. package/lib/cjs/components/reclameAqui/reclameAquiCarousel.js +64 -0
  64. package/lib/cjs/components/resultWithoutInformation/ResultWithoutInformation.d.ts +4 -0
  65. package/lib/cjs/components/resultWithoutInformation/ResultWithoutInformation.js +37 -0
  66. package/lib/cjs/components/webservice.d.ts +67 -0
  67. package/lib/cjs/components/webservice.js +150 -0
  68. package/lib/cjs/constants/regex.d.ts +2 -0
  69. package/lib/cjs/constants/regex.js +5 -0
  70. package/lib/cjs/hooks/useToggle.d.ts +10 -0
  71. package/lib/cjs/hooks/useToggle.js +26 -0
  72. package/lib/cjs/index.d.ts +12 -0
  73. package/lib/cjs/index.js +43 -0
  74. package/lib/cjs/mock/dossie.d.ts +207 -0
  75. package/lib/cjs/mock/dossie.js +630 -0
  76. package/lib/cjs/utils/number.d.ts +1 -0
  77. package/lib/cjs/utils/number.js +10 -0
  78. package/lib/cjs/utils/string.d.ts +3 -0
  79. package/lib/cjs/utils/string.js +22 -0
  80. package/lib/cjs/utils/xpath.d.ts +4 -0
  81. package/lib/cjs/utils/xpath.js +12 -0
  82. package/lib/esm/components/adresses/adresses.d.ts +18 -0
  83. package/lib/esm/components/adresses/adresses.js +40 -0
  84. package/lib/esm/components/adresses/getGeocode.d.ts +6 -0
  85. package/lib/esm/components/adresses/getGeocode.js +67 -0
  86. package/lib/esm/components/adresses/map.d.ts +11 -0
  87. package/lib/esm/components/adresses/map.js +25 -0
  88. package/lib/esm/components/bank-accounts/bank-accounts.d.ts +3 -0
  89. package/lib/esm/components/bank-accounts/bank-accounts.js +23 -0
  90. package/lib/esm/components/ccf/ccf.d.ts +6 -0
  91. package/lib/esm/components/ccf/ccf.js +26 -0
  92. package/lib/esm/components/ccf/ccfList.d.ts +13 -0
  93. package/lib/esm/components/ccf/ccfList.js +18 -0
  94. package/lib/esm/components/common/addItem.d.ts +11 -0
  95. package/lib/esm/components/common/addItem.js +35 -0
  96. package/lib/esm/components/common/button.d.ts +5 -0
  97. package/lib/esm/components/common/button.js +10 -0
  98. package/lib/esm/components/common/carousel.d.ts +4 -0
  99. package/lib/esm/components/common/carousel.js +19 -0
  100. package/lib/esm/components/common/headerAction.d.ts +9 -0
  101. package/lib/esm/components/common/headerAction.js +10 -0
  102. package/lib/esm/components/contacts/contacts.d.ts +14 -0
  103. package/lib/esm/components/contacts/contacts.js +40 -0
  104. package/lib/esm/components/contacts/contactsLikeDislike.d.ts +9 -0
  105. package/lib/esm/components/contacts/contactsLikeDislike.js +9 -0
  106. package/lib/esm/components/contacts/thumbsButton.d.ts +10 -0
  107. package/lib/esm/components/contacts/thumbsButton.js +17 -0
  108. package/lib/esm/components/dossie/carrousel/carrousel.d.ts +8 -0
  109. package/lib/esm/components/dossie/carrousel/carrousel.js +8 -0
  110. package/lib/esm/components/dossie/companyLogo/companyLogo.d.ts +7 -0
  111. package/lib/esm/components/dossie/companyLogo/companyLogo.js +14 -0
  112. package/lib/esm/components/dossie/dossie.d.ts +35 -0
  113. package/lib/esm/components/dossie/dossie.js +38 -0
  114. package/lib/esm/components/dossie/summary/summary.d.ts +17 -0
  115. package/lib/esm/components/dossie/summary/summary.js +180 -0
  116. package/lib/esm/components/dossie/transactionTable/transactionTable.d.ts +6 -0
  117. package/lib/esm/components/dossie/transactionTable/transactionTable.js +32 -0
  118. package/lib/esm/components/interface/header.d.ts +16 -0
  119. package/lib/esm/components/interface/header.js +51 -0
  120. package/lib/esm/components/interface/result.d.ts +7 -0
  121. package/lib/esm/components/interface/result.js +31 -0
  122. package/lib/esm/components/interface/section.d.ts +14 -0
  123. package/lib/esm/components/interface/section.js +40 -0
  124. package/lib/esm/components/partners/partnerField.d.ts +9 -0
  125. package/lib/esm/components/partners/partnerField.js +9 -0
  126. package/lib/esm/components/partners/partnerList.d.ts +16 -0
  127. package/lib/esm/components/partners/partnerList.js +15 -0
  128. package/lib/esm/components/partners/partners.d.ts +3 -0
  129. package/lib/esm/components/partners/partners.js +27 -0
  130. package/lib/esm/components/processos-juridicos/envolvidosList.d.ts +9 -0
  131. package/lib/esm/components/processos-juridicos/envolvidosList.js +17 -0
  132. package/lib/esm/components/processos-juridicos/processosJuridicos.d.ts +7 -0
  133. package/lib/esm/components/processos-juridicos/processosJuridicos.js +19 -0
  134. package/lib/esm/components/processos-juridicos/processosJuridicosList.d.ts +15 -0
  135. package/lib/esm/components/processos-juridicos/processosJuridicosList.js +24 -0
  136. package/lib/esm/components/protestos/protestos.d.ts +3 -0
  137. package/lib/esm/components/protestos/protestos.js +41 -0
  138. package/lib/esm/components/protestos/protestosCategory.d.ts +7 -0
  139. package/lib/esm/components/protestos/protestosCategory.js +16 -0
  140. package/lib/esm/components/protestos/protestosList.d.ts +33 -0
  141. package/lib/esm/components/protestos/protestosList.js +43 -0
  142. package/lib/esm/components/reclameAqui/reclameAquiCarousel.d.ts +26 -0
  143. package/lib/esm/components/reclameAqui/reclameAquiCarousel.js +57 -0
  144. package/lib/esm/components/resultWithoutInformation/ResultWithoutInformation.d.ts +4 -0
  145. package/lib/esm/components/resultWithoutInformation/ResultWithoutInformation.js +32 -0
  146. package/lib/esm/components/webservice.d.ts +67 -0
  147. package/lib/esm/components/webservice.js +119 -0
  148. package/lib/esm/constants/regex.d.ts +2 -0
  149. package/lib/esm/constants/regex.js +2 -0
  150. package/lib/esm/hooks/useToggle.d.ts +10 -0
  151. package/lib/esm/hooks/useToggle.js +24 -0
  152. package/lib/esm/index.d.ts +12 -0
  153. package/lib/esm/index.js +12 -0
  154. package/lib/esm/mock/dossie.d.ts +207 -0
  155. package/lib/esm/mock/dossie.js +628 -0
  156. package/lib/esm/utils/number.d.ts +1 -0
  157. package/lib/esm/utils/number.js +6 -0
  158. package/lib/esm/utils/string.d.ts +3 -0
  159. package/lib/esm/utils/string.js +16 -0
  160. package/lib/esm/utils/xpath.d.ts +4 -0
  161. package/lib/esm/utils/xpath.js +10 -0
  162. package/package.json +79 -0
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ReclameAquiCarousel = void 0;
18
+ var react_1 = __importDefault(require("react"));
19
+ var carousel_1 = __importDefault(require("../common/carousel"));
20
+ var statusMap = {
21
+ 'GREAT': 'Ótimo',
22
+ 'GOOD': 'Bom',
23
+ 'REGULAR': 'Regular',
24
+ 'NOT_RECOMMENDED': 'Não Recomendado',
25
+ 'NO_INDEX': '--',
26
+ 'BAD': 'Ruim',
27
+ };
28
+ var translateStatus = function (status) {
29
+ return statusMap[status] || '--';
30
+ };
31
+ var ProblemasResolvidos = function (_a) {
32
+ var value = _a.value;
33
+ return (react_1.default.createElement("div", { className: "reclame-aqui-problemas-resolvidos" },
34
+ react_1.default.createElement("span", null, "Problemas Resolvidos"),
35
+ react_1.default.createElement("span", null, value)));
36
+ };
37
+ var ReclameAquiStats = function (_a) {
38
+ 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;
39
+ return (react_1.default.createElement("div", { className: "reclame-aqui-stats-container" },
40
+ react_1.default.createElement("div", { className: "container-reclame-aqui-header" },
41
+ react_1.default.createElement("img", { src: imageUrl }),
42
+ react_1.default.createElement("span", { className: "bold" }, nome),
43
+ react_1.default.createElement("span", { className: "bold" }, cnpj)),
44
+ react_1.default.createElement("div", { className: "container-reclame-aqui-stats" },
45
+ react_1.default.createElement(ProblemasResolvidos, { value: quantidadeProblemasResolvidos }),
46
+ react_1.default.createElement("div", { className: "reclame-aqui-nota" },
47
+ react_1.default.createElement("a", { href: "https://www.reclameaqui.com.br/empresa/".concat(shortname), rel: "noreferrer", target: "_blank" },
48
+ react_1.default.createElement("img", { src: "https://painel.credithub.com.br/images/RA-small.png" })),
49
+ react_1.default.createElement("span", null, translateStatus(status)),
50
+ react_1.default.createElement("span", null,
51
+ score,
52
+ "/10")),
53
+ react_1.default.createElement(ProblemasResolvidos, { value: percentualProblemasResolvidos + '%' }))));
54
+ };
55
+ var ReclameAquiCarousel = function (_a) {
56
+ var data = _a.data;
57
+ return (react_1.default.createElement("div", { className: "reclame-aqui-carousel" },
58
+ react_1.default.createElement("div", { className: "carrossel-content" },
59
+ react_1.default.createElement(carousel_1.default, { pagination: false, isRTL: false, showArrows: (data === null || data === void 0 ? void 0 : data.length) > 1, renderArrow: function (_a) {
60
+ var type = _a.type, onClick = _a.onClick;
61
+ return (react_1.default.createElement("i", { className: "fa fa-angle-".concat(type == 'PREV' ? 'left' : 'right', " reclame-aqui-carousel-btn"), onClick: onClick }));
62
+ } }, data === null || data === void 0 ? void 0 : data.map(function (empresa, index) { return (react_1.default.createElement(ReclameAquiStats, __assign({ key: index }, empresa))); })))));
63
+ };
64
+ exports.ReclameAquiCarousel = ReclameAquiCarousel;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { AddItemProps } from '../common/addItem';
3
+ declare const ResultWithoutInformation: React.FC<Partial<AddItemProps>>;
4
+ export default ResultWithoutInformation;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ var react_1 = __importDefault(require("react"));
29
+ var result_1 = require("../interface/result");
30
+ var addItem_1 = __importDefault(require("../common/addItem"));
31
+ var ResultWithoutInformation = function (_a) {
32
+ 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"]);
33
+ return (react_1.default.createElement(result_1.Result, null,
34
+ react_1.default.createElement(result_1.Result, { isContainer: true },
35
+ react_1.default.createElement(addItem_1.default, __assign({ name: name, value: value }, props)))));
36
+ };
37
+ exports.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,150 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ var __rest = (this && this.__rest) || function (s, e) {
37
+ var t = {};
38
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
39
+ t[p] = s[p];
40
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
41
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
42
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
43
+ t[p[i]] = s[p[i]];
44
+ }
45
+ return t;
46
+ };
47
+ var __importDefault = (this && this.__importDefault) || function (mod) {
48
+ return (mod && mod.__esModule) ? mod : { "default": mod };
49
+ };
50
+ var _a;
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.Queries = exports.query = exports.RequestStatus = exports.WebServiceProvider = exports.WebService = void 0;
53
+ /* eslint-disable @typescript-eslint/no-explicit-any */
54
+ /* eslint-disable react-hooks/rules-of-hooks */ var webservice_1 = require("@credithub/webservice");
55
+ var react_1 = __importStar(require("react"));
56
+ var header_1 = __importDefault(require("./interface/header"));
57
+ var classnames_1 = __importDefault(require("classnames"));
58
+ exports.WebService = (0, react_1.createContext)(new webservice_1.Client.WebService);
59
+ var WebServiceProvider = function (_a) {
60
+ var credential = _a.credential, children = _a.children;
61
+ return (react_1.default.createElement(exports.WebService.Provider, { value: new webservice_1.Client.WebService(credential) }, children));
62
+ };
63
+ exports.WebServiceProvider = WebServiceProvider;
64
+ var RequestStatus;
65
+ (function (RequestStatus) {
66
+ RequestStatus[RequestStatus["Empty"] = 0] = "Empty";
67
+ RequestStatus[RequestStatus["Loading"] = 1] = "Loading";
68
+ RequestStatus[RequestStatus["Success"] = 2] = "Success";
69
+ RequestStatus[RequestStatus["Error"] = 3] = "Error";
70
+ })(RequestStatus || (exports.RequestStatus = RequestStatus = {}));
71
+ function CustomProvider(Provider, query) {
72
+ return function (_a) {
73
+ var children = _a.children, data = _a.data, urlData = _a.urlData;
74
+ var client = (0, react_1.useContext)(exports.WebService);
75
+ var abortController = (0, react_1.useMemo)(function () { return new AbortController; }, []);
76
+ var _b = (0, react_1.useState)(null), response = _b[0], setResponse = _b[1];
77
+ var _c = (0, react_1.useState)(null), error = _c[0], setError = _c[1];
78
+ (0, react_1.useEffect)(function () {
79
+ client.request(query, data, urlData, abortController.signal)
80
+ .then(function (response) { return webservice_1.Client.WebService.parse(response).then(function (document) { return ({ response: response, document: document }); }); })
81
+ .then(function (document) { return setResponse(document); })
82
+ .catch(function (requestError) { return setError(requestError instanceof Error ? requestError : new Error(requestError)); });
83
+ return function () { return abortController.abort(); };
84
+ }, [abortController, client, data, urlData]);
85
+ var value = {
86
+ type: error ? RequestStatus.Error : (response ? RequestStatus.Success : RequestStatus.Loading),
87
+ error: error,
88
+ data: data,
89
+ urlData: urlData,
90
+ response: response === null || response === void 0 ? void 0 : response.response,
91
+ document: response === null || response === void 0 ? void 0 : response.document,
92
+ Section: function (_a) {
93
+ var props = __rest(_a, []);
94
+ return react_1.default.createElement(Section, __assign({}, props, { ctx: value }));
95
+ }
96
+ };
97
+ return react_1.default.createElement(Provider.Provider, { value: value }, children);
98
+ };
99
+ }
100
+ function query(query) {
101
+ var RequestContext = (0, react_1.createContext)({
102
+ type: RequestStatus.Empty,
103
+ Section: function (_a) {
104
+ var props = __rest(_a, []);
105
+ return react_1.default.createElement(Section, __assign({}, props));
106
+ }
107
+ });
108
+ return Object.assign(RequestContext, {
109
+ Request: CustomProvider(RequestContext, query),
110
+ });
111
+ }
112
+ exports.query = query;
113
+ exports.Queries = {
114
+ Finder: query("SELECT FROM 'FINDER'.'BILLING'"),
115
+ Protestos: query("SELECT FROM 'APICENPROT'.'PRINT'")
116
+ };
117
+ var Section = function (_a) {
118
+ var onSuccess = _a.onSuccess, _b = _a.onError, onError = _b === void 0 ? function () { return react_1.default.createElement(react_1.default.Fragment, null, "Erro"); } : _b, _c = _a.onLoading, onLoading = _c === void 0 ? function () { return react_1.default.createElement(react_1.default.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"]);
119
+ if (!ctx)
120
+ return null;
121
+ var renderResponse = function () {
122
+ switch (ctx.type) {
123
+ case RequestStatus.Success:
124
+ return onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(ctx.document, ctx);
125
+ case RequestStatus.Error:
126
+ return onError === null || onError === void 0 ? void 0 : onError(ctx.error, ctx);
127
+ case RequestStatus.Loading:
128
+ return onLoading === null || onLoading === void 0 ? void 0 : onLoading(ctx);
129
+ default:
130
+ return children;
131
+ }
132
+ };
133
+ var renderedResponse = renderResponse();
134
+ if (react_1.default.isValidElement(renderedResponse)) {
135
+ return (react_1.default.createElement(react_1.default.Fragment, null,
136
+ react_1.default.createElement(header_1.default, __assign({}, headerProps, { className: (0, classnames_1.default)(className, headerStatus[ctx.type]), hidden: hideHeader })),
137
+ renderedResponse));
138
+ }
139
+ var _e = renderedResponse, renderedChildren = _e.children, headerReplaceProps = __rest(_e, ["children"]);
140
+ var headerPropsUnified = Object.assign(headerProps, headerReplaceProps);
141
+ return (react_1.default.createElement(react_1.default.Fragment, null,
142
+ react_1.default.createElement(header_1.default, __assign({}, headerPropsUnified, { className: (0, classnames_1.default)(className, headerStatus[ctx.type], headerPropsUnified.className), hidden: hideHeader })),
143
+ renderedChildren));
144
+ };
145
+ var headerStatus = (_a = {},
146
+ _a[RequestStatus.Loading] = 'external-source loading',
147
+ _a[RequestStatus.Success] = 'success',
148
+ _a[RequestStatus.Error] = 'external-source error',
149
+ _a[RequestStatus.Empty] = 'external-source error',
150
+ _a);
@@ -0,0 +1,2 @@
1
+ export declare const REGEX_PROTESTOS_DE_CREDITO: RegExp;
2
+ export declare const REGEX_PROTESTOS_DE_IMPOSTO: RegExp;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REGEX_PROTESTOS_DE_IMPOSTO = exports.REGEX_PROTESTOS_DE_CREDITO = void 0;
4
+ exports.REGEX_PROTESTOS_DE_CREDITO = /(banco|ativo|securitizadora|factoring|fidc|esc|psc|fomento|mercantil|cheque|sicredi|bco|santander|caixa|bradesco|itaú|itau)/i;
5
+ exports.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,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var react_1 = require("react");
4
+ /**
5
+ * Custom hook to toggle a boolean state.
6
+ * Can be used for toggling visibility, state, etc.
7
+ *
8
+ * @param {boolean} initOpen Initial state value. Defaults to `true`.
9
+ * @param {Function} [onChange] Callback function to be called after state change.
10
+ * @return {[boolean, () => void]} Current state and a toggle function.
11
+ */
12
+ function useToggle(initialState, onChange) {
13
+ if (initialState === void 0) { initialState = true; }
14
+ var _a = (0, react_1.useState)(initialState), state = _a[0], setState = _a[1];
15
+ var toggle = (0, react_1.useCallback)(function () {
16
+ setState(function (prevState) {
17
+ var newState = !prevState;
18
+ if (onChange) {
19
+ onChange(newState);
20
+ }
21
+ return newState;
22
+ });
23
+ }, [onChange]);
24
+ return [state, toggle];
25
+ }
26
+ exports.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";
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.BankAccounts = exports.Addresses = exports.ProcessosJuridicos = exports.Dossie = exports.CCF = exports.Protestos = exports.Partners = exports.Contacts = exports.AddItemField = exports.Header = exports.Section = void 0;
21
+ var section_1 = require("./components/interface/section");
22
+ Object.defineProperty(exports, "Section", { enumerable: true, get: function () { return __importDefault(section_1).default; } });
23
+ var header_1 = require("./components/interface/header");
24
+ Object.defineProperty(exports, "Header", { enumerable: true, get: function () { return __importDefault(header_1).default; } });
25
+ var addItem_1 = require("./components/common/addItem");
26
+ Object.defineProperty(exports, "AddItemField", { enumerable: true, get: function () { return __importDefault(addItem_1).default; } });
27
+ var contacts_1 = require("./components/contacts/contacts");
28
+ Object.defineProperty(exports, "Contacts", { enumerable: true, get: function () { return __importDefault(contacts_1).default; } });
29
+ var partners_1 = require("./components/partners/partners");
30
+ Object.defineProperty(exports, "Partners", { enumerable: true, get: function () { return __importDefault(partners_1).default; } });
31
+ var protestos_1 = require("./components/protestos/protestos");
32
+ Object.defineProperty(exports, "Protestos", { enumerable: true, get: function () { return __importDefault(protestos_1).default; } });
33
+ var ccf_1 = require("./components/ccf/ccf");
34
+ Object.defineProperty(exports, "CCF", { enumerable: true, get: function () { return __importDefault(ccf_1).default; } });
35
+ var dossie_1 = require("./components/dossie/dossie");
36
+ Object.defineProperty(exports, "Dossie", { enumerable: true, get: function () { return __importDefault(dossie_1).default; } });
37
+ var processosJuridicos_1 = require("./components/processos-juridicos/processosJuridicos");
38
+ Object.defineProperty(exports, "ProcessosJuridicos", { enumerable: true, get: function () { return __importDefault(processosJuridicos_1).default; } });
39
+ var adresses_1 = require("./components/adresses/adresses");
40
+ Object.defineProperty(exports, "Addresses", { enumerable: true, get: function () { return __importDefault(adresses_1).default; } });
41
+ var bank_accounts_1 = require("./components/bank-accounts/bank-accounts");
42
+ Object.defineProperty(exports, "BankAccounts", { enumerable: true, get: function () { return __importDefault(bank_accounts_1).default; } });
43
+ __exportStar(require("./components/interface/result"), exports);
@@ -0,0 +1,207 @@
1
+ declare const returnData: () => {
2
+ "@type": string;
3
+ "@version": string;
4
+ associates: {
5
+ tipo: string;
6
+ document: string;
7
+ dividasPublicas: string;
8
+ nome: string;
9
+ protestos: number;
10
+ receitaStatus: string;
11
+ }[];
12
+ events: {
13
+ "@types": string;
14
+ "@version": string;
15
+ identificator: string;
16
+ name: string;
17
+ memories: string;
18
+ message: string;
19
+ parameters: {
20
+ name: string;
21
+ "CPF/CNPJ": string;
22
+ };
23
+ queryType: string;
24
+ resultBehaviour: number;
25
+ resultNotation: string;
26
+ status: number;
27
+ target: {
28
+ "@types": string;
29
+ "@version": string;
30
+ about: {
31
+ fantasyName: string;
32
+ phones: string[];
33
+ addresses: {
34
+ street: string;
35
+ number: string;
36
+ complement: string;
37
+ district: string;
38
+ city: string;
39
+ state: string;
40
+ country: string;
41
+ zipcode: string;
42
+ main: boolean;
43
+ }[];
44
+ birthday: string;
45
+ emails: string[];
46
+ status: boolean;
47
+ companySize: string;
48
+ jointStock: string;
49
+ numberOfEmployees: string;
50
+ companyAge: string;
51
+ openingDate: string;
52
+ economicActivity: string;
53
+ };
54
+ };
55
+ }[];
56
+ notations: {
57
+ "@types": string;
58
+ "@version": string;
59
+ identificator: string;
60
+ queryType: string;
61
+ results: ({
62
+ "@types": string;
63
+ "@version": string;
64
+ behaviour: number;
65
+ items: {
66
+ "@types": string;
67
+ "@version": string;
68
+ about: {
69
+ name: string;
70
+ phones: string[];
71
+ addresses: {
72
+ street: string;
73
+ number: string;
74
+ complement: string;
75
+ district: string;
76
+ city: string;
77
+ state: string;
78
+ country: string;
79
+ zipcode: string;
80
+ main: boolean;
81
+ urlImage: string;
82
+ pastUrlImage: string;
83
+ urlMaps: string;
84
+ }[];
85
+ birthday: string;
86
+ emails: string[];
87
+ };
88
+ }[];
89
+ notation: string;
90
+ notationType: number;
91
+ sideNote: string;
92
+ subtitle: string;
93
+ title: string;
94
+ } | {
95
+ "@types": string;
96
+ "@version": string;
97
+ behaviour: number;
98
+ items: {
99
+ "@types": string;
100
+ "@version": string;
101
+ about: {
102
+ name: string;
103
+ phones: string[];
104
+ addresses: {
105
+ street: string;
106
+ number: string;
107
+ complement: string;
108
+ district: string;
109
+ city: string;
110
+ state: string;
111
+ country: string;
112
+ zipcode: string;
113
+ main: boolean;
114
+ urlImage: string;
115
+ urlMaps: string;
116
+ }[];
117
+ birthday: string;
118
+ emails: string[];
119
+ };
120
+ }[];
121
+ notation: string;
122
+ notationType: number;
123
+ sideNote: string;
124
+ subtitle: string;
125
+ title: string;
126
+ })[];
127
+ target: {
128
+ "@types": string;
129
+ "@version": string;
130
+ about: {
131
+ fantasyName: string;
132
+ phones: string[];
133
+ addresses: {
134
+ street: string;
135
+ number: string;
136
+ complement: string;
137
+ district: string;
138
+ city: string;
139
+ state: string;
140
+ country: string;
141
+ zipcode: string;
142
+ main: boolean;
143
+ }[];
144
+ birthday: string;
145
+ emails: string[];
146
+ status: boolean;
147
+ companySize: string;
148
+ jointStock: string;
149
+ numberOfEmployees: string;
150
+ companyAge: string;
151
+ openingDate: string;
152
+ economicActivity: string;
153
+ };
154
+ };
155
+ }[];
156
+ relations: {
157
+ "@types": string;
158
+ "@version": string;
159
+ description: string;
160
+ from: string;
161
+ to: string;
162
+ type: number;
163
+ };
164
+ target: {
165
+ "@types": string;
166
+ "@version": string;
167
+ about: {
168
+ nomeFantasia: string;
169
+ contacts: {
170
+ phone: string;
171
+ email: string;
172
+ validEmail: boolean;
173
+ }[];
174
+ addresses: {
175
+ address: string;
176
+ type: string;
177
+ number: string;
178
+ complement: string;
179
+ district: string;
180
+ city: string;
181
+ state: string;
182
+ country: string;
183
+ zipcode: string;
184
+ main: boolean;
185
+ urlImage: string;
186
+ urlMaps: string;
187
+ }[];
188
+ aniversario: string;
189
+ emails: string[];
190
+ situacao: string;
191
+ dividaPublica: string;
192
+ porteDaEmpresa: string;
193
+ capitalSocial: string;
194
+ chequesDevolvidos: number;
195
+ totalDeProtestos: number;
196
+ quantidadeDeFuncionarios: string;
197
+ idadeDaEmpresa: string;
198
+ dataDeAbertura: string;
199
+ atividadeEconomica: string;
200
+ "CPF/CNPJ": string;
201
+ };
202
+ identificator: {
203
+ "CPF/CNPJ": string;
204
+ };
205
+ };
206
+ };
207
+ export default returnData;