@credithub/harlan-components 1.3.3 → 1.4.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.
Files changed (115) hide show
  1. package/lib/cjs/components/ccf/ccf.js +2 -5
  2. package/lib/cjs/components/chart/categoryProtestos.d.ts +4 -0
  3. package/lib/cjs/components/chart/categoryProtestos.js +97 -0
  4. package/lib/cjs/components/chart/chartContent.d.ts +7 -0
  5. package/lib/cjs/components/chart/chartContent.js +77 -0
  6. package/lib/cjs/components/chart/chartHelper.d.ts +7 -0
  7. package/lib/cjs/components/chart/chartHelper.js +66 -0
  8. package/lib/cjs/components/chart/customChart.d.ts +10 -0
  9. package/lib/cjs/components/chart/customChart.js +125 -0
  10. package/lib/cjs/components/chart/getUniqueDates.d.ts +2 -0
  11. package/lib/cjs/components/chart/getUniqueDates.js +8 -0
  12. package/lib/cjs/components/chart/plotly/barChartDataStrategy.d.ts +14 -0
  13. package/lib/cjs/components/chart/plotly/barChartDataStrategy.js +152 -0
  14. package/lib/cjs/components/chart/plotly/baseChartDataStrategy.d.ts +8 -0
  15. package/lib/cjs/components/chart/plotly/baseChartDataStrategy.js +31 -0
  16. package/lib/cjs/components/chart/plotly/getSeries.d.ts +3 -0
  17. package/lib/cjs/components/chart/plotly/getSeries.js +35 -0
  18. package/lib/cjs/components/chart/plotly/iChartDataStrategy.d.ts +35 -0
  19. package/lib/cjs/components/chart/plotly/iChartDataStrategy.js +2 -0
  20. package/lib/cjs/components/chart/plotly/index.d.ts +5 -0
  21. package/lib/cjs/components/chart/plotly/index.js +20 -0
  22. package/lib/cjs/components/chart/plotly/layoutLineBarChart.d.ts +39 -0
  23. package/lib/cjs/components/chart/plotly/layoutLineBarChart.js +65 -0
  24. package/lib/cjs/components/chart/plotly/lineChartDataStrategy.d.ts +17 -0
  25. package/lib/cjs/components/chart/plotly/lineChartDataStrategy.js +198 -0
  26. package/lib/cjs/components/chart/plotly/pieChartDataStrategy.d.ts +5 -0
  27. package/lib/cjs/components/chart/plotly/pieChartDataStrategy.js +45 -0
  28. package/lib/cjs/components/chart/plotly/types.d.ts +40 -0
  29. package/lib/cjs/components/chart/plotly/types.js +2 -0
  30. package/lib/cjs/components/chart/processChartData.d.ts +5 -0
  31. package/lib/cjs/components/chart/processChartData.js +41 -0
  32. package/lib/cjs/components/chart/quantityResult.d.ts +17 -0
  33. package/lib/cjs/components/chart/quantityResult.js +38 -0
  34. package/lib/cjs/components/chart/useCalculation.d.ts +6 -0
  35. package/lib/cjs/components/chart/useCalculation.js +12 -0
  36. package/lib/cjs/components/chart/useUltimaOcorrenciaCCF.d.ts +2 -0
  37. package/lib/cjs/components/chart/useUltimaOcorrenciaCCF.js +20 -0
  38. package/lib/cjs/components/protestos/getTotalProtestos.d.ts +1 -0
  39. package/lib/cjs/components/protestos/getTotalProtestos.js +10 -0
  40. package/lib/cjs/components/protestos/protestosCategory.js +1 -1
  41. package/lib/cjs/components/webservice.d.ts +14 -0
  42. package/lib/cjs/components/webservice.js +7 -6
  43. package/lib/cjs/consultaSimples.js +13 -11
  44. package/lib/cjs/index.d.ts +1 -0
  45. package/lib/cjs/index.js +4 -1
  46. package/lib/cjs/mock/mockDataInput.d.ts +34 -0
  47. package/lib/cjs/mock/mockDataInput.js +139 -0
  48. package/lib/cjs/utils/calculation.d.ts +9 -0
  49. package/lib/cjs/utils/calculation.js +23 -0
  50. package/lib/cjs/utils/date.d.ts +1 -0
  51. package/lib/cjs/utils/date.js +10 -0
  52. package/lib/cjs/utils/formatter.d.ts +2 -0
  53. package/lib/cjs/utils/formatter.js +7 -0
  54. package/lib/cjs/utils/number.d.ts +3 -2
  55. package/lib/cjs/utils/number.js +9 -5
  56. package/lib/cjs/utils/string.d.ts +1 -0
  57. package/lib/cjs/utils/string.js +8 -3
  58. package/lib/esm/components/ccf/ccf.js +2 -5
  59. package/lib/esm/components/chart/categoryProtestos.d.ts +4 -0
  60. package/lib/esm/components/chart/categoryProtestos.js +69 -0
  61. package/lib/esm/components/chart/chartContent.d.ts +7 -0
  62. package/lib/esm/components/chart/chartContent.js +49 -0
  63. package/lib/esm/components/chart/chartHelper.d.ts +7 -0
  64. package/lib/esm/components/chart/chartHelper.js +60 -0
  65. package/lib/esm/components/chart/customChart.d.ts +10 -0
  66. package/lib/esm/components/chart/customChart.js +95 -0
  67. package/lib/esm/components/chart/getUniqueDates.d.ts +2 -0
  68. package/lib/esm/components/chart/getUniqueDates.js +4 -0
  69. package/lib/esm/components/chart/plotly/barChartDataStrategy.d.ts +14 -0
  70. package/lib/esm/components/chart/plotly/barChartDataStrategy.js +149 -0
  71. package/lib/esm/components/chart/plotly/baseChartDataStrategy.d.ts +8 -0
  72. package/lib/esm/components/chart/plotly/baseChartDataStrategy.js +28 -0
  73. package/lib/esm/components/chart/plotly/getSeries.d.ts +3 -0
  74. package/lib/esm/components/chart/plotly/getSeries.js +31 -0
  75. package/lib/esm/components/chart/plotly/iChartDataStrategy.d.ts +35 -0
  76. package/lib/esm/components/chart/plotly/iChartDataStrategy.js +1 -0
  77. package/lib/esm/components/chart/plotly/index.d.ts +5 -0
  78. package/lib/esm/components/chart/plotly/index.js +5 -0
  79. package/lib/esm/components/chart/plotly/layoutLineBarChart.d.ts +39 -0
  80. package/lib/esm/components/chart/plotly/layoutLineBarChart.js +62 -0
  81. package/lib/esm/components/chart/plotly/lineChartDataStrategy.d.ts +17 -0
  82. package/lib/esm/components/chart/plotly/lineChartDataStrategy.js +195 -0
  83. package/lib/esm/components/chart/plotly/pieChartDataStrategy.d.ts +5 -0
  84. package/lib/esm/components/chart/plotly/pieChartDataStrategy.js +42 -0
  85. package/lib/esm/components/chart/plotly/types.d.ts +40 -0
  86. package/lib/esm/components/chart/plotly/types.js +1 -0
  87. package/lib/esm/components/chart/processChartData.d.ts +5 -0
  88. package/lib/esm/components/chart/processChartData.js +37 -0
  89. package/lib/esm/components/chart/quantityResult.d.ts +17 -0
  90. package/lib/esm/components/chart/quantityResult.js +33 -0
  91. package/lib/esm/components/chart/useCalculation.d.ts +6 -0
  92. package/lib/esm/components/chart/useCalculation.js +8 -0
  93. package/lib/esm/components/chart/useUltimaOcorrenciaCCF.d.ts +2 -0
  94. package/lib/esm/components/chart/useUltimaOcorrenciaCCF.js +15 -0
  95. package/lib/esm/components/protestos/getTotalProtestos.d.ts +1 -0
  96. package/lib/esm/components/protestos/getTotalProtestos.js +4 -0
  97. package/lib/esm/components/protestos/protestosCategory.js +1 -1
  98. package/lib/esm/components/webservice.d.ts +14 -0
  99. package/lib/esm/components/webservice.js +4 -3
  100. package/lib/esm/consultaSimples.js +14 -12
  101. package/lib/esm/index.d.ts +1 -0
  102. package/lib/esm/index.js +1 -0
  103. package/lib/esm/mock/mockDataInput.d.ts +34 -0
  104. package/lib/esm/mock/mockDataInput.js +137 -0
  105. package/lib/esm/utils/calculation.d.ts +9 -0
  106. package/lib/esm/utils/calculation.js +17 -0
  107. package/lib/esm/utils/date.d.ts +1 -0
  108. package/lib/esm/utils/date.js +6 -0
  109. package/lib/esm/utils/formatter.d.ts +2 -0
  110. package/lib/esm/utils/formatter.js +5 -0
  111. package/lib/esm/utils/number.d.ts +3 -2
  112. package/lib/esm/utils/number.js +7 -4
  113. package/lib/esm/utils/string.d.ts +1 -0
  114. package/lib/esm/utils/string.js +6 -2
  115. package/package.json +8 -2
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ /* eslint-disable react-hooks/exhaustive-deps */
7
+ var react_1 = require("react");
8
+ var webservice_1 = require("../webservice");
9
+ var xpath_1 = __importDefault(require("../../utils/xpath"));
10
+ var useUltimaOcorrenciaCCF = function () {
11
+ var ctxCCF = (0, react_1.useContext)(webservice_1.Queries.CCF);
12
+ var ultimaOcorrenciaCCF = (0, react_1.useMemo)(function () {
13
+ if ((ctxCCF === null || ctxCCF === void 0 ? void 0 : ctxCCF.type) === webservice_1.RequestStatus.Success) {
14
+ return xpath_1.default.select('string(//ultimaOcorrencia)', ctxCCF === null || ctxCCF === void 0 ? void 0 : ctxCCF.document);
15
+ }
16
+ return undefined;
17
+ }, [ctxCCF === null || ctxCCF === void 0 ? void 0 : ctxCCF.type]);
18
+ return ultimaOcorrenciaCCF;
19
+ };
20
+ exports.default = useUltimaOcorrenciaCCF;
@@ -0,0 +1 @@
1
+ export default function getTotalProtestos(response: Document): number;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var xpath_1 = __importDefault(require("../../utils/xpath"));
7
+ function getTotalProtestos(response) {
8
+ return xpath_1.default.select("number(//registros)", response);
9
+ }
10
+ exports.default = getTotalProtestos;
@@ -11,7 +11,7 @@ var headerAction_1 = __importDefault(require("../common/headerAction"));
11
11
  var result_1 = require("../interface/result");
