@credithub/harlan-components 1.86.2 → 1.86.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.
@@ -11,6 +11,8 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import ScoreBoaVistaIcon from '../../assets/icones/scoreBoaVista';
13
13
  import { useGlobalData } from '../../contexts/globalDataContext';
14
+ import { useSafeQuery } from '../../hooks/useSafeQuery';
15
+ import { isDocumentoPF } from '../../utils/string';
14
16
  import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
15
17
  import AddItemField from '../common/addItem';
16
18
  import { ConsultasComplementaresContext } from '../consultasComplementares';
@@ -18,8 +20,12 @@ import { Result, ResultContent } from '../interface/result';
18
20
  import StatusMessage from '../interface/statusMessage';
19
21
  import Section from '../section';
20
22
  import { RequestStatus } from '../webservice';
21
- import { isDocumentoPF } from '../../utils/string';
22
- import { useSafeQuery } from '../../hooks/useSafeQuery';
23
+ var parseProb = function (raw) {
24
+ if (raw === null || raw === undefined)
25
+ return 0;
26
+ var str = String(raw).replace(',', '.');
27
+ return Number(str) || 0;
28
+ };
23
29
  var ConsultaScoreSerasa = function (_a) {
24
30
  var _b, _c, _d, _e, _f, _g, _h;
25
31
  var documento = _a.documento;
@@ -66,11 +72,11 @@ var ConsultaScoreSerasa = function (_a) {
66
72
  Section: Section,
67
73
  progress: loadingProgress
68
74
  }, title: "Score Serasa", subtitle: "Consulta de Score", icon: ScoreBoaVistaIcon, description: !error && (React.createElement(StatusMessage, { type: scoreData ? 'success' : 'default' }, description)), onSuccess: function () {
69
- var _a, _b, _c, _d;
75
+ var _a, _b, _c;
70
76
  return (React.createElement(Result, null, scoreData && (React.createElement(ResultContent, { desktop: "repeat(4, 1fr)", tablet: "repeat(3, 1fr)", mobile: "1fr 1fr" },
71
77
  React.createElement(AddItemField, { name: "Score", value: String((_a = scoreData.score) === null || _a === void 0 ? void 0 : _a.pontuacao) }),
72
- React.createElement(AddItemField, { name: "Probabilidade de Inadimpl\u00EAncia", value: "".concat((_b = scoreData.score) === null || _b === void 0 ? void 0 : _b.probabilidade_inadimplencia, "%") }),
73
- React.createElement(AddItemField, { name: "An\u00E1lise", value: "\n DE CADA 100 ".concat(isDocumentoPF(documento) ? 'PESSOAS' : 'EMPRESAS', " \n CLASSIFICADAS NESTA CLASSE DE SCORE, \u00C9 PROV\u00C1VEL QUE \n ").concat(Math.floor(Number((_d = (_c = scoreData.score) === null || _c === void 0 ? void 0 : _c.probabilidade_inadimplencia) === null || _d === void 0 ? void 0 : _d.replace(',', '.'))), " APRESENTEM D\u00C9BITOS NO MERCADO NOS PR\u00D3XIMOS 6 MESES.") })))));
78
+ React.createElement(AddItemField, { name: "Probabilidade de Inadimpl\u00EAncia", value: "".concat(parseProb((_b = scoreData.score) === null || _b === void 0 ? void 0 : _b.probabilidade_inadimplencia), "%") }),
79
+ React.createElement(AddItemField, { name: "An\u00E1lise", value: "\n DE CADA 100 ".concat(isDocumentoPF(documento) ? 'PESSOAS' : 'EMPRESAS', "\n CLASSIFICADAS NESTA CLASSE DE SCORE, \u00C9 PROV\u00C1VEL QUE\n ").concat(Math.floor(parseProb((_c = scoreData.score) === null || _c === void 0 ? void 0 : _c.probabilidade_inadimplencia)), " APRESENTEM D\u00C9BITOS NO MERCADO NOS PR\u00D3XIMOS 6 MESES.") })))));
74
80
  }, isError: function (err) { return ({
75
81
  children: React.createElement(React.Fragment, null),
76
82
  description: (React.createElement(StatusMessage, { type: "error" },