@credithub/harlan-components 1.109.2 → 1.109.4
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/assets/btn/btnWrapper.js +1 -1
- package/dist/components/chart/chartSystem.js +58 -40
- package/dist/components/consultaSimplesSection/consultaSimplesSection.js +12 -14
- package/dist/components/dossie/summary/styles.js +1 -1
- package/dist/components/interface/header.js +1 -1
- package/dist/components/liminar/liminar.js +25 -3
- package/dist/components/protestos/protestos.js +58 -31
- package/dist/components/protestos/protestosList.js +246 -23
- package/dist/consultaSimples.js +10 -7
- package/dist/contexts/globalDataContext.js +1 -1
- package/lib/cjs/index.js +450 -159
- package/lib/esm/index.js +450 -159
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
3
3
|
return cooked;
|
|
4
4
|
};
|
|
5
5
|
import styled from 'styled-components';
|
|
6
|
-
var BtnWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 30px;\n height: 30px;\n background-color: ", ";\n border-radius: 50%;\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n\n @media print {\n display: none;\n }\n"], ["\n width: 30px;\n height: 30px;\n background-color: ", ";\n border-radius: 50%;\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n\n @media print {\n display: none;\n }\n"])), function (_a) {
|
|
6
|
+
var BtnWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 30px;\n height: 30px;\n background-color: ", ";\n border-radius: 50%;\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n\n @media print {\n display: none !important;\n visibility: hidden !important;\n pointer-events: none !important;\n }\n"], ["\n width: 30px;\n height: 30px;\n background-color: ", ";\n border-radius: 50%;\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n\n @media print {\n display: none !important;\n visibility: hidden !important;\n pointer-events: none !important;\n }\n"])), function (_a) {
|
|
7
7
|
var theme = _a.theme;
|
|
8
8
|
return theme.colors.cinza85;
|
|
9
9
|
});
|
|
@@ -146,18 +146,9 @@ var ChartSystem = function (_a) {
|
|
|
146
146
|
serasa: null,
|
|
147
147
|
boaVista: null
|
|
148
148
|
});
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
if (serasaChanged || boaVistaChanged) {
|
|
153
|
-
lastComplementary.current = {
|
|
154
|
-
serasa: consultaSerasa,
|
|
155
|
-
boaVista: consultaBoaVista
|
|
156
|
-
};
|
|
157
|
-
refetchChart();
|
|
158
|
-
}
|
|
159
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
160
|
-
}, [consultaSerasa, consultaBoaVista]);
|
|
149
|
+
// Evita escrever documentHistory repetidamente com o mesmo conteúdo
|
|
150
|
+
var lastDocHistorySigRef = useRef('');
|
|
151
|
+
// (refetch de histórico por mudança complementar centralizado no hook useChartData)
|
|
161
152
|
var errorMessage = typeof errorChart === 'string' ? new Error(errorChart) : errorChart;
|
|
162
153
|
var isOpen = useToggle(true)[0];
|
|
163
154
|
// Usa valores já calculados de globalData.protestosData (calculados uma única vez em protestos.tsx)
|
|
@@ -188,7 +179,7 @@ var ChartSystem = function (_a) {
|
|
|
188
179
|
var loadingProgress = (chartDataProgress + dividasProgress) / 2;
|
|
189
180
|
var modulesReady = useMemo(function () { return areModulesLoaded(globalData); }, [globalData]);
|
|
190
181
|
useEffect(function () {
|
|
191
|
-
var _a, _b;
|
|
182
|
+
var _a, _b, _c, _d;
|
|
192
183
|
if (!dataUpdated && chartData && modulesReady) {
|
|
193
184
|
var protestoHistory_1 = (_b = (_a = chartData.protestos) === null || _a === void 0 ? void 0 : _a.map(function (p) {
|
|
194
185
|
var _a, _b;
|
|
@@ -200,34 +191,61 @@ var ChartSystem = function (_a) {
|
|
|
200
191
|
});
|
|
201
192
|
}).sort(function (a, b) { return new Date(a.data).getTime() - new Date(b.data).getTime(); })) !== null && _b !== void 0 ? _b : [];
|
|
202
193
|
var protestoLiminar_1 = calcularProtestoLiminar(protestoHistory_1);
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
: undefined
|
|
227
|
-
};
|
|
228
|
-
return __assign(__assign({}, prev), { documentHistory: docHistory });
|
|
194
|
+
// Cria assinatura estável para evitar setState repetido
|
|
195
|
+
var signature = JSON.stringify({
|
|
196
|
+
protestoHistory: protestoHistory_1,
|
|
197
|
+
protestoLiminar: protestoLiminar_1,
|
|
198
|
+
quantidadeProtestos: quantidadeProtestos,
|
|
199
|
+
quantidadeProcessos: (_d = (_c = chartData.pieChartTotalConfig) === null || _c === void 0 ? void 0 : _c.processosJuridicos) !== null && _d !== void 0 ? _d : 0,
|
|
200
|
+
quantidadeDividas: quantidadeDividas,
|
|
201
|
+
quantidadeDividasSerasa: quantidadeSerasa,
|
|
202
|
+
quantidadeDividasBoaVista: quantidadeBoaVista,
|
|
203
|
+
quantidadeChequesSemFundos: quantidadeCCFs,
|
|
204
|
+
ultimaOcorrenciaChequesSemFundos: ultimaOcorrenciaCCF,
|
|
205
|
+
valorTotalDividasSerasa: valorTotalSerasa,
|
|
206
|
+
valorTotalDividasBoaVista: valorTotalBoaVista,
|
|
207
|
+
valorTotalProtestos: valorTotalProtestos,
|
|
208
|
+
valorTotalDividas: valorTotalDividas,
|
|
209
|
+
ultimaOcorrenciaProtestos: ultimaOcorrenciaProtestos,
|
|
210
|
+
ultimaOcorrenciaDividas: ultimaOcorrenciaDividas,
|
|
211
|
+
ultimaOcorrenciaPefinBoaVista: quantidadeBoaVista > 0 && ultimaOcorrenciaBoaVista
|
|
212
|
+
? ultimaOcorrenciaBoaVista
|
|
213
|
+
: undefined,
|
|
214
|
+
ultimaOcorrenciaPefinSerasa: quantidadeSerasa > 0 && ultimaOcorrenciaSerasa
|
|
215
|
+
? ultimaOcorrenciaSerasa
|
|
216
|
+
: undefined
|
|
229
217
|
});
|
|
230
|
-
|
|
218
|
+
if (signature !== lastDocHistorySigRef.current) {
|
|
219
|
+
setGlobalState(function (prev) {
|
|
220
|
+
var _a, _b;
|
|
221
|
+
var docHistory = {
|
|
222
|
+
protestoHistory: protestoHistory_1,
|
|
223
|
+
protestoLiminar: protestoLiminar_1,
|
|
224
|
+
quantidadeProtestos: quantidadeProtestos,
|
|
225
|
+
quantidadeProcessos: (_b = (_a = chartData.pieChartTotalConfig) === null || _a === void 0 ? void 0 : _a.processosJuridicos) !== null && _b !== void 0 ? _b : 0,
|
|
226
|
+
quantidadeDividas: quantidadeDividas,
|
|
227
|
+
quantidadeDividasSerasa: quantidadeSerasa,
|
|
228
|
+
quantidadeDividasBoaVista: quantidadeBoaVista,
|
|
229
|
+
quantidadeChequesSemFundos: quantidadeCCFs,
|
|
230
|
+
ultimaOcorrenciaChequesSemFundos: ultimaOcorrenciaCCF,
|
|
231
|
+
valorTotalDividasSerasa: valorTotalSerasa,
|
|
232
|
+
valorTotalDividasBoaVista: valorTotalBoaVista,
|
|
233
|
+
valorTotalProtestos: valorTotalProtestos,
|
|
234
|
+
valorTotalDividas: valorTotalDividas,
|
|
235
|
+
ultimaOcorrenciaProtestos: ultimaOcorrenciaProtestos,
|
|
236
|
+
ultimaOcorrenciaDividas: ultimaOcorrenciaDividas,
|
|
237
|
+
ultimaOcorrenciaPefinBoaVista: quantidadeBoaVista > 0 && ultimaOcorrenciaBoaVista
|
|
238
|
+
? ultimaOcorrenciaBoaVista
|
|
239
|
+
: undefined,
|
|
240
|
+
ultimaOcorrenciaPefinSerasa: quantidadeSerasa > 0 && ultimaOcorrenciaSerasa
|
|
241
|
+
? ultimaOcorrenciaSerasa
|
|
242
|
+
: undefined
|
|
243
|
+
};
|
|
244
|
+
return __assign(__assign({}, prev), { documentHistory: docHistory });
|
|
245
|
+
});
|
|
246
|
+
lastDocHistorySigRef.current = signature;
|
|
247
|
+
setDataUpdated(true);
|
|
248
|
+
}
|
|
231
249
|
}
|
|
232
250
|
}, [
|
|
233
251
|
chartData,
|
|
@@ -48,13 +48,13 @@ var ClickableStatusMessage = styled(StatusMessage)(templateObject_3 || (template
|
|
|
48
48
|
// Wrapper para o texto clicável dentro do StatusMessage
|
|
49
49
|
var ClickableText = styled.span(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n cursor: pointer;\n &:hover {\n opacity: 0.85;\n }\n"], ["\n cursor: pointer;\n &:hover {\n opacity: 0.85;\n }\n"])));
|
|
50
50
|
var ConsultaSimplesSection = function (_a) {
|
|
51
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
52
|
-
var documento = _a.documento, children = _a.children, onClose = _a.onClose, onClickPrint = _a.onClickPrint, isFinancial = _a.isFinancial, ctime = _a.ctime, printMode = _a.printMode,
|
|
51
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
52
|
+
var documento = _a.documento, children = _a.children, onClose = _a.onClose, onClickPrint = _a.onClickPrint, isFinancial = _a.isFinancial, ctime = _a.ctime, printMode = _a.printMode, _y = _a.tags, tags = _y === void 0 ? [] : _y, rest = __rest(_a, ["documento", "children", "onClose", "onClickPrint", "isFinancial", "ctime", "printMode", "tags"]);
|
|
53
53
|
var ctx = useContext(Queries.Finder);
|
|
54
54
|
var data = useGlobalData().data;
|
|
55
55
|
var posthog = usePostHog().posthog;
|
|
56
56
|
// Hook para observar mutações no DOM e chamar callback quando estável
|
|
57
|
-
var
|
|
57
|
+
var _z = usePrintWhenStable({
|
|
58
58
|
debounceTime: 500,
|
|
59
59
|
maxWaitTime: 30000,
|
|
60
60
|
onStart: function () {
|
|
@@ -65,7 +65,7 @@ var ConsultaSimplesSection = function (_a) {
|
|
|
65
65
|
// Chama o callback externo (Harlan decide como imprimir)
|
|
66
66
|
onClickPrint === null || onClickPrint === void 0 ? void 0 : onClickPrint();
|
|
67
67
|
}
|
|
68
|
-
}), printWhenStable =
|
|
68
|
+
}), printWhenStable = _z.printWhenStable, isWaiting = _z.isWaiting;
|
|
69
69
|
// Handler que usa o observer ao invés de imprimir diretamente
|
|
70
70
|
var handlePrint = function () {
|
|
71
71
|
printWhenStable();
|
|
@@ -131,12 +131,10 @@ var ConsultaSimplesSection = function (_a) {
|
|
|
131
131
|
? 'Processo Jurídico'
|
|
132
132
|
: 'Processos Jurídicos')
|
|
133
133
|
: '', (_o = data.processosJuridicosData) === null || _o === void 0 ? void 0 : _o.error),
|
|
134
|
-
makeItem('Liminar', (_p = data.liminar) === null || _p === void 0 ? void 0 : _p.isLoaded, data.liminar
|
|
135
|
-
(data.liminar.totalProtestos === 'NADA CONSTA' ||
|
|
136
|
-
data.liminar.message === 'Encontrado')
|
|
134
|
+
makeItem('Liminar', (_p = data.liminar) === null || _p === void 0 ? void 0 : _p.isLoaded, ((_q = data.liminar) === null || _q === void 0 ? void 0 : _q.message) === 'Encontrado'
|
|
137
135
|
? 'Indício de Liminar'
|
|
138
|
-
: '', (
|
|
139
|
-
makeItem('Potenciais Protestos Entrantes', true, ((
|
|
136
|
+
: '', (_r = data.liminar) === null || _r === void 0 ? void 0 : _r.error),
|
|
137
|
+
makeItem('Potenciais Protestos Entrantes', true, ((_s = data.editalData) === null || _s === void 0 ? void 0 : _s.recentesCount)
|
|
140
138
|
? "".concat(data.editalData.recentesCount === 1 ? '1 Potencial Protesto Entrante' : "".concat(data.editalData.recentesCount, " Potenciais Protestos Entrantes"))
|
|
141
139
|
: ''
|
|
142
140
|
// Não exibe erro de edital - deve falhar silenciosamente
|
|
@@ -155,8 +153,8 @@ var ConsultaSimplesSection = function (_a) {
|
|
|
155
153
|
data.dividasPublicas ||
|
|
156
154
|
data.processosJuridicos ||
|
|
157
155
|
receitaStatus ||
|
|
158
|
-
((
|
|
159
|
-
(((
|
|
156
|
+
((_t = data.liminar) === null || _t === void 0 ? void 0 : _t.message) === 'Encontrado' ||
|
|
157
|
+
(((_u = data.editalData) === null || _u === void 0 ? void 0 : _u.recentesCount) &&
|
|
160
158
|
hasOneOfTags(tags, ['diamante', 'diamante-new']));
|
|
161
159
|
var statusType = isError ? 'warning' : hasPendencias ? 'error' : 'success';
|
|
162
160
|
useEffect(function () {
|
|
@@ -283,13 +281,13 @@ var ConsultaSimplesSection = function (_a) {
|
|
|
283
281
|
}
|
|
284
282
|
return item.text ? (item.label === 'Potenciais Protestos Entrantes' ? (React.createElement(ClickableStatusMessage, { key: item.label, type: "error", onClick: scrollToEditais, title: "Clique para ver detalhes" }, item.text)) : (React.createElement(StatusMessage, { key: item.label, type: "error" }, item.text))) : null;
|
|
285
283
|
}),
|
|
286
|
-
((
|
|
287
|
-
!!((
|
|
284
|
+
((_v = data.editalData) === null || _v === void 0 ? void 0 : _v.isLoaded) &&
|
|
285
|
+
!!((_w = data.editalData) === null || _w === void 0 ? void 0 : _w.vencidosCount) &&
|
|
288
286
|
data.editalData.vencidosCount > 0 &&
|
|
289
287
|
hasOneOfTags(tags, ['diamante', 'diamante-new']) && (React.createElement(StatusMessage, { type: "error" },
|
|
290
288
|
React.createElement(ClickableText, { onClick: scrollToEditais, title: "Clique para ver detalhes" },
|
|
291
289
|
"Cart\u00F3rio com dificuldade para intimar",
|
|
292
|
-
((
|
|
290
|
+
((_x = data.editalData) === null || _x === void 0 ? void 0 : _x.dataEditalMaisAntigo) &&
|
|
293
291
|
" desde o: ".concat(data.editalData.dataEditalMaisAntigo))))), onClose: onClose, icon: ConsultaSimplesIcon, variant: isLoading ? 'loading' : 'default', ctx: ctx, loadingProps: {
|
|
294
292
|
percentage: (ctx === null || ctx === void 0 ? void 0 : ctx.progress) || 0,
|
|
295
293
|
hidden: !isLoading
|
|
@@ -15,7 +15,7 @@ export var ContainerSummary = styled.div(templateObject_2 || (templateObject_2 =
|
|
|
15
15
|
export var ContentSummary = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: grid;\n grid-row: 1 / 8;\n grid-template-columns: repeat(4, 1fr);\n gap: 0 16px;\n\n @media (max-width: 1280px) {\n grid-template-columns: repeat(3, 1fr);\n justify-content: center;\n align-items: center;\n }\n\n @media (max-width: 768px) {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n flex-direction: row;\n width: 100%;\n }\n"], ["\n display: grid;\n grid-row: 1 / 8;\n grid-template-columns: repeat(4, 1fr);\n gap: 0 16px;\n\n @media (max-width: 1280px) {\n grid-template-columns: repeat(3, 1fr);\n justify-content: center;\n align-items: center;\n }\n\n @media (max-width: 768px) {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n flex-direction: row;\n width: 100%;\n }\n"])));
|
|
16
16
|
export var FieldSummary = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n align-items: center;\n margin-bottom: 16px;\n grid-column: ", ";\n"], ["\n align-items: center;\n margin-bottom: 16px;\n grid-column: ", ";\n"])), function (props) { return (props.fullRow ? '1 / 3' : 'auto'); });
|
|
17
17
|
export var ButtonsSummary = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n @media (max-width: 768px) {\n align-items: center;\n max-width: 100%;\n }\n"], ["\n @media (max-width: 768px) {\n align-items: center;\n max-width: 100%;\n }\n"])));
|
|
18
|
-
export var ButtonsWrapper = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n gap: 10px;\n min-width: fit-content;\n flex-direction: column;\n\n @media print {\n display: none;\n }\n"], ["\n display: flex;\n gap: 10px;\n min-width: fit-content;\n flex-direction: column;\n\n @media print {\n display: none;\n }\n"])));
|
|
18
|
+
export var ButtonsWrapper = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n gap: 10px;\n min-width: fit-content;\n flex-direction: column;\n\n @media print {\n display: none !important;\n visibility: hidden !important;\n }\n"], ["\n display: flex;\n gap: 10px;\n min-width: fit-content;\n flex-direction: column;\n\n @media print {\n display: none !important;\n visibility: hidden !important;\n }\n"])));
|
|
19
19
|
export var SummaryButton = styled(Button)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n\n background: ", ";\n color: ", ";\n cursor: ", ";\n opacity: ", ";\n pointer-events: ", ";\n\n &:hover {\n background: ", ";\n }\n"], ["\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n\n background: ", ";\n color: ", ";\n cursor: ", ";\n opacity: ", ";\n pointer-events: ", ";\n\n &:hover {\n background: ", ";\n }\n"])), function (_a) {
|
|
20
20
|
var theme = _a.theme, disabled = _a.disabled;
|
|
21
21
|
return disabled ? theme.colors.cinzaClaro : theme.colors.azulCredithub;
|
|
@@ -78,7 +78,7 @@ var HeaderUI = styled(function (_a) {
|
|
|
78
78
|
return (React.createElement("header", __assign({}, props), children));
|
|
79
79
|
})(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n @media screen {\n background: #ffffff !important;\n box-shadow: 0px 4px 5px rgba(0, 0, 0, 0.15);\n border-radius: 30px;\n }\n\n @media print {\n page-break-before: avoid;\n page-break-after: avoid;\n page-break-inside: avoid;\n padding: 18px;\n print-color-adjust: exact;\n background: #eae9e9;\n border-radius: 18px;\n }\n\n padding: 30px 20px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n\n ", " {\n color: ", ";\n }\n"], ["\n @media screen {\n background: #ffffff !important;\n box-shadow: 0px 4px 5px rgba(0, 0, 0, 0.15);\n border-radius: 30px;\n }\n\n @media print {\n page-break-before: avoid;\n page-break-after: avoid;\n page-break-inside: avoid;\n padding: 18px;\n print-color-adjust: exact;\n background: #eae9e9;\n border-radius: 18px;\n }\n\n padding: 30px 20px;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n\n ", " {\n color: ", ";\n }\n"])), Title, function (props) { return props.color; });
|
|
80
80
|
var HeaderContainer = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n gap: 20px;\n\n @media print {\n width: 100%;\n }\n"], ["\n display: flex;\n gap: 20px;\n\n @media print {\n width: 100%;\n }\n"])));
|
|
81
|
-
var ActionsList = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n gap: 10px;\n"], ["\n display: flex;\n flex-direction: row;\n gap: 10px;\n"])));
|
|
81
|
+
var ActionsList = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n gap: 10px;\n\n @media print {\n display: none !important;\n visibility: hidden !important;\n }\n"], ["\n display: flex;\n flex-direction: row;\n gap: 10px;\n\n @media print {\n display: none !important;\n visibility: hidden !important;\n }\n"])));
|
|
82
82
|
var IconWrapper = styled.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: flex;\n align-items: flex-start;\n padding-top: 5px;\n width: 30px;\n"], ["\n display: flex;\n align-items: flex-start;\n padding-top: 5px;\n width: 30px;\n"])));
|
|
83
83
|
var TextWrapper = styled.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 10px;\n\n .text-wrapper-subtitle-description {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 20px;\n align-items: center;\n\n @media (max-width: 768px) {\n align-items: flex-start;\n }\n\n @media print {\n flex-direction: row;\n }\n }\n"], ["\n display: flex;\n flex-direction: column;\n gap: 10px;\n\n .text-wrapper-subtitle-description {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n gap: 20px;\n align-items: center;\n\n @media (max-width: 768px) {\n align-items: flex-start;\n }\n\n @media print {\n flex-direction: row;\n }\n }\n"])));
|
|
84
84
|
var LoadingBarWrapper = styled.div(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n width: 100%;\n max-width: 300px;\n height: 10px;\n opacity: ", ";\n transition: opacity 0.3s ease;\n"], ["\n width: 100%;\n max-width: 300px;\n height: 10px;\n opacity: ", ";\n transition: opacity 0.3s ease;\n"])), function (_a) {
|
|
@@ -245,7 +245,7 @@ var Liminar = function (_a) {
|
|
|
245
245
|
setData(function (prev) { return (__assign(__assign({}, prev), { liminar: {
|
|
246
246
|
/* -------------------------------------------------------------
|
|
247
247
|
* Há 3 fontes possíveis de indício de liminar:
|
|
248
|
-
* 1) API
|
|
248
|
+
* 1) API (Cenprot/Serasa) ‑ indiciosApi
|
|
249
249
|
* 2) Liminar detectada por protestos passados ‑ indiciosDeLiminarProtestosDoPassado
|
|
250
250
|
* 3) Processos Judiciais com assuntos compatíveis ‑ processosComAssuntoValido
|
|
251
251
|
* ----------------------------------------------------------- */
|
|
@@ -266,8 +266,29 @@ var Liminar = function (_a) {
|
|
|
266
266
|
}
|
|
267
267
|
});
|
|
268
268
|
}); };
|
|
269
|
-
if (isFinancial)
|
|
269
|
+
if (isFinancial) {
|
|
270
270
|
fetch();
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
// Se não for financial, marca como carregado imediatamente
|
|
274
|
+
var dossie = globalData === null || globalData === void 0 ? void 0 : globalData.dossie;
|
|
275
|
+
var processosJuridicos = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData;
|
|
276
|
+
var depsLoaded = !!(processosJuridicos === null || processosJuridicos === void 0 ? void 0 : processosJuridicos.isLoaded) && !!(dossie === null || dossie === void 0 ? void 0 : dossie.carousel);
|
|
277
|
+
if (depsLoaded && !processedRef.current) {
|
|
278
|
+
setData(function (prev) { return (__assign(__assign({}, prev), { liminar: {
|
|
279
|
+
indiciosDeLiminar: false,
|
|
280
|
+
message: 'Não encontrado',
|
|
281
|
+
isLoaded: true,
|
|
282
|
+
processosComLiminarIds: [],
|
|
283
|
+
indiciosDeLiminarProtestosDoPassado: false,
|
|
284
|
+
protestosDoPassadoIds: '',
|
|
285
|
+
invertedProcessos: [],
|
|
286
|
+
origensLiminar: [],
|
|
287
|
+
descricaoLiminar: 'Não encontrado'
|
|
288
|
+
} })); });
|
|
289
|
+
processedRef.current = true;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
271
292
|
}, [
|
|
272
293
|
isFinancial,
|
|
273
294
|
ctx.type,
|
|
@@ -276,7 +297,8 @@ var Liminar = function (_a) {
|
|
|
276
297
|
globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData,
|
|
277
298
|
processosComAssuntoValido,
|
|
278
299
|
setData,
|
|
279
|
-
foundBusinessEntity
|
|
300
|
+
foundBusinessEntity,
|
|
301
|
+
protestosIsReady
|
|
280
302
|
]);
|
|
281
303
|
var ready = processedRef.current &&
|
|
282
304
|
!!((_h = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _h === void 0 ? void 0 : _h.isLoaded) &&
|
|
@@ -44,42 +44,57 @@ var BtnWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTempla
|
|
|
44
44
|
// Função utilitária para extrair as chaves dos protestos
|
|
45
45
|
var getChaves = function (arr) { return arr.map(function (p) { return p.nm_chave; }); };
|
|
46
46
|
var PROTESTOS_ERROR_SUMMARY = 'Falha ao consultar protestos, tente novamente mais tarde.';
|
|
47
|
+
var clearProtestosCollections = function (state) { return (__assign(__assign({}, (state || {})), { protestosDeCredito: undefined, protestosDeImposto: undefined, protestosGerais: undefined, totalProtestos: undefined, valorTotalProtestos: undefined, nmChaves: undefined })); };
|
|
47
48
|
var Protestos = function () {
|
|
48
|
-
var _a;
|
|
49
|
+
var _a, _b;
|
|
49
50
|
var ctx = useContext(Queries.Protestos);
|
|
50
51
|
var ctxLiminar = useContext(Queries.Liminar);
|
|
51
|
-
var
|
|
52
|
-
var
|
|
52
|
+
var _c = useGlobalData(), globalData = _c.data, setData = _c.setData;
|
|
53
|
+
var _d = useState(false), dataUpdated = _d[0], setDataUpdated = _d[1];
|
|
53
54
|
var protestosAll = useMemo(function () {
|
|
54
55
|
if (!ctx.document)
|
|
55
56
|
return [];
|
|
56
57
|
return XPathUtils.selectArray('//body//protesto', ctx.document).map(parseProtesto);
|
|
57
58
|
}, [ctx.document]);
|
|
58
59
|
var iaOverrides = (_a = globalData.protestosData) === null || _a === void 0 ? void 0 : _a.iaOverrides;
|
|
59
|
-
var
|
|
60
|
+
var _e = useProtestosClassification(protestosAll, iaOverrides), protestosDeCredito = _e.protestosDeCredito, protestosDeImposto = _e.protestosDeImposto, protestosGerais = _e.protestosGerais;
|
|
60
61
|
useEffect(function () {
|
|
62
|
+
var _a;
|
|
63
|
+
var prevProtestos = globalData.protestosData;
|
|
61
64
|
if ((ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Error) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
var alreadyErrored = (prevProtestos === null || prevProtestos === void 0 ? void 0 : prevProtestos.isLoaded) === true &&
|
|
66
|
+
(prevProtestos === null || prevProtestos === void 0 ? void 0 : prevProtestos.isLoading) === false &&
|
|
67
|
+
((_a = prevProtestos === null || prevProtestos === void 0 ? void 0 : prevProtestos.error) === null || _a === void 0 ? void 0 : _a.summary) === PROTESTOS_ERROR_SUMMARY;
|
|
68
|
+
if (alreadyErrored)
|
|
69
|
+
return;
|
|
70
|
+
setData(function (prevState) {
|
|
71
|
+
var current = prevState.protestosData;
|
|
72
|
+
return __assign(__assign({}, prevState), { protestosData: __assign(__assign({}, clearProtestosCollections(current)), { isLoaded: true, isLoading: false, error: { summary: PROTESTOS_ERROR_SUMMARY } }) });
|
|
73
|
+
});
|
|
66
74
|
return;
|
|
67
75
|
}
|
|
68
76
|
if ((ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Empty) {
|
|
69
|
-
|
|
70
|
-
|
|
77
|
+
var alreadyPending = (prevProtestos === null || prevProtestos === void 0 ? void 0 : prevProtestos.isLoaded) === false &&
|
|
78
|
+
(prevProtestos === null || prevProtestos === void 0 ? void 0 : prevProtestos.isLoading) === true &&
|
|
79
|
+
!(prevProtestos === null || prevProtestos === void 0 ? void 0 : prevProtestos.error);
|
|
80
|
+
if (alreadyPending)
|
|
81
|
+
return;
|
|
82
|
+
setData(function (prevState) {
|
|
83
|
+
var current = prevState.protestosData;
|
|
84
|
+
return __assign(__assign({}, prevState), { protestosData: __assign(__assign({}, clearProtestosCollections(current)), { isLoaded: false, isLoading: true, error: undefined }) });
|
|
85
|
+
});
|
|
71
86
|
}
|
|
72
|
-
}, [ctx.type, setData]);
|
|
87
|
+
}, [ctx === null || ctx === void 0 ? void 0 : ctx.type, globalData === null || globalData === void 0 ? void 0 : globalData.protestosData, setData]);
|
|
73
88
|
useEffect(function () {
|
|
74
89
|
if (dataUpdated || !ctx.document)
|
|
75
90
|
return;
|
|
76
91
|
var registros = protestosAll.length;
|
|
77
92
|
var haveException = /Falha na integra/gi.test(XPathUtils.select('string(//raw)', ctx.document));
|
|
78
93
|
if (haveException) {
|
|
79
|
-
setData(function (prevState) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
94
|
+
setData(function (prevState) {
|
|
95
|
+
var prevProtestos = prevState.protestosData;
|
|
96
|
+
return __assign(__assign({}, prevState), { protestosData: __assign(__assign({}, clearProtestosCollections(prevProtestos)), { isLoaded: true, isLoading: false, error: { summary: PROTESTOS_ERROR_SUMMARY } }) });
|
|
97
|
+
});
|
|
83
98
|
setDataUpdated(true);
|
|
84
99
|
return;
|
|
85
100
|
}
|
|
@@ -91,17 +106,8 @@ var Protestos = function () {
|
|
|
91
106
|
return total + valorNumero;
|
|
92
107
|
}, 0);
|
|
93
108
|
setData(function (prevState) {
|
|
94
|
-
var
|
|
95
|
-
return
|
|
96
|
-
protestosDeCredito: protestosDeCredito,
|
|
97
|
-
protestosDeImposto: protestosDeImposto,
|
|
98
|
-
protestosGerais: protestosGerais,
|
|
99
|
-
totalProtestos: registros,
|
|
100
|
-
valorTotalProtestos: valorTotalProtestos,
|
|
101
|
-
isLoaded: true,
|
|
102
|
-
iaOverrides: (_a = prevState.protestosData) === null || _a === void 0 ? void 0 : _a.iaOverrides,
|
|
103
|
-
nmChaves: nmChave
|
|
104
|
-
} }));
|
|
109
|
+
var prevProtestos = prevState.protestosData;
|
|
110
|
+
return __assign(__assign({}, prevState), { protestos: registros, protestosData: __assign(__assign({}, clearProtestosCollections(prevProtestos)), { protestosDeCredito: protestosDeCredito, protestosDeImposto: protestosDeImposto, protestosGerais: protestosGerais, totalProtestos: registros, valorTotalProtestos: valorTotalProtestos, isLoaded: true, isLoading: false, error: undefined, iaOverrides: prevProtestos === null || prevProtestos === void 0 ? void 0 : prevProtestos.iaOverrides, nmChaves: nmChave, failedInstruments: prevProtestos === null || prevProtestos === void 0 ? void 0 : prevProtestos.failedInstruments, failedInstrumentReasons: prevProtestos === null || prevProtestos === void 0 ? void 0 : prevProtestos.failedInstrumentReasons, instrumentCache: prevProtestos === null || prevProtestos === void 0 ? void 0 : prevProtestos.instrumentCache, checkedInstruments: prevProtestos === null || prevProtestos === void 0 ? void 0 : prevProtestos.checkedInstruments }) });
|
|
105
111
|
});
|
|
106
112
|
setDataUpdated(true);
|
|
107
113
|
}, [
|
|
@@ -113,10 +119,20 @@ var Protestos = function () {
|
|
|
113
119
|
protestosGerais
|
|
114
120
|
]);
|
|
115
121
|
useEffect(function () {
|
|
116
|
-
if ((ctx === null || ctx === void 0 ? void 0 : ctx.type)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
122
|
+
if ((ctx === null || ctx === void 0 ? void 0 : ctx.type) !== RequestStatus.Loading)
|
|
123
|
+
return;
|
|
124
|
+
var prevProtestos = globalData.protestosData;
|
|
125
|
+
var alreadyLoading = (prevProtestos === null || prevProtestos === void 0 ? void 0 : prevProtestos.isLoaded) === false &&
|
|
126
|
+
(prevProtestos === null || prevProtestos === void 0 ? void 0 : prevProtestos.isLoading) === true &&
|
|
127
|
+
!(prevProtestos === null || prevProtestos === void 0 ? void 0 : prevProtestos.error);
|
|
128
|
+
if (alreadyLoading)
|
|
129
|
+
return;
|
|
130
|
+
setDataUpdated(false);
|
|
131
|
+
setData(function (prevState) {
|
|
132
|
+
var current = prevState.protestosData;
|
|
133
|
+
return __assign(__assign({}, prevState), { protestosData: __assign(__assign({}, clearProtestosCollections(current)), { isLoaded: false, isLoading: true, error: undefined, iaOverrides: current === null || current === void 0 ? void 0 : current.iaOverrides, failedInstruments: current === null || current === void 0 ? void 0 : current.failedInstruments, failedInstrumentReasons: current === null || current === void 0 ? void 0 : current.failedInstrumentReasons, instrumentCache: current === null || current === void 0 ? void 0 : current.instrumentCache, checkedInstruments: current === null || current === void 0 ? void 0 : current.checkedInstruments }) });
|
|
134
|
+
});
|
|
135
|
+
}, [ctx === null || ctx === void 0 ? void 0 : ctx.type, globalData === null || globalData === void 0 ? void 0 : globalData.protestosData, setData]);
|
|
120
136
|
var handleSuccess = useCallback(function (data) {
|
|
121
137
|
var parsed = XPathUtils.selectArray('//body//protesto', data).map(parseProtesto);
|
|
122
138
|
var registros = parsed.length;
|
|
@@ -150,7 +166,18 @@ var Protestos = function () {
|
|
|
150
166
|
: 'Não há ocorrência de protesto'))
|
|
151
167
|
};
|
|
152
168
|
}, [iaOverrides]);
|
|
153
|
-
|
|
169
|
+
var effectiveCtx = useMemo(function () {
|
|
170
|
+
var _a, _b;
|
|
171
|
+
if (!ctx)
|
|
172
|
+
return ctx;
|
|
173
|
+
var shouldForceLoading = ((_b = (_a = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _a === void 0 ? void 0 : _a.isLoading) !== null && _b !== void 0 ? _b : false) &&
|
|
174
|
+
ctx.type !== RequestStatus.Error;
|
|
175
|
+
if (shouldForceLoading && ctx.type !== RequestStatus.Loading) {
|
|
176
|
+
return __assign(__assign({}, ctx), { type: RequestStatus.Loading });
|
|
177
|
+
}
|
|
178
|
+
return ctx;
|
|
179
|
+
}, [ctx, (_b = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _b === void 0 ? void 0 : _b.isLoading]);
|
|
180
|
+
return (React.createElement(Section, { ctx: effectiveCtx, 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,
|
|
154
181
|
React.createElement(Button, { onClick: function () {
|
|
155
182
|
var _a;
|
|
156
183
|
// Obtém o documento do contexto e formata adequadamente
|