@credithub/harlan-components 1.91.6 → 1.91.8
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/dist/components/dossie/dossie.js +6 -2
- package/dist/components/protestos/protestos.js +2 -15
- package/lib/cjs/index.js +10 -24
- package/lib/esm/index.js +10 -24
- package/package.json +1 -1
|
@@ -35,14 +35,18 @@ var GenerativeAIContainer = styled.div(templateObject_3 || (templateObject_3 = _
|
|
|
35
35
|
// Utilitário para obter o nome da empresa, priorizando ReceitaWS
|
|
36
36
|
var getCompanyName = function (isPF, finderDoc, rfbDoc) {
|
|
37
37
|
if (isPF) {
|
|
38
|
+
// PRIORIDADE: nome atualizado da Receita Federal (via CERTIDAO)
|
|
39
|
+
var rfbName_1 = XPathUtils.select('string(//RFB/nome)', rfbDoc);
|
|
40
|
+
if (rfbName_1)
|
|
41
|
+
return rfbName_1;
|
|
42
|
+
// fallback: nome do Finder
|
|
38
43
|
return XPathUtils.select('string(//cadastro/nome)', finderDoc);
|
|
39
44
|
}
|
|
40
|
-
//
|
|
45
|
+
// para CNPJ
|
|
41
46
|
var rfbName = (rfbDoc && XPathUtils.select('string(//RFB/nome)', rfbDoc)) ||
|
|
42
47
|
'';
|
|
43
48
|
if (rfbName)
|
|
44
49
|
return rfbName;
|
|
45
|
-
// prioridade 2 → Finder
|
|
46
50
|
return ((finderDoc &&
|
|
47
51
|
XPathUtils.select('string(//cadastro/razaoSocial)', finderDoc)) ||
|
|
48
52
|
'');
|
|
@@ -28,7 +28,6 @@ import ProtestosGeraisIcon from '../../assets/icones/protestosGerais';
|
|
|
28
28
|
import ProtestosImpostosIcon from '../../assets/icones/protestosImpostos';
|
|
29
29
|
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
30
30
|
import { classifyProtestos, useProtestosClassification } from '../../hooks/useProtestosClassification';
|
|
31
|
-
import { extractIntegerFromText } from '../../utils/number';
|
|
32
31
|
import { parseProtesto } from '../../utils/parseProtesto';
|
|
33
32
|
import XPathUtils from '../../utils/xpath';
|
|
34
33
|
import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
@@ -50,7 +49,6 @@ var Protestos = function () {
|
|
|
50
49
|
var ctxLiminar = useContext(Queries.Liminar);
|
|
51
50
|
var _b = useGlobalData(), globalData = _b.data, setData = _b.setData;
|
|
52
51
|
var _c = useState(false), dataUpdated = _c[0], setDataUpdated = _c[1];
|
|
53
|
-
// Calcula o total e memorizamos esse valor para evitar recalcular a cada render
|
|
54
52
|
var total = useMemo(function () {
|
|
55
53
|
var _a;
|
|
56
54
|
if ((ctxLiminar === null || ctxLiminar === void 0 ? void 0 : ctxLiminar.type) === RequestStatus.Success &&
|
|
@@ -59,7 +57,6 @@ var Protestos = function () {
|
|
|
59
57
|
}
|
|
60
58
|
return 0;
|
|
61
59
|
}, [ctxLiminar === null || ctxLiminar === void 0 ? void 0 : ctxLiminar.type, ctxLiminar === null || ctxLiminar === void 0 ? void 0 : ctxLiminar.document]);
|
|
62
|
-
// converte XML → Protesto[]
|
|
63
60
|
var protestosAll = useMemo(function () {
|
|
64
61
|
if (!ctx.document)
|
|
65
62
|
return [];
|
|
@@ -67,8 +64,6 @@ var Protestos = function () {
|
|
|
67
64
|
}, [ctx.document]);
|
|
68
65
|
var iaOverrides = (_a = globalData.protestosData) === null || _a === void 0 ? void 0 : _a.iaOverrides;
|
|
69
66
|
var _d = useProtestosClassification(protestosAll, iaOverrides), protestosDeCredito = _d.protestosDeCredito, protestosDeImposto = _d.protestosDeImposto, protestosGerais = _d.protestosGerais;
|
|
70
|
-
// Total de protestos
|
|
71
|
-
var registros = protestosAll.length;
|
|
72
67
|
useEffect(function () {
|
|
73
68
|
if ((ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Error ||
|
|
74
69
|
(ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Empty) {
|
|
@@ -76,15 +71,11 @@ var Protestos = function () {
|
|
|
76
71
|
return;
|
|
77
72
|
}
|
|
78
73
|
}, [ctx.type]);
|
|
79
|
-
// Atualiza o contexto global com os protestos classificados
|
|
80
74
|
useEffect(function () {
|
|
81
75
|
if (dataUpdated || !ctx.document)
|
|
82
76
|
return;
|
|
83
|
-
var
|
|
77
|
+
var registros = protestosAll.length;
|
|
84
78
|
var haveException = /Falha na integra/gi.test(XPathUtils.select('string(//raw)', ctx.document));
|
|
85
|
-
var registros = haveException
|
|
86
|
-
? extractIntegerFromText(registrosText) + total
|
|
87
|
-
: extractIntegerFromText(registrosText);
|
|
88
79
|
if (haveException) {
|
|
89
80
|
setData(function (prevState) { return (__assign(__assign({}, prevState), { protestosData: { isLoaded: true } })); });
|
|
90
81
|
setDataUpdated(true);
|
|
@@ -105,10 +96,8 @@ var Protestos = function () {
|
|
|
105
96
|
});
|
|
106
97
|
setDataUpdated(true);
|
|
107
98
|
}, [
|
|
108
|
-
ctx.type,
|
|
109
99
|
ctx.document,
|
|
110
100
|
dataUpdated,
|
|
111
|
-
total,
|
|
112
101
|
setData,
|
|
113
102
|
protestosDeCredito,
|
|
114
103
|
protestosDeImposto,
|
|
@@ -119,11 +108,9 @@ var Protestos = function () {
|
|
|
119
108
|
setData(function (prevState) { return (__assign(__assign({}, prevState), { protestosData: __assign(__assign({}, (prevState.protestosData || {})), { isLoaded: false }) })); });
|
|
120
109
|
}
|
|
121
110
|
}, [ctx.type]);
|
|
122
|
-
// Callback memorizado para a renderização do conteúdo em caso de sucesso
|
|
123
111
|
var handleSuccess = useCallback(function (data) {
|
|
124
|
-
var registrosText = XPathUtils.select('string(//registros)', data);
|
|
125
112
|
var parsed = XPathUtils.selectArray('//body//protesto', data).map(parseProtesto);
|
|
126
|
-
|
|
113
|
+
var registros = parsed.length;
|
|
127
114
|
var _a = classifyProtestos(parsed, iaOverrides), protestosDeCredito = _a.protestosDeCredito, protestosDeImposto = _a.protestosDeImposto, protestosGerais = _a.protestosGerais;
|
|
128
115
|
var elements = [
|
|
129
116
|
{
|