@credithub/harlan-components 1.13.8 → 1.14.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 (159) hide show
  1. package/lib/cjs/components/chart/chartContent.d.ts +3 -4
  2. package/lib/cjs/components/chart/chartContent.js +40 -72
  3. package/lib/cjs/components/chart/chartSystem.d.ts +6 -0
  4. package/lib/cjs/components/chart/chartSystem.js +50 -0
  5. package/lib/cjs/components/chart/components/MixedChart.d.ts +7 -0
  6. package/lib/cjs/components/chart/components/MixedChart.js +55 -0
  7. package/lib/cjs/components/chart/components/PieChart.d.ts +7 -0
  8. package/lib/cjs/components/chart/components/PieChart.js +14 -0
  9. package/lib/cjs/components/chart/components/categoryProtestos.d.ts +7 -0
  10. package/lib/cjs/components/chart/components/categoryProtestos.js +22 -0
  11. package/lib/cjs/components/chart/hooks/useCategoryProtestos.d.ts +6 -0
  12. package/lib/cjs/components/chart/hooks/useCategoryProtestos.js +75 -0
  13. package/lib/cjs/components/chart/hooks/useChartData.d.ts +8 -0
  14. package/lib/cjs/components/chart/hooks/useChartData.js +61 -0
  15. package/lib/cjs/components/chart/hooks/useMixedChartData.d.ts +10 -0
  16. package/lib/cjs/components/chart/hooks/useMixedChartData.js +47 -0
  17. package/lib/cjs/components/chart/hooks/usePieChartData.d.ts +6 -0
  18. package/lib/cjs/components/chart/hooks/usePieChartData.js +93 -0
  19. package/lib/cjs/components/chart/quantityResult.js +22 -21
  20. package/lib/cjs/components/chart/types/iChart.d.ts +58 -0
  21. package/lib/cjs/components/chart/utils/chartCustomization.d.ts +7 -0
  22. package/lib/cjs/components/chart/utils/chartCustomization.js +159 -0
  23. package/lib/cjs/components/chart/utils/chartUtils.d.ts +11 -0
  24. package/lib/cjs/components/chart/utils/chartUtils.js +46 -0
  25. package/lib/cjs/components/chart/utils/dataManipulation.d.ts +10 -0
  26. package/lib/cjs/components/chart/utils/dataManipulation.js +106 -0
  27. package/lib/cjs/components/chart/utils/dataProcessing.d.ts +3 -0
  28. package/lib/cjs/components/chart/utils/dataProcessing.js +94 -0
  29. package/lib/cjs/components/common/button.js +1 -1
  30. package/lib/cjs/components/dossie/carrousel/carrousel.js +1 -1
  31. package/lib/cjs/components/dossie/companyLogo/companyLogo.js +7 -8
  32. package/lib/cjs/components/dossie/dossie.js +6 -5
  33. package/lib/cjs/components/dossie/summary/cardsAndProducts.js +2 -2
  34. package/lib/cjs/components/dossie/summary/summary.js +12 -9
  35. package/lib/cjs/components/interface/theme.d.ts +6 -0
  36. package/lib/cjs/components/interface/theme.js +6 -0
  37. package/lib/cjs/consultaSimples.js +4 -2
  38. package/lib/cjs/hooks/useWindowSize.d.ts +4 -0
  39. package/lib/cjs/hooks/useWindowSize.js +23 -0
  40. package/lib/cjs/index.d.ts +1 -1
  41. package/lib/cjs/index.js +5 -4
  42. package/lib/cjs/utils/fillMissingData.d.ts +6 -0
  43. package/lib/cjs/utils/fillMissingData.js +16 -0
  44. package/lib/cjs/utils/getUniqueDates.d.ts +5 -0
  45. package/lib/cjs/utils/getUniqueDates.js +13 -0
  46. package/lib/esm/components/chart/chartContent.d.ts +3 -4
  47. package/lib/esm/components/chart/chartContent.js +41 -50
  48. package/lib/esm/components/chart/chartSystem.d.ts +6 -0
  49. package/lib/esm/components/chart/chartSystem.js +45 -0
  50. package/lib/esm/components/chart/components/MixedChart.d.ts +7 -0
  51. package/lib/esm/components/chart/components/MixedChart.js +30 -0
  52. package/lib/esm/components/chart/components/PieChart.d.ts +7 -0
  53. package/lib/esm/components/chart/components/PieChart.js +9 -0
  54. package/lib/esm/components/chart/components/categoryProtestos.d.ts +7 -0
  55. package/lib/esm/components/chart/components/categoryProtestos.js +17 -0
  56. package/lib/esm/components/chart/hooks/useCategoryProtestos.d.ts +6 -0
  57. package/lib/esm/components/chart/hooks/useCategoryProtestos.js +71 -0
  58. package/lib/esm/components/chart/hooks/useChartData.d.ts +8 -0
  59. package/lib/esm/components/chart/hooks/useChartData.js +59 -0
  60. package/lib/esm/components/chart/hooks/useMixedChartData.d.ts +10 -0
  61. package/lib/esm/components/chart/hooks/useMixedChartData.js +43 -0
  62. package/lib/esm/components/chart/hooks/usePieChartData.d.ts +6 -0
  63. package/lib/esm/components/chart/hooks/usePieChartData.js +89 -0
  64. package/lib/esm/components/chart/quantityResult.js +23 -22
  65. package/lib/esm/components/chart/types/iChart.d.ts +58 -0
  66. package/lib/esm/components/chart/utils/chartCustomization.d.ts +7 -0
  67. package/lib/esm/components/chart/utils/chartCustomization.js +154 -0
  68. package/lib/esm/components/chart/utils/chartUtils.d.ts +11 -0
  69. package/lib/esm/components/chart/utils/chartUtils.js +37 -0
  70. package/lib/esm/components/chart/utils/dataManipulation.d.ts +10 -0
  71. package/lib/esm/components/chart/utils/dataManipulation.js +97 -0
  72. package/lib/esm/components/chart/utils/dataProcessing.d.ts +3 -0
  73. package/lib/esm/components/chart/utils/dataProcessing.js +86 -0
  74. package/lib/esm/components/common/button.js +1 -1
  75. package/lib/esm/components/dossie/carrousel/carrousel.js +1 -1
  76. package/lib/esm/components/dossie/companyLogo/companyLogo.js +7 -8
  77. package/lib/esm/components/dossie/dossie.js +6 -5
  78. package/lib/esm/components/dossie/summary/cardsAndProducts.js +2 -2
  79. package/lib/esm/components/dossie/summary/summary.js +12 -9
  80. package/lib/esm/components/interface/theme.d.ts +6 -0
  81. package/lib/esm/components/interface/theme.js +6 -0
  82. package/lib/esm/consultaSimples.js +6 -4
  83. package/lib/esm/hooks/useWindowSize.d.ts +4 -0
  84. package/lib/esm/hooks/useWindowSize.js +19 -0
  85. package/lib/esm/index.d.ts +1 -1
  86. package/lib/esm/index.js +4 -1
  87. package/lib/esm/utils/fillMissingData.d.ts +6 -0
  88. package/lib/esm/utils/fillMissingData.js +12 -0
  89. package/lib/esm/utils/getUniqueDates.d.ts +5 -0
  90. package/lib/esm/utils/getUniqueDates.js +9 -0
  91. package/package.json +8 -1
  92. package/lib/cjs/components/chart/categoryProtestos.d.ts +0 -4
  93. package/lib/cjs/components/chart/categoryProtestos.js +0 -97
  94. package/lib/cjs/components/chart/chartHelper.d.ts +0 -7
  95. package/lib/cjs/components/chart/chartHelper.js +0 -66
  96. package/lib/cjs/components/chart/customChart.d.ts +0 -10
  97. package/lib/cjs/components/chart/customChart.js +0 -142
  98. package/lib/cjs/components/chart/getUniqueDates.d.ts +0 -2
  99. package/lib/cjs/components/chart/getUniqueDates.js +0 -8
  100. package/lib/cjs/components/chart/plotly/barChartDataStrategy.d.ts +0 -14
  101. package/lib/cjs/components/chart/plotly/barChartDataStrategy.js +0 -152
  102. package/lib/cjs/components/chart/plotly/baseChartDataStrategy.d.ts +0 -8
  103. package/lib/cjs/components/chart/plotly/baseChartDataStrategy.js +0 -31
  104. package/lib/cjs/components/chart/plotly/getSeries.d.ts +0 -3
  105. package/lib/cjs/components/chart/plotly/getSeries.js +0 -35
  106. package/lib/cjs/components/chart/plotly/iChartDataStrategy.d.ts +0 -35
  107. package/lib/cjs/components/chart/plotly/index.d.ts +0 -5
  108. package/lib/cjs/components/chart/plotly/index.js +0 -20
  109. package/lib/cjs/components/chart/plotly/layoutLineBarChart.d.ts +0 -39
  110. package/lib/cjs/components/chart/plotly/layoutLineBarChart.js +0 -67
  111. package/lib/cjs/components/chart/plotly/lineChartDataStrategy.d.ts +0 -17
  112. package/lib/cjs/components/chart/plotly/lineChartDataStrategy.js +0 -198
  113. package/lib/cjs/components/chart/plotly/pieChartDataStrategy.d.ts +0 -5
  114. package/lib/cjs/components/chart/plotly/pieChartDataStrategy.js +0 -45
  115. package/lib/cjs/components/chart/plotly/types.d.ts +0 -40
  116. package/lib/cjs/components/chart/plotly/types.js +0 -2
  117. package/lib/cjs/components/chart/processChartData.d.ts +0 -5
  118. package/lib/cjs/components/chart/processChartData.js +0 -41
  119. package/lib/cjs/components/chart/useCalculation.d.ts +0 -6
  120. package/lib/cjs/components/chart/useCalculation.js +0 -12
  121. package/lib/cjs/components/chart/useDividasPublicas.d.ts +0 -5
  122. package/lib/cjs/components/chart/useDividasPublicas.js +0 -26
  123. package/lib/cjs/components/chart/useUltimaOcorrenciaCCF.d.ts +0 -2
  124. package/lib/cjs/components/chart/useUltimaOcorrenciaCCF.js +0 -20
  125. package/lib/esm/components/chart/categoryProtestos.d.ts +0 -4
  126. package/lib/esm/components/chart/categoryProtestos.js +0 -69
  127. package/lib/esm/components/chart/chartHelper.d.ts +0 -7
  128. package/lib/esm/components/chart/chartHelper.js +0 -60
  129. package/lib/esm/components/chart/customChart.d.ts +0 -10
  130. package/lib/esm/components/chart/customChart.js +0 -112
  131. package/lib/esm/components/chart/getUniqueDates.d.ts +0 -2
  132. package/lib/esm/components/chart/getUniqueDates.js +0 -4
  133. package/lib/esm/components/chart/plotly/barChartDataStrategy.d.ts +0 -14
  134. package/lib/esm/components/chart/plotly/barChartDataStrategy.js +0 -149
  135. package/lib/esm/components/chart/plotly/baseChartDataStrategy.d.ts +0 -8
  136. package/lib/esm/components/chart/plotly/baseChartDataStrategy.js +0 -28
  137. package/lib/esm/components/chart/plotly/getSeries.d.ts +0 -3
  138. package/lib/esm/components/chart/plotly/getSeries.js +0 -31
  139. package/lib/esm/components/chart/plotly/iChartDataStrategy.d.ts +0 -35
  140. package/lib/esm/components/chart/plotly/index.d.ts +0 -5
  141. package/lib/esm/components/chart/plotly/index.js +0 -5
  142. package/lib/esm/components/chart/plotly/layoutLineBarChart.d.ts +0 -39
  143. package/lib/esm/components/chart/plotly/layoutLineBarChart.js +0 -64
  144. package/lib/esm/components/chart/plotly/lineChartDataStrategy.d.ts +0 -17
  145. package/lib/esm/components/chart/plotly/lineChartDataStrategy.js +0 -195
  146. package/lib/esm/components/chart/plotly/pieChartDataStrategy.d.ts +0 -5
  147. package/lib/esm/components/chart/plotly/pieChartDataStrategy.js +0 -42
  148. package/lib/esm/components/chart/plotly/types.d.ts +0 -40
  149. package/lib/esm/components/chart/plotly/types.js +0 -1
  150. package/lib/esm/components/chart/processChartData.d.ts +0 -5
  151. package/lib/esm/components/chart/processChartData.js +0 -37
  152. package/lib/esm/components/chart/useCalculation.d.ts +0 -6
  153. package/lib/esm/components/chart/useCalculation.js +0 -8
  154. package/lib/esm/components/chart/useDividasPublicas.d.ts +0 -5
  155. package/lib/esm/components/chart/useDividasPublicas.js +0 -21
  156. package/lib/esm/components/chart/useUltimaOcorrenciaCCF.d.ts +0 -2
  157. package/lib/esm/components/chart/useUltimaOcorrenciaCCF.js +0 -15
  158. /package/lib/cjs/components/chart/{plotly/iChartDataStrategy.js → types/iChart.js} +0 -0
  159. /package/lib/esm/components/chart/{plotly/iChartDataStrategy.js → types/iChart.js} +0 -0
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.layoutLineBarChart = exports.getSeries = exports.lineProtestos = exports.lineBoaVista = exports.lineSerasa = exports.lineCCF = exports.lineDividasPublicas = exports.barBoaVista = exports.barSerasa = exports.barProtestos = exports.barDividasPublicas = exports.BaseChartDataStrategy = void 0;
4
- var baseChartDataStrategy_1 = require("./baseChartDataStrategy");
5
- Object.defineProperty(exports, "BaseChartDataStrategy", { enumerable: true, get: function () { return baseChartDataStrategy_1.BaseChartDataStrategy; } });
6
- var barChartDataStrategy_1 = require("./barChartDataStrategy");
7
- Object.defineProperty(exports, "barDividasPublicas", { enumerable: true, get: function () { return barChartDataStrategy_1.barDividasPublicas; } });
8
- Object.defineProperty(exports, "barProtestos", { enumerable: true, get: function () { return barChartDataStrategy_1.barProtestos; } });
9
- Object.defineProperty(exports, "barSerasa", { enumerable: true, get: function () { return barChartDataStrategy_1.barSerasa; } });
10
- Object.defineProperty(exports, "barBoaVista", { enumerable: true, get: function () { return barChartDataStrategy_1.barBoaVista; } });
11
- var lineChartDataStrategy_1 = require("./lineChartDataStrategy");
12
- Object.defineProperty(exports, "lineDividasPublicas", { enumerable: true, get: function () { return lineChartDataStrategy_1.lineDividasPublicas; } });
13
- Object.defineProperty(exports, "lineCCF", { enumerable: true, get: function () { return lineChartDataStrategy_1.lineCCF; } });
14
- Object.defineProperty(exports, "lineSerasa", { enumerable: true, get: function () { return lineChartDataStrategy_1.lineSerasa; } });
15
- Object.defineProperty(exports, "lineBoaVista", { enumerable: true, get: function () { return lineChartDataStrategy_1.lineBoaVista; } });
16
- Object.defineProperty(exports, "lineProtestos", { enumerable: true, get: function () { return lineChartDataStrategy_1.lineProtestos; } });
17
- var getSeries_1 = require("./getSeries");
18
- Object.defineProperty(exports, "getSeries", { enumerable: true, get: function () { return getSeries_1.getSeries; } });
19
- var layoutLineBarChart_1 = require("./layoutLineBarChart");
20
- Object.defineProperty(exports, "layoutLineBarChart", { enumerable: true, get: function () { return layoutLineBarChart_1.layoutLineBarChart; } });
@@ -1,39 +0,0 @@
1
- export interface LayoutConfig extends Partial<Plotly.Layout> {
2
- xaxis?: {
3
- range: [string, string];
4
- domain: [number, number];
5
- rangeslider: {};
6
- rangeselector: {
7
- buttons: Array<{
8
- step: "month" | "year" | "all";
9
- stepmode?: "backward" | "todate";
10
- count?: number;
11
- label?: string;
12
- }>;
13
- };
14
- };
15
- yaxis2?: {
16
- title: string;
17
- titlefont: {
18
- color: string;
19
- };
20
- tickfont: {
21
- color: string;
22
- };
23
- tickformat: string;
24
- };
25
- yaxis?: {
26
- title: string;
27
- titlefont: {
28
- color: string;
29
- };
30
- tickfont: {
31
- color: string;
32
- };
33
- anchor: "x";
34
- side: "right";
35
- overlaying: "y2";
36
- };
37
- }
38
- declare const layoutLineBarChart: (layoutWidth: number, lastDate: Date) => LayoutConfig;
39
- export { layoutLineBarChart };
@@ -1,67 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.layoutLineBarChart = void 0;
4
- var layoutLineBarChart = function (layoutWidth, lastDate) {
5
- var currentDate = lastDate;
6
- var thirtyDaysAgo = new Date(currentDate.getTime() - 30 * 24 * 60 * 60 * 1000);
7
- var oneDayAhead = new Date(currentDate.getTime() + 24 * 60 * 60 * 1000);
8
- var formattedThirtyDaysAgo = thirtyDaysAgo.toISOString();
9
- var formattedOneDayAhead = oneDayAhead.toISOString();
10
- return {
11
- title: "",
12
- width: layoutWidth,
13
- height: 800,
14
- xaxis: {
15
- range: [formattedThirtyDaysAgo, formattedOneDayAhead],
16
- domain: [0.1, 0.92],
17
- rangeslider: { visible: true },
18
- rangeselector: {
19
- buttons: [
20
- {
21
- step: "month",
22
- stepmode: "backward",
23
- count: 1,
24
- label: "1 mês",
25
- },
26
- {
27
- step: "month",
28
- stepmode: "backward",
29
- count: 6,
30
- label: "6 meses",
31
- },
32
- {
33
- step: "year",
34
- stepmode: "backward",
35
- count: 1,
36
- label: "1 ano",
37
- },
38
- {
39
- step: "all",
40
- label: "all",
41
- },
42
- ],
43
- },
44
- },
45
- yaxis2: {
46
- title: "Valor Total de Negativações (R$)",
47
- titlefont: { color: "#1f77b4" },
48
- tickfont: { color: "#1f77b4" },
49
- tickformat: ",.2f",
50
- },
51
- yaxis: {
52
- title: "Quantidade de Ocorrências por Consulta",
53
- titlefont: {
54
- color: "#ff7f0e",
55
- },
56
- tickfont: {
57
- color: "#ff7f0e",
58
- },
59
- anchor: "x",
60
- side: "right",
61
- overlaying: "y2",
62
- },
63
- paper_bgcolor: "rgba(0,0,0,0)",
64
- plot_bgcolor: "rgba(0,0,0,0)",
65
- };
66
- };
67
- exports.layoutLineBarChart = layoutLineBarChart;
@@ -1,17 +0,0 @@
1
- import { BaseChartDataStrategy } from "./";
2
- import { ChartDataAndLayoutState, DataInput } from "./types";
3
- export declare class lineDividasPublicas extends BaseChartDataStrategy<DataInput> {
4
- processData(data: DataInput): ChartDataAndLayoutState;
5
- }
6
- export declare class lineCCF extends BaseChartDataStrategy<DataInput> {
7
- processData(data: DataInput): ChartDataAndLayoutState;
8
- }
9
- export declare class lineSerasa extends BaseChartDataStrategy<DataInput> {
10
- processData(data: DataInput): ChartDataAndLayoutState;
11
- }
12
- export declare class lineBoaVista extends BaseChartDataStrategy<DataInput> {
13
- processData(data: DataInput): ChartDataAndLayoutState;
14
- }
15
- export declare class lineProtestos extends BaseChartDataStrategy<DataInput> {
16
- processData(data: DataInput): ChartDataAndLayoutState;
17
- }
@@ -1,198 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.lineProtestos = exports.lineBoaVista = exports.lineSerasa = exports.lineCCF = exports.lineDividasPublicas = void 0;
19
- var _1 = require("./");
20
- var layout = {};
21
- var lineDividasPublicas = /** @class */ (function (_super) {
22
- __extends(lineDividasPublicas, _super);
23
- function lineDividasPublicas() {
24
- return _super !== null && _super.apply(this, arguments) || this;
25
- }
26
- lineDividasPublicas.prototype.processData = function (data) {
27
- var dividasPublicasData = data.dividasPublicasGrafico
28
- .filter(function (consulta) { return consulta.quantidade !== null; })
29
- .map(function (consulta) { return ({
30
- x: consulta.data,
31
- y: consulta.quantidade,
32
- }); });
33
- var color = "#ef4b6c";
34
- var dividasPublicasState = {
35
- name: "Dívidas Públicas",
36
- yaxis: "y",
37
- marker: {
38
- color: color,
39
- },
40
- textfont: {
41
- family: "sans serif",
42
- size: 12,
43
- color: color,
44
- },
45
- type: "scatter",
46
- mode: "lines+markers+text",
47
- data: dividasPublicasData,
48
- connectgaps: true,
49
- layout: layout,
50
- };
51
- return dividasPublicasState;
52
- };
53
- return lineDividasPublicas;
54
- }(_1.BaseChartDataStrategy));
55
- exports.lineDividasPublicas = lineDividasPublicas;
56
- var lineCCF = /** @class */ (function (_super) {
57
- __extends(lineCCF, _super);
58
- function lineCCF() {
59
- return _super !== null && _super.apply(this, arguments) || this;
60
- }
61
- lineCCF.prototype.processData = function (data) {
62
- var ccfData = data.ccfs
63
- .filter(function (consulta) { return consulta.quantidade !== null; })
64
- .map(function (consulta) { return ({
65
- x: consulta.data,
66
- y: consulta.quantidade,
67
- }); });
68
- var color = "#3f51b5";
69
- var ccfState = {
70
- name: "Cheques sem Fundos",
71
- yaxis: "y",
72
- marker: {
73
- color: color,
74
- },
75
- textfont: {
76
- family: "sans serif",
77
- size: 12,
78
- color: color,
79
- },
80
- type: "scatter",
81
- mode: "lines+markers+text",
82
- data: ccfData,
83
- connectgaps: true,
84
- layout: layout,
85
- };
86
- return ccfState;
87
- };
88
- return lineCCF;
89
- }(_1.BaseChartDataStrategy));
90
- exports.lineCCF = lineCCF;
91
- var lineSerasa = /** @class */ (function (_super) {
92
- __extends(lineSerasa, _super);
93
- function lineSerasa() {
94
- return _super !== null && _super.apply(this, arguments) || this;
95
- }
96
- lineSerasa.prototype.processData = function (data) {
97
- var serasaData = data.serasa
98
- .filter(function (consulta) { return consulta.quantidade !== null; })
99
- .map(function (consulta) { return ({
100
- x: consulta.creation,
101
- y: consulta.quantidade,
102
- }); });
103
- var serasaState = {
104
- name: "Pefin/Refin Serasa",
105
- yaxis: "y",
106
- type: "scatter",
107
- marker: {
108
- color: "#ffc107",
109
- },
110
- textfont: {
111
- family: "sans serif",
112
- size: 12,
113
- color: "#ffc107",
114
- },
115
- mode: "lines+markers+text",
116
- data: serasaData,
117
- connectgaps: true,
118
- layout: layout,
119
- };
120
- return serasaState;
121
- };
122
- return lineSerasa;
123
- }(_1.BaseChartDataStrategy));
124
- exports.lineSerasa = lineSerasa;
125
- var lineBoaVista = /** @class */ (function (_super) {
126
- __extends(lineBoaVista, _super);
127
- function lineBoaVista() {
128
- return _super !== null && _super.apply(this, arguments) || this;
129
- }
130
- lineBoaVista.prototype.processData = function (data) {
131
- var boaVistaData = data.boaVista
132
- .filter(function (consulta) { return consulta.quantidade !== null; })
133
- .map(function (consulta) { return ({
134
- x: consulta.creation,
135
- y: consulta.quantidade,
136
- }); });
137
- var color = "#4caf50";
138
- var boaVistaState = {
139
- name: "Pefin/Refin Boa Vista",
140
- yaxis: "y",
141
- type: "scatter",
142
- marker: {
143
- color: color,
144
- },
145
- textfont: {
146
- family: "sans serif",
147
- size: 12,
148
- color: color,
149
- },
150
- mode: "lines+markers+text",
151
- data: boaVistaData,
152
- connectgaps: true,
153
- layout: layout,
154
- };
155
- return boaVistaState;
156
- };
157
- return lineBoaVista;
158
- }(_1.BaseChartDataStrategy));
159
- exports.lineBoaVista = lineBoaVista;
160
- var lineProtestos = /** @class */ (function (_super) {
161
- __extends(lineProtestos, _super);
162
- function lineProtestos() {
163
- return _super !== null && _super.apply(this, arguments) || this;
164
- }
165
- lineProtestos.prototype.processData = function (data) {
166
- var protestosData = data.protestos
167
- .filter(function (consulta) { return consulta.quantidade !== null; })
168
- .map(function (consulta) { return ({
169
- x: consulta.data,
170
- y: consulta.quantidade,
171
- }); });
172
- var protestosState = {
173
- name: "Protestos",
174
- yaxis: "y",
175
- marker: {
176
- color: "red",
177
- line: {
178
- color: "rgb(255, 255, 255)",
179
- width: 1,
180
- },
181
- },
182
- textfont: {
183
- bgcolor: "#fffff",
184
- family: "sans serif",
185
- size: 12,
186
- color: "red",
187
- },
188
- type: "scatter",
189
- mode: "lines+markers+text",
190
- data: protestosData,
191
- connectgaps: true,
192
- layout: layout,
193
- };
194
- return protestosState;
195
- };
196
- return lineProtestos;
197
- }(_1.BaseChartDataStrategy));
198
- exports.lineProtestos = lineProtestos;
@@ -1,5 +0,0 @@
1
- import { IChartDataStrategy } from "./iChartDataStrategy";
2
- import { ChartDataAndLayoutState, DataInput } from "./types";
3
- export declare class PieChartDataStrategy implements IChartDataStrategy<DataInput> {
4
- processData(data: DataInput): ChartDataAndLayoutState;
5
- }
@@ -1,45 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.PieChartDataStrategy = void 0;
15
- var underscore_1 = require("underscore");
16
- var PieChartDataStrategy = /** @class */ (function () {
17
- function PieChartDataStrategy() {
18
- }
19
- PieChartDataStrategy.prototype.processData = function (data) {
20
- var _a, _b, _c, _d, _e, _f;
21
- var totalDeProtestos = (_a = (0, underscore_1.last)(data.protestos)) === null || _a === void 0 ? void 0 : _a.quantidade;
22
- var chequesDevolvidos = (_b = (0, underscore_1.last)(data.ccfs)) === null || _b === void 0 ? void 0 : _b.quantidade;
23
- var totalDePefinRefinSerasa = (_c = (0, underscore_1.last)(data.serasa)) === null || _c === void 0 ? void 0 : _c.quantidade;
24
- var totalDePefinRefinBoaVista = (_d = (0, underscore_1.last)(data.boaVista)) === null || _d === void 0 ? void 0 : _d.quantidade;
25
- var totalDeDividasPublicas = (_e = (0, underscore_1.last)(data.dividasPublicasGrafico)) === null || _e === void 0 ? void 0 : _e.quantidade;
26
- var pieChartLayout = {
27
- autosize: true,
28
- };
29
- return {
30
- name: "Quantidade de Ocorrências",
31
- yaxis: "",
32
- type: "pie",
33
- data: (_f = [
34
- { x: "Protestos", y: totalDeProtestos },
35
- { x: "Cheques Devolvidos", y: chequesDevolvidos },
36
- { x: "Pefin/Refin Serasa", y: totalDePefinRefinSerasa },
37
- { x: "Pefin/Refin Boa Vista", y: totalDePefinRefinBoaVista },
38
- { x: "Divídas Públicas", y: totalDeDividasPublicas }
39
- ]) === null || _f === void 0 ? void 0 : _f.map(function (query) { return (__assign(__assign({}, query), { y: query.y || 0 })); }),
40
- layout: pieChartLayout,
41
- };
42
- };
43
- return PieChartDataStrategy;
44
- }());
45
- exports.PieChartDataStrategy = PieChartDataStrategy;
@@ -1,40 +0,0 @@
1
- import { ChartDataState } from "./iChartDataStrategy";
2
- import { LayoutConfig } from "./layoutLineBarChart";
3
- export interface Consulta {
4
- data: string | Date;
5
- categoria?: string;
6
- quantidade: number | null;
7
- creation?: string | Date;
8
- valorTotal: number | null;
9
- }
10
- export interface DataInput {
11
- ccfs: Consulta[];
12
- protestos: Consulta[];
13
- serasa: Consulta[];
14
- boaVista: Consulta[];
15
- dividasPublicas: {
16
- quantidade: number;
17
- valorTotal: number;
18
- };
19
- dividasPublicasGrafico: Consulta[];
20
- pieChartTotalConfig?: {
21
- protestos?: {
22
- total: number | null;
23
- valorTotal: number | null;
24
- ultimaOcorrencia: string | null;
25
- };
26
- processosJuridicos?: number;
27
- ccf?: {
28
- total: number | null;
29
- ultimaOcorrencia: string | null;
30
- };
31
- };
32
- }
33
- export interface CategoriaProtestoProps {
34
- width?: number;
35
- height?: number;
36
- }
37
- export type LineChartMode = "lines" | "markers" | "lines+markers" | "text+markers" | "text+lines" | "text+lines+markers";
38
- export interface ChartDataAndLayoutState extends ChartDataState {
39
- layout: LayoutConfig;
40
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- import { DataInput } from "./plotly/types";
2
- export declare const processChartData: ({ dataInput, dates }: {
3
- dataInput: DataInput;
4
- dates: Date[];
5
- }) => import("plotly.js").Data[];
@@ -1,41 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.processChartData = void 0;
15
- var plotly_1 = require("./plotly");
16
- var chartHelper_1 = require("./chartHelper");
17
- var underscore_1 = require("underscore");
18
- var processChartData = function (_a) {
19
- var dataInput = _a.dataInput, dates = _a.dates;
20
- var chartData = [];
21
- var adicionarDatasFaltantes = function (dataset) { return dates.map(function (date) { return (0, underscore_1.find)(dataset, function (consulta) { return consulta.x === date; }) || ({ x: date, y: null }); }).flat(); };
22
- var ordenarDatas = function (consultas) { return (0, underscore_1.sortBy)(consultas, function (consulta) { return consulta.x.getTime(); }); };
23
- if (dataInput) {
24
- var processedDataSets = (0, plotly_1.getSeries)(dataInput);
25
- processedDataSets = processedDataSets.map(function (dataset) { return (__assign(__assign({}, dataset), { x: ordenarDatas(adicionarDatasFaltantes(dataset.data)) })); });
26
- processedDataSets.forEach(function (dataSet) {
27
- var chartDataAndLayout = __assign(__assign({}, dataSet), { layout: {} });
28
- if (dataSet.type === "scatter") {
29
- chartData.push((0, chartHelper_1.createLineChart)(chartDataAndLayout));
30
- }
31
- else if (dataSet.type === "bar") {
32
- chartData.push((0, chartHelper_1.createBarChart)(chartDataAndLayout));
33
- }
34
- else if (dataSet.type === "pie") {
35
- chartData.push((0, chartHelper_1.createPieChart)(chartDataAndLayout));
36
- }
37
- });
38
- }
39
- return chartData;
40
- };
41
- exports.processChartData = processChartData;
@@ -1,6 +0,0 @@
1
- import { ItemCalculo } from "../../utils/calculation";
2
- export declare const useCalculation: (itens: ItemCalculo[]) => {
3
- quantidade: number;
4
- valorTotal: number;
5
- dataMaisRecente: string;
6
- };
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useCalculation = void 0;
4
- var react_1 = require("react");
5
- var calculation_1 = require("../../utils/calculation");
6
- var useCalculation = function (itens) {
7
- var quantidade = (0, react_1.useMemo)(function () { return (0, calculation_1.somarQuantidades)(itens); }, [itens]);
8
- var valorTotal = (0, react_1.useMemo)(function () { return (0, calculation_1.somarValoresTotais)(itens); }, [itens]);
9
- var dataMaisRecente = (0, react_1.useMemo)(function () { return (0, calculation_1.encontrarDataMaisRecente)(itens); }, [itens]);
10
- return { quantidade: quantidade, valorTotal: valorTotal, dataMaisRecente: dataMaisRecente };
11
- };
12
- exports.useCalculation = useCalculation;
@@ -1,5 +0,0 @@
1
- declare const useDividasPublicas: () => {
2
- quantidade: number;
3
- valorTotal: number;
4
- };
5
- export default useDividasPublicas;
@@ -1,26 +0,0 @@
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 useDividasPublicas = function () {
11
- var ctxFinder = (0, react_1.useContext)(webservice_1.Queries.Finder);
12
- var dividasPublicasData = (0, react_1.useMemo)(function () {
13
- if ((ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.type) === webservice_1.RequestStatus.Success) {
14
- return {
15
- quantidade: xpath_1.default.select("number(//dividas/resumo/quantidade_dividas)", ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.document) || 0,
16
- valorTotal: xpath_1.default.select("number(//dividas/resumo/valor_total_dividas)", ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.document) || 0
17
- };
18
- }
19
- return {
20
- quantidade: 0,
21
- valorTotal: 0
22
- };
23
- }, [ctxFinder === null || ctxFinder === void 0 ? void 0 : ctxFinder.type]);
24
- return dividasPublicasData;
25
- };
26
- exports.default = useDividasPublicas;
@@ -1,2 +0,0 @@
1
- declare const useUltimaOcorrenciaCCF: () => string | undefined;
2
- export default useUltimaOcorrenciaCCF;
@@ -1,20 +0,0 @@
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;
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- import { CategoriaProtestoProps } from "./plotly/types";
3
- declare const CategoriaProtesto: React.FC<CategoriaProtestoProps>;
4
- export default CategoriaProtesto;
@@ -1,69 +0,0 @@
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.selectArray("//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.selectArray("//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;
@@ -1,7 +0,0 @@
1
- import Plotly from "react-plotly.js";
2
- import { ChartDataAndLayoutState } from "./plotly/types";
3
- export declare const createPieChart: (data: ChartDataAndLayoutState) => Plotly.PieData & {
4
- possuiPendencias: boolean;
5
- };
6
- export declare const createBarChart: (data: ChartDataAndLayoutState) => Plotly.Data;
7
- export declare const createLineChart: (data: ChartDataAndLayoutState) => Plotly.Data;