@credithub/harlan-components 1.101.2 → 1.101.3
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/protestos/protestos.js +14 -13
- package/lib/cjs/index.js +16 -15
- package/lib/esm/index.js +16 -15
- package/package.json +1 -1
|
@@ -40,23 +40,15 @@ import ProtestosCategory from './protestosCategory';
|
|
|
40
40
|
import { ProtestoItem } from './protestosList';
|
|
41
41
|
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"])));
|
|
42
42
|
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"])));
|
|
43
|
-
// Remover função de ordenação por data não usada
|
|
44
43
|
// Função utilitária para extrair as chaves dos protestos
|
|
45
44
|
var getChaves = function (arr) { return arr.map(function (p) { return p.nm_chave; }); };
|
|
45
|
+
var PROTESTOS_ERROR_SUMMARY = 'Falha ao consultar protestos, tente novamente mais tarde.';
|
|
46
46
|
var Protestos = function () {
|
|
47
47
|
var _a;
|
|
48
48
|
var ctx = useContext(Queries.Protestos);
|
|
49
49
|
var ctxLiminar = useContext(Queries.Liminar);
|
|
50
50
|
var _b = useGlobalData(), globalData = _b.data, setData = _b.setData;
|
|
51
51
|
var _c = useState(false), dataUpdated = _c[0], setDataUpdated = _c[1];
|
|
52
|
-
var total = useMemo(function () {
|
|
53
|
-
var _a;
|
|
54
|
-
if ((ctxLiminar === null || ctxLiminar === void 0 ? void 0 : ctxLiminar.type) === RequestStatus.Success &&
|
|
55
|
-
((_a = ctxLiminar.document) === null || _a === void 0 ? void 0 : _a.data)) {
|
|
56
|
-
return (ctxLiminar.document.data.reduce(function (carry, e) { return carry + Number(e === null || e === void 0 ? void 0 : e[9]); }, 0) || 0);
|
|
57
|
-
}
|
|
58
|
-
return 0;
|
|
59
|
-
}, [ctxLiminar === null || ctxLiminar === void 0 ? void 0 : ctxLiminar.type, ctxLiminar === null || ctxLiminar === void 0 ? void 0 : ctxLiminar.document]);
|
|
60
52
|
var protestosAll = useMemo(function () {
|
|
61
53
|
if (!ctx.document)
|
|
62
54
|
return [];
|
|
@@ -65,19 +57,28 @@ var Protestos = function () {
|
|
|
65
57
|
var iaOverrides = (_a = globalData.protestosData) === null || _a === void 0 ? void 0 : _a.iaOverrides;
|
|
66
58
|
var _d = useProtestosClassification(protestosAll, iaOverrides), protestosDeCredito = _d.protestosDeCredito, protestosDeImposto = _d.protestosDeImposto, protestosGerais = _d.protestosGerais;
|
|
67
59
|
useEffect(function () {
|
|
68
|
-
if ((ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Error
|
|
69
|
-
(
|
|
60
|
+
if ((ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Error) {
|
|
61
|
+
setData(function (prevState) { return (__assign(__assign({}, prevState), { protestosData: {
|
|
62
|
+
isLoaded: true,
|
|
63
|
+
error: { summary: PROTESTOS_ERROR_SUMMARY }
|
|
64
|
+
} })); });
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if ((ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Empty) {
|
|
70
68
|
setData(function (prevState) { return (__assign(__assign({}, prevState), { protestosData: { isLoaded: true } })); });
|
|
71
69
|
return;
|
|
72
70
|
}
|
|
73
|
-
}, [ctx.type]);
|
|
71
|
+
}, [ctx.type, setData]);
|
|
74
72
|
useEffect(function () {
|
|
75
73
|
if (dataUpdated || !ctx.document)
|
|
76
74
|
return;
|
|
77
75
|
var registros = protestosAll.length;
|
|
78
76
|
var haveException = /Falha na integra/gi.test(XPathUtils.select('string(//raw)', ctx.document));
|
|
79
77
|
if (haveException) {
|
|
80
|
-
setData(function (prevState) { return (__assign(__assign({}, prevState), { protestosData: {
|
|
78
|
+
setData(function (prevState) { return (__assign(__assign({}, prevState), { protestosData: {
|
|
79
|
+
isLoaded: true,
|
|
80
|
+
error: { summary: PROTESTOS_ERROR_SUMMARY }
|
|
81
|
+
} })); });
|
|
81
82
|
setDataUpdated(true);
|
|
82
83
|
return;
|
|
83
84
|
}
|