@credithub/harlan-components 1.78.4 → 1.80.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.
@@ -2,5 +2,6 @@ import React from 'react';
2
2
  import { SectionProps } from '../interface/section';
3
3
  declare const ConsultaSimplesSection: React.FC<SectionProps & {
4
4
  documento: string;
5
+ isFinancial: boolean;
5
6
  }>;
6
7
  export default ConsultaSimplesSection;
@@ -40,7 +40,7 @@ var spin = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObjec
40
40
  var Spinner = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border: 1px solid rgba(0, 0, 0, 0.1);\n border-left-color: #222;\n border-radius: 50%;\n width: 9px;\n height: 9px;\n animation: ", " 1s linear infinite;\n margin-right: 8px;\n display: inline-block;\n vertical-align: middle;\n"], ["\n border: 1px solid rgba(0, 0, 0, 0.1);\n border-left-color: #222;\n border-radius: 50%;\n width: 9px;\n height: 9px;\n animation: ", " 1s linear infinite;\n margin-right: 8px;\n display: inline-block;\n vertical-align: middle;\n"])), spin);
41
41
  var ConsultaSimplesSection = function (_a) {
42
42
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
43
- var documento = _a.documento, children = _a.children, onClose = _a.onClose, rest = __rest(_a, ["documento", "children", "onClose"]);
43
+ var documento = _a.documento, children = _a.children, onClose = _a.onClose, isFinancial = _a.isFinancial, rest = __rest(_a, ["documento", "children", "onClose", "isFinancial"]);
44
44
  var ctx = useContext(Queries.Finder);
45
45
  var data = useGlobalData().data;
46
46
  // Extraindo valores do globalData
@@ -94,17 +94,18 @@ var ConsultaSimplesSection = function (_a) {
94
94
  : '',
95
95
  loaded: (_o = (_m = data.liminar) === null || _m === void 0 ? void 0 : _m.isLoaded) !== null && _o !== void 0 ? _o : false
96
96
  }
97
- ];
97
+ ].filter(function (e) { return e.label === 'Liminar' ? isFinancial : e; });
98
98
  var isError = (ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Error;
99
99
  var isLoading = (ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Loading;
100
+ var hasPendencias = data.ccf ||
101
+ data.protestos ||
102
+ data.dividasPublicas ||
103
+ data.processosJuridicos ||
104
+ receitaStatus ||
105
+ ((_p = data.liminar) === null || _p === void 0 ? void 0 : _p.message) === 'Encontrado';
100
106
  var statusType = isError
101
107
  ? 'warning'
102
- : data.ccf ||
103
- data.protestos ||
104
- data.dividasPublicas ||
105
- data.processosJuridicos ||
106
- receitaStatus ||
107
- ((_p = data.liminar) === null || _p === void 0 ? void 0 : _p.message) === 'Encontrado'
108
+ : hasPendencias
108
109
  ? 'error'
109
110
  : 'success';
110
111
  return (React.createElement(Section, __assign({ title: "Consulta Simples", subtitle: "Consulta de informa\u00E7\u00F5es do documento.", description: React.createElement(React.Fragment, null,
@@ -245,8 +245,10 @@ var Liminar = function (_a) {
245
245
  }
246
246
  });
247
247
  }); };
248
- fetch();
248
+ if (isFinancial)
249
+ fetch();
249
250
  }, [
251
+ isFinancial,
250
252
  ctx.type,
251
253
  ctx.document,
252
254
  globalData === null || globalData === void 0 ? void 0 : globalData.dossie,
@@ -319,7 +321,7 @@ var Liminar = function (_a) {
319
321
  return [2 /*return*/];
320
322
  });
321
323
  }); };
322
- if (!shouldRender)
324
+ if (!isFinancial || !shouldRender)
323
325
  return null;
324
326
  return (React.createElement(React.Fragment, null,
325
327
  React.createElement(Section, { title: React.createElement(TitleWithTooltip, null,
@@ -150,7 +150,16 @@ var Protestos = function () {
150
150
  }, [total, iaOverrides]);
151
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
152
  React.createElement(Button, { onClick: function () {
153
- harlan === null || harlan === void 0 ? void 0 : harlan.call('creditHub::addLiminar');
153
+ var _a;
154
+ // Obtém o documento do contexto e formata adequadamente
155
+ var documento = ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.data) === null || _a === void 0 ? void 0 : _a.documento) || '';
156
+ var formattedDoc = (function () {
157
+ var cleanDoc = documento.replace(/\D+/g, '');
158
+ return cleanDoc.length === 14
159
+ ? "".concat(cleanDoc.slice(0, 2), ".").concat(cleanDoc.slice(2, 5), ".").concat(cleanDoc.slice(5, 8), "/").concat(cleanDoc.slice(8, 12), "-").concat(cleanDoc.slice(12))
160
+ : "".concat(cleanDoc.slice(0, 3), ".").concat(cleanDoc.slice(3, 6), ".").concat(cleanDoc.slice(6, 9), "-").concat(cleanDoc.slice(9));
161
+ })();
162
+ harlan === null || harlan === void 0 ? void 0 : harlan.call('creditHub::addLiminar', { document: formattedDoc });
154
163
  } }, "Apontar Protesto"))) : null }));
155
164
  };
156
165
  export default React.memo(Protestos);
@@ -40,7 +40,7 @@ var ConsultaSimples = function (_a) {
40
40
  React.createElement(Queries.LiminarCenprot.Request, { data: { documento: documento } },
41
41
  React.createElement(Wrapper, null,
42
42
  React.createElement(GlobalDataProvider, null,
43
- React.createElement(ConsultaSimplesSection, { documento: documento, onClose: onClose, onClickPrint: onClickPrint },
43
+ React.createElement(ConsultaSimplesSection, { documento: documento, onClose: onClose, onClickPrint: onClickPrint, isFinancial: isFinancial },
44
44
  React.createElement(ConsultaRfbProvider, { documento: documento },
45
45
  React.createElement(Dossie, { documento: documento, printMode: printMode }),
46
46
  React.createElement(Liminar, { isFinancial: isFinancial, hasCredits: hasCredits, tags: tags }),