@credithub/harlan-components 1.75.4 → 1.76.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,10 @@
1
1
  import React from 'react';
2
- declare const Liminar: React.FC;
2
+ interface LiminarProps {
3
+ /**
4
+ * Se verdadeiro, exibe ações exclusivas para instituições financeiras,
5
+ * como o download de protestos ocultos.
6
+ */
7
+ isFinanceira?: boolean;
8
+ }
9
+ declare const Liminar: React.FC<LiminarProps>;
3
10
  export default Liminar;
@@ -79,21 +79,22 @@ var businessTypes = [
79
79
  'banco',
80
80
  'cooperativa'
81
81
  ];
82
- var Liminar = function () {
83
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
82
+ var Liminar = function (_a) {
83
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
84
+ var _o = _a.isFinanceira, isFinanceira = _o === void 0 ? false : _o;
84
85
  var ctx = useContext(Queries.LiminarCenprot);
85
- var _m = useGlobalData(), globalData = _m.data, setData = _m.setData;
86
+ var _p = useGlobalData(), globalData = _p.data, setData = _p.setData;
86
87
  var fetchLiminarProtestosDoPassado = useLiminarProtestosDoPassado({
87
- documento: ((_b = (_a = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _a === void 0 ? void 0 : _a.carousel) === null || _b === void 0 ? void 0 : _b.document) || ''
88
+ documento: ((_c = (_b = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _b === void 0 ? void 0 : _b.carousel) === null || _c === void 0 ? void 0 : _c.document) || ''
88
89
  }).fetchLiminarProtestosDoPassado;
89
- var _o = useState(false), isLoadingLiminarProtestosDoPassado = _o[0], setIsLoadingLiminarProtestosDoPassado = _o[1];
90
+ var _q = useState(false), isLoadingLiminarProtestosDoPassado = _q[0], setIsLoadingLiminarProtestosDoPassado = _q[1];
90
91
  var processedRef = useRef(false);
91
92
  var dataHashRef = useRef('');
92
93
  var invertedIdsRef = useRef([]);
93
- var _p = useState(false), isTooltipVisible = _p[0], setTooltipVisible = _p[1];
94
- var _q = useState(false), isEmailModalOpen = _q[0], setIsEmailModalOpen = _q[1];
95
- var _r = useState(''), emailModalMessage = _r[0], setEmailModalMessage = _r[1];
96
- var _s = useFetch("SELECT FROM 'LIMINAR'.'SENDMAIL'"), sendIndiciosEmail = _s.fetch, isEmailSending = _s.isLoading, emailError = _s.error;
94
+ var _r = useState(false), isTooltipVisible = _r[0], setTooltipVisible = _r[1];
95
+ var _s = useState(false), isEmailModalOpen = _s[0], setIsEmailModalOpen = _s[1];
96
+ var _t = useState(''), emailModalMessage = _t[0], setEmailModalMessage = _t[1];
97
+ var _u = useFetch("SELECT FROM 'LIMINAR'.'SENDMAIL'"), sendIndiciosEmail = _u.fetch, isEmailSending = _u.isLoading, emailError = _u.error;
97
98
  var hideTt = useRef();
98
99
  /*
99
100
  * Extrai e normaliza os tipos de documento presentes em ctx.document, retornando sempre um array de strings em minúsculo.
@@ -131,13 +132,13 @@ var Liminar = function () {
131
132
  });
132
133
  });
133
134
  }, [
134
- (_c = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _c === void 0 ? void 0 : _c.carousel,
135
- (_d = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _d === void 0 ? void 0 : _d.empresa
135
+ (_d = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _d === void 0 ? void 0 : _d.carousel,
136
+ (_e = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _e === void 0 ? void 0 : _e.empresa
136
137
  ]);
137
138
  /*
138
139
  * Identifica as origens de liminares detectadas e verifica se existe liminar de protesto invertida
139
140
  */
140
- var _t = useMemo(function () {
141
+ var _v = useMemo(function () {
141
142
  var _a, _b;
142
143
  var labels = new Set();
143
144
  var indiciosApi = ((_a = ctx.document) === null || _a === void 0 ? void 0 : _a.indiciosDeLiminar) === true;
@@ -172,8 +173,8 @@ var Liminar = function () {
172
173
  ctx.document,
173
174
  tiposDocumento,
174
175
  processosComAssuntoValido,
175
- (_e = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _e === void 0 ? void 0 : _e.indiciosDeLiminarProtestosDoPassado
176
- ]), origensDetectadas = _t.origensDetectadas, foundBusinessEntity = _t.foundBusinessEntity;
176
+ (_f = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _f === void 0 ? void 0 : _f.indiciosDeLiminarProtestosDoPassado
177
+ ]), origensDetectadas = _v.origensDetectadas, foundBusinessEntity = _v.foundBusinessEntity;
177
178
  useEffect(function () {
178
179
  var fetch = function () { return __awaiter(void 0, void 0, void 0, function () {
179
180
  var dossie, processosJuridicos, depsLoaded, newIds, hash, indiciosApi, indiciosDeLiminarProtestosDoPassado, protestosDoPassadoIds, _a, possuiIndiciosDeLiminarProtestosDoPassado, protestosIds, finalStatus;
@@ -249,8 +250,8 @@ var Liminar = function () {
249
250
  foundBusinessEntity
250
251
  ]);
251
252
  var ready = processedRef.current &&
252
- !!((_f = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _f === void 0 ? void 0 : _f.isLoaded) &&
253
- !!((_g = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _g === void 0 ? void 0 : _g.carousel) &&
253
+ !!((_g = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _g === void 0 ? void 0 : _g.isLoaded) &&
254
+ !!((_h = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _h === void 0 ? void 0 : _h.carousel) &&
254
255
  !isLoadingLiminarProtestosDoPassado &&
255
256
  ctx.type !== RequestStatus.Loading;
256
257
  var ctxLoading = useMemo(function () { return (__assign(__assign({}, ctx), { type: RequestStatus.Loading })); }, [ctx]);
@@ -270,8 +271,8 @@ var Liminar = function () {
270
271
  : 'Processos com indícios encontrados:';
271
272
  var shouldRender = isLoadingLiminarProtestosDoPassado ||
272
273
  (ready &&
273
- (((_h = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _h === void 0 ? void 0 : _h.indiciosDeLiminar) ||
274
- ((_l = (_k = (_j = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _j === void 0 ? void 0 : _j.processosComLiminarIds) === null || _k === void 0 ? void 0 : _k.length) !== null && _l !== void 0 ? _l : 0) > 0));
274
+ (((_j = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _j === void 0 ? void 0 : _j.indiciosDeLiminar) ||
275
+ ((_m = (_l = (_k = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _k === void 0 ? void 0 : _k.processosComLiminarIds) === null || _l === void 0 ? void 0 : _l.length) !== null && _m !== void 0 ? _m : 0) > 0));
275
276
  // Função para disparar o envio do e-mail e configurar a mensagem do modal
276
277
  var handleSendEmailIndicios = function (e) { return __awaiter(void 0, void 0, void 0, function () {
277
278
  var documento, ids;
@@ -328,8 +329,9 @@ var Liminar = function () {
328
329
  description: (React.createElement(React.Fragment, null,
329
330
  React.createElement(StatusMessage, { type: variant }, msg),
330
331
  origensDetectadas.map(function (o) { return (React.createElement(StatusMessage, { key: o, type: variant }, o)); }))),
331
- actions: (React.createElement("div", { style: { textAlign: 'center' }, onClick: function (e) { return e.stopPropagation(); } }, ((_c = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _c === void 0 ? void 0 : _c.indiciosDeLiminarProtestosDoPassado) &&
332
- ((_d = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _d === void 0 ? void 0 : _d.protestosDoPassadoIds) && (React.createElement(Button, { onClick: handleSendEmailIndicios }, "Enviar Ind\u00EDcios por Email"))))
332
+ actions: (React.createElement("div", { style: { textAlign: 'center' }, onClick: function (e) { return e.stopPropagation(); } }, isFinanceira &&
333
+ ((_c = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _c === void 0 ? void 0 : _c.indiciosDeLiminarProtestosDoPassado) &&
334
+ ((_d = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _d === void 0 ? void 0 : _d.protestosDoPassadoIds) && (React.createElement(Button, { onClick: handleSendEmailIndicios, disabled: isEmailSending }, "Baixar Protestos Ocultos"))))
333
335
  };
334
336
  }
335
337
  : undefined }),
@@ -16,6 +16,7 @@ type ConsultaSimplesProps = {
16
16
  initRefinSerasa?: boolean;
17
17
  initVeiculos?: boolean;
18
18
  printMode?: boolean;
19
+ isFinanceira?: boolean;
19
20
  };
20
21
  declare const ConsultaSimples: React.FC<ConsultaSimplesProps>;
21
22
  export default ConsultaSimples;
@@ -27,7 +27,7 @@ var FinderDependency = function (_a) {
27
27
  React.createElement(Queries.Protestos.Request, { data: { documento: documento }, depends: [ctxFinder] }, children)));
28
28
  };
29
29
  var ConsultaSimples = function (_a) {
30
- var _documento = _a.documento, onClickConsultarProcessoJuridico = _a.onClickConsultarProcessoJuridico, onClickQSA = _a.onClickQSA, onClickPrint = _a.onClickPrint, apiKey = _a.apiKey, onClose = _a.onClose, hasCredits = _a.hasCredits, _b = _a.initRefinBoaVista, initRefinBoaVista = _b === void 0 ? false : _b, _c = _a.initRefinSerasa, initRefinSerasa = _c === void 0 ? false : _c, _d = _a.initVeiculos, initVeiculos = _d === void 0 ? false : _d, _e = _a.printMode, printMode = _e === void 0 ? false : _e;
30
+ var _documento = _a.documento, onClickConsultarProcessoJuridico = _a.onClickConsultarProcessoJuridico, onClickQSA = _a.onClickQSA, onClickPrint = _a.onClickPrint, apiKey = _a.apiKey, onClose = _a.onClose, hasCredits = _a.hasCredits, _b = _a.initRefinBoaVista, initRefinBoaVista = _b === void 0 ? false : _b, _c = _a.initRefinSerasa, initRefinSerasa = _c === void 0 ? false : _c, _d = _a.initVeiculos, initVeiculos = _d === void 0 ? false : _d, _e = _a.printMode, printMode = _e === void 0 ? false : _e, _f = _a.isFinanceira, isFinanceira = _f === void 0 ? false : _f;
31
31
  var documento = _documento.replace(/\D+/g, '');
32
32
  return (React.createElement(ThemeProvider, { theme: theme },
33
33
  React.createElement(ConsultasComplementaresProvider, { hasCredits: hasCredits, initRefinBoaVista: initRefinBoaVista, initRefinSerasa: initRefinSerasa, initVeiculos: initVeiculos },
@@ -43,7 +43,7 @@ var ConsultaSimples = function (_a) {
43
43
  React.createElement(ConsultaSimplesSection, { documento: documento, onClose: onClose, onClickPrint: onClickPrint },
44
44
  React.createElement(ConsultaRfbProvider, { documento: documento },
45
45
  React.createElement(Dossie, { documento: documento, printMode: printMode }),
46
- React.createElement(Liminar, null),
46
+ React.createElement(Liminar, { isFinanceira: isFinanceira }),
47
47
  React.createElement(Addresses, { apiKey: apiKey }),
48
48
  React.createElement(Contacts, null),
49
49
  React.createElement(Partners, { onClickQSA: onClickQSA })),