@credithub/harlan-components 1.114.0 → 1.115.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.
@@ -1,3 +1,5 @@
1
1
  import React from 'react';
2
- declare const _default: React.NamedExoticComponent<{}>;
2
+ declare const _default: React.NamedExoticComponent<{
3
+ tags: (string | RegExp)[];
4
+ }>;
3
5
  export default _default;
@@ -39,25 +39,28 @@ import Section from '../section';
39
39
  import { Queries, RequestStatus } from '../webservice';
40
40
  import ProtestosCategory from './protestosCategory';
41
41
  import { ProtestoItem } from './protestosList';
42
+ import { hasOneOfTags } from '../../utils/tags';
42
43
  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"])));
43
44
  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"])));
44
45
  // Função utilitária para extrair as chaves dos protestos
45
46
  var getChaves = function (arr) { return arr.map(function (p) { return p.nm_chave; }); };
46
47
  var PROTESTOS_ERROR_SUMMARY = 'Falha ao consultar protestos, tente novamente mais tarde.';
47
48
  var clearProtestosCollections = function (state) { return (__assign(__assign({}, (state || {})), { protestosDeCredito: undefined, protestosDeImposto: undefined, protestosGerais: undefined, totalProtestos: undefined, valorTotalProtestos: undefined, nmChaves: undefined })); };