12
12
  var ProtestosCategory = function (_a) {
13
13
  var registros = _a.registros, title = _a.title, subtitle = _a.subtitle, children = _a.children;
14
- var _b = (0, useToggle_1.default)(true), isOpen = _b[0], toggleOpen = _b[1];
14
+ var _b = (0, useToggle_1.default)(false), isOpen = _b[0], toggleOpen = _b[1];
15
15
  return (react_1.default.createElement(react_1.default.Fragment, null,
16
16
  react_1.default.createElement(header_1.default, { title: title, subtitle: subtitle, description: !registros
17
17
  ? "Não foram encontradas ocorrências."
@@ -103,5 +103,19 @@ export declare const Queries: {
103
103
  urlData?: Client.Form | undefined;
104
104
  }>>;
105
105
  };
106
+ GraficosAnaliticos: React.Context<RequestContext<string>> & {
107
+ Request: React.FC<React.PropsWithChildren<{
108
+ data?: {
109
+ documento: string;
110
+ } | undefined;
111
+ urlData?: Client.Form | undefined;
112
+ }>>;
113
+ };
114
+ };
115
+ export declare const headerStatus: {
116
+ 1: string;
117
+ 2: string;
118
+ 3: string;
119
+ 0: string;
106
120
  };
107
121
  export {};
@@ -49,7 +49,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
49
49
  };
50
50
  var _a;
51
51
  Object.defineProperty(exports, "__esModule", { value: true });
52
- exports.Queries = exports.query = exports.useMutation = exports.useQuery = exports.RequestStatus = exports.WebServiceProvider = exports.WebService = void 0;
52
+ exports.headerStatus = exports.Queries = exports.query = exports.useMutation = exports.useQuery = exports.RequestStatus = exports.WebServiceProvider = exports.WebService = void 0;
53
53
  /* eslint-disable @typescript-eslint/no-explicit-any */
54
54
  /* eslint-disable react-hooks/rules-of-hooks */
55
55
  var webservice_1 = require("@credithub/webservice");
@@ -92,7 +92,7 @@ function CustomProvider(Provider, query) {
92
92
  : new Error(requestError));
93
93
  });
