@credithub/harlan-components 1.71.0 → 1.72.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.
- package/dist/components/chart/hooks/useChartData.js +12 -8
- package/dist/components/chart/hooks/useProtestosClassification.d.ts +12 -0
- package/dist/components/chart/hooks/useProtestosClassification.js +59 -0
- package/dist/components/chart/utils/dataProcessing.d.ts +1 -1
- package/dist/components/chart/utils/dataProcessing.js +16 -24
- package/dist/components/protestos/protestos.js +40 -59
- package/dist/components/protestos/protestosList.js +13 -5
- package/lib/cjs/index.js +131 -112
- package/lib/esm/index.js +131 -112
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { Queries, RequestStatus, useQuery } from '../../../components/webservice';
|
|
13
|
+
import { useGlobalData } from '../../../contexts/globalDataContext';
|
|
13
14
|
import XPathUtils from '../../../utils/xpath';
|
|
14
15
|
import { useContext, useEffect, useMemo, useState } from 'react';
|
|
15
16
|
import { processData, processProtestData } from '../utils/dataProcessing';
|
|
@@ -53,16 +54,19 @@ export var useDividasPublicas = function () {
|
|
|
53
54
|
return __assign(__assign({}, dividasPublicasData), { loadingProgress: loadingProgress });
|
|
54
55
|
};
|
|
55
56
|
var useChartData = function (documento, consultaSerasa, consultaBoaVista) {
|
|
56
|
-
var _a
|
|
57
|
-
var _b = useState(null),
|
|
58
|
-
var _c = useState(
|
|
59
|
-
var _d = useState(
|
|
60
|
-
var _e =
|
|
57
|
+
var _a;
|
|
58
|
+
var _b = useState(null), data = _b[0], setData = _b[1];
|
|
59
|
+
var _c = useState(null), errorState = _c[0], setErrorState = _c[1];
|
|
60
|
+
var _d = useState(0), loadingProgress = _d[0], setLoadingProgress = _d[1];
|
|
61
|
+
var _e = useState(false), shouldFetch = _e[0], setShouldFetch = _e[1];
|
|
62
|
+
var _f = useQuery("SELECT FROM 'DOCUMENTHISTORY'.'BASICHISTORY'", {
|
|
61
63
|
documento: documento
|
|
62
|
-
}), response =
|
|
64
|
+
}), response = _f.response, queryError = _f.error, isLoading = _f.isLoading, refetch = _f.refetch;
|
|
63
65
|
var ctxProtestos = useContext(Queries.Protestos);
|
|
64
66
|
var ctxCCF = useContext(Queries.CCF);
|
|
65
67
|
var ctxProcessosJuridicos = useContext(Queries.ProcessosJuridicos);
|
|
68
|
+
var globalData = useGlobalData().data;
|
|
69
|
+
var iaOverrides = (_a = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _a === void 0 ? void 0 : _a.iaOverrides;
|
|
66
70
|
var quantidadeProcessosJuridicos = useMemo(function () {
|
|
67
71
|
var _a;
|
|
68
72
|
if ((ctxProcessosJuridicos === null || ctxProcessosJuridicos === void 0 ? void 0 : ctxProcessosJuridicos.type) === RequestStatus.Success &&
|
|
@@ -82,10 +86,10 @@ var useChartData = function (documento, consultaSerasa, consultaBoaVista) {
|
|
|
82
86
|
}, [ctxProtestos === null || ctxProtestos === void 0 ? void 0 : ctxProtestos.type, ctxCCF === null || ctxCCF === void 0 ? void 0 : ctxCCF.type, ctxProcessosJuridicos === null || ctxProcessosJuridicos === void 0 ? void 0 : ctxProcessosJuridicos.type]);
|
|
83
87
|
var dadosProtestos = useMemo(function () {
|
|
84
88
|
if ((ctxProtestos === null || ctxProtestos === void 0 ? void 0 : ctxProtestos.type) === RequestStatus.Success && ctxProtestos.document) {
|
|
85
|
-
return processProtestData(ctxProtestos.document);
|
|
89
|
+
return processProtestData(ctxProtestos.document, iaOverrides);
|
|
86
90
|
}
|
|
87
91
|
return [];
|
|
88
|
-
}, [ctxProtestos]);
|
|
92
|
+
}, [ctxProtestos, iaOverrides]);
|
|
89
93
|
useEffect(function () {
|
|
90
94
|
if (liveQueriesIsFinish && !shouldFetch) {
|
|
91
95
|
setShouldFetch(true);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ProtestosClassificados {
|
|
2
|
+
protestosDeCredito: Node[];
|
|
3
|
+
protestosDeImposto: Node[];
|
|
4
|
+
protestosGerais: Node[];
|
|
5
|
+
}
|
|
6
|
+
export declare function classifyProtestos(document: Document | null | undefined, iaOverrides?: Record<string, string>): ProtestosClassificados;
|
|
7
|
+
/**
|
|
8
|
+
* Hook para classificar protestos em Crédito, Imposto e Gerais, com suporte a overrides de IA.
|
|
9
|
+
* @param document Documento XML dos protestos
|
|
10
|
+
* @param iaOverrides Mapa opcional de chaves para nomes de cedente ajustados por IA
|
|
11
|
+
*/
|
|
12
|
+
export declare function useProtestosClassification(document: Document | null | undefined, iaOverrides?: Record<string, string>): ProtestosClassificados;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { REGEX_PROTESTOS_DE_CREDITO, REGEX_PROTESTOS_DE_IMPOSTO } from '../../../constants/regex';
|
|
2
|
+
import { formatDatePtBrToDate } from '../../../utils/date';
|
|
3
|
+
import XPathUtils from '../../../utils/xpath';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
// Função de ordenação por data
|
|
6
|
+
var byDate = function (protesto, protesto2) {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
var v0 = ((_a = formatDatePtBrToDate(XPathUtils.select('string(./dataProtesto)', protesto2))) === null || _a === void 0 ? void 0 : _a.getTime()) || 0;
|
|
9
|
+
var v1 = ((_b = formatDatePtBrToDate(XPathUtils.select('string(./dataProtesto)', protesto))) === null || _b === void 0 ? void 0 : _b.getTime()) || 0;
|
|
10
|
+
return v0 - v1;
|
|
11
|
+
};
|
|
12
|
+
export function classifyProtestos(document, iaOverrides) {
|
|
13
|
+
if (!document) {
|
|
14
|
+
return {
|
|
15
|
+
protestosDeCredito: [],
|
|
16
|
+
protestosDeImposto: [],
|
|
17
|
+
protestosGerais: []
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
var filterProtestos = function (regex, data, iaOverrides) {
|
|
21
|
+
return XPathUtils.selectArray('//body//protesto', data).filter(function (protesto) {
|
|
22
|
+
var cedente = XPathUtils.select('string(./nomeCedente)', protesto);
|
|
23
|
+
var chave = XPathUtils.select('string(./nm_chave)', protesto);
|
|
24
|
+
var iaNome = (iaOverrides === null || iaOverrides === void 0 ? void 0 : iaOverrides[chave]) || '';
|
|
25
|
+
if (iaNome) {
|
|
26
|
+
return regex.test(iaNome);
|
|
27
|
+
}
|
|
28
|
+
return regex.test(cedente);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
var protestosDeCredito = filterProtestos(REGEX_PROTESTOS_DE_CREDITO, document, iaOverrides).sort(byDate);
|
|
32
|
+
var protestosDeImposto = filterProtestos(REGEX_PROTESTOS_DE_IMPOSTO, document, iaOverrides).sort(byDate);
|
|
33
|
+
var protestosGerais = XPathUtils.selectArray('//body//protesto', document)
|
|
34
|
+
.filter(function (protesto) {
|
|
35
|
+
var cedente = XPathUtils.select('string(./nomeCedente)', protesto);
|
|
36
|
+
var chave = XPathUtils.select('string(./nm_chave)', protesto);
|
|
37
|
+
var iaNome = (iaOverrides === null || iaOverrides === void 0 ? void 0 : iaOverrides[chave]) || '';
|
|
38
|
+
if (iaNome) {
|
|
39
|
+
return (!REGEX_PROTESTOS_DE_IMPOSTO.test(iaNome) &&
|
|
40
|
+
!REGEX_PROTESTOS_DE_CREDITO.test(iaNome));
|
|
41
|
+
}
|
|
42
|
+
return (!REGEX_PROTESTOS_DE_IMPOSTO.test(cedente) &&
|
|
43
|
+
!REGEX_PROTESTOS_DE_CREDITO.test(cedente));
|
|
44
|
+
})
|
|
45
|
+
.sort(byDate);
|
|
46
|
+
return {
|
|
47
|
+
protestosDeCredito: protestosDeCredito,
|
|
48
|
+
protestosDeImposto: protestosDeImposto,
|
|
49
|
+
protestosGerais: protestosGerais
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Hook para classificar protestos em Crédito, Imposto e Gerais, com suporte a overrides de IA.
|
|
54
|
+
* @param document Documento XML dos protestos
|
|
55
|
+
* @param iaOverrides Mapa opcional de chaves para nomes de cedente ajustados por IA
|
|
56
|
+
*/
|
|
57
|
+
export function useProtestosClassification(document, iaOverrides) {
|
|
58
|
+
return useMemo(function () { return classifyProtestos(document, iaOverrides); }, [document, iaOverrides]);
|
|
59
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { DataInput } from '../../../components/chart/types/iChart';
|
|
2
2
|
export declare const processData: (data: DataInput, quantidadeProcessosJuridicos: number) => DataInput;
|
|
3
|
-
export declare function processProtestData(document: Document): DataInput['protestosCategory'];
|
|
3
|
+
export declare function processProtestData(document: Document, iaOverrides?: Record<string, string>): DataInput['protestosCategory'];
|
|
@@ -9,10 +9,10 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import { REGEX_PROTESTOS_DE_CREDITO, REGEX_PROTESTOS_DE_IMPOSTO } from '../../../constants/regex';
|
|
13
12
|
import { converterParaFormatoValido, formatDatePtBrToDate } from '../../../utils/date';
|
|
14
13
|
import XPathUtils from '../../../utils/xpath';
|
|
15
14
|
import { groupBy, sortBy, unique } from 'underscore';
|
|
15
|
+
import { classifyProtestos } from '../hooks/useProtestosClassification';
|
|
16
16
|
export var processData = function (data, quantidadeProcessosJuridicos) {
|
|
17
17
|
var removeZeros = function (current, index, arr) {
|
|
18
18
|
return index === 0 || index === arr.length - 1
|
|
@@ -70,29 +70,21 @@ var obterUltimaData = function (protestos) {
|
|
|
70
70
|
? new Date(Math.max.apply(Math, datas)).toLocaleDateString('pt-BR')
|
|
71
71
|
: null;
|
|
72
72
|
};
|
|
73
|
-
export function processProtestData(document) {
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return
|
|
73
|
+
export function processProtestData(document, iaOverrides) {
|
|
74
|
+
var _a = classifyProtestos(document, iaOverrides), protestosDeCredito = _a.protestosDeCredito, protestosDeImposto = _a.protestosDeImposto, protestosGerais = _a.protestosGerais;
|
|
75
|
+
var obterUltimaData = function (protestos) {
|
|
76
|
+
if (!protestos.length)
|
|
77
|
+
return null;
|
|
78
|
+
var datas = protestos
|
|
79
|
+
.map(function (p) {
|
|
80
|
+
var data = XPathUtils.select('string(./dataProtesto)', p);
|
|
81
|
+
return new Date(converterParaFormatoValido(data)).getTime();
|
|
78
82
|
})
|
|
79
|
-
.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
.filter(function (d) { return !isNaN(d); });
|
|
84
|
+
return datas.length
|
|
85
|
+
? new Date(Math.max.apply(Math, datas)).toLocaleDateString('pt-BR')
|
|
86
|
+
: null;
|
|
83
87
|
};
|
|
84
|
-
var protestosDeCredito = filterProtestos(REGEX_PROTESTOS_DE_CREDITO, document);
|
|
85
|
-
var protestosDeImpostos = filterProtestos(REGEX_PROTESTOS_DE_IMPOSTO, document);
|
|
86
|
-
var protestosGerais = XPathUtils.selectArray('//body//protesto', document)
|
|
87
|
-
.filter(function (protesto) {
|
|
88
|
-
var nomeCedente = XPathUtils.select('string(./nomeCedente)', protesto);
|
|
89
|
-
return (!REGEX_PROTESTOS_DE_IMPOSTO.test(nomeCedente) &&
|
|
90
|
-
!REGEX_PROTESTOS_DE_CREDITO.test(nomeCedente));
|
|
91
|
-
})
|
|
92
|
-
.map(function (protesto) { return ({
|
|
93
|
-
dataProtesto: XPathUtils.select('string(./dataProtesto)', protesto),
|
|
94
|
-
valor: parseFloat(XPathUtils.select('string(./valor)', protesto))
|
|
95
|
-
}); });
|
|
96
88
|
return [
|
|
97
89
|
{
|
|
98
90
|
categoria: 'Protestos de Crédito',
|
|
@@ -101,8 +93,8 @@ export function processProtestData(document) {
|
|
|
101
93
|
},
|
|
102
94
|
{
|
|
103
95
|
categoria: 'Protestos de Impostos',
|
|
104
|
-
quantidade:
|
|
105
|
-
ultimaOcorrencia: obterUltimaData(
|
|
96
|
+
quantidade: protestosDeImposto.length,
|
|
97
|
+
ultimaOcorrencia: obterUltimaData(protestosDeImposto)
|
|
106
98
|
},
|
|
107
99
|
{
|
|
108
100
|
categoria: 'Protestos Gerais',
|
|
@@ -17,13 +17,13 @@ import ProtestosIcon from '../../assets/icones/protestos';
|
|
|
17
17
|
import ProtestosCreditoIcon from '../../assets/icones/protestosCredito';
|
|
18
18
|
import ProtestosGeraisIcon from '../../assets/icones/protestosGerais';
|
|
19
19
|
import ProtestosImpostosIcon from '../../assets/icones/protestosImpostos';
|
|
20
|
-
import { REGEX_PROTESTOS_DE_CREDITO, REGEX_PROTESTOS_DE_IMPOSTO } from '../../constants/regex';
|
|
21
20
|
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
22
21
|
import { formatDatePtBrToDate } from '../../utils/date';
|
|
23
22
|
import { extractIntegerFromText } from '../../utils/number';
|
|
24
23
|
import XPathUtils from '../../utils/xpath';
|
|
25
24
|
import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
26
25
|
import styled from 'styled-components';
|
|
26
|
+
import { classifyProtestos, useProtestosClassification } from '../chart/hooks/useProtestosClassification';
|
|
27
27
|
import StatusMessage from '../interface/statusMessage';
|
|
28
28
|
import Section from '../section';
|
|
29
29
|
import { Queries, RequestStatus } from '../webservice';
|
|
@@ -37,6 +37,10 @@ var byDate = function (protesto, protesto2) {
|
|
|
37
37
|
var v1 = ((_b = formatDatePtBrToDate(XPathUtils.select('string(./dataProtesto)', protesto))) === null || _b === void 0 ? void 0 : _b.getTime()) || 0;
|
|
38
38
|
return v0 - v1;
|
|
39
39
|
};
|
|
40
|
+
// Função utilitária para extrair as chaves dos protestos
|
|
41
|
+
var getChaves = function (arr) {
|
|
42
|
+
return arr.map(function (protesto) { return XPathUtils.select('string(./nm_chave)', protesto); });
|
|
43
|
+
};
|
|
40
44
|
var Protestos = function () {
|
|
41
45
|
var _a;
|
|
42
46
|
var ctx = useContext(Queries.Protestos);
|
|
@@ -52,6 +56,9 @@ var Protestos = function () {
|
|
|
52
56
|
}
|
|
53
57
|
return 0;
|
|
54
58
|
}, [ctxLiminar === null || ctxLiminar === void 0 ? void 0 : ctxLiminar.type, ctxLiminar === null || ctxLiminar === void 0 ? void 0 : ctxLiminar.document]);
|
|
59
|
+
// NOVO: usa classificação centralizada
|
|
60
|
+
var iaOverrides = (_a = globalData.protestosData) === null || _a === void 0 ? void 0 : _a.iaOverrides;
|
|
61
|
+
var _d = useProtestosClassification(ctx.document, iaOverrides), protestosDeCredito = _d.protestosDeCredito, protestosDeImposto = _d.protestosDeImposto, protestosGerais = _d.protestosGerais;
|
|
55
62
|
useEffect(function () {
|
|
56
63
|
if ((ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Error ||
|
|
57
64
|
(ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Empty) {
|
|
@@ -59,14 +66,13 @@ var Protestos = function () {
|
|
|
59
66
|
return;
|
|
60
67
|
}
|
|
61
68
|
}, [ctx.type]);
|
|
62
|
-
//
|
|
69
|
+
// Atualiza o contexto global com os protestos classificados
|
|
63
70
|
useEffect(function () {
|
|
64
71
|
if (dataUpdated || !ctx.document) {
|
|
65
72
|
return;
|
|
66
73
|
}
|
|
67
|
-
var
|
|
68
|
-
var
|
|
69
|
-
var haveException = /Falha na integra/gi.test(XPathUtils.select('string(//raw)', data));
|
|
74
|
+
var registrosText = XPathUtils.select('string(//registros)', ctx.document);
|
|
75
|
+
var haveException = /Falha na integra/gi.test(XPathUtils.select('string(//raw)', ctx.document));
|
|
70
76
|
var registros = haveException
|
|
71
77
|
? extractIntegerFromText(registrosText) + total
|
|
72
78
|
: extractIntegerFromText(registrosText);
|
|
@@ -75,67 +81,42 @@ var Protestos = function () {
|
|
|
75
81
|
setDataUpdated(true);
|
|
76
82
|
return;
|
|
77
83
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
!REGEX_PROTESTOS_DE_CREDITO.test(nomeCedente));
|
|
90
|
-
})
|
|
91
|
-
.sort(byDate);
|
|
92
|
-
var protestosState = {
|
|
93
|
-
protestosDeCredito: protestosDeCredito,
|
|
94
|
-
protestosDeImposto: protestosDeImposto,
|
|
95
|
-
protestosGerais: protestosGerais,
|
|
96
|
-
totalProtestos: registros,
|
|
97
|
-
isLoaded: true
|
|
98
|
-
};
|
|
99
|
-
setData(function (prevState) { return (__assign(__assign({}, prevState), { protestos: registros, protestosData: protestosState })); });
|
|
84
|
+
setData(function (prevState) {
|
|
85
|
+
var _a;
|
|
86
|
+
return (__assign(__assign({}, prevState), { protestos: registros, protestosData: {
|
|
87
|
+
protestosDeCredito: protestosDeCredito,
|
|
88
|
+
protestosDeImposto: protestosDeImposto,
|
|
89
|
+
protestosGerais: protestosGerais,
|
|
90
|
+
totalProtestos: registros,
|
|
91
|
+
isLoaded: true,
|
|
92
|
+
iaOverrides: (_a = prevState.protestosData) === null || _a === void 0 ? void 0 : _a.iaOverrides
|
|
93
|
+
} }));
|
|
94
|
+
});
|
|
100
95
|
setDataUpdated(true);
|
|
101
|
-
}, [
|
|
96
|
+
}, [
|
|
97
|
+
ctx.type,
|
|
98
|
+
ctx.document,
|
|
99
|
+
dataUpdated,
|
|
100
|
+
total,
|
|
101
|
+
setData,
|
|
102
|
+
protestosDeCredito,
|
|
103
|
+
protestosDeImposto,
|
|
104
|
+
protestosGerais
|
|
105
|
+
]);
|
|
106
|
+
useEffect(function () {
|
|
107
|
+
if ((ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Loading) {
|
|
108
|
+
setData(function (prevState) { return (__assign(__assign({}, prevState), { protestosData: __assign(__assign({}, (prevState.protestosData || {})), { isLoaded: false }) })); });
|
|
109
|
+
}
|
|
110
|
+
}, [ctx.type]);
|
|
102
111
|
// Callback memorizado para a renderização do conteúdo em caso de sucesso
|
|
103
112
|
var handleSuccess = useCallback(function (data, _ctx) {
|
|
104
|
-
var _a;
|
|
105
113
|
var registrosText = XPathUtils.select('string(//registros)', data);
|
|
106
114
|
var haveException = /Falha na integra/gi.test(XPathUtils.select('string(//raw)', data));
|
|
107
115
|
var registros = haveException
|
|
108
116
|
? extractIntegerFromText(registrosText) + total
|
|
109
117
|
: extractIntegerFromText(registrosText);
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
var filterProtestos = function (regex, data, iaOverrides) {
|
|
113
|
-
return XPathUtils.selectArray('//body//protesto', data).filter(function (protesto) {
|
|
114
|
-
var cedente = XPathUtils.select('string(./nomeCedente)', protesto);
|
|
115
|
-
var apresentante = XPathUtils.select('string(./nomeApresentante)', protesto);
|
|
116
|
-
var chave = XPathUtils.select('string(./nm_chave)', protesto);
|
|
117
|
-
var iaNome = iaOverrides[chave] || '';
|
|
118
|
-
return (regex.test(cedente) ||
|
|
119
|
-
regex.test(apresentante) ||
|
|
120
|
-
regex.test(iaNome));
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
var protestosDeCredito = filterProtestos(REGEX_PROTESTOS_DE_CREDITO, data, iaOverrides).sort(byDate);
|
|
124
|
-
var protestosDeImposto = filterProtestos(REGEX_PROTESTOS_DE_IMPOSTO, data, iaOverrides).sort(byDate);
|
|
125
|
-
var protestosGerais = XPathUtils.selectArray('//body//protesto', data)
|
|
126
|
-
.filter(function (protesto) {
|
|
127
|
-
var cedente = XPathUtils.select('string(./nomeCedente)', protesto);
|
|
128
|
-
var apresentante = XPathUtils.select('string(./nomeApresentante)', protesto);
|
|
129
|
-
var chave = XPathUtils.select('string(./nm_chave)', protesto);
|
|
130
|
-
var iaNome = iaOverrides[chave] || '';
|
|
131
|
-
return (!REGEX_PROTESTOS_DE_IMPOSTO.test(cedente) &&
|
|
132
|
-
!REGEX_PROTESTOS_DE_IMPOSTO.test(apresentante) &&
|
|
133
|
-
!REGEX_PROTESTOS_DE_IMPOSTO.test(iaNome) &&
|
|
134
|
-
!REGEX_PROTESTOS_DE_CREDITO.test(cedente) &&
|
|
135
|
-
!REGEX_PROTESTOS_DE_CREDITO.test(apresentante) &&
|
|
136
|
-
!REGEX_PROTESTOS_DE_CREDITO.test(iaNome));
|
|
137
|
-
})
|
|
138
|
-
.sort(byDate);
|
|
118
|
+
// Usa função pura para classificar
|
|
119
|
+
var _a = classifyProtestos(data, iaOverrides), protestosDeCredito = _a.protestosDeCredito, protestosDeImposto = _a.protestosDeImposto, protestosGerais = _a.protestosGerais;
|
|
139
120
|
var elements = [
|
|
140
121
|
{
|
|
141
122
|
total: protestosDeCredito.length,
|
|
@@ -164,7 +145,7 @@ var Protestos = function () {
|
|
|
164
145
|
: "Encontrados ".concat(registros, " protestos")
|
|
165
146
|
: 'Não há ocorrência de protesto'))
|
|
166
147
|
};
|
|
167
|
-
}, [total,
|
|
148
|
+
}, [total, iaOverrides]);
|
|
168
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 }));
|
|
169
150
|
};
|
|
170
151
|
export default React.memo(Protestos);
|
|
@@ -105,13 +105,15 @@ var AIIndicator = function () { return (React.createElement("span", { title: "In
|
|
|
105
105
|
cursor: 'help'
|
|
106
106
|
} }, "*")); };
|
|
107
107
|
export var ProtestoItem = memo(function (_a) {
|
|
108
|
+
var _b;
|
|
108
109
|
var protesto = _a.protesto;
|
|
109
110
|
var client = useContext(WebService);
|
|
110
|
-
var
|
|
111
|
-
var _b =
|
|
112
|
-
var
|
|
113
|
-
var
|
|
114
|
-
var
|
|
111
|
+
var _c = useGlobalData(), setData = _c.setData, globalData = _c.data;
|
|
112
|
+
var iaOverrides = ((_b = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _b === void 0 ? void 0 : _b.iaOverrides) || {};
|
|
113
|
+
var _d = useState(null), quemApresentou = _d[0], setQuemApresentou = _d[1];
|
|
114
|
+
var _e = useState(false), loading = _e[0], setLoading = _e[1];
|
|
115
|
+
var _f = useState(false), queued = _f[0], setQueued = _f[1];
|
|
116
|
+
var _g = useState(false), isAIData = _g[0], setIsAIData = _g[1];
|
|
115
117
|
var getField = function (path, formatter) {
|
|
116
118
|
var value = XPathUtils.select("string(".concat(path, ")"), protesto);
|
|
117
119
|
return formatter ? formatter(value) : value;
|
|
@@ -201,6 +203,12 @@ export var ProtestoItem = memo(function (_a) {
|
|
|
201
203
|
}, []);
|
|
202
204
|
var getQuemProtestouDisplay = function () {
|
|
203
205
|
var original = getField('./nomeCedente');
|
|
206
|
+
var override = iaOverrides[nm_chave];
|
|
207
|
+
if (override && override.trim() !== '') {
|
|
208
|
+
return (React.createElement(React.Fragment, null,
|
|
209
|
+
override,
|
|
210
|
+
React.createElement(AIIndicator, null)));
|
|
211
|
+
}
|
|
204
212
|
if (original && original.trim() !== '')
|
|
205
213
|
return original;
|
|
206
214
|
if (isAIData && quemApresentou)
|