48
- var Protestos = function () {
49
- var _a, _b;
49
+ var Protestos = function (_a) {
50
+ var _b, _c;
51
+ var tags = _a.tags;
50
52
  var ctx = useContext(Queries.Protestos);
51
53
  var ctxLiminar = useContext(Queries.Liminar);
52
- var _c = useGlobalData(), globalData = _c.data, setData = _c.setData;
53
- var _d = useState(false), dataUpdated = _d[0], setDataUpdated = _d[1];
54
+ var _d = useGlobalData(), globalData = _d.data, setData = _d.setData;
55
+ var _e = useState(false), dataUpdated = _e[0], setDataUpdated = _e[1];
56
+ var showInstrumento = !hasOneOfTags(tags, [/flex/, 'bronze']);
54
57
  var protestosAll = useMemo(function () {
55
58
  if (!ctx.document)
56
59
  return [];
57
60
  return XPathUtils.selectArray('//body//protesto', ctx.document).map(parseProtesto);
58
61
  }, [ctx.document]);
59
- var iaOverrides = (_a = globalData.protestosData) === null || _a === void 0 ? void 0 : _a.iaOverrides;
60
- var _e = useProtestosClassification(protestosAll, iaOverrides), protestosDeCredito = _e.protestosDeCredito, protestosDeImposto = _e.protestosDeImposto, protestosGerais = _e.protestosGerais;
62
+ var iaOverrides = (_b = globalData.protestosData) === null || _b === void 0 ? void 0 : _b.iaOverrides;
63
+ var _f = useProtestosClassification(protestosAll, iaOverrides), protestosDeCredito = _f.protestosDeCredito, protestosDeImposto = _f.protestosDeImposto, protestosGerais = _f.protestosGerais;
61
64
  useEffect(function () {
62
65
  var _a;
63
66
  var prevProtestos = globalData.protestosData;
@@ -140,15 +143,15 @@ var Protestos = function () {
140
143
  var elements = [
141
144
  {
142
145
  total: protestosDeCredito.length,
143
- element: (React.createElement(ProtestosCategory, { title: "Protestos de Cr\u00E9dito", subtitle: "Protestos de cr\u00E9dito em geral.", registros: protestosDeCredito.length, icon: ProtestosCreditoIcon }, protestosDeCredito.map(function (protesto, i) { return (React.createElement(ProtestoItem, { protesto: protesto, key: i })); })))
146
+ element: (React.createElement(ProtestosCategory, { title: "Protestos de Cr\u00E9dito", subtitle: "Protestos de cr\u00E9dito em geral.", registros: protestosDeCredito.length, icon: ProtestosCreditoIcon }, protestosDeCredito.map(function (protesto, i) { return (React.createElement(ProtestoItem, { protesto: protesto, key: i, showInstrumento: showInstrumento })); })))
144
147
  },
145
148
  {
146
149
  total: protestosDeImposto.length,
147
- element: (React.createElement(ProtestosCategory, { title: "Protestos de Imposto", subtitle: "Protestos de impostos federais, estaduais e municipais.", registros: protestosDeImposto.length, icon: ProtestosImpostosIcon }, protestosDeImposto.map(function (protesto, i) { return (React.createElement(ProtestoItem, { protesto: protesto, key: i })); })))
150
+ element: (React.createElement(ProtestosCategory, { title: "Protestos de Imposto", subtitle: "Protestos de impostos federais, estaduais e municipais.", registros: protestosDeImposto.length, icon: ProtestosImpostosIcon }, protestosDeImposto.map(function (protesto, i) { return (React.createElement(ProtestoItem, { protesto: protesto, key: i, showInstrumento: showInstrumento })); })))
148
151
  },
149
152
  {
150
153
  total: protestosGerais.length,
151
- element: (React.createElement(ProtestosCategory, { title: "Protestos Gerais", subtitle: "Protestos de outros tipos.", registros: protestosGerais.length, icon: ProtestosGeraisIcon }, protestosGerais.map(function (protesto, i) { return (React.createElement(ProtestoItem, { protesto: protesto, key: i })); })))
154
+ element: (React.createElement(ProtestosCategory, { title: "Protestos Gerais", subtitle: "Protestos de outros tipos.", registros: protestosGerais.length, icon: ProtestosGeraisIcon }, protestosGerais.map(function (protesto, i) { return (React.createElement(ProtestoItem, { protesto: protesto, key: i, showInstrumento: showInstrumento })); })))
152
155
  }
153
156
  ].sort(function (a, b) { return b.total - a.total; });
154
157
  var children = registros ? (React.createElement(ResultProtestos, null, elements.map(function (_a, i) {
@@ -176,7 +179,7 @@ var Protestos = function () {
176
179
  return __assign(__assign({}, ctx), { type: RequestStatus.Loading });
177
180
  }
178
181
  return ctx;
179
- }, [ctx, (_b = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _b === void 0 ? void 0 : _b.isLoading]);
182
+ }, [ctx, (_c = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _c === void 0 ? void 0 : _c.isLoading]);
180
183
  return (React.createElement(Section, { ctx: effectiveCtx, 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,
181
184
  React.createElement(Button, { onClick: function () {
182
185
  var _a;
@@ -1,12 +1,10 @@
1
1
  import { Protesto } from '../../utils/parseProtesto';
2
2
  import React from 'react';
3
- export declare const ProtestoItem: React.MemoExoticComponent<({ protesto }: {
3
+ export declare const ProtestoItem: React.MemoExoticComponent<({ protesto, showInstrumento }: {
4
4
  protesto: Protesto;
5
+ showInstrumento: boolean;
5
6
  }) => React.JSX.Element>;
6
7
  export declare const Instrumento: ({ nm_chave, cpfCnpj }: {
7
8
  nm_chave?: string;
8
9
  cpfCnpj?: string;
9
10
  }) => React.JSX.Element | null;
10
- export declare const ProtestosList: React.FC<{
11
- protestos: Protesto[];
12
- }>;
@@ -148,7 +148,7 @@ var AIIndicator = function () { return (React.createElement("span", { title: "In
148
148
  } }, "*")); };
149
149
  export var ProtestoItem = memo(function (_a) {
150
150
  var _b, _c;
151
- var protesto = _a.protesto;
151
+ var protesto = _a.protesto, showInstrumento = _a.showInstrumento;
152
152
  var client = useContext(WebService);
153
153
  var _d = useGlobalData(), setData = _d.setData, globalData = _d.data;
154
154
  var iaOverrides = ((_b = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _b === void 0 ? void 0 : _b.iaOverrides) || {};
@@ -272,7 +272,7 @@ export var ProtestoItem = memo(function (_a) {
272
272
  React.createElement(AddItemField, { name: "Possui Anu\u00EAncia / Protesto Pago", value: formatBooleanField(String(protesto.temAnuencia)) }),
273
273
  React.createElement(AddItemField, { name: "Valor Do Protesto", value: formatMoney(protesto.valor) }),
274
274
  protesto.vl_custas && (React.createElement(AddItemField, { name: "Custas de Cart\u00F3rio para Baixa", value: formatMoney(protesto.vl_custas) })),
275
- React.createElement(Instrumento, { nm_chave: nm_chave, cpfCnpj: documento })));
275
+ showInstrumento && React.createElement(Instrumento, { nm_chave: nm_chave, cpfCnpj: documento })));
276
276
  });
277
277
  export var Instrumento = function (_a) {
278
278
  var nm_chave = _a.nm_chave, cpfCnpj = _a.cpfCnpj;
@@ -560,7 +560,3 @@ export var Instrumento = function (_a) {
560
560
  });
561
561
  }); } })));
562
562
  };
563
- export var ProtestosList = function (_a) {
564
- var protestos = _a.protestos;
565
- return (React.createElement(ResultContent, null, (protestos === null || protestos === void 0 ? void 0 : protestos.length) ? (protestos.map(function (protesto) { return (React.createElement(ProtestoItem, { key: protesto.nm_chave, protesto: protesto })); })) : (React.createElement(AddItemField, { name: "Informa\u00E7\u00E3o", value: "N\u00E3o h\u00E1 registros de protestos." }))));
566
- };
@@ -123,7 +123,7 @@ var ConsultaSimples = function (_a) {
123
123
  React.createElement(ConsultaImoveis, { documento: documento }),
124
124
  React.createElement(Veiculos, { documento: documento })),
125
125
  React.createElement(ProtestosSP, null),
126
- React.createElement(Protestos, null),
126
+ React.createElement(Protestos, { tags: tags }),
127
127
  React.createElement(Edital, { isFinancial: isFinancial, tags: tags }),
128
128
  React.createElement(ProtestosPagosBaixados, { isFinancial: isFinancial }),
129
129
  React.createElement(CCF, null),