94
94
  return function () { return abortController.abort(); };
95
- }, [abortController, client, data, urlData]);
95
+ }, []);
96
96
  var value = {
97
97
  type: error
98
98
  ? RequestStatus.Error
@@ -194,10 +194,11 @@ function query(query) {
194
194
  exports.query = query;
195
195
  exports.Queries = {
196
196
  Finder: query("SELECT FROM 'FINDER'.'BILLING'"),
197
- Protestos: query("SELECT FROM 'APICENPROT'.'PRINT'"),
197
+ Protestos: query("SELECT FROM 'IEPTB'.'IEPTBHARLAN'"),
198
198
  CCF: query("SELECT FROM 'SEEKLOC'.'CCF'"),
199
199
  ProcessosJuridicos: query("SELECT FROM 'PROCESSOSJURIDICOS'.'PROCESSOS'"),
200
200
  ReclameAqui: query("SELECT FROM 'RECLAMEAQUI'.'CONSULTA'"),
201
+ GraficosAnaliticos: query("SELECT FROM 'DOCUMENTHISTORY'.'BASICHISTORY'")
201
202
  };
202
203
  var Section = function (_a) {
203
204
  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); } : _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"]);
@@ -218,16 +219,16 @@ var Section = function (_a) {
218
219
  var renderedResponse = renderResponse();
219
220
  if (react_1.default.isValidElement(renderedResponse)) {
220
221
  return (react_1.default.createElement(react_1.default.Fragment, null,
221
- react_1.default.createElement(header_1.default, __assign({}, headerProps, { className: (0, classnames_1.default)(className, headerStatus[ctx.type]), hidden: hideHeader })),
222
+ react_1.default.createElement(header_1.default, __assign({}, headerProps, { className: (0, classnames_1.default)(className, exports.headerStatus[ctx.type]), hidden: hideHeader })),
222
223
  renderedResponse));
223
224
  }
224
225
  var _e = renderedResponse, renderedChildren = _e.children, headerReplaceProps = __rest(_e, ["children"]);
225
226
  var headerPropsUnified = Object.assign(headerProps, headerReplaceProps);
226
227
  return (react_1.default.createElement(react_1.default.Fragment, null,
227
- react_1.default.createElement(header_1.default, __assign({}, headerPropsUnified, { className: (0, classnames_1.default)(className, headerStatus[ctx.type], headerPropsUnified.className), hidden: hideHeader })),
228
+ react_1.default.createElement(header_1.default, __assign({}, headerPropsUnified, { className: (0, classnames_1.default)(className, exports.headerStatus[ctx.type], headerPropsUnified.className), hidden: hideHeader })),
228
229
  renderedChildren));
229
230
  };
230
- var headerStatus = (_a = {},
231
+ exports.headerStatus = (_a = {},
231
232
  _a[RequestStatus.Loading] = "external-source loading",
232
233
  _a[RequestStatus.Success] = "success",
233
234
  _a[RequestStatus.Error] = "external-source error",
@@ -10,16 +10,18 @@ var ConsultaSimples = function (_a) {
10
10
  return (react_1.default.createElement(_1.WebServiceProvider, { credential: apiKey },
11
11
  react_1.default.createElement(_1.Section, { title: "Consulta Simples", subtitle: "Informa\u00E7\u00F5es agregadas do CPF ou CNPJ", description: "Registro encontrado", onClose: onClose },
12
12
  react_1.default.createElement(_1.Queries.Finder.Request, { data: { documento: documento } },
13
- react_1.default.createElement(_1.Dossie, { onOpenNewTransactionModal: console.log }),
14
- react_1.default.createElement(_1.Addresses, { apiKey: apiKey }),
15
- react_1.default.createElement(_1.Contacts, { onClickConsutarEmail: console.log }),
16
- react_1.default.createElement(_1.Partners, null),
17
- react_1.default.createElement(_1.BankAccounts, null)),
18
- react_1.default.createElement(_1.Queries.CCF.Request, { data: { documento: documento } },
19
- react_1.default.createElement(_1.CCF, null)),
20
- react_1.default.createElement(_1.Queries.Protestos.Request, { data: { documento: documento } },
21
- react_1.default.createElement(_1.Protestos, null)),
22
- react_1.default.createElement(_1.Queries.ProcessosJuridicos.Request, { data: { documento: documento } },
23
- react_1.default.createElement(_1.ProcessosJuridicos, { onClickConsultarProcessoJuridico: console.log })))));
13
+ react_1.default.createElement(_1.Queries.CCF.Request, { data: { documento: documento } },
14
+ react_1.default.createElement(_1.Queries.Protestos.Request, { data: { documento: documento } },
15
+ react_1.default.createElement(_1.Queries.ProcessosJuridicos.Request, { data: { documento: documento } },
16
+ react_1.default.createElement(_1.Dossie, { onOpenNewTransactionModal: console.log }),
17
+ react_1.default.createElement(_1.Addresses, { apiKey: apiKey }),
18
+ react_1.default.createElement(_1.Contacts, { onClickConsutarEmail: console.log }),
19
+ react_1.default.createElement(_1.Partners, null),
20
+ react_1.default.createElement(_1.BankAccounts, null),
21
+ react_1.default.createElement(_1.Queries.GraficosAnaliticos.Request, { data: { documento: documento } },
22
+ react_1.default.createElement(_1.CustomChartSection, { documento: documento })),
23
+ react_1.default.createElement(_1.Protestos, null),
24
+ react_1.default.createElement(_1.CCF, null),
25
+ react_1.default.createElement(_1.ProcessosJuridicos, { onClickConsultarProcessoJuridico: console.log }))))))));
24
26
  };
