@credithub/harlan-components 1.77.0 → 1.78.4

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.
@@ -72,12 +72,18 @@ import QuantidadeResultados from './quantityResult';
72
72
  import { useCalculation, useUltimaOcorrenciaCCF } from './utils/chartUtils';
73
73
  var Content = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n padding: 0px 30px;\n\n @media print {\n display: block;\n }\n"], ["\n display: ", ";\n padding: 0px 30px;\n\n @media print {\n display: block;\n }\n"])), function (props) { return (props.isOpen ? 'block' : 'none'); });
74
74
  function calcularProtestoLiminar(history) {
75
- var _a;
76
- if (!history.length)
75
+ var _a, _b;
76
+ if (history.length < 2)
77
77
  return false;
78
- var teveAnterior = history.slice(0, -1).some(function (h) { return h.quantidade > 0; });
79
- var ultimoZerado = ((_a = history.at(-1)) === null || _a === void 0 ? void 0 : _a.quantidade) === 0;
80
- return teveAnterior && ultimoZerado;
78
+ var anteriores = history.slice(0, -1).map(function (h) { return h.quantidade; });
79
+ var ultimo = (_b = (_a = history.at(-1)) === null || _a === void 0 ? void 0 : _a.quantidade) !== null && _b !== void 0 ? _b : 0;
80
+ var maiorAnterior = Math.max.apply(Math, anteriores);
81
+ if (maiorAnterior === 0)
82
+ return false;
83
+ if (ultimo === 0)
84
+ return true;
85
+ var reducao = 1 - ultimo / maiorAnterior;
86
+ return reducao >= 0.8;
81
87
  }
82
88
  var ChartSystem = function (_a) {
83
89
  var _b, _c, _d, _e, _f, _g, _h, _j;
@@ -17,7 +17,7 @@ var PartnerList = memo(function (_a) {
17
17
  React.createElement(PartnerField, { name: partner.cnpj ? 'CNPJ' : 'CPF', value: (_b = (partner.cnpj || partner.cpf)) !== null && _b !== void 0 ? _b : '', onClick: function () { var _a, _b; return (_a = partner.onClickCpfCnpj) === null || _a === void 0 ? void 0 : _a.call(partner, (_b = (partner.cnpj || partner.cpf)) !== null && _b !== void 0 ? _b : ''); } }),
18
18
  React.createElement(PartnerField, { name: "Protestos", value: partner === null || partner === void 0 ? void 0 : partner.protestos }),
19
19
  React.createElement(PartnerField, { name: "Situa\u00E7\u00E3o na Receita Federal", value: partner.receitaStatus }),
20
- React.createElement(PartnerField, { name: "Dividas P\u00FAblicas", value: partner.dividasPublicas }),
20
+ React.createElement(PartnerField, { name: "D\u00EDvidas P\u00FAblicas", value: partner.dividasPublicas }),
21
21
  React.createElement("div", null, (partner.cpf || partner.cnpj) && (React.createElement(ButtonPartner, { onClick: function (e) {
22
22
  e.preventDefault();
23
23
  onClickQSA(partner.cpf || partner.cnpj || '');
@@ -24,12 +24,14 @@ import { extractIntegerFromText } from '../../utils/number';
24
24
  import XPathUtils from '../../utils/xpath';
25
25
  import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
26
26
  import styled from 'styled-components';
27
+ import Button from '../common/button';
27
28
  import StatusMessage from '../interface/statusMessage';
28
29
  import Section from '../section';
29
30
  import { Queries, RequestStatus } from '../webservice';
30
31
  import ProtestosCategory from './protestosCategory';
31
32
  import { ProtestoItem } from './protestosList';
32
33
  var ResultProtestos = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n row-gap: 20px;\n margin-top: 20px;\n"], ["\n display: flex;\n flex-direction: column;\n row-gap: 20px;\n margin-top: 20px;\n"])));
34
+ var BtnWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n text-align: center;\n @media print {\n display: none;\n }\n"], ["\n text-align: center;\n @media print {\n display: none;\n }\n"])));
33
35
  // Função de ordenação por data
34
36
  var byDate = function (protesto, protesto2) {
35
37
  var _a, _b;
@@ -137,7 +139,7 @@ var Protestos = function () {
137
139
  }))) : null;
138
140
  var variant = registros ? 'error' : 'default';
139
141
  return {
140
- children: children,
142
+ children: React.createElement(React.Fragment, null, children),
141
143
  variant: variant,
142
144
  description: (React.createElement(StatusMessage, { type: registros ? 'error' : 'default' }, registros
143
145
  ? registros === 1
@@ -146,7 +148,10 @@ var Protestos = function () {
146
148
  : 'Não há ocorrência de protesto'))
147
149
  };
148
150
  }, [total, iaOverrides]);
149
- return (React.createElement(Section, { ctx: ctx, title: "Apontamentos na Central de Protestos (CENPROT)", subtitle: "Consulta de protestos de cr\u00E9dito, imposto e gerais.", icon: ProtestosIcon, onSuccess: handleSuccess }));
151
+ return (React.createElement(Section, { ctx: ctx, title: "Apontamentos na Central de Protestos (CENPROT)", subtitle: "Consulta de protestos de cr\u00E9dito, imposto e gerais.", icon: ProtestosIcon, onSuccess: handleSuccess, actions: typeof harlan !== 'undefined' ? (React.createElement(BtnWrapper, null,
152
+ React.createElement(Button, { onClick: function () {
153
+ harlan === null || harlan === void 0 ? void 0 : harlan.call('creditHub::addLiminar');
154
+ } }, "Apontar Protesto"))) : null }));
150
155
  };
151
156
  export default React.memo(Protestos);
152
- var templateObject_1;
157
+ var templateObject_1, templateObject_2;