@credithub/harlan-components 1.20.10 → 1.21.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 (267) hide show
  1. package/dist/assets/btn/btnWrapper.d.ts +2 -0
  2. package/dist/assets/btn/btnWrapper.js +9 -0
  3. package/dist/assets/btn/chevronDown.d.ts +3 -0
  4. package/dist/assets/btn/chevronDown.js +29 -0
  5. package/dist/assets/btn/chevronLeft.d.ts +3 -0
  6. package/dist/assets/btn/chevronLeft.js +30 -0
  7. package/dist/assets/btn/chevronRight.d.ts +3 -0
  8. package/dist/assets/btn/chevronRight.js +30 -0
  9. package/dist/assets/btn/chevronUp.d.ts +3 -0
  10. package/dist/assets/btn/chevronUp.js +30 -0
  11. package/dist/assets/btn/closeIcon.d.ts +3 -0
  12. package/dist/assets/btn/closeIcon.js +29 -0
  13. package/dist/assets/btn/thumbDown.d.ts +7 -0
  14. package/dist/assets/btn/thumbDown.js +11 -0
  15. package/dist/assets/btn/thumbUp.d.ts +7 -0
  16. package/dist/assets/btn/thumbUp.js +11 -0
  17. package/dist/assets/icones/chequesSemFundo.d.ts +4 -0
  18. package/dist/assets/icones/chequesSemFundo.js +12 -0
  19. package/dist/assets/icones/consultaSimples.d.ts +4 -0
  20. package/dist/assets/icones/consultaSimples.js +12 -0
  21. package/dist/assets/icones/contasBancarias.d.ts +4 -0
  22. package/dist/assets/icones/contasBancarias.js +12 -0
  23. package/dist/assets/icones/contato.d.ts +4 -0
  24. package/dist/assets/icones/contato.js +12 -0
  25. package/dist/assets/icones/dividasVencidasSerasa.d.ts +4 -0
  26. package/dist/assets/icones/dividasVencidasSerasa.js +9 -0
  27. package/dist/assets/icones/dominios.d.ts +4 -0
  28. package/dist/assets/icones/dominios.js +9 -0
  29. package/dist/assets/icones/endereco.d.ts +4 -0
  30. package/dist/assets/icones/endereco.js +12 -0
  31. package/dist/assets/icones/iconeEmpresa.d.ts +8 -0
  32. package/dist/assets/icones/iconeEmpresa.js +12 -0
  33. package/dist/assets/icones/iconePessoa.d.ts +9 -0
  34. package/dist/assets/icones/iconePessoa.js +12 -0
  35. package/dist/assets/icones/imoveis.d.ts +4 -0
  36. package/dist/assets/icones/imoveis.js +9 -0
  37. package/dist/assets/icones/pefinRefinBoaVista.d.ts +4 -0
  38. package/dist/assets/icones/pefinRefinBoaVista.js +9 -0
  39. package/dist/assets/icones/pefinRefinSerasa.d.ts +4 -0
  40. package/dist/assets/icones/pefinRefinSerasa.js +11 -0
  41. package/dist/assets/icones/processosJuridicos.d.ts +4 -0
  42. package/dist/assets/icones/processosJuridicos.js +12 -0
  43. package/dist/assets/icones/protestos.d.ts +4 -0
  44. package/dist/assets/icones/protestos.js +12 -0
  45. package/dist/assets/icones/protestosCredito.d.ts +4 -0
  46. package/dist/assets/icones/protestosCredito.js +12 -0
  47. package/dist/assets/icones/protestosGerais.d.ts +4 -0
  48. package/dist/assets/icones/protestosGerais.js +12 -0
  49. package/dist/assets/icones/protestosImpostos.d.ts +4 -0
  50. package/dist/assets/icones/protestosImpostos.js +12 -0
  51. package/dist/assets/icones/quadroSocietario.d.ts +4 -0
  52. package/dist/assets/icones/quadroSocietario.js +12 -0
  53. package/dist/assets/icones/resumoNegativacoes.d.ts +4 -0
  54. package/dist/assets/icones/resumoNegativacoes.js +11 -0
  55. package/dist/assets/icones/scoreBoaVista.d.ts +4 -0
  56. package/dist/assets/icones/scoreBoaVista.js +9 -0
  57. package/dist/assets/icones/scr.d.ts +4 -0
  58. package/dist/assets/icones/scr.js +9 -0
  59. package/dist/assets/icones/ultimaMovimentacao.d.ts +4 -0
  60. package/dist/assets/icones/ultimaMovimentacao.js +12 -0
  61. package/dist/assets/icones/veiculos.d.ts +4 -0
  62. package/dist/assets/icones/veiculos.js +9 -0
  63. package/dist/components/adresses/addresses.d.ts +19 -0
  64. package/dist/components/adresses/addresses.js +50 -0
  65. package/dist/components/adresses/getGeocode.d.ts +6 -0
  66. package/dist/components/adresses/getGeocode.js +69 -0
  67. package/dist/components/adresses/map.d.ts +11 -0
  68. package/dist/components/adresses/map.js +25 -0
  69. package/dist/components/bank-accounts/bank-accounts.d.ts +3 -0
  70. package/dist/components/bank-accounts/bank-accounts.js +32 -0
  71. package/dist/components/ccf/ccf.d.ts +3 -0
  72. package/dist/components/ccf/ccf.js +37 -0
  73. package/dist/components/ccf/ccfList.d.ts +12 -0
  74. package/dist/components/ccf/ccfList.js +24 -0
  75. package/dist/components/chart/chartContent.d.ts +6 -0
  76. package/dist/components/chart/chartContent.js +50 -0
  77. package/dist/components/chart/chartSystem.d.ts +6 -0
  78. package/dist/components/chart/chartSystem.js +61 -0
  79. package/dist/components/chart/components/MixedChart.d.ts +7 -0
  80. package/dist/components/chart/components/MixedChart.js +30 -0
  81. package/dist/components/chart/components/PieChart.d.ts +7 -0
  82. package/dist/components/chart/components/PieChart.js +9 -0
  83. package/dist/components/chart/components/categoryProtestos.d.ts +7 -0
  84. package/dist/components/chart/components/categoryProtestos.js +17 -0
  85. package/dist/components/chart/hooks/useCategoryProtestos.d.ts +6 -0
  86. package/dist/components/chart/hooks/useCategoryProtestos.js +71 -0
  87. package/dist/components/chart/hooks/useChartData.d.ts +8 -0
  88. package/dist/components/chart/hooks/useChartData.js +64 -0
  89. package/dist/components/chart/hooks/useMixedChartData.d.ts +10 -0
  90. package/dist/components/chart/hooks/useMixedChartData.js +43 -0
  91. package/dist/components/chart/hooks/usePieChartData.d.ts +6 -0
  92. package/dist/components/chart/hooks/usePieChartData.js +89 -0
  93. package/dist/components/chart/quantityResult.d.ts +19 -0
  94. package/dist/components/chart/quantityResult.js +41 -0
  95. package/dist/components/chart/types/iChart.d.ts +59 -0
  96. package/dist/components/chart/types/iChart.js +1 -0
  97. package/dist/components/chart/utils/chartCustomization.d.ts +7 -0
  98. package/dist/components/chart/utils/chartCustomization.js +154 -0
  99. package/dist/components/chart/utils/chartUtils.d.ts +11 -0
  100. package/dist/components/chart/utils/chartUtils.js +38 -0
  101. package/dist/components/chart/utils/dataManipulation.d.ts +10 -0
  102. package/dist/components/chart/utils/dataManipulation.js +97 -0
  103. package/dist/components/chart/utils/dataProcessing.d.ts +3 -0
  104. package/dist/components/chart/utils/dataProcessing.js +113 -0
  105. package/dist/components/common/addItem.d.ts +11 -0
  106. package/dist/components/common/addItem.js +44 -0
  107. package/dist/components/common/button.d.ts +5 -0
  108. package/dist/components/common/button.js +41 -0
  109. package/dist/components/common/carousel.d.ts +4 -0
  110. package/dist/components/common/carousel.js +19 -0
  111. package/dist/components/common/content.d.ts +4 -0
  112. package/dist/components/common/content.js +8 -0
  113. package/dist/components/consultaRfb.d.ts +16 -0
  114. package/dist/components/consultaRfb.js +21 -0
  115. package/dist/components/consultaSimplesSection/consultaSimplesSection.d.ts +6 -0
  116. package/dist/components/consultaSimplesSection/consultaSimplesSection.js +93 -0
  117. package/dist/components/consultasComplementares.d.ts +29 -0
  118. package/dist/components/consultasComplementares.js +32 -0
  119. package/dist/components/contacts/contactLikeDislikeSection.d.ts +8 -0
  120. package/dist/components/contacts/contactLikeDislikeSection.js +68 -0
  121. package/dist/components/contacts/contacts.d.ts +18 -0
  122. package/dist/components/contacts/contacts.js +60 -0
  123. package/dist/components/contacts/contactsLikeDislike.d.ts +9 -0
  124. package/dist/components/contacts/contactsLikeDislike.js +7 -0
  125. package/dist/components/contacts/thumbsButton.d.ts +9 -0
  126. package/dist/components/contacts/thumbsButton.js +41 -0
  127. package/dist/components/dividasPublicas/dividasPublicas.d.ts +3 -0
  128. package/dist/components/dividasPublicas/dividasPublicas.js +67 -0
  129. package/dist/components/dominios/dominios.d.ts +3 -0
  130. package/dist/components/dominios/dominios.js +29 -0
  131. package/dist/components/dossie/carrousel/carrousel.d.ts +8 -0
  132. package/dist/components/dossie/carrousel/carrousel.js +15 -0
  133. package/dist/components/dossie/companyLogo/companyLogo.d.ts +7 -0
  134. package/dist/components/dossie/companyLogo/companyLogo.js +25 -0
  135. package/dist/components/dossie/dossie.d.ts +9 -0
  136. package/dist/components/dossie/dossie.js +44 -0
  137. package/dist/components/dossie/summary/cardsAndProducts.d.ts +21 -0
  138. package/dist/components/dossie/summary/cardsAndProducts.js +209 -0
  139. package/dist/components/dossie/summary/summary.d.ts +20 -0
  140. package/dist/components/dossie/summary/summary.js +38 -0
  141. package/dist/components/dossie/summary/utils.d.ts +10 -0
  142. package/dist/components/dossie/summary/utils.js +29 -0
  143. package/dist/components/dossie/transactionTable/transactionTable.d.ts +6 -0
  144. package/dist/components/dossie/transactionTable/transactionTable.js +33 -0
  145. package/dist/components/imoveis/imoveisService.d.ts +6 -0
  146. package/dist/components/imoveis/imoveisService.js +51 -0
  147. package/dist/components/imoveis/types.d.ts +24 -0
  148. package/dist/components/imoveis/types.js +1 -0
  149. package/dist/components/interface/globalStyle.d.ts +2 -0
  150. package/dist/components/interface/globalStyle.js +9 -0
  151. package/dist/components/interface/header.d.ts +23 -0
  152. package/dist/components/interface/header.js +72 -0
  153. package/dist/components/interface/loading.d.ts +2 -0
  154. package/dist/components/interface/loading.js +8 -0
  155. package/dist/components/interface/loadingBar.d.ts +5 -0
  156. package/dist/components/interface/loadingBar.js +41 -0
  157. package/dist/components/interface/responsiveGrid.d.ts +9 -0
  158. package/dist/components/interface/responsiveGrid.js +8 -0
  159. package/dist/components/interface/result.d.ts +10 -0
  160. package/dist/components/interface/result.js +18 -0
  161. package/dist/components/interface/resultWithoutInformation.d.ts +4 -0
  162. package/dist/components/interface/resultWithoutInformation.js +32 -0
  163. package/dist/components/interface/section.d.ts +10 -0
  164. package/dist/components/interface/section.js +30 -0
  165. package/dist/components/interface/statusMessage.d.ts +7 -0
  166. package/dist/components/interface/statusMessage.js +25 -0
  167. package/dist/components/interface/theme.d.ts +73 -0
  168. package/dist/components/interface/theme.js +73 -0
  169. package/dist/components/liminar/liminar.d.ts +3 -0
  170. package/dist/components/liminar/liminar.js +24 -0
  171. package/dist/components/liminar/types.d.ts +3 -0
  172. package/dist/components/liminar/types.js +1 -0
  173. package/dist/components/partners/partner-dividas-publicas.d.ts +5 -0
  174. package/dist/components/partners/partner-dividas-publicas.js +10 -0
  175. package/dist/components/partners/partner-protestos.d.ts +5 -0
  176. package/dist/components/partners/partner-protestos.js +10 -0
  177. package/dist/components/partners/partner-rfb-status.d.ts +5 -0
  178. package/dist/components/partners/partner-rfb-status.js +10 -0
  179. package/dist/components/partners/partnerField.d.ts +9 -0
  180. package/dist/components/partners/partnerField.js +9 -0
  181. package/dist/components/partners/partnerList.d.ts +17 -0
  182. package/dist/components/partners/partnerList.js +28 -0
  183. package/dist/components/partners/partners.d.ts +5 -0
  184. package/dist/components/partners/partners.js +52 -0
  185. package/dist/components/pep/pep.d.ts +3 -0
  186. package/dist/components/pep/pep.js +41 -0
  187. package/dist/components/processos-juridicos/envolvidosList.d.ts +10 -0
  188. package/dist/components/processos-juridicos/envolvidosList.js +24 -0
  189. package/dist/components/processos-juridicos/processosJuridicos.d.ts +5 -0
  190. package/dist/components/processos-juridicos/processosJuridicos.js +26 -0
  191. package/dist/components/processos-juridicos/processosJuridicosList.d.ts +7 -0
  192. package/dist/components/processos-juridicos/processosJuridicosList.js +64 -0
  193. package/dist/components/processos-juridicos/types.d.ts +27 -0
  194. package/dist/components/processos-juridicos/types.js +1 -0
  195. package/dist/components/protestos/getTotalProtestos.d.ts +1 -0
  196. package/dist/components/protestos/getTotalProtestos.js +4 -0
  197. package/dist/components/protestos/protestos.d.ts +3 -0
  198. package/dist/components/protestos/protestos.js +74 -0
  199. package/dist/components/protestos/protestosCategory.d.ts +7 -0
  200. package/dist/components/protestos/protestosCategory.js +46 -0
  201. package/dist/components/protestos/protestosList.d.ts +36 -0
  202. package/dist/components/protestos/protestosList.js +120 -0
  203. package/dist/components/reclameAqui/reclameAquiCarousel.d.ts +5 -0
  204. package/dist/components/reclameAqui/reclameAquiCarousel.js +100 -0
  205. package/dist/components/reclameAqui/types.d.ts +31 -0
  206. package/dist/components/reclameAqui/types.js +1 -0
  207. package/dist/components/refinBoaVista/refinBoaVista.d.ts +22 -0
  208. package/dist/components/refinBoaVista/refinBoaVista.js +65 -0
  209. package/dist/components/refinBoaVista/types.d.ts +48 -0
  210. package/dist/components/refinBoaVista/types.js +4 -0
  211. package/dist/components/refinSerasa/refinSerasa.d.ts +22 -0
  212. package/dist/components/refinSerasa/refinSerasa.js +119 -0
  213. package/dist/components/refinSerasa/types.d.ts +48 -0
  214. package/dist/components/refinSerasa/types.js +1 -0
  215. package/dist/components/resultadoDaPesquisa/resultado-da-pesquisa.d.ts +5 -0
  216. package/dist/components/resultadoDaPesquisa/resultado-da-pesquisa.js +26 -0
  217. package/dist/components/score/scoreService.d.ts +6 -0
  218. package/dist/components/score/scoreService.js +43 -0
  219. package/dist/components/score/types.d.ts +12 -0
  220. package/dist/components/score/types.js +1 -0
  221. package/dist/components/scr/getResumoDeCreditos.d.ts +6 -0
  222. package/dist/components/scr/getResumoDeCreditos.js +79 -0
  223. package/dist/components/scr/getResumoDeModalidades.d.ts +8 -0
  224. package/dist/components/scr/getResumoDeModalidades.js +109 -0
  225. package/dist/components/scr/scr.d.ts +5 -0
  226. package/dist/components/scr/scr.js +134 -0
  227. package/dist/components/scr/types.d.ts +87 -0
  228. package/dist/components/scr/types.js +1 -0
  229. package/dist/components/veiculos/types.d.ts +0 -0
  230. package/dist/components/veiculos/types.js +0 -0
  231. package/dist/components/veiculos/veiculos.d.ts +22 -0
  232. package/dist/components/veiculos/veiculos.js +70 -0
  233. package/dist/components/webservice.d.ts +140 -0
  234. package/dist/components/webservice.js +233 -0
  235. package/dist/constants/regex.d.ts +2 -0
  236. package/dist/constants/regex.js +2 -0
  237. package/dist/consultaSimples.d.ts +13 -0
  238. package/dist/consultaSimples.js +57 -0
  239. package/dist/hooks/useConsultaRfb.d.ts +6 -0
  240. package/dist/hooks/useConsultaRfb.js +9 -0
  241. package/dist/hooks/useConsultasComplementares.d.ts +1 -0
  242. package/dist/hooks/useConsultasComplementares.js +9 -0
  243. package/dist/hooks/useToggle.d.ts +10 -0
  244. package/dist/hooks/useToggle.js +24 -0
  245. package/dist/hooks/useWindowSize.d.ts +4 -0
  246. package/dist/hooks/useWindowSize.js +19 -0
  247. package/dist/index.d.ts +23 -0
  248. package/dist/index.js +26 -0
  249. package/dist/utils/calculation.d.ts +9 -0
  250. package/dist/utils/calculation.js +17 -0
  251. package/dist/utils/date.d.ts +1 -0
  252. package/dist/utils/date.js +6 -0
  253. package/dist/utils/fillMissingData.d.ts +6 -0
  254. package/dist/utils/fillMissingData.js +12 -0
  255. package/dist/utils/formatter.d.ts +2 -0
  256. package/dist/utils/formatter.js +5 -0
  257. package/dist/utils/getUniqueDates.d.ts +5 -0
  258. package/dist/utils/getUniqueDates.js +9 -0
  259. package/dist/utils/number.d.ts +4 -0
  260. package/dist/utils/number.js +20 -0
  261. package/dist/utils/string.d.ts +11 -0
  262. package/dist/utils/string.js +64 -0
  263. package/dist/utils/xpath.d.ts +6 -0
  264. package/dist/utils/xpath.js +21 -0
  265. package/lib/cjs/index.js +25 -9470
  266. package/lib/esm/index.js +30 -11408
  267. package/package.json +3 -2
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { DataInput } from '../types/iChart';
3
+ interface MixedChartProps {
4
+ dataInput: DataInput;
5
+ }
6
+ declare const MixedChart: React.FC<MixedChartProps>;
7
+ export default MixedChart;
@@ -0,0 +1,30 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ import React, { useState } from 'react';
6
+ import { Chart } from 'react-chartjs-2';
7
+ import { useMixedChartData } from '../hooks/useMixedChartData';
8
+ import styled, { css } from 'styled-components';
9
+ var TimeFilterButton = styled.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: 8px 16px;\n margin-right: 5px;\n background-color: #f0f0f0;\n border: 1px solid #ccc;\n border-radius: 8px;\n cursor: pointer;\n width: 100px;\n min-width: 100px;\n text-align: center;\n\n ", "\n\n &:hover {\n background-color: #007af2;\n color: white;\n }\n\n @media print {\n display: none !important;\n }\n"], ["\n padding: 8px 16px;\n margin-right: 5px;\n background-color: #f0f0f0;\n border: 1px solid #ccc;\n border-radius: 8px;\n cursor: pointer;\n width: 100px;\n min-width: 100px;\n text-align: center;\n\n ", "\n\n &:hover {\n background-color: #007af2;\n color: white;\n }\n\n @media print {\n display: none !important;\n }\n"])), function (props) {
10
+ return props.isActive && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: #007af2;\n color: white;\n border-color: #007af2;\n "], ["\n background-color: #007af2;\n color: white;\n border-color: #007af2;\n "])));
11
+ });
12
+ var MixedChart = function (_a) {
13
+ var dataInput = _a.dataInput;
14
+ var _b = useState('1m'), timeFilter = _b[0], setTimeFilter = _b[1];
15
+ var _c = useMixedChartData(dataInput, timeFilter), data = _c.data, options = _c.options;
16
+ var chartType = data.datasets.some(function (dataset) { return dataset.type === 'bar'; })
17
+ ? 'bar'
18
+ : 'line';
19
+ return (React.createElement("div", null,
20
+ React.createElement("div", null, ['all', '1y', '6m', '1m'].map(function (filter) { return (React.createElement(TimeFilterButton, { key: filter, onClick: function () { return setTimeFilter(filter); }, isActive: timeFilter === filter }, filter === 'all'
21
+ ? 'All'
22
+ : filter === '1y'
23
+ ? '1 Ano'
24
+ : filter === '6m'
25
+ ? '6 Meses'
26
+ : '1 Mês')); })),
27
+ React.createElement(Chart, { className: "mixed-chart", type: chartType, data: data, options: options })));
28
+ };
29
+ export default MixedChart;
30
+ var templateObject_1, templateObject_2;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { DataInput } from '../types/iChart';
3
+ interface PieChartProps {
4
+ dataInput: DataInput;
5
+ }
6
+ declare const PieChart: React.FC<PieChartProps>;
7
+ export default PieChart;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { Pie } from 'react-chartjs-2';
3
+ import { usePieChartData } from '../hooks/usePieChartData';
4
+ var PieChart = function (_a) {
5
+ var dataInput = _a.dataInput;
6
+ var _b = usePieChartData(dataInput), data = _b.data, options = _b.options;
7
+ return React.createElement(Pie, { className: "pie-chart", data: data, options: options });
8
+ };
9
+ export default PieChart;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { DataInput } from '../types/iChart';
3
+ interface ProtestoCategory {
4
+ dataInput: DataInput['protestosCategory'];
5
+ }
6
+ declare const CategoriaProtesto: React.FC<ProtestoCategory>;
7
+ export default CategoriaProtesto;
@@ -0,0 +1,17 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ import React from 'react';
6
+ import { Bar } from 'react-chartjs-2';
7
+ import styled from 'styled-components';
8
+ import { useCategoryProtestos } from '../hooks/useCategoryProtestos';
9
+ var ChartContainer = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 400px;\n width: 100%;\n"], ["\n height: 400px;\n width: 100%;\n"])));
10
+ var CategoriaProtesto = function (_a) {
11
+ var dataInput = _a.dataInput;
12
+ var _b = useCategoryProtestos(dataInput), data = _b.data, options = _b.options;
13
+ return (React.createElement(ChartContainer, null,
14
+ React.createElement(Bar, { className: "categoria-protesto", data: data, options: options })));
15
+ };
16
+ export default CategoriaProtesto;
17
+ var templateObject_1;
@@ -0,0 +1,6 @@
1
+ import { ChartData, ChartOptions } from 'chart.js';
2
+ import { DataInput } from '../types/iChart';
3
+ export declare const useCategoryProtestos: (dataInput: DataInput['protestosCategory']) => {
4
+ data: ChartData<'bar', number[], string>;
5
+ options: ChartOptions<'bar'>;
6
+ };
@@ -0,0 +1,71 @@
1
+ import { useMemo } from 'react';
2
+ export var useCategoryProtestos = function (dataInput) {
3
+ var data = useMemo(function () {
4
+ var safeDataInput = dataInput || [];
5
+ var categoryCounts = {
6
+ 'Protestos de Crédito': 0,
7
+ 'Protestos de Impostos': 0,
8
+ 'Protestos Gerais': 0
9
+ };
10
+ safeDataInput.forEach(function (item) {
11
+ categoryCounts[item.categoria] = item.quantidade;
12
+ });
13
+ var labels = Object.keys(categoryCounts);
14
+ var dataValues = Object.values(categoryCounts);
15
+ return {
16
+ labels: labels,
17
+ datasets: [
18
+ {
19
+ data: dataValues,
20
+ backgroundColor: [
21
+ 'rgba(255, 99, 132, 0.2)',
22
+ 'rgba(255, 159, 64, 0.2)',
23
+ 'rgba(54, 162, 235, 0.2)'
24
+ ],
25
+ borderColor: [
26
+ 'rgba(255, 99, 132, 1)',
27
+ 'rgba(255, 159, 64, 1)',
28
+ 'rgba(54, 162, 235, 1)'
29
+ ],
30
+ borderWidth: 1
31
+ }
32
+ ]
33
+ };
34
+ }, [dataInput]);
35
+ var options = useMemo(function () {
36
+ return {
37
+ scales: {
38
+ y: {
39
+ beginAtZero: true,
40
+ ticks: {
41
+ precision: 0,
42
+ stepSize: 1,
43
+ suggestedMin: 0,
44
+ callback: function (value) {
45
+ return Number.isInteger(value) ? value : null;
46
+ }
47
+ }
48
+ }
49
+ },
50
+ responsive: true,
51
+ maintainAspectRatio: false,
52
+ plugins: {
53
+ legend: {
54
+ display: false
55
+ },
56
+ title: {
57
+ display: true,
58
+ text: 'Quantidade de Protestos por Categoria',
59
+ font: {
60
+ size: 12
61
+ },
62
+ padding: {
63
+ bottom: 10,
64
+ top: 20
65
+ }
66
+ }
67
+ }
68
+ };
69
+ }, []);
70
+ return { data: data, options: options };
71
+ };
@@ -0,0 +1,8 @@
1
+ import { DataInput } from '../../../components/chart/types/iChart';
2
+ declare const useChartData: (documento: string) => {
3
+ data: DataInput | null;
4
+ isLoading: boolean;
5
+ error: string | Error | null;
6
+ refetch: () => void;
7
+ };
8
+ export default useChartData;
@@ -0,0 +1,64 @@
1
+ import { useContext, useEffect, useState, useMemo } from 'react';
2
+ import { useQuery, Queries, RequestStatus } from '../../../components/webservice';
3
+ import { processData, processProtestData } from '../utils/dataProcessing';
4
+ var useChartData = function (documento) {
5
+ var _a = useState(null), data = _a[0], setData = _a[1];
6
+ var _b = useState(null), errorState = _b[0], setErrorState = _b[1];
7
+ var _c = useQuery("SELECT FROM 'DOCUMENTHISTORY'.'BASICHISTORY'", {
8
+ documento: documento
9
+ }), response = _c.response, queryError = _c.error, isLoading = _c.isLoading, refetch = _c.refetch;
10
+ var ctxProtestos = useContext(Queries.Protestos);
11
+ var ctxCCF = useContext(Queries.CCF);
12
+ var ctxProcessosJuridicos = useContext(Queries.ProcessosJuridicos);
13
+ var quantidadeProcessosJuridicos = useMemo(function () {
14
+ var _a;
15
+ if ((ctxProcessosJuridicos === null || ctxProcessosJuridicos === void 0 ? void 0 : ctxProcessosJuridicos.type) === RequestStatus.Success &&
16
+ ((_a = ctxProcessosJuridicos.document) === null || _a === void 0 ? void 0 : _a.empresa)) {
17
+ return ctxProcessosJuridicos.document.empresa.length;
18
+ }
19
+ return 0;
20
+ }, [ctxProcessosJuridicos]);
21
+ var liveQueriesIsFinish = useMemo(function () {
22
+ return [
23
+ ctxProtestos === null || ctxProtestos === void 0 ? void 0 : ctxProtestos.type,
24
+ ctxCCF === null || ctxCCF === void 0 ? void 0 : ctxCCF.type,
25
+ ctxProcessosJuridicos === null || ctxProcessosJuridicos === void 0 ? void 0 : ctxProcessosJuridicos.type
26
+ ].every(function (status) { return status !== RequestStatus.Loading; });
27
+ }, [ctxProtestos, ctxCCF, ctxProcessosJuridicos]);
28
+ var dadosProtestos = useMemo(function () {
29
+ if ((ctxProtestos === null || ctxProtestos === void 0 ? void 0 : ctxProtestos.type) === RequestStatus.Success && ctxProtestos.data) {
30
+ return processProtestData(ctxProtestos.document);
31
+ }
32
+ return [];
33
+ }, [ctxProtestos]);
34
+ useEffect(function () {
35
+ if (liveQueriesIsFinish) {
36
+ refetch();
37
+ }
38
+ }, [liveQueriesIsFinish]);
39
+ useEffect(function () {
40
+ if (!isLoading &&
41
+ !queryError &&
42
+ (response === null || response === void 0 ? void 0 : response.document) &&
43
+ liveQueriesIsFinish) {
44
+ try {
45
+ var parsedData = JSON.parse(response.document);
46
+ parsedData.protestosCategory = dadosProtestos;
47
+ var processedData = processData(parsedData, quantidadeProcessosJuridicos);
48
+ setData(processedData);
49
+ }
50
+ catch (e) {
51
+ console.error('Erro ao processar os dados', e);
52
+ setErrorState('Erro ao processar os dados');
53
+ }
54
+ }
55
+ }, [
56
+ isLoading,
57
+ response,
58
+ queryError,
59
+ liveQueriesIsFinish,
60
+ quantidadeProcessosJuridicos
61
+ ]);
62
+ return { data: data, isLoading: isLoading, error: errorState || queryError, refetch: refetch };
63
+ };
64
+ export default useChartData;
@@ -0,0 +1,10 @@
1
+ import { ChartData, ChartOptions } from 'chart.js';
2
+ import { DataInput, TimeFilter } from '../types/iChart';
3
+ import 'chartjs-adapter-date-fns';
4
+ export declare const useMixedChartData: (dataInput: DataInput, timeFilter?: TimeFilter) => {
5
+ data: ChartData<'line' | 'bar', (number | {
6
+ x: string;
7
+ y: number | null;
8
+ })[], string>;
9
+ options: ChartOptions<'line' | 'bar'>;
10
+ };
@@ -0,0 +1,43 @@
1
+ import { useMemo } from 'react';
2
+ import 'chartjs-adapter-date-fns';
3
+ import { getEndDate, getUniqueDates, addMissingDateEntries, getFilteredStartDate, getEarliestDate } from '../utils/dataManipulation';
4
+ import { createDatasets, getChartOptions } from '../utils/chartCustomization';
5
+ export var useMixedChartData = function (dataInput, timeFilter) {
6
+ if (timeFilter === void 0) { timeFilter = '1m'; }
7
+ return useMemo(function () {
8
+ var filteredStartDate = getFilteredStartDate(timeFilter, dataInput);
9
+ var endDate = getEndDate();
10
+ var fullDataStartDate = getEarliestDate(dataInput);
11
+ var fullProcessedData = {
12
+ protestos: addMissingDateEntries(dataInput.protestos, fullDataStartDate, endDate),
13
+ ccfs: addMissingDateEntries(dataInput.ccfs, fullDataStartDate, endDate),
14
+ serasa: dataInput.serasa,
15
+ boaVista: dataInput.boaVista,
16
+ dividasPublicasGrafico: addMissingDateEntries(dataInput.dividasPublicasGrafico, fullDataStartDate, endDate)
17
+ };
18
+ var processedData = {
19
+ protestos: fullProcessedData.protestos.filter(function (d) { return new Date(d.data) >= filteredStartDate; }),
20
+ ccfs: fullProcessedData.ccfs.filter(function (d) { return new Date(d.data) >= filteredStartDate; }),
21
+ serasa: fullProcessedData.serasa.filter(function (d) { return new Date(d.data) >= filteredStartDate; }),
22
+ boaVista: fullProcessedData.boaVista.filter(function (d) { return new Date(d.data) >= filteredStartDate; }),
23
+ dividasPublicasGrafico: fullProcessedData.dividasPublicasGrafico.filter(function (d) { return new Date(d.data) >= filteredStartDate; })
24
+ };
25
+ var uniqueDates = getUniqueDates(processedData);
26
+ var datasets = createDatasets(processedData, uniqueDates, timeFilter);
27
+ var options = getChartOptions(timeFilter);
28
+ if (!options.plugins) {
29
+ options.plugins = {};
30
+ }
31
+ options.plugins.datalabels = {
32
+ display: false
33
+ };
34
+ var labels = uniqueDates;
35
+ return {
36
+ data: {
37
+ labels: labels,
38
+ datasets: datasets
39
+ },
40
+ options: options
41
+ };
42
+ }, [dataInput, timeFilter]);
43
+ };
@@ -0,0 +1,6 @@
1
+ import { ChartData, ChartOptions } from 'chart.js';
2
+ import { DataInput } from '../types/iChart';
3
+ export declare const usePieChartData: (dataInput: DataInput) => {
4
+ data: ChartData<'pie', number[], string>;
5
+ options: ChartOptions<'pie'>;
6
+ };
@@ -0,0 +1,89 @@
1
+ import { useMemo } from 'react';
2
+ import { useWindowSize } from '../../../hooks/useWindowSize';
3
+ export var usePieChartData = function (dataInput) {
4
+ var width = useWindowSize().width;
5
+ return useMemo(function () {
6
+ var _a;
7
+ var getLastValue = function (arr) { var _a; return arr.length > 0 ? (_a = arr[arr.length - 1].quantidade) !== null && _a !== void 0 ? _a : 0 : 0; };
8
+ var totalProtestos = getLastValue(dataInput.protestos);
9
+ var totalCCFs = getLastValue(dataInput.ccfs);
10
+ var totalSerasa = getLastValue(dataInput.serasa);
11
+ var totalBoaVista = getLastValue(dataInput.boaVista);
12
+ var totalDividasPublicas = getLastValue(dataInput.dividasPublicasGrafico);
13
+ var processosJuridicos = (_a = dataInput.pieChartTotalConfig) === null || _a === void 0 ? void 0 : _a.processosJuridicos;
14
+ var chartData = {
15
+ labels: [
16
+ 'Protestos',
17
+ 'Cheques Devolvidos',
18
+ 'Pefin/Refin Serasa',
19
+ 'Pefin/Refin Boa Vista',
20
+ 'Dívidas Públicas',
21
+ 'Processos Jurídicos'
22
+ ],
23
+ datasets: [
24
+ {
25
+ data: [
26
+ totalProtestos,
27
+ totalCCFs,
28
+ totalSerasa,
29
+ totalBoaVista,
30
+ totalDividasPublicas,
31
+ processosJuridicos !== null && processosJuridicos !== void 0 ? processosJuridicos : 0
32
+ ],
33
+ backgroundColor: [
34
+ '#ff4081',
35
+ '#3f51b5',
36
+ '#008cf8',
37
+ '#ffc107',
38
+ '#4caf50',
39
+ '#58508d'
40
+ ],
41
+ hoverOffset: 4
42
+ }
43
+ ]
44
+ };
45
+ var aspectRatio = width < 1000 ? 1.5 : 1;
46
+ var options = {
47
+ responsive: true,
48
+ maintainAspectRatio: true,
49
+ aspectRatio: aspectRatio,
50
+ layout: {
51
+ padding: {
52
+ top: 32
53
+ }
54
+ },
55
+ plugins: {
56
+ legend: {
57
+ position: 'right',
58
+ align: 'start',
59
+ fullSize: true,
60
+ labels: {
61
+ boxWidth: 16,
62
+ padding: 16
63
+ }
64
+ },
65
+ title: {
66
+ display: true,
67
+ text: 'Quantidade de Ocorrências',
68
+ font: {
69
+ size: 12
70
+ },
71
+ padding: {
72
+ bottom: 8
73
+ }
74
+ },
75
+ datalabels: {
76
+ color: '#fff',
77
+ formatter: function (value) {
78
+ return value > 0 ? value.toString() : '';
79
+ },
80
+ font: {
81
+ weight: 'bold'
82
+ },
83
+ textAlign: 'center'
84
+ }
85
+ }
86
+ };
87
+ return { data: chartData, options: options };
88
+ }, [dataInput]);
89
+ };
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { DataInput } from './types/iChart';
3
+ type QuantidadeResultadosProps = Partial<{
4
+ data: DataInput | null;
5
+ quantidadeProtestos: number;
6
+ quantidadeProcessos: number;
7
+ quantidadeDividas: number;
8
+ quantidadeChequesSemFundos: number;
9
+ quantidadeDividasSerasa: number;
10
+ quantidadeDividasBoaVista: number;
11
+ valorTotalProtestos: number;
12
+ valorTotalDividas: number;
13
+ valorTotalDividasSerasa: number;
14
+ valorTotalDividasBoaVista: number;
15
+ ultimaOcorrenciaProtestos: string;
16
+ ultimaOcorrenciaChequesSemFundos: string;
17
+ }>;
18
+ declare const QuantidadeResultados: React.FC<QuantidadeResultadosProps>;
19
+ export default QuantidadeResultados;
@@ -0,0 +1,41 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ /* eslint-disable no-extra-boolean-cast */
6
+ import React from 'react';
7
+ import AddItemField from '../common/addItem';
8
+ import { formatMoney, formatValue } from '../../utils/number';
9
+ import { Result, ResultContent } from '../interface/result';
10
+ import styled from 'styled-components';
11
+ var QuantityContainer = function (_a) {
12
+ var children = _a.children;
13
+ return (React.createElement("div", { className: "t" }, children));
14
+ };
15
+ var QuantidadeResultadosWrapper = styled(ResultContent)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 18px 20px;\n row-gap: 20px;\n > * {\n row-gap: 10px;\n }\n"], ["\n padding: 18px 20px;\n row-gap: 20px;\n > * {\n row-gap: 10px;\n }\n"])));
16
+ var QuantidadeResultados = function (_a) {
17
+ var _b, _c, _d, _e;
18
+ var data = _a.data, _f = _a.quantidadeProtestos, quantidadeProtestos = _f === void 0 ? 0 : _f, _g = _a.quantidadeProcessos, quantidadeProcessos = _g === void 0 ? 0 : _g, _h = _a.quantidadeDividas, quantidadeDividas = _h === void 0 ? 0 : _h, _j = _a.quantidadeChequesSemFundos, quantidadeChequesSemFundos = _j === void 0 ? 0 : _j, _k = _a.quantidadeDividasSerasa, quantidadeDividasSerasa = _k === void 0 ? 0 : _k, _l = _a.quantidadeDividasBoaVista, quantidadeDividasBoaVista = _l === void 0 ? 0 : _l, _m = _a.valorTotalProtestos, valorTotalProtestos = _m === void 0 ? 0 : _m, _o = _a.valorTotalDividas, valorTotalDividas = _o === void 0 ? 0 : _o, _p = _a.valorTotalDividasSerasa, valorTotalDividasSerasa = _p === void 0 ? 0 : _p, _q = _a.valorTotalDividasBoaVista, valorTotalDividasBoaVista = _q === void 0 ? 0 : _q, _r = _a.ultimaOcorrenciaProtestos, ultimaOcorrenciaProtestos = _r === void 0 ? null : _r, _s = _a.ultimaOcorrenciaChequesSemFundos, ultimaOcorrenciaChequesSemFundos = _s === void 0 ? null : _s;
19
+ return (React.createElement(Result, { resultContentStriped: false },
20
+ React.createElement(QuantidadeResultadosWrapper, { desktop: "repeat(6, 1fr)", print: "repeat(6, 1fr)", tablet: "repeat(3, 1fr)", mobile: "repeat(2, 1fr)" },
21
+ React.createElement(QuantityContainer, null,
22
+ React.createElement(AddItemField, { name: "Total Protestos", value: formatValue(quantidadeProtestos) }),
23
+ React.createElement(AddItemField, { name: "Valor Total Protestos", value: formatMoney(valorTotalProtestos) }),
24
+ React.createElement(AddItemField, { hidden: quantidadeProtestos == 0, name: "\u00DAltima Ocorr\u00EAncia", value: ultimaOcorrenciaProtestos })),
25
+ React.createElement(QuantityContainer, null,
26
+ React.createElement(AddItemField, { name: "Cheques Sem Fundos", value: formatValue(quantidadeChequesSemFundos) }),
27
+ React.createElement(AddItemField, { hidden: quantidadeChequesSemFundos == 0, name: "\u00DAltima Ocorr\u00EAncia", value: ultimaOcorrenciaChequesSemFundos })),
28
+ React.createElement(QuantityContainer, null,
29
+ React.createElement(AddItemField, { name: "Processos Jur\u00EDdicos", value: formatValue(quantidadeProcessos) })),
30
+ React.createElement(QuantityContainer, null,
31
+ React.createElement(AddItemField, { name: "D\u00EDvidas P\u00FAblicas", value: formatValue(quantidadeDividas) }),
32
+ React.createElement(AddItemField, { name: "Total D\u00EDvidas P\u00FAblicas", value: formatMoney(valorTotalDividas) })),
33
+ React.createElement(QuantityContainer, null,
34
+ React.createElement(AddItemField, { hidden: !((_b = data === null || data === void 0 ? void 0 : data.serasa) === null || _b === void 0 ? void 0 : _b.length), name: "Pefin Refin Serasa", value: formatValue(quantidadeDividasSerasa) }),
35
+ React.createElement(AddItemField, { hidden: !((_c = data === null || data === void 0 ? void 0 : data.serasa) === null || _c === void 0 ? void 0 : _c.length), name: "Total Pefin Refin Serasa", value: formatMoney(valorTotalDividasSerasa) })),
36
+ React.createElement(QuantityContainer, null,
37
+ React.createElement(AddItemField, { hidden: !((_d = data === null || data === void 0 ? void 0 : data.boaVista) === null || _d === void 0 ? void 0 : _d.length), name: "Pefin Refin Boa Vista", value: formatValue(quantidadeDividasBoaVista) }),
38
+ React.createElement(AddItemField, { hidden: !((_e = data === null || data === void 0 ? void 0 : data.boaVista) === null || _e === void 0 ? void 0 : _e.length), name: "Total Pefin Refin Boa Vista", value: formatMoney(valorTotalDividasBoaVista) })))));
39
+ };
40
+ export default QuantidadeResultados;
41
+ var templateObject_1;
@@ -0,0 +1,59 @@
1
+ export interface Consulta {
2
+ data: string | Date;
3
+ categoria?: string;
4
+ quantidade?: number | null;
5
+ creation?: string | Date;
6
+ valorTotal?: number | null;
7
+ total?: number | null;
8
+ }
9
+ export interface DataInput {
10
+ ccfs: Consulta[];
11
+ protestos: Consulta[];
12
+ serasa: Consulta[];
13
+ boaVista: Consulta[];
14
+ dividasPublicasGrafico: Consulta[];
15
+ pieChartTotalConfig?: {
16
+ protestos?: {
17
+ total: number | null;
18
+ valorTotal: number | null;
19
+ ultimaOcorrencia: string | null;
20
+ };
21
+ processosJuridicos?: number;
22
+ ccf?: {
23
+ total: number | null;
24
+ ultimaOcorrencia: string | null;
25
+ };
26
+ };
27
+ protestosCategory?: ProtestoData[];
28
+ }
29
+ export interface ProtestoData {
30
+ categoria: string;
31
+ quantidade: number;
32
+ ultimaOcorrencia: string | null;
33
+ }
34
+ export interface DataSetCommon {
35
+ label: string;
36
+ data: {
37
+ x: string;
38
+ y: number | null;
39
+ }[];
40
+ borderColor?: string;
41
+ backgroundColor?: string;
42
+ borderWidth?: number;
43
+ yAxisID?: 'y' | 'y2';
44
+ }
45
+ export interface DataSetLine extends DataSetCommon {
46
+ type: 'line';
47
+ tension?: number;
48
+ spanGaps: boolean;
49
+ showLine: boolean;
50
+ pointRadius: number;
51
+ fill?: boolean;
52
+ }
53
+ export interface DataSetBar extends DataSetCommon {
54
+ type: 'bar';
55
+ borderRadius?: number;
56
+ categoryPercentage?: number;
57
+ barPercentage?: number;
58
+ }
59
+ export type TimeFilter = '1y' | '6m' | '1m' | 'all';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { DataInput, TimeFilter } from '../types/iChart';
2
+ import { ChartDataset, ChartOptions } from 'chart.js';
3
+ export declare function createDatasets(data: DataInput, uniqueDates: string[], timeFilter: TimeFilter): ChartDataset<'line' | 'bar', (number | {
4
+ x: string;
5
+ y: number | null;
6
+ })[]>[];
7
+ export declare function getChartOptions(timeFilter: TimeFilter): ChartOptions<'line' | 'bar'>;