25
27
  exports.default = ConsultaSimples;
@@ -9,6 +9,7 @@ export { default as CCF } from "./components/ccf/ccf";
9
9
  export { default as Dossie } from "./components/dossie/dossie";
10
10
  export { default as ProcessosJuridicos } from "./components/processos-juridicos/processosJuridicos";
11
11
  export { default as Addresses } from "./components/adresses/adresses";
12
+ export { default as Chart, ResumoDeNegativacoesChartSection as CustomChartSection } from "./components/chart/customChart";
12
13
  export { default as BankAccounts } from "./components/bank-accounts/bank-accounts";
13
14
  export { default as ResultWithoutInformation } from "./components/interface/resultWithoutInformation";
14
15
  export * from "./components/webservice";
package/lib/cjs/index.js CHANGED
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.ConsultaSimples = exports.ResultWithoutInformation = exports.BankAccounts = exports.Addresses = exports.ProcessosJuridicos = exports.Dossie = exports.CCF = exports.Protestos = exports.Partners = exports.Contacts = exports.AddItemField = exports.Loading = exports.Header = exports.Section = void 0;
20
+ exports.ConsultaSimples = exports.ResultWithoutInformation = exports.BankAccounts = exports.CustomChartSection = exports.Chart = exports.Addresses = exports.ProcessosJuridicos = exports.Dossie = exports.CCF = exports.Protestos = exports.Partners = exports.Contacts = exports.AddItemField = exports.Loading = exports.Header = exports.Section = void 0;
21
21
  var section_1 = require("./components/interface/section");
