@credithub/harlan-components 1.69.4 → 1.70.1
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/@types/domain/index.d.ts +1 -0
- package/dist/components/common/gauge.d.ts +6 -0
- package/dist/components/common/gauge.js +17 -0
- package/dist/components/consultasComplementares.d.ts +2 -0
- package/dist/components/consultasComplementares.js +3 -0
- package/dist/components/dossie/summary/cardsAndProducts.d.ts +5 -0
- package/dist/components/dossie/summary/cardsAndProducts.js +16 -9
- package/dist/components/dossie/summary/utils.d.ts +2 -8
- package/dist/components/dossie/summary/utils.js +1 -0
- package/dist/components/scoreSerasa/scoreSerasa.d.ts +6 -0
- package/dist/components/scoreSerasa/scoreSerasa.js +81 -0
- package/dist/consultaSimples.js +2 -0
- package/lib/cjs/index.js +316 -233
- package/lib/esm/index.js +316 -233
- package/package.json +3 -1
|
@@ -17,3 +17,4 @@ export type { PefinRefinSerasaResponse, RefinSerasaState } from '@/@types/domain
|
|
|
17
17
|
export type { ScoreResponse, ScoreState } from '@/@types/domain/scoreTypes';
|
|
18
18
|
export type { RegistroVeiculo, VeiculosState } from '@/@types/domain/veiculosTypes';
|
|
19
19
|
export type { SCRState } from '@/@types/domain/scrTypes';
|
|
20
|
+
export type { ScoreSerasaState } from '@/@types/domain/scoreTypes';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import React, { useMemo } from "react";
|
|
6
|
+
import styled, { css } from "styled-components";
|
|
7
|
+
import GaugeChart from 'react-gauge-chart';
|
|
8
|
+
import { uniqueId } from "underscore";
|
|
9
|
+
var Wrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (props) { return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n #gauge-chart-", " .needle {\n display: none;\n }\n "], ["\n #gauge-chart-", " .needle {\n display: none;\n }\n "])), props._id); });
|
|
10
|
+
var GaugeScore = function (_a) {
|
|
11
|
+
var score = _a.score;
|
|
12
|
+
var id = useMemo(function () { return uniqueId(); }, []);
|
|
13
|
+
return (React.createElement(Wrapper, { _id: id },
|
|
14
|
+
React.createElement(GaugeChart, { id: "gauge-chart-".concat(id), nrOfLevels: 4, colors: ["#FF5F6D", "#FFC371", "#5fff64"], textColor: "#000000", percent: score / 1000, formatTextValue: function (_value) { return score + ' / 1000'; }, fontSize: "48px" })));
|
|
15
|
+
};
|
|
16
|
+
export default GaugeScore;
|
|
17
|
+
var templateObject_1, templateObject_2;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ImoveisConsultaResponse, PefinRefinSerasaResponse, RefinBoaVistaResponse, ScoreResponse } from '../@types/domain';
|
|
2
2
|
import React, { PropsWithChildren } from 'react';
|
|
3
3
|
import { ParsedResponse } from './webservice';
|
|
4
|
+
import { ScoreSerasaResponse } from '@/@types/domain/scoreTypes';
|
|
4
5
|
type QueryType<DataType = any> = {
|
|
5
6
|
consultaRealizada: boolean;
|
|
6
7
|
data?: ParsedResponse<DataType> | null;
|
|
@@ -12,6 +13,7 @@ type ConsultasComplementaresProps = {
|
|
|
12
13
|
refinSerasa: QueryType<PefinRefinSerasaResponse>;
|
|
13
14
|
refinBoaVista: QueryType<RefinBoaVistaResponse>;
|
|
14
15
|
scoreBoaVista: QueryType<ScoreResponse>;
|
|
16
|
+
scoreSerasa: QueryType<ScoreSerasaResponse>;
|
|
15
17
|
imoveis: QueryType<ImoveisConsultaResponse>;
|
|
16
18
|
};
|
|
17
19
|
export type ConsultasComplementaresContextProps = {
|
|
@@ -22,6 +22,9 @@ export var ConsultasComplementaresProvider = function (_a) {
|
|
|
22
22
|
consultaRealizada: false,
|
|
23
23
|
dataBase: undefined
|
|
24
24
|
},
|
|
25
|
+
scoreSerasa: {
|
|
26
|
+
consultaRealizada: false
|
|
27
|
+
},
|
|
25
28
|
hasCredits: hasCredits
|
|
26
29
|
}), consultasComplementares = _e[0], setConsultasComplementares = _e[1];
|
|
27
30
|
return (React.createElement(ConsultasComplementaresContext.Provider, { value: {
|
|
@@ -46,6 +46,11 @@ declare const useCardsAndProducts: ({ finderResponse }: {
|
|
|
46
46
|
data?: import("../../webservice").ParsedResponse<import("@/@types/domain/scoreTypes").ScoreResponse> | null | undefined;
|
|
47
47
|
dataBase?: string;
|
|
48
48
|
};
|
|
49
|
+
scoreSerasa: {
|
|
50
|
+
consultaRealizada: boolean;
|
|
51
|
+
data?: import("../../webservice").ParsedResponse<import("@/@types/domain/scoreTypes").ScoreSerasaResponse> | null | undefined;
|
|
52
|
+
dataBase?: string;
|
|
53
|
+
};
|
|
49
54
|
imoveis: {
|
|
50
55
|
consultaRealizada: boolean;
|
|
51
56
|
data?: import("../../webservice").ParsedResponse<import("@/@types/domain/imoveisTypes").ImoveisConsultaResponse> | null | undefined;
|
|
@@ -53,13 +53,13 @@ import React, { useState } from 'react';
|
|
|
53
53
|
import { LoadingDots } from '../generativeAi/styles';
|
|
54
54
|
import { getAtividadesEconomicasSecundarias, getField, getFieldRfb, getProductsPrices } from './utils';
|
|
55
55
|
var useCardsAndProducts = function (_a) {
|
|
56
|
-
var _b, _c, _d, _e, _f;
|
|
56
|
+
var _b, _c, _d, _e, _f, _g;
|
|
57
57
|
var finderResponse = _a.finderResponse;
|
|
58
|
-
var
|
|
59
|
-
var
|
|
60
|
-
var
|
|
61
|
-
var
|
|
62
|
-
var
|
|
58
|
+
var _h = useConsultaRfb(), rfbResponse = _h.rfbResponse, rfbIsLoading = _h.isLoading;
|
|
59
|
+
var _j = useState(false), isModalOpen = _j[0], setModalOpen = _j[1];
|
|
60
|
+
var _k = useConsultasComplementares(), consultasComplementares = _k.consultasComplementares, setConsultasComplementares = _k.setConsultasComplementares, hasCredits = _k.hasCredits;
|
|
61
|
+
var _l = useState(false), isScrModalOpen = _l[0], setScrModalOpen = _l[1];
|
|
62
|
+
var _m = useState({}), loadingButtons = _m[0], setLoadingButtons = _m[1];
|
|
63
63
|
var handleModalClick = function () { return setModalOpen(true); };
|
|
64
64
|
var closeModal = function () { return setModalOpen(false); };
|
|
65
65
|
var isPF = !!getField('cpf', finderResponse);
|
|
@@ -106,7 +106,7 @@ var useCardsAndProducts = function (_a) {
|
|
|
106
106
|
});
|
|
107
107
|
}); };
|
|
108
108
|
};
|
|
109
|
-
var
|
|
109
|
+
var _o = {
|
|
110
110
|
cards: [
|
|
111
111
|
{
|
|
112
112
|
title: getField('sexo', finderResponse, function (value) {
|
|
@@ -276,11 +276,18 @@ var useCardsAndProducts = function (_a) {
|
|
|
276
276
|
hide: (_e = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.scoreBoaVista) === null || _e === void 0 ? void 0 : _e.consultaRealizada,
|
|
277
277
|
isLoading: loadingButtons['scoreBoaVista']
|
|
278
278
|
},
|
|
279
|
+
{
|
|
280
|
+
title: 'Consultar Score Serasa',
|
|
281
|
+
price: productsPrices === null || productsPrices === void 0 ? void 0 : productsPrices.scoreSerasa,
|
|
282
|
+
onClick: handleOnClick('scoreSerasa'),
|
|
283
|
+
hide: (_f = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.scoreSerasa) === null || _f === void 0 ? void 0 : _f.consultaRealizada,
|
|
284
|
+
isLoading: loadingButtons['scoreSerasa']
|
|
285
|
+
},
|
|
279
286
|
{
|
|
280
287
|
title: 'Consultar Pefin/Refin Serasa',
|
|
281
288
|
price: productsPrices === null || productsPrices === void 0 ? void 0 : productsPrices.refinSerasa,
|
|
282
289
|
onClick: handleOnClick('refinSerasa'),
|
|
283
|
-
hide: (
|
|
290
|
+
hide: (_g = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.refinSerasa) === null || _g === void 0 ? void 0 : _g.consultaRealizada,
|
|
284
291
|
isLoading: loadingButtons['refinSerasa']
|
|
285
292
|
} /*,
|
|
286
293
|
{
|
|
@@ -291,7 +298,7 @@ var useCardsAndProducts = function (_a) {
|
|
|
291
298
|
isLoading: loadingButtons['imoveis']
|
|
292
299
|
}*/
|
|
293
300
|
]
|
|
294
|
-
}, cards =
|
|
301
|
+
}, cards = _o.cards, products = _o.products;
|
|
295
302
|
return {
|
|
296
303
|
cards: cards,
|
|
297
304
|
products: products,
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
+
import { ConsultasComplementaresContextProps } from '../../../components/consultasComplementares';
|
|
1
2
|
export declare const getField: (path: string, response?: Document, formatter?: (value: string | number) => string) => string;
|
|
2
3
|
export declare const getFieldRfb: (path: string, response?: Document | null, formatter?: (value: string | number) => string) => string;
|
|
3
4
|
export declare const getAtividadesEconomicasSecundarias: (response?: Document | null) => string[];
|
|
4
|
-
export declare const getProductsPrices: (isPF: boolean) =>
|
|
5
|
-
refinBoaVista: number;
|
|
6
|
-
scoreBoaVista: number;
|
|
7
|
-
refinSerasa: number;
|
|
8
|
-
veiculos: number;
|
|
9
|
-
scr: number;
|
|
10
|
-
imoveis: number;
|
|
11
|
-
};
|
|
5
|
+
export declare const getProductsPrices: (isPF: boolean) => Record<keyof ConsultasComplementaresContextProps["consultasComplementares"], number>;
|
|
@@ -42,6 +42,7 @@ export var getAtividadesEconomicasSecundarias = function (response) {
|
|
|
42
42
|
export var getProductsPrices = function (isPF) { return ({
|
|
43
43
|
refinBoaVista: isPF ? 1.2 : 2.7,
|
|
44
44
|
scoreBoaVista: isPF ? 3 : 6,
|
|
45
|
+
scoreSerasa: 5,
|
|
45
46
|
refinSerasa: 4.2,
|
|
46
47
|
veiculos: 10,
|
|
47
48
|
scr: 7,
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import ScoreBoaVistaIcon from '../../assets/icones/scoreBoaVista';
|
|
13
|
+
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
14
|
+
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
15
|
+
import AddItemField from '../common/addItem';
|
|
16
|
+
import { ConsultasComplementaresContext } from '../consultasComplementares';
|
|
17
|
+
import { Result, ResultContent } from '../interface/result';
|
|
18
|
+
import StatusMessage from '../interface/statusMessage';
|
|
19
|
+
import Section from '../section';
|
|
20
|
+
import { RequestStatus, useQuery } from '../webservice';
|
|
21
|
+
import { isDocumentoPF } from '../../utils/string';
|
|
22
|
+
var ConsultaScoreSerasa = function (_a) {
|
|
23
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
24
|
+
var documento = _a.documento;
|
|
25
|
+
var consultasComplementaresContext = useContext(ConsultasComplementaresContext);
|
|
26
|
+
var setData = useGlobalData().setData;
|
|
27
|
+
var _j = useState(false), dataUpdated = _j[0], setDataUpdated = _j[1];
|
|
28
|
+
var _k = useQuery("SELECT FROM 'ScoreSerasa'.'Consulta'", { documento: documento }, (_c = (_b = consultasComplementaresContext === null || consultasComplementaresContext === void 0 ? void 0 : consultasComplementaresContext.consultasComplementares) === null || _b === void 0 ? void 0 : _b.scoreSerasa) === null || _c === void 0 ? void 0 : _c.consultaRealizada), response = _k.response, isLoading = _k.isLoading, error = _k.error, loadingProgress = _k.loadingProgress;
|
|
29
|
+
var scoreData = (_d = response === null || response === void 0 ? void 0 : response.document) === null || _d === void 0 ? void 0 : _d.dados;
|
|
30
|
+
var scoreRef = useRef(null);
|
|
31
|
+
var consultaRealizada = useMemo(function () {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
return (_b = (_a = consultasComplementaresContext === null || consultasComplementaresContext === void 0 ? void 0 : consultasComplementaresContext.consultasComplementares) === null || _a === void 0 ? void 0 : _a.scoreSerasa) === null || _b === void 0 ? void 0 : _b.consultaRealizada;
|
|
34
|
+
}, [
|
|
35
|
+
(_f = (_e = consultasComplementaresContext === null || consultasComplementaresContext === void 0 ? void 0 : consultasComplementaresContext.consultasComplementares) === null || _e === void 0 ? void 0 : _e.scoreSerasa) === null || _f === void 0 ? void 0 : _f.consultaRealizada
|
|
36
|
+
]);
|
|
37
|
+
var description = ((_g = scoreData === null || scoreData === void 0 ? void 0 : scoreData.score) === null || _g === void 0 ? void 0 : _g.score_calculado) == 'S'
|
|
38
|
+
? "Score: ".concat((_h = scoreData === null || scoreData === void 0 ? void 0 : scoreData.score) === null || _h === void 0 ? void 0 : _h.pontuacao)
|
|
39
|
+
: 'Não há informação de score disponível para este documento.';
|
|
40
|
+
useEffect(function () {
|
|
41
|
+
var _a;
|
|
42
|
+
var topOffset = ((_a = scoreRef.current) === null || _a === void 0 ? void 0 : _a.offsetTop) || 0;
|
|
43
|
+
window.scrollTo({
|
|
44
|
+
top: topOffset,
|
|
45
|
+
behavior: 'smooth'
|
|
46
|
+
});
|
|
47
|
+
}, [consultaRealizada]);
|
|
48
|
+
useEffect(function () {
|
|
49
|
+
if (!consultaRealizada && !dataUpdated && response && response.document) {
|
|
50
|
+
var scoreData_1 = { scoreSerasa: response.document };
|
|
51
|
+
setData(function (prevState) { return (__assign(__assign({}, prevState), { scoreSerasa: scoreData_1 })); });
|
|
52
|
+
setDataUpdated(true);
|
|
53
|
+
}
|
|
54
|
+
}, [response, consultaRealizada, dataUpdated, setData]);
|
|
55
|
+
return consultaRealizada ? (React.createElement(Section, { ref: scoreRef, ctx: {
|
|
56
|
+
type: isLoading
|
|
57
|
+
? RequestStatus.Loading
|
|
58
|
+
: error
|
|
59
|
+
? RequestStatus.Error
|
|
60
|
+
: RequestStatus.Success,
|
|
61
|
+
error: error || null,
|
|
62
|
+
response: undefined,
|
|
63
|
+
document: response === null || response === void 0 ? void 0 : response.document,
|
|
64
|
+
refetch: function () { },
|
|
65
|
+
Section: Section,
|
|
66
|
+
progress: loadingProgress
|
|
67
|
+
}, title: "Score Serasa", subtitle: "Consulta de Score", icon: ScoreBoaVistaIcon, description: !error && (React.createElement(StatusMessage, { type: scoreData ? 'success' : 'default' }, description)), onSuccess: function () {
|
|
68
|
+
var _a, _b, _c;
|
|
69
|
+
return (React.createElement(Result, null, scoreData && (React.createElement(ResultContent, { desktop: "repeat(4, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" },
|
|
70
|
+
React.createElement(AddItemField, { name: "Score", value: String((_a = scoreData.score) === null || _a === void 0 ? void 0 : _a.pontuacao) }),
|
|
71
|
+
React.createElement(AddItemField, { name: "Probabilidade de Inadimpl\u00EAncia", value: "".concat((_b = scoreData.score) === null || _b === void 0 ? void 0 : _b.probabilidade_inadimplencia, "%") }),
|
|
72
|
+
React.createElement(AddItemField, { name: "An\u00E1lise", value: "DE CADA 100 ".concat(isDocumentoPF(documento) ? 'PESSOAS' : 'EMPRESAS', " CLASSIFICADAS NESTA CLASSE DE SCORE, \u00C9 PROV\u00C1VEL QUE ").concat(Math.floor(Number((_c = scoreData.score) === null || _c === void 0 ? void 0 : _c.probabilidade_inadimplencia)), " APRESENTEM D\u00C9BITOS NO MERCADO NOS PR\u00D3XIMOS 6 MESES.") })))));
|
|
73
|
+
}, isError: function (err) { return ({
|
|
74
|
+
children: React.createElement(React.Fragment, null),
|
|
75
|
+
description: (React.createElement(StatusMessage, { type: "error" },
|
|
76
|
+
"Erro ao realizar a consulta: ",
|
|
77
|
+
err.message)),
|
|
78
|
+
variant: 'error'
|
|
79
|
+
}); } })) : null;
|
|
80
|
+
};
|
|
81
|
+
export default ConsultaScoreSerasa;
|
package/dist/consultaSimples.js
CHANGED
|
@@ -17,6 +17,7 @@ import ConsultaSCR from './components/scr/scr';
|
|
|
17
17
|
import { GlobalDataProvider } from './contexts/globalDataContext';
|
|
18
18
|
import GlobalStyle from './styles/globalStyle';
|
|
19
19
|
import theme from './styles/theme';
|
|
20
|
+
import ConsultaScoreSerasa from './components/scoreSerasa/scoreSerasa';
|
|
20
21
|
Chart.register.apply(Chart, registerables);
|
|
21
22
|
var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: 'Open Sans Condensed';\n display: flex;\n flex-direction: column;\n gap: 20px;\n margin-bottom: 20px;\n\n * {\n -webkit-print-color-adjust: exact !important;\n print-color-adjust: exact !important;\n }\n\n @media print {\n @page {\n size: auto;\n margin: 5mm;\n }\n }\n"], ["\n font-family: 'Open Sans Condensed';\n display: flex;\n flex-direction: column;\n gap: 20px;\n margin-bottom: 20px;\n\n * {\n -webkit-print-color-adjust: exact !important;\n print-color-adjust: exact !important;\n }\n\n @media print {\n @page {\n size: auto;\n margin: 5mm;\n }\n }\n"])));
|
|
22
23
|
var FinderDependency = function (_a) {
|
|
@@ -54,6 +55,7 @@ var ConsultaSimples = function (_a) {
|
|
|
54
55
|
React.createElement(RefinBoaVista, { documento: documento }),
|
|
55
56
|
React.createElement(RefinSerasa, { documento: documento }),
|
|
56
57
|
React.createElement(ConsultaScore, { documento: documento }),
|
|
58
|
+
React.createElement(ConsultaScoreSerasa, { documento: documento }),
|
|
57
59
|
React.createElement(ConsultaImoveis, { documento: documento }),
|
|
58
60
|
React.createElement(Veiculos, { documento: documento })),
|
|
59
61
|
React.createElement(Protestos, null),
|