@credithub/harlan-components 1.17.0 → 1.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -13677,7 +13677,7 @@ var PartnerRFBStatus = function (_a) {
13677
13677
 
13678
13678
  var PartnerProtestos = function (_a) {
13679
13679
  var documento = _a.documento;
13680
- var _b = useQuery("SELECT FROM 'APICENPROT'.'PRINT'", { documento: documento }), isLoading = _b.isLoading, error = _b.error, response = _b.response;
13680
+ var _b = useQuery("SELECT FROM 'IEPTB'.'IEPTBHARLAN'", { documento: documento }), isLoading = _b.isLoading, error = _b.error, response = _b.response;
13681
13681
  return isLoading ? React.createElement(Loading, null) : error ? 'Houve um erro ao obter a informação.' : XPathUtils.select('string(//registros)', response === null || response === void 0 ? void 0 : response.document);
13682
13682
  };
13683
13683
 
@@ -13802,6 +13802,42 @@ var ProtestosCategory = function (_a) {
13802
13802
  };
13803
13803
  var templateObject_1$i;
13804
13804
 
13805
+ var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
13806
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13807
+ return new (P || (P = Promise))(function (resolve, reject) {
13808
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
13809
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
13810
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13811
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
13812
+ });
13813
+ };
13814
+ var __generator$1 = (undefined && undefined.__generator) || function (thisArg, body) {
13815
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13816
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13817
+ function verb(n) { return function (v) { return step([n, v]); }; }
13818
+ function step(op) {
13819
+ if (f) throw new TypeError("Generator is already executing.");
13820
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
13821
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
13822
+ if (y = 0, t) op = [op[0] & 2, t.value];
13823
+ switch (op[0]) {
13824
+ case 0: case 1: t = op; break;
13825
+ case 4: _.label++; return { value: op[1], done: false };
13826
+ case 5: _.label++; y = op[1]; op = [0]; continue;
13827
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
13828
+ default:
13829
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
13830
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
13831
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
13832
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
13833
+ if (t[2]) _.ops.pop();
13834
+ _.trys.pop(); continue;
13835
+ }
13836
+ op = body.call(thisArg, _);
13837
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
13838
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
13839
+ }
13840
+ };
13805
13841
  var ProtestoItem = React.memo(function (_a) {
13806
13842
  var protesto = _a.protesto;
13807
13843
  var getField = function (path, formatter) {
@@ -13811,15 +13847,54 @@ var ProtestoItem = React.memo(function (_a) {
13811
13847
  var formatBooleanField = function (value) {
13812
13848
  return value === "true" ? "Sim" : "Não";
13813
13849
  };
13814
- return (React.createElement(ResultContent, { desktop: "repeat(7, 1fr)", tablet: "repeat(4, 1fr)", mobile: "repeat(2, 1fr)" },
13850
+ return (React.createElement(ResultContent, { desktop: "repeat(8, 1fr)", tablet: "repeat(4, 1fr)", mobile: "repeat(2, 1fr)" },
13815
13851
  React.createElement(AddItemField, { name: "Quem Protestou", value: getField("./nomeCedente") }),
13816
13852
  React.createElement(AddItemField, { name: "Atrav\u00E9s De", value: getField("./nomeApresentante") }),
13817
13853
  React.createElement(AddItemField, { name: "CPF/CNPJ Protestado", value: formatDocument(getField("./cpfCnpj")) }),
13818
13854
  React.createElement(AddItemField, { name: "Data Do Protesto", value: getField("./dataProtesto") }),
13819
13855
  React.createElement(AddItemField, { name: "Possui Anu\u00EAncia", value: formatBooleanField(getField("./temAnuencia")) }),
13820
13856
  React.createElement(AddItemField, { name: "Anu\u00EAncia Vencida", value: formatBooleanField(getField("./anuenciaVencida")) }),
13821
- React.createElement(AddItemField, { name: "Valor Do Protesto", value: formatMoney(getField("./valor")) })));
13857
+ React.createElement(AddItemField, { name: "Valor Do Protesto", value: formatMoney(getField("./valor")) }),
13858
+ React.createElement(Instrumento, { nm_chave: getField("./nm_chave") })));
13822
13859
  });
13860
+ var Instrumento = function (_a) {
13861
+ var nm_chave = _a.nm_chave;
13862
+ var client = React.useContext(WebService);
13863
+ var _b = React.useState(), error = _b[0], setError = _b[1];
13864
+ var _c = React.useState(false), isLoading = _c[0], setIsLoading = _c[1];
13865
+ if (!nm_chave)
13866
+ return null;
13867
+ return React.createElement(Button$1, { onClick: function () { return __awaiter$1(void 0, void 0, void 0, function () {
13868
+ var request, pdfWindow, e_1;
13869
+ return __generator$1(this, function (_a) {
13870
+ switch (_a.label) {
13871
+ case 0:
13872
+ setIsLoading(true);
13873
+ _a.label = 1;
13874
+ case 1:
13875
+ _a.trys.push([1, 4, 5, 6]);
13876
+ return [4 /*yield*/, client.request("SELECT FROM 'IEPTB'.'PDF'", { nm_chave: nm_chave })];
13877
+ case 2: return [4 /*yield*/, (_a.sent()).json()];
13878
+ case 3:
13879
+ request = _a.sent();
13880
+ pdfWindow = window.open('', '_blank');
13881
+ if (!pdfWindow)
13882
+ return [2 /*return*/];
13883
+ pdfWindow.document.write("<iframe width='100%' height='100%' src='data:application/pdf;base64,".concat(request === null || request === void 0 ? void 0 : request.instrumentoProtesto, "'></iframe>"));
13884
+ return [3 /*break*/, 6];
13885
+ case 4:
13886
+ e_1 = _a.sent();
13887
+ console.error(e_1);
13888
+ setError(true);
13889
+ return [3 /*break*/, 6];
13890
+ case 5:
13891
+ setIsLoading(false);
13892
+ return [7 /*endfinally*/];
13893
+ case 6: return [2 /*return*/];
13894
+ }
13895
+ });
13896
+ }); }, disabled: isLoading }, error ? 'Instrumento não Localizado' : 'Instrumento');
13897
+ };
13823
13898
  /**
13824
13899
  * const ProtestosList: React.FC<{
13825
13900
  protestos: ProtestoData[]
@@ -47646,7 +47721,8 @@ var QuantityContainer = function (_a) {
47646
47721
  };
47647
47722
  var QuantidadeResultadosWrapper = styled(ResultContent)(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject$8(["\n padding: 18px 20px;\n row-gap: 20px;\n > * {\n row-gap: 10px;\n }\n @media only screen and (max-width: 768px) {\n > * {\n :not(:last-child) {\n border-bottom: 1px solid ", ";\n }\n }\n }\n"], ["\n padding: 18px 20px;\n row-gap: 20px;\n > * {\n row-gap: 10px;\n }\n @media only screen and (max-width: 768px) {\n > * {\n :not(:last-child) {\n border-bottom: 1px solid ", ";\n }\n }\n }\n"])), theme.colors.cinzaClaro);
47648
47723
  var QuantidadeResultados = function (_a) {
47649
- var _b = _a.quantidadeProtestos, quantidadeProtestos = _b === void 0 ? 0 : _b, _c = _a.quantidadeProcessos, quantidadeProcessos = _c === void 0 ? 0 : _c, _d = _a.quantidadeDividas, quantidadeDividas = _d === void 0 ? 0 : _d, _e = _a.quantidadeChequesSemFundos, quantidadeChequesSemFundos = _e === void 0 ? 0 : _e, _f = _a.quantidadeDividasSerasa, quantidadeDividasSerasa = _f === void 0 ? 0 : _f, _g = _a.quantidadeDividasBoaVista, quantidadeDividasBoaVista = _g === void 0 ? 0 : _g, _h = _a.valorTotalProtestos, valorTotalProtestos = _h === void 0 ? 0 : _h, _j = _a.valorTotalDividas, valorTotalDividas = _j === void 0 ? 0 : _j, _k = _a.valorTotalDividasSerasa, valorTotalDividasSerasa = _k === void 0 ? 0 : _k, _l = _a.valorTotalDividasBoaVista, valorTotalDividasBoaVista = _l === void 0 ? 0 : _l, _m = _a.ultimaOcorrenciaProtestos, ultimaOcorrenciaProtestos = _m === void 0 ? null : _m, _o = _a.ultimaOcorrenciaChequesSemFundos, ultimaOcorrenciaChequesSemFundos = _o === void 0 ? null : _o;
47724
+ var _b, _c, _d, _e;
47725
+ 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;
47650
47726
  return (React.createElement(Result, { resultContentStriped: false },
47651
47727
  React.createElement(QuantidadeResultadosWrapper, { desktop: "repeat(6, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr" },
47652
47728
  React.createElement(QuantityContainer, null,
@@ -47662,11 +47738,11 @@ var QuantidadeResultados = function (_a) {
47662
47738
  React.createElement(AddItemField, { name: "D\u00EDvidas P\u00FAblicas", value: formatValue(quantidadeDividas) }),
47663
47739
  React.createElement(AddItemField, { name: "Total D\u00EDvidas P\u00FAblicas", value: formatMoney(valorTotalDividas) })),
47664
47740
  React.createElement(QuantityContainer, null,
47665
- React.createElement(AddItemField, { name: "Pefin Refin Serasa", value: formatValue(quantidadeDividasSerasa) }),
47666
- React.createElement(AddItemField, { name: "Total Pefin Refin Serasa", value: formatMoney(valorTotalDividasSerasa) })),
47741
+ 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) }),
47742
+ 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) })),
47667
47743
  React.createElement(QuantityContainer, null,
47668
- React.createElement(AddItemField, { name: "Pefin Refin Boa Vista", value: formatValue(quantidadeDividasBoaVista) }),
47669
- React.createElement(AddItemField, { name: "Total Pefin Refin Boa Vista", value: formatMoney(valorTotalDividasBoaVista) })))));
47744
+ 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) }),
47745
+ 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) })))));
47670
47746
  };
47671
47747
  var templateObject_1$8;
47672
47748
 
@@ -63002,7 +63078,7 @@ function createDatasets(data, uniqueDates, timeFilter) {
63002
63078
  }));
63003
63079
  var datasetData = uniqueDates.map(function (date) {
63004
63080
  var _a;
63005
- var value = (_a = dateValues.get(date)) !== null && _a !== void 0 ? _a : 0;
63081
+ var value = (_a = dateValues.get(date)) !== null && _a !== void 0 ? _a : null;
63006
63082
  return { x: date, y: value };
63007
63083
  });
63008
63084
  var datasetConfiguration = __assign$6({ type: chartType, label: label, data: datasetData, borderColor: borderColor, backgroundColor: chartType === "bar" ? borderColor + "60" : undefined, tension: chartType === "line" ? 0.4 : undefined, spanGaps: true, showLine: chartType === "line", pointRadius: 2, yAxisID: yAxisID }, (chartType === "bar" && {
@@ -63141,8 +63217,8 @@ var useMixedChartData = function (dataInput, timeFilter) {
63141
63217
  var fullProcessedData = {
63142
63218
  protestos: addMissingDateEntries(dataInput.protestos, fullDataStartDate, endDate),
63143
63219
  ccfs: addMissingDateEntries(dataInput.ccfs, fullDataStartDate, endDate),
63144
- serasa: addMissingDateEntries(dataInput.serasa, fullDataStartDate, endDate),
63145
- boaVista: addMissingDateEntries(dataInput.boaVista, fullDataStartDate, endDate),
63220
+ serasa: dataInput.serasa,
63221
+ boaVista: dataInput.boaVista,
63146
63222
  dividasPublicasGrafico: addMissingDateEntries(dataInput.dividasPublicasGrafico, fullDataStartDate, endDate),
63147
63223
  };
63148
63224
  var processedData = {
@@ -64762,7 +64838,7 @@ var ChartSystem = function (_a) {
64762
64838
  React.createElement(Result, null,
64763
64839
  React.createElement(Content, { isOpen: isOpen },
64764
64840
  data && React.createElement(ChartContent, { dataInput: data }),
64765
- !isLoading && (React.createElement(QuantidadeResultados, { quantidadeProtestos: quantidadeProtestos, quantidadeProcessos: (_f = data === null || data === void 0 ? void 0 : data.pieChartTotalConfig) === null || _f === void 0 ? void 0 : _f.processosJuridicos, quantidadeDividas: quantidadeDividas, quantidadeDividasSerasa: quantidadeSerasa, quantidadeDividasBoaVista: quantidadeBoaVista, quantidadeChequesSemFundos: quantidadeCCFs, ultimaOcorrenciaChequesSemFundos: ultimaOcorrenciaCCF, valorTotalDividasSerasa: valorTotalSerasa, valorTotalDividasBoaVista: valorTotalBoaVista, valorTotalProtestos: valorTotalProtestos, valorTotalDividas: valorTotalDividas, ultimaOcorrenciaProtestos: ultimaOcorrenciaProtestos }))))));
64841
+ !isLoading && (React.createElement(QuantidadeResultados, { data: data, quantidadeProtestos: quantidadeProtestos, quantidadeProcessos: (_f = data === null || data === void 0 ? void 0 : data.pieChartTotalConfig) === null || _f === void 0 ? void 0 : _f.processosJuridicos, quantidadeDividas: quantidadeDividas, quantidadeDividasSerasa: quantidadeSerasa, quantidadeDividasBoaVista: quantidadeBoaVista, quantidadeChequesSemFundos: quantidadeCCFs, ultimaOcorrenciaChequesSemFundos: ultimaOcorrenciaCCF, valorTotalDividasSerasa: valorTotalSerasa, valorTotalDividasBoaVista: valorTotalBoaVista, valorTotalProtestos: valorTotalProtestos, valorTotalDividas: valorTotalDividas, ultimaOcorrenciaProtestos: ultimaOcorrenciaProtestos }))))));
64766
64842
  };
64767
64843
  var templateObject_1$4;
64768
64844
 
@@ -39,7 +39,7 @@ var ChartSystem = function (_a) {
39
39
  React.createElement(Result, null,
40
40
  React.createElement(Content, { isOpen: isOpen },
41
41
  data && React.createElement(ChartContent, { dataInput: data }),
42
- !isLoading && (React.createElement(QuantidadeResultados, { quantidadeProtestos: quantidadeProtestos, quantidadeProcessos: (_f = data === null || data === void 0 ? void 0 : data.pieChartTotalConfig) === null || _f === void 0 ? void 0 : _f.processosJuridicos, quantidadeDividas: quantidadeDividas, quantidadeDividasSerasa: quantidadeSerasa, quantidadeDividasBoaVista: quantidadeBoaVista, quantidadeChequesSemFundos: quantidadeCCFs, ultimaOcorrenciaChequesSemFundos: ultimaOcorrenciaCCF, valorTotalDividasSerasa: valorTotalSerasa, valorTotalDividasBoaVista: valorTotalBoaVista, valorTotalProtestos: valorTotalProtestos, valorTotalDividas: valorTotalDividas, ultimaOcorrenciaProtestos: ultimaOcorrenciaProtestos }))))));
42
+ !isLoading && (React.createElement(QuantidadeResultados, { data: data, quantidadeProtestos: quantidadeProtestos, quantidadeProcessos: (_f = data === null || data === void 0 ? void 0 : data.pieChartTotalConfig) === null || _f === void 0 ? void 0 : _f.processosJuridicos, quantidadeDividas: quantidadeDividas, quantidadeDividasSerasa: quantidadeSerasa, quantidadeDividasBoaVista: quantidadeBoaVista, quantidadeChequesSemFundos: quantidadeCCFs, ultimaOcorrenciaChequesSemFundos: ultimaOcorrenciaCCF, valorTotalDividasSerasa: valorTotalSerasa, valorTotalDividasBoaVista: valorTotalBoaVista, valorTotalProtestos: valorTotalProtestos, valorTotalDividas: valorTotalDividas, ultimaOcorrenciaProtestos: ultimaOcorrenciaProtestos }))))));
43
43
  };
44
44
  export default ChartSystem;
45
45
  var templateObject_1;
@@ -4,7 +4,7 @@ import "chartjs-adapter-date-fns";
4
4
  export declare const useMixedChartData: (dataInput: DataInput, timeFilter?: TimeFilter) => {
5
5
  data: ChartData<"line" | "bar", (number | {
6
6
  x: string;
7
- y: number;
7
+ y: number | null;
8
8
  })[], string>;
9
9
  options: ChartOptions<"line" | "bar">;
10
10
  };
@@ -11,8 +11,8 @@ export var useMixedChartData = function (dataInput, timeFilter) {
11
11
  var fullProcessedData = {
12
12
  protestos: addMissingDateEntries(dataInput.protestos, fullDataStartDate, endDate),
13
13
  ccfs: addMissingDateEntries(dataInput.ccfs, fullDataStartDate, endDate),
14
- serasa: addMissingDateEntries(dataInput.serasa, fullDataStartDate, endDate),
15
- boaVista: addMissingDateEntries(dataInput.boaVista, fullDataStartDate, endDate),
14
+ serasa: dataInput.serasa,
15
+ boaVista: dataInput.boaVista,
16
16
  dividasPublicasGrafico: addMissingDateEntries(dataInput.dividasPublicasGrafico, fullDataStartDate, endDate),
17
17
  };
18
18
  var processedData = {
@@ -1,5 +1,7 @@
1
1
  import React from "react";
2
+ import { DataInput } from "./types/iChart";
2
3
  type QuantidadeResultadosProps = Partial<{
4
+ data: DataInput | null;
3
5
  quantidadeProtestos: number;
4
6
  quantidadeProcessos: number;
5
7
  quantidadeDividas: number;
@@ -15,7 +15,8 @@ var QuantityContainer = function (_a) {
15
15
  };
16
16
  var QuantidadeResultadosWrapper = styled(ResultContent)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 18px 20px;\n row-gap: 20px;\n > * {\n row-gap: 10px;\n }\n @media only screen and (max-width: 768px) {\n > * {\n :not(:last-child) {\n border-bottom: 1px solid ", ";\n }\n }\n }\n"], ["\n padding: 18px 20px;\n row-gap: 20px;\n > * {\n row-gap: 10px;\n }\n @media only screen and (max-width: 768px) {\n > * {\n :not(:last-child) {\n border-bottom: 1px solid ", ";\n }\n }\n }\n"])), theme.colors.cinzaClaro);
17
17
  var QuantidadeResultados = function (_a) {
18
- var _b = _a.quantidadeProtestos, quantidadeProtestos = _b === void 0 ? 0 : _b, _c = _a.quantidadeProcessos, quantidadeProcessos = _c === void 0 ? 0 : _c, _d = _a.quantidadeDividas, quantidadeDividas = _d === void 0 ? 0 : _d, _e = _a.quantidadeChequesSemFundos, quantidadeChequesSemFundos = _e === void 0 ? 0 : _e, _f = _a.quantidadeDividasSerasa, quantidadeDividasSerasa = _f === void 0 ? 0 : _f, _g = _a.quantidadeDividasBoaVista, quantidadeDividasBoaVista = _g === void 0 ? 0 : _g, _h = _a.valorTotalProtestos, valorTotalProtestos = _h === void 0 ? 0 : _h, _j = _a.valorTotalDividas, valorTotalDividas = _j === void 0 ? 0 : _j, _k = _a.valorTotalDividasSerasa, valorTotalDividasSerasa = _k === void 0 ? 0 : _k, _l = _a.valorTotalDividasBoaVista, valorTotalDividasBoaVista = _l === void 0 ? 0 : _l, _m = _a.ultimaOcorrenciaProtestos, ultimaOcorrenciaProtestos = _m === void 0 ? null : _m, _o = _a.ultimaOcorrenciaChequesSemFundos, ultimaOcorrenciaChequesSemFundos = _o === void 0 ? null : _o;
18
+ var _b, _c, _d, _e;
19
+ 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
20
  return (React.createElement(Result, { resultContentStriped: false },
20
21
  React.createElement(QuantidadeResultadosWrapper, { desktop: "repeat(6, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr" },
21
22
  React.createElement(QuantityContainer, null,
@@ -31,11 +32,11 @@ var QuantidadeResultados = function (_a) {
31
32
  React.createElement(AddItemField, { name: "D\u00EDvidas P\u00FAblicas", value: formatValue(quantidadeDividas) }),
32
33
  React.createElement(AddItemField, { name: "Total D\u00EDvidas P\u00FAblicas", value: formatMoney(valorTotalDividas) })),
33
34
  React.createElement(QuantityContainer, null,
34
- React.createElement(AddItemField, { name: "Pefin Refin Serasa", value: formatValue(quantidadeDividasSerasa) }),
35
- React.createElement(AddItemField, { name: "Total Pefin Refin Serasa", value: formatMoney(valorTotalDividasSerasa) })),
35
+ 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) }),
36
+ 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
37
  React.createElement(QuantityContainer, null,
37
- React.createElement(AddItemField, { name: "Pefin Refin Boa Vista", value: formatValue(quantidadeDividasBoaVista) }),
38
- React.createElement(AddItemField, { name: "Total Pefin Refin Boa Vista", value: formatMoney(valorTotalDividasBoaVista) })))));
38
+ 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) }),
39
+ 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
  };
40
41
  export default QuantidadeResultados;
41
42
  var templateObject_1;
@@ -34,7 +34,7 @@ export interface DataSetCommon {
34
34
  label: string;
35
35
  data: {
36
36
  x: string;
37
- y: number;
37
+ y: number | null;
38
38
  }[];
39
39
  borderColor?: string;
40
40
  backgroundColor?: string;
@@ -2,6 +2,6 @@ import { DataInput, TimeFilter } from "../types/iChart";
2
2
  import { ChartDataset, ChartOptions } from "chart.js";
3
3
  export declare function createDatasets(data: DataInput, uniqueDates: string[], timeFilter: TimeFilter): ChartDataset<"line" | "bar", (number | {
4
4
  x: string;
5
- y: number;
5
+ y: number | null;
6
6
  })[]>[];
7
7
  export declare function getChartOptions(timeFilter: TimeFilter): ChartOptions<"line" | "bar">;
@@ -23,7 +23,7 @@ export function createDatasets(data, uniqueDates, timeFilter) {
23
23
  }));
24
24
  var datasetData = uniqueDates.map(function (date) {
25
25
  var _a;
26
- var value = (_a = dateValues.get(date)) !== null && _a !== void 0 ? _a : 0;
26
+ var value = (_a = dateValues.get(date)) !== null && _a !== void 0 ? _a : null;
27
27
  return { x: date, y: value };
28
28
  });
29
29
  var datasetConfiguration = __assign({ type: chartType, label: label, data: datasetData, borderColor: borderColor, backgroundColor: chartType === "bar" ? borderColor + "60" : undefined, tension: chartType === "line" ? 0.4 : undefined, spanGaps: true, showLine: chartType === "line", pointRadius: 2, yAxisID: yAxisID }, (chartType === "bar" && {
@@ -1,5 +1,5 @@
1
1
  import React, { ReactNode } from "react";
2
- declare const Button: React.FC<React.HTMLAttributes<HTMLButtonElement> & {
2
+ declare const Button: React.FC<React.ButtonHTMLAttributes<HTMLButtonElement> & {
3
3
  smallContent?: ReactNode;
4
4
  }>;
5
5
  export default Button;
@@ -4,7 +4,7 @@ import { useQuery } from "../webservice";
4
4
  import XPathUtils from '../../utils/xpath';
5
5
  var PartnerProtestos = function (_a) {
6
6
  var documento = _a.documento;
7
- var _b = useQuery("SELECT FROM 'APICENPROT'.'PRINT'", { documento: documento }), isLoading = _b.isLoading, error = _b.error, response = _b.response;
7
+ var _b = useQuery("SELECT FROM 'IEPTB'.'IEPTBHARLAN'", { documento: documento }), isLoading = _b.isLoading, error = _b.error, response = _b.response;
8
8
  return isLoading ? React.createElement(Loading, null) : error ? 'Houve um erro ao obter a informação.' : XPathUtils.select('string(//registros)', response === null || response === void 0 ? void 0 : response.document);
9
9
  };
10
10
  export default PartnerProtestos;
@@ -13,6 +13,9 @@ export type ProtestoData = {
13
13
  export declare const ProtestoItem: React.MemoExoticComponent<({ protesto }: {
14
14
  protesto: Node;
15
15
  }) => React.JSX.Element>;
16
+ export declare const Instrumento: ({ nm_chave }: {
17
+ nm_chave?: string | undefined;
18
+ }) => React.JSX.Element | null;
16
19
  export declare const ProtestosList: React.FC<{
17
20
  protestos: Node[];
18
21
  }>;
@@ -1,9 +1,47 @@
1
- import React, { memo } from "react";
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import React, { memo, useContext } from "react";
2
38
  import AddItemField from "../common/addItem";
3
39
  import XPathUtils from "../../utils/xpath";
4
40
  import { formatMoney } from "../../utils/number";
5
41
  import { ResultContent } from "../interface/result";
6
42
  import { formatDocument } from "../../utils/string";
43
+ import Button from "../common/button";
44
+ import { WebService } from "../webservice";
7
45
  export var ProtestoItem = memo(function (_a) {
8
46
  var protesto = _a.protesto;
9
47
  var getField = function (path, formatter) {
@@ -13,15 +51,54 @@ export var ProtestoItem = memo(function (_a) {
13
51
  var formatBooleanField = function (value) {
14
52
  return value === "true" ? "Sim" : "Não";
15
53
  };
16
- return (React.createElement(ResultContent, { desktop: "repeat(7, 1fr)", tablet: "repeat(4, 1fr)", mobile: "repeat(2, 1fr)" },
54
+ return (React.createElement(ResultContent, { desktop: "repeat(8, 1fr)", tablet: "repeat(4, 1fr)", mobile: "repeat(2, 1fr)" },
17
55
  React.createElement(AddItemField, { name: "Quem Protestou", value: getField("./nomeCedente") }),
18
56
  React.createElement(AddItemField, { name: "Atrav\u00E9s De", value: getField("./nomeApresentante") }),
19
57
  React.createElement(AddItemField, { name: "CPF/CNPJ Protestado", value: formatDocument(getField("./cpfCnpj")) }),
20
58
  React.createElement(AddItemField, { name: "Data Do Protesto", value: getField("./dataProtesto") }),
21
59
  React.createElement(AddItemField, { name: "Possui Anu\u00EAncia", value: formatBooleanField(getField("./temAnuencia")) }),
22
60
  React.createElement(AddItemField, { name: "Anu\u00EAncia Vencida", value: formatBooleanField(getField("./anuenciaVencida")) }),
23
- React.createElement(AddItemField, { name: "Valor Do Protesto", value: formatMoney(getField("./valor")) })));
61
+ React.createElement(AddItemField, { name: "Valor Do Protesto", value: formatMoney(getField("./valor")) }),
62
+ React.createElement(Instrumento, { nm_chave: getField("./nm_chave") })));
24
63
  });
64
+ export var Instrumento = function (_a) {
65
+ var nm_chave = _a.nm_chave;
66
+ var client = useContext(WebService);
67
+ var _b = React.useState(), error = _b[0], setError = _b[1];
68
+ var _c = React.useState(false), isLoading = _c[0], setIsLoading = _c[1];
69
+ if (!nm_chave)
70
+ return null;
71
+ return React.createElement(Button, { onClick: function () { return __awaiter(void 0, void 0, void 0, function () {
72
+ var request, pdfWindow, e_1;
73
+ return __generator(this, function (_a) {
74
+ switch (_a.label) {
75
+ case 0:
76
+ setIsLoading(true);
77
+ _a.label = 1;
78
+ case 1:
79
+ _a.trys.push([1, 4, 5, 6]);
80
+ return [4 /*yield*/, client.request("SELECT FROM 'IEPTB'.'PDF'", { nm_chave: nm_chave })];
81
+ case 2: return [4 /*yield*/, (_a.sent()).json()];
82
+ case 3:
83
+ request = _a.sent();
84
+ pdfWindow = window.open('', '_blank');
85
+ if (!pdfWindow)
86
+ return [2 /*return*/];
87
+ pdfWindow.document.write("<iframe width='100%' height='100%' src='data:application/pdf;base64,".concat(request === null || request === void 0 ? void 0 : request.instrumentoProtesto, "'></iframe>"));
88
+ return [3 /*break*/, 6];
89
+ case 4:
90
+ e_1 = _a.sent();
91
+ console.error(e_1);
92
+ setError(true);
93
+ return [3 /*break*/, 6];
94
+ case 5:
95
+ setIsLoading(false);
96
+ return [7 /*endfinally*/];
97
+ case 6: return [2 /*return*/];
98
+ }
99
+ });
100
+ }); }, disabled: isLoading }, error ? 'Instrumento não Localizado' : 'Instrumento');
101
+ };
25
102
  export var ProtestosList = function (_a) {
26
103
  var protestos = _a.protestos;
27
104
  return (React.createElement(ResultContent, null, (protestos === null || protestos === void 0 ? void 0 : protestos.length) ? (protestos.map(function (protesto, i) { return (React.createElement(ProtestoItem, { key: i, protesto: protesto })); })) : (React.createElement(AddItemField, { name: "Informa\u00E7\u00E3o", value: "N\u00E3o h\u00E1 registros de protestos." }))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credithub/harlan-components",
3
- "version": "1.17.0",
3
+ "version": "1.18.1",
4
4
  "description": "Provide a set of web components to be used in Harlan and other projects",
5
5
  "keywords": [
6
6
  "harlan",