22
22
  Object.defineProperty(exports, "Section", { enumerable: true, get: function () { return __importDefault(section_1).default; } });
23
23
  var header_1 = require("./components/interface/header");
@@ -40,6 +40,9 @@ var processosJuridicos_1 = require("./components/processos-juridicos/processosJu
40
40
  Object.defineProperty(exports, "ProcessosJuridicos", { enumerable: true, get: function () { return __importDefault(processosJuridicos_1).default; } });
41
41
  var adresses_1 = require("./components/adresses/adresses");
42
42
  Object.defineProperty(exports, "Addresses", { enumerable: true, get: function () { return __importDefault(adresses_1).default; } });
43
+ var customChart_1 = require("./components/chart/customChart");
44
+ Object.defineProperty(exports, "Chart", { enumerable: true, get: function () { return __importDefault(customChart_1).default; } });
45
+ Object.defineProperty(exports, "CustomChartSection", { enumerable: true, get: function () { return customChart_1.ResumoDeNegativacoesChartSection; } });
43
46
  var bank_accounts_1 = require("./components/bank-accounts/bank-accounts");
44
47
  Object.defineProperty(exports, "BankAccounts", { enumerable: true, get: function () { return __importDefault(bank_accounts_1).default; } });
45
48
  var resultWithoutInformation_1 = require("./components/interface/resultWithoutInformation");
@@ -0,0 +1,34 @@
1
+ declare const mockDataInput: {
2
+ ccfs: {
3
+ data: string;
4
+ quantidade: number;
5
+ creation: string;
6
+ valorTotal: number;
7
+ }[];
8
+ protestos: {
9
+ data: string;
10
+ categoria: string;
11
+ quantidade: number;
12
+ creation: string;
13
+ valorTotal: number;
14
+ }[];
15
+ serasa: {
16
+ data: string;
17
+ quantidade: number;
18
+ creation: string;
19
+ valorTotal: number;
20
+ }[];
21
+ boaVista: {
22
+ data: string;
23
+ quantidade: number;
24
+ creation: string;
25
+ valorTotal: number;
26
+ }[];
27
+ dividasPublicasGrafico: {
28
+ data: string;
29
+ quantidade: number;
30
+ creation: string;
31
+ valorTotal: number;
32
+ }[];
33
+ };
34
+ export default mockDataInput;
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var mockDataInput = {
4
+ ccfs: [
5
+ {
6
+ data: "01/01/2023",
7
+ quantidade: 10,
8
+ creation: "01/01/2023",
9
+ valorTotal: 5000,
10
+ },
11
+ {
12
+ data: "02/01/2023",
13
+ quantidade: 8,
14
+ creation: "02/01/2023",
15
+ valorTotal: 4500,
16
+ },
17
+ {
18
+ data: "03/01/2023",
19
+ quantidade: 12,
20
+ creation: "03/01/2023",
21
+ valorTotal: 5200,
22
+ },
23
+ {
24
+ data: "04/01/2023",
25
+ quantidade: 7,
26
+ creation: "04/01/2023",
27
+ valorTotal: 4300,
28
+ },
29
+ ],
30
+ protestos: [
31
+ {
32
+ data: "01/01/2023",
33
+ categoria: "Protestos de Crédito",
34
+ quantidade: 5,
35
+ creation: "01/01/2023",
36
+ valorTotal: 3000,
37
+ },
38
+ {
39
+ data: "02/01/2023",
40
+ categoria: "Protestos de Impostos",
41
+ quantidade: 7,
42
+ creation: "02/01/2023",
43
+ valorTotal: 3500,
44
+ },
45
+ {
46
+ data: "03/01/2023",
47
+ categoria: "Protestos em Geral",
48
+ quantidade: 6,
49
+ creation: "03/01/2023",
50
+ valorTotal: 3200,
51
+ },
52
+ {
53
+ data: "04/01/2023",
54
+ categoria: "Protestos em Geral",
55
+ quantidade: 9,
56
+ creation: "04/01/2023",
57
+ valorTotal: 3700,
58
+ },
59
+ ],
60
+ serasa: [
61
+ {
62
+ data: "01/01/2023",
63
+ quantidade: 20,
64
+ creation: "01/01/2023",
65
+ valorTotal: 10000,
66
+ },
67
+ {
68
+ data: "02/01/2023",
69
+ quantidade: 15,
70
+ creation: "02/01/2023",
71
+ valorTotal: 9000,
72
+ },
73
+ {
74
+ data: "03/01/2023",
75
+ quantidade: 18,
76
+ creation: "03/01/2023",
77
+ valorTotal: 9500,
78
+ },
79
+ {
80
+ data: "04/01/2023",
81
+ quantidade: 16,
82
+ creation: "04/01/2023",
83
+ valorTotal: 8800,
84
+ },
85
+ ],
86
+ boaVista: [
87
+ {
88
+ data: "01/01/2023",
89
+ quantidade: 8,
90
+ creation: "01/01/2023",
91
+ valorTotal: 4000,
92
+ },
93
+ {
94
+ data: "02/01/2023",
95
+ quantidade: 6,
96
+ creation: "02/01/2023",
97
+ valorTotal: 3600,
98
+ },
99
+ {
100
+ data: "03/01/2023",
101
+ quantidade: 7,
102
+ creation: "03/01/2023",
103
+ valorTotal: 3800,
104
+ },
105
+ {
106
+ data: "04/01/2023",
107
+ quantidade: 5,
108
+ creation: "04/01/2023",
109
+ valorTotal: 3500,
110
+ },
111
+ ],
112
+ dividasPublicasGrafico: [
113
+ {
114
+ data: "01/01/2023",
115
+ quantidade: 12,
116
+ creation: "01/01/2023",
117
+ valorTotal: 6000,
118
+ },
119
+ {
120
+ data: "02/01/2023",
121
+ quantidade: 10,
122
+ creation: "02/01/2023",
123
+ valorTotal: 5500,
124
+ },
125
+ {
126
+ data: "03/01/2023",
127
+ quantidade: 14,
128
+ creation: "03/01/2023",
129
+ valorTotal: 6200,
130
+ },
131
+ {
132
+ data: "04/01/2023",
133
+ quantidade: 11,
134
+ creation: "04/01/2023",
135
+ valorTotal: 5800,
136
+ },
137
+ ],
138
+ };
139
+ exports.default = mockDataInput;
@@ -0,0 +1,9 @@
1
+ export interface ItemCalculo {
2
+ quantidade?: number | null;
3
+ valorTotal?: number | null;
4
+ data?: string | Date;
5
+ creation?: string | Date;
6
+ }
7
+ export declare function somarQuantidades(itens: ItemCalculo[]): number;
8
+ export declare function somarValoresTotais(itens: ItemCalculo[]): number;
9
+ export declare function encontrarDataMaisRecente(itens: ItemCalculo[]): string;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.encontrarDataMaisRecente = exports.somarValoresTotais = exports.somarQuantidades = void 0;
4
+ function somarQuantidades(itens) {
5
+ return itens.reduce(function (total, item) { var _a; return total + ((_a = item.quantidade) !== null && _a !== void 0 ? _a : 0); }, 0);
6
+ }
7
+ exports.somarQuantidades = somarQuantidades;
8
+ function somarValoresTotais(itens) {
9
+ return itens.reduce(function (total, item) { var _a; return total + ((_a = item.valorTotal) !== null && _a !== void 0 ? _a : 0); }, 0);
10
+ }
11
+ exports.somarValoresTotais = somarValoresTotais;
12
+ function encontrarDataMaisRecente(itens) {
13
+ var maisRecente = itens.reduce(function (maisRecente, item) {
14
+ var dataAtual = item.data ? new Date(item.data) : new Date(0);
15
+ return dataAtual > maisRecente ? dataAtual : maisRecente;
16
+ }, new Date(0));
17
+ return (maisRecente.getDate().toString().padStart(2, "0") +
18
+ "/" +
19
+ (maisRecente.getMonth() + 1).toString().padStart(2, "0") +
20
+ "/" +
21
+ maisRecente.getFullYear().toString());
22
+ }
23
+ exports.encontrarDataMaisRecente = encontrarDataMaisRecente;
@@ -0,0 +1 @@
1
+ export declare function isDate(date: string | Date): boolean;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isDate = void 0;
4
+ var dateRegex = /^\d{4}-\d{2}-\d{2}$/;
5
+ function isDate(date) {
6
+ if (typeof date === 'string' && !dateRegex.test(date))
7
+ return false;
8
+ return !isNaN(new Date(date).getTime());
9
+ }
10
+ exports.isDate = isDate;
@@ -0,0 +1,2 @@
1
+ declare const formatter: Intl.NumberFormat;
2
+ export default formatter;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var formatter = new Intl.NumberFormat("pt-BR", {
4
+ style: "currency",
5
+ currency: "BRL",
6
+ });
7
+ exports.default = formatter;
@@ -1,2 +1,3 @@
1
- export declare const formatMoney: (value: string | number) => string;
2
- export declare const phoneMask: (value: string) => string;
1
+ export declare const formatMoney: (value?: string | number) => string;
2
+ export declare const phoneMask: (value?: string) => string;
3
+ export declare function formatValue(valor?: number): string | undefined;
@@ -1,19 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.phoneMask = exports.formatMoney = void 0;
3
+ exports.formatValue = exports.phoneMask = exports.formatMoney = void 0;
4
4
  var formatMoney = function (value) {
5
- return new Intl.NumberFormat('pt-BR', {
6
- style: 'currency',
7
- currency: 'BRL'
5
+ return new Intl.NumberFormat("pt-BR", {
6
+ style: "currency",
7
+ currency: "BRL"
8
8
  }).format(Number(value));
9
9
  };
10
10
  exports.formatMoney = formatMoney;
11
11
  var phoneMask = function (value) {
12
12
  if (!value)
13
13
  return "";
14
- value = value.replace(/\D/g, '');
14
+ value = value.replace(/\D/g, "");
15
15
  value = value.replace(/(\d{2})(\d)/, "($1) $2");
16
16
  value = value.replace(/(\d)(\d{4})$/, "$1-$2");
17
17
  return value;
18
18
  };
19
19
  exports.phoneMask = phoneMask;
20
+ function formatValue(valor) {
21
+ return valor === null || valor === void 0 ? void 0 : valor.toLocaleString('pt-BR');
22
+ }
23
+ exports.formatValue = formatValue;
@@ -1,3 +1,4 @@
1
1
  export declare function formatCpf(cpf: string): string;
2
2
  export declare function formatCnpj(cnpj: string): string;
3
3
  export declare function isCnpj(documento: string): boolean;
4
+ export declare function formatDatePtBrToDate(date: string): Date;
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isCnpj = exports.formatCnpj = exports.formatCpf = void 0;
3
+ exports.formatDatePtBrToDate = exports.isCnpj = exports.formatCnpj = exports.formatCpf = void 0;
4
4
  function formatCpf(cpf) {
5
5
  cpf = cpf.replace(/[^0-9]/g, "");
6
6
  if (cpf.length !== 11)
7
- return '';
7
+ return "";
8
8
  return "".concat(cpf.slice(0, 3), ".").concat(cpf.slice(3, 6), ".").concat(cpf.slice(6, 9), "-").concat(cpf.slice(9));
9
9
  }
10
10
  exports.formatCpf = formatCpf;
11
11
  function formatCnpj(cnpj) {
12
12
  cnpj = cnpj.replace(/[^0-9]/g, "");
13
13
  if (cnpj.length !== 14)
14
- return '';
14
+ return "";
15
15
  return "".concat(cnpj.slice(0, 2), ".").concat(cnpj.slice(2, 5), ".").concat(cnpj.slice(5, 8), "/").concat(cnpj.slice(8, 12), "-").concat(cnpj.slice(12));
16
16
  }
17
17
  exports.formatCnpj = formatCnpj;
@@ -20,3 +20,8 @@ function isCnpj(documento) {
20
20
  return documento.length === 14;
21
21
  }
22
22
  exports.isCnpj = isCnpj;
23
+ function formatDatePtBrToDate(date) {
24
+ var _a, _b;
25
+ return new Date((_b = (_a = date === null || date === void 0 ? void 0 : date.split('/')) === null || _a === void 0 ? void 0 : _a.reverse()) === null || _b === void 0 ? void 0 : _b.join('-'));
26
+ }
27
+ exports.formatDatePtBrToDate = formatDatePtBrToDate;
@@ -15,16 +15,13 @@ var CCF = function () {
15
15
  ultimaOcorrencia: XPathUtils.select("string(./ultimo)", node),
16
16
  motivo: XPathUtils.select("string(./motivo)", node),
17
17
  }); };
18
- var calculateTotalOcorrencias = function (ccfData) {
19
- return ccfData.reduce(function (acc, item) { return acc + item.quantidadeDeOcorrencias; }, 0);
20
- };
21
- return (React.createElement(Section, { ctx: ctx, title: "Cheques Sem Fundo Em Institui\u00E7\u00E3o Banc\u00E1ria", subtitle: "Detalhes Acerca De Cheques Sem Fundo Emitidos", onLoading: function () { return React.createElement(React.Fragment, null, "Carregando..."); }, onError: function () { return React.createElement(React.Fragment, null, "Erro"); }, onSuccess: function (data) {
18
+ return (React.createElement(Section, { ctx: ctx, title: "Cheques Sem Fundo Em Institui\u00E7\u00E3o Banc\u00E1ria", subtitle: "Detalhes Acerca De Cheques Sem Fundo Emitidos", onSuccess: function (data) {
22
19
  var allItems = XPathUtils.select("//list/*", data);
23
20
  var filteredItems = allItems.filter(function (node) {
24
21
  return node.nodeName.startsWith("item");
25
22
  });
26
23
  var ccfData = filteredItems.map(mapNodeToCCFData);
27
- var totalOcorrencias = calculateTotalOcorrencias(ccfData);
24
+ var totalOcorrencias = XPathUtils.select('number(//sumQteOcorrencias)', data);
28
25
  var children = totalOcorrencias ? (React.createElement(Result, null, ccfData.map(function (ccf, key) { return (React.createElement(CCFList, { key: key, data: [ccf] })); }))) : (React.createElement(ResultWithoutInformation, null));
29
26
  return {
30
27
  children: children,
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { CategoriaProtestoProps } from "./plotly/types";
3
+ declare const CategoriaProtesto: React.FC<CategoriaProtestoProps>;
4
+ export default CategoriaProtesto;
@@ -0,0 +1,69 @@
1
+ import React, { useContext } from "react";
2
+ import Plot from "react-plotly.js";
3
+ import { Queries } from "../webservice";
4
+ import XPathUtils from "../../utils/xpath";
5
+ import { REGEX_PROTESTOS_DE_CREDITO, REGEX_PROTESTOS_DE_IMPOSTO } from "../../constants/regex";
6
+ var CategoriaProtesto = function (_a) {
7
+ var _b = _a.width, width = _b === void 0 ? 600 : _b, _c = _a.height, height = _c === void 0 ? 400 : _c;
8
+ var ctx = useContext(Queries.Protestos);
9
+ var Section = ctx.Section;
10
+ return (React.createElement(Section, { hideHeader: true, onSuccess: function (document) {
11
+ var _a, _b, _c;
12
+ var filterProtestos = function (regex, data) {
13
+ return XPathUtils.select("//body//protesto", data).filter(function (protesto) {
14
+ return regex.test(XPathUtils.select("string(./nomeCedente)", protesto));
15
+ });
16
+ };
17
+ var data = [
18
+ {
19
+ categoria: 'Protestos de Crédito',
20
+ quantidade: (_a = filterProtestos(REGEX_PROTESTOS_DE_CREDITO, document)) === null || _a === void 0 ? void 0 : _a.length
21
+ }, {
22
+ categoria: 'Protestos de Impostos',
23
+ quantidade: (_b = filterProtestos(REGEX_PROTESTOS_DE_IMPOSTO, document)) === null || _b === void 0 ? void 0 : _b.length
24
+ }, {
25
+ categoria: 'Protestos em Geral',
26
+ quantidade: (_c = XPathUtils.select("//body//protesto", document).filter(function (protesto) {
27
+ var nomeCedente = XPathUtils.select("string(./nomeCedente)", protesto);
28
+ return (!REGEX_PROTESTOS_DE_IMPOSTO.test(nomeCedente) &&
29
+ !REGEX_PROTESTOS_DE_CREDITO.test(nomeCedente));
30
+ })) === null || _c === void 0 ? void 0 : _c.length
31
+ }
32
+ ];
33
+ // Filtrar dados com quantidade nula ou zero
34
+ var dadosFiltrados = data === null || data === void 0 ? void 0 : data.filter(function (dado) { return dado.quantidade > 0; });
35
+ if (dadosFiltrados.length === 0) {
36
+ return React.createElement(React.Fragment, null);
37
+ }
38
+ var categoriaParaCor = {
39
+ "Protestos de Crédito": 'red',
40
+ "Protestos de Impostos": "orange",
41
+ };
42
+ var categorias = dadosFiltrados.map(function (dado) { return dado.categoria; });
43
+ var quantidades = dadosFiltrados.map(function (dado) { return dado.quantidade; });
44
+ var cores = categorias.map(function (categoria) { return categoriaParaCor[categoria] || "rgb(30, 144, 255)"; });
45
+ var plotData = [
46
+ {
47
+ x: categorias,
48
+ y: quantidades,
49
+ type: "bar",
50
+ marker: {
51
+ color: cores,
52
+ },
53
+ text: quantidades.map(String),
54
+ textposition: "auto",
55
+ },
56
+ ];
57
+ var layout = {
58
+ title: "Protestos por Categoria",
59
+ width: width,
60
+ height: height,
61
+ yaxis: { fixedrange: true, autorange: true },
62
+ xaxis: { fixedrange: true },
63
+ margin: { l: 50, r: 50, b: 100, t: 50, pad: 4 },
64
+ };
65
+ var config = { displayModeBar: false, responsive: true };
66
+ return React.createElement(Plot, { data: plotData, layout: layout, config: config });
67
+ } }));
68
+ };
69
+ export default CategoriaProtesto;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { DataInput } from "./plotly/types";
3
+ interface ChartContentProps {
4
+ dataInput: DataInput;
5
+ }
6
+ declare const ChartContent: React.FC<ChartContentProps>;
7
+ export default ChartContent;