@credithub/harlan-components 1.86.5 → 1.88.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.
@@ -18,3 +18,4 @@ 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
20
  export type { ScoreSerasaState } from '@/@types/domain/scoreTypes';
21
+ export type { ProtestosPagosBaixadosState } from '@/@types/domain/protestosPagosBaixadosTypes';
@@ -0,0 +1,8 @@
1
+ import { IconProps } from '@/@types/icon';
2
+ import React from 'react';
3
+ /**
4
+ * Ícone TrendDown com círculo colorido, compatível com a
5
+ * API `circleFill` usada pelo Header.
6
+ */
7
+ declare const FalenciaIcon: React.FC<IconProps>;
8
+ export default FalenciaIcon;
@@ -0,0 +1,21 @@
1
+ import { TrendDown } from 'phosphor-react';
2
+ import React from 'react';
3
+ import { useTheme } from 'styled-components';
4
+ /**
5
+ * Ícone TrendDown com círculo colorido, compatível com a
6
+ * API `circleFill` usada pelo Header.
7
+ */
8
+ var FalenciaIcon = function (_a) {
9
+ var _b = _a.size, size = _b === void 0 ? 30 : _b, _c = _a.className, className = _c === void 0 ? '' : _c, circleFill = _a.circleFill;
10
+ var theme = useTheme();
11
+ var fill = circleFill || theme.colors.azulCredithub;
12
+ var sizeNumber = Number(size);
13
+ // espaço interno para o desenho da seta
14
+ var inner = Math.floor(sizeNumber * 0.6);
15
+ var offset = (sizeNumber - inner) / 2;
16
+ return (React.createElement("svg", { width: sizeNumber, height: sizeNumber, viewBox: "0 0 ".concat(sizeNumber, " ").concat(sizeNumber), className: className, xmlns: "http://www.w3.org/2000/svg" },
17
+ React.createElement("circle", { cx: sizeNumber / 2, cy: sizeNumber / 2, r: sizeNumber / 2, fill: fill }),
18
+ React.createElement("g", { transform: "translate(".concat(offset, " ").concat(offset, ")") },
19
+ React.createElement(TrendDown, { size: inner, color: "white", weight: "bold" }))));
20
+ };
21
+ export default FalenciaIcon;
@@ -39,7 +39,7 @@ var spin = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObjec
39
39
  // Componente Spinner sutil
40
40
  var Spinner = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border: 1px solid rgba(0, 0, 0, 0.1);\n border-left-color: #222;\n border-radius: 50%;\n width: 9px;\n height: 9px;\n animation: ", " 1s linear infinite;\n margin-right: 8px;\n display: inline-block;\n vertical-align: middle;\n"], ["\n border: 1px solid rgba(0, 0, 0, 0.1);\n border-left-color: #222;\n border-radius: 50%;\n width: 9px;\n height: 9px;\n animation: ", " 1s linear infinite;\n margin-right: 8px;\n display: inline-block;\n vertical-align: middle;\n"])), spin);
41
41
  var ConsultaSimplesSection = function (_a) {
42
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
42
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
43
43
  var documento = _a.documento, children = _a.children, onClose = _a.onClose, isFinancial = _a.isFinancial, rest = __rest(_a, ["documento", "children", "onClose", "isFinancial"]);
44
44
  var ctx = useContext(Queries.Finder);
45
45
  var data = useGlobalData().data;
@@ -84,17 +84,16 @@ var ConsultaSimplesSection = function (_a) {
84
84
  ? "".concat(data.processosJuridicos, " ").concat(data.processosJuridicos === 1 ? 'Processo Jurídico' : 'Processos Jurídicos')
85
85
  : '',
86
86
  loaded: (_l = (_k = data.processosJuridicosData) === null || _k === void 0 ? void 0 : _k.isLoaded) !== null && _l !== void 0 ? _l : false
87
+ },
88
+ {
89
+ label: 'Liminar',
90
+ text: data.liminar &&
91
+ (data.liminar.totalProtestos === 'NADA CONSTA' ||
92
+ data.liminar.message === 'Encontrado')
93
+ ? 'Indício de Liminar'
94
+ : '',
95
+ loaded: (_o = (_m = data.liminar) === null || _m === void 0 ? void 0 : _m.isLoaded) !== null && _o !== void 0 ? _o : false
87
96
  }
88
- // {
89
- // label: 'Liminar',
90
- // text:
91
- // data.liminar &&
92
- // (data.liminar.totalProtestos === 'NADA CONSTA' ||
93
- // data.liminar.message === 'Encontrado')
94
- // ? 'Indício de Liminar'
95
- // : '',
96
- // loaded: data.liminar?.isLoaded ?? false
97
- // }
98
97
  ].filter(function (e) { return (e.label === 'Liminar' ? isFinancial : e); });
99
98
  var isError = (ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Error;
100
99
  var isLoading = (ctx === null || ctx === void 0 ? void 0 : ctx.type) === RequestStatus.Loading;
@@ -103,7 +102,7 @@ var ConsultaSimplesSection = function (_a) {
103
102
  data.dividasPublicas ||
104
103
  data.processosJuridicos ||
105
104
  receitaStatus ||
106
- ((_m = data.liminar) === null || _m === void 0 ? void 0 : _m.message) === 'Encontrado';
105
+ ((_p = data.liminar) === null || _p === void 0 ? void 0 : _p.message) === 'Encontrado';
107
106
  var statusType = isError ? 'warning' : hasPendencias ? 'error' : 'success';
108
107
  return (React.createElement(Section, __assign({ title: "Consulta Simples", subtitle: "Consulta de informa\u00E7\u00F5es do documento.", description: React.createElement(React.Fragment, null,
109
108
  React.createElement(StatusMessage, null, format(new Date(), "dd/MM/yyyy 'às' HH:mm")),
@@ -72,6 +72,7 @@ import { flattenData, selectRelevantData } from './dataUtils';
72
72
  import { processStream } from './processStream';
73
73
  import { createQueryAndMessages } from './queryUtils';
74
74
  import { BetaTag, ChatInput, ChatInputContainer, Container, ContainerInput, GenerativeAi, Header, HeaderContent, InitialMessageBox, InitialMessageContent, LoadingDots, Message, MessageHistory, SendButton, Title } from './styles';
75
+ import { isDocumentHistoryReady, isGlobalReady } from '../../../utils/isGlobalReady';
75
76
  var GenerativeAI = function (_a) {
76
77
  var _b, _c, _d;
77
78
  var documento = _a.documento, refreshQuery = _a.refreshQuery, _e = _a.isFinancial, isFinancial = _e === void 0 ? false : _e;
@@ -89,14 +90,14 @@ var GenerativeAI = function (_a) {
89
90
  var lastQueryRef = useRef(null);
90
91
  var lastUserMessageRef = useRef(null);
91
92
  var messageHistoryRef = useRef(null);
92
- // const isGlobalDataReady = useMemo(() => {
93
- // return isFinancial
94
- // ? isGlobalReady(globalData) // clientes financeiros
95
- // : isDocumentHistoryReady(globalData); // demais clientes
96
- // }, [globalData, isFinancial]);
97
93
  var isGlobalDataReady = useMemo(function () {
98
- return !!globalData.documentHistory; // verificação direta
99
- }, [globalData]);
94
+ return isFinancial
95
+ ? isGlobalReady(globalData) // clientes financeiros
96
+ : isDocumentHistoryReady(globalData); // demais clientes
97
+ }, [globalData, isFinancial]);
98
+ /*const isGlobalDataReady = useMemo(() => {
99
+ return !!globalData.documentHistory; // verificação direta
100
+ }, [globalData]);*/
100
101
  // Atualiza o payload serializado sempre que os dados globais mudarem
101
102
  useEffect(function () {
102
103
  if (globalData && documento && isGlobalDataReady) {
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ declare const Falencia: React.FC<{
3
+ documento: string;
4
+ }>;
5
+ export default Falencia;
@@ -0,0 +1,64 @@
1
+ import React, { useMemo } from 'react';
2
+ import FalenciaIcon from '../../assets/icones/falenciaIcon';
3
+ import Section from '../section';
4
+ import { RequestStatus, useQuery } from '../webservice';
5
+ function parseFalencia(document) {
6
+ var _a;
7
+ if (!document)
8
+ return [];
9
+ if (Array.isArray(document)) {
10
+ return document;
11
+ }
12
+ try {
13
+ var raw = (_a = document.textContent) === null || _a === void 0 ? void 0 : _a.trim();
14
+ if (raw) {
15
+ var json = JSON.parse(raw);
16
+ if (Array.isArray(json))
17
+ return json;
18
+ }
19
+ }
20
+ catch (_b) { }
21
+ try {
22
+ var items = document.querySelectorAll('item');
23
+ if (items === null || items === void 0 ? void 0 : items.length) {
24
+ return Array.from(items).map(function (item) {
25
+ var _a, _b, _c, _d, _e, _f, _g;
26
+ return ({
27
+ title: (_c = (_b = (_a = item.querySelector('title')) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '',
28
+ description: (_e = (_d = item.querySelector('description')) === null || _d === void 0 ? void 0 : _d.textContent) !== null && _e !== void 0 ? _e : '',
29
+ link: (_g = (_f = item.querySelector('link')) === null || _f === void 0 ? void 0 : _f.textContent) !== null && _g !== void 0 ? _g : ''
30
+ });
31
+ });
32
+ }
33
+ }
34
+ catch (_c) { }
35
+ return [];
36
+ }
37
+ var Falencia = function (_a) {
38
+ var documento = _a.documento;
39
+ var _b = useQuery("SELECT FROM 'ValorEconomico'.'Falencia'", { documento: documento }), response = _b.response, error = _b.error, isLoading = _b.isLoading, refetch = _b.refetch;
40
+ var items = useMemo(function () { return parseFalencia(response === null || response === void 0 ? void 0 : response.document); }, [response]);
41
+ var shouldRender = isLoading || items.length > 0;
42
+ if (!shouldRender)
43
+ return null;
44
+ // 🔴 cora a seção de vermelho se houver falência
45
+ var variant = isLoading
46
+ ? 'loading'
47
+ : items.length > 0
48
+ ? 'error'
49
+ : 'default';
50
+ /** ------------------------------------------------------------
51
+ * ctx precisa ter `Section` e `refetch`
52
+ * ----------------------------------------------------------- */
53
+ var ctx = {
54
+ type: isLoading ? RequestStatus.Loading : RequestStatus.Success,
55
+ error: error,
56
+ document: response === null || response === void 0 ? void 0 : response.document,
57
+ response: response === null || response === void 0 ? void 0 : response.response,
58
+ refetch: refetch, // ← agora existe
59
+ Section: Section // ← pode ser o próprio componente (não é usado)
60
+ };
61
+ // Passa o variant para colorir header/icon de acordo
62
+ return (React.createElement(Section, { title: "Fal\u00EAncias", subtitle: "Movimentos falimentares encontrados.", icon: FalenciaIcon, variant: variant, minimized: false, ctx: ctx }));
63
+ };
64
+ export default Falencia;
@@ -2,6 +2,24 @@ interface LiminarProtestosDoPassadoProps {
2
2
  /** CNPJ/CPF analisado para detectar instrumentos de protesto que sumiram do CENPROT */
3
3
  documento: string;
4
4
  }
5
+ export interface ProtestoHistoricoItem {
6
+ cpfCnpj: string;
7
+ data: string;
8
+ dataProtesto: string;
9
+ valor: number;
10
+ valorProtestado: number;
11
+ temAnuencia: boolean;
12
+ nomeApresentante: string | null;
13
+ nomeCedente: string | null;
14
+ chave: string;
15
+ creation: string;
16
+ custas: number;
17
+ missingAt: string;
18
+ protestoProvavelmenteExpirado: boolean;
19
+ }
20
+ export interface ProtestoHistoricoResponse {
21
+ [key: string]: ProtestoHistoricoItem[];
22
+ }
5
23
  /**
6
24
  * Hook que identifica indícios de liminar de sustação de protesto.
7
25
  *
@@ -1,3 +1,14 @@
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
+ };
1
12
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
13
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
14
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -34,12 +45,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
34
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
46
  }
36
47
  };
37
- import XPathUtils from '../../utils/xpath';
38
48
  import { Client } from '@credithub/webservice';
39
49
  import { useCallback, useContext } from 'react';
40
50
  import { WebService } from '../webservice';
41
51
  import { useGlobalData } from '../../contexts/globalDataContext';
42
- import { difference, uniq } from 'lodash';
52
+ import PostHogContext from '../../contexts/PostHogContext';
43
53
  /**
44
54
  * Hook que identifica indícios de liminar de sustação de protesto.
45
55
  *
@@ -54,7 +64,8 @@ var useLiminarProtestosDoPassado = function (_a) {
54
64
  var _b;
55
65
  var documento = _a.documento;
56
66
  var client = useContext(WebService);
57
- var globalData = useGlobalData().data;
67
+ var posthog = useContext(PostHogContext).posthog;
68
+ var _c = useGlobalData(), globalData = _c.data, setData = _c.setData;
58
69
  /** Máximo de requisições simultâneas ao endpoint de PDF. */
59
70
  var MAX_CONCURRENT = 10;
60
71
  /** Timeout (ms) por requisição individual ao PDF. */
@@ -64,22 +75,23 @@ var useLiminarProtestosDoPassado = function (_a) {
64
75
  * Retorna `true` quando há PDF, `false` caso contrário ou erro.
65
76
  */
66
77
  var possuiPdf = function (nm_chave) { return __awaiter(void 0, void 0, void 0, function () {
67
- var ctrl, timer, response, _a;
68
- return __generator(this, function (_b) {
69
- switch (_b.label) {
78
+ var ctrl, timer, response, error_1;
79
+ return __generator(this, function (_a) {
80
+ switch (_a.label) {
70
81
  case 0:
71
82
  ctrl = new AbortController();
72
83
  timer = setTimeout(function () { return ctrl.abort(); }, PDF_TIMEOUT);
73
- _b.label = 1;
84
+ _a.label = 1;
74
85
  case 1:
75
- _b.trys.push([1, 4, 5, 6]);
86
+ _a.trys.push([1, 4, 5, 6]);
76
87
  return [4 /*yield*/, client.request("SELECT FROM 'PDFPROTESTO'.'PDF'", { nm_chave: nm_chave, documento: documento }, undefined, ctrl.signal)];
77
88
  case 2:
78
- response = _b.sent();
89
+ response = _a.sent();
79
90
  return [4 /*yield*/, response.json()];
80
- case 3: return [2 /*return*/, !!(_b.sent())];
91
+ case 3: return [2 /*return*/, !!(_a.sent())];
81
92
  case 4:
82
- _a = _b.sent();
93
+ error_1 = _a.sent();
94
+ console.error('Erro ao verificar PDF:', error_1);
83
95
  return [2 /*return*/, false]; // considera oculto se erro ou timeout
84
96
  case 5:
85
97
  clearTimeout(timer);
@@ -89,20 +101,19 @@ var useLiminarProtestosDoPassado = function (_a) {
89
101
  });
90
102
  }); };
91
103
  var fetch = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
92
- var data, parsed, nodes, numerosChave, ocultos, running, idx, launch, _loop_1;
93
- var _a;
94
- return __generator(this, function (_b) {
95
- switch (_b.label) {
96
- case 0: return [4 /*yield*/, client.request("SELECT FROM 'IEPTB'.'PASTQUERIES'", {
104
+ var data, parsedData, _a, _b, numerosChave, ocultos, running, idx, launch, _loop_1;
105
+ return __generator(this, function (_c) {
106
+ switch (_c.label) {
107
+ case 0: return [4 /*yield*/, client.request("SELECT FROM 'Protestos'.'History'", {
97
108
  documento: documento
98
109
  })];
99
110
  case 1:
100
- data = _b.sent();
111
+ data = _c.sent();
112
+ _b = (_a = Object).values;
101
113
  return [4 /*yield*/, Client.WebService.parse(data)];
102
114
  case 2:
103
- parsed = (_b.sent());
104
- nodes = XPathUtils.selectArray('//protesto/nm_chave', parsed);
105
- numerosChave = difference(uniq(nodes.map(function (n) { return n.textContent || ''; })), ((_a = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _a === void 0 ? void 0 : _a.nmChaves) || []);
115
+ parsedData = _b.apply(_a, [(_c.sent())]).flat();
116
+ numerosChave = parsedData.filter(function (item) { return item.missingAt; }).map(function (item) { return item.chave; });
106
117
  ocultos = [];
107
118
  running = [];
108
119
  idx = 0;
@@ -117,7 +128,7 @@ var useLiminarProtestosDoPassado = function (_a) {
117
128
  }
118
129
  });
119
130
  }); };
120
- _b.label = 3;
131
+ _c.label = 3;
121
132
  case 3:
122
133
  if (!(idx < numerosChave.length || running.length)) return [3 /*break*/, 6];
123
134
  _loop_1 = function () {
@@ -132,15 +143,27 @@ var useLiminarProtestosDoPassado = function (_a) {
132
143
  _loop_1();
133
144
  }
134
145
  if (!running.length) return [3 /*break*/, 5];
135
- return [4 /*yield*/, Promise.all(running)];
146
+ return [4 /*yield*/, Promise.race(running)];
136
147
  case 4:
137
- _b.sent();
138
- _b.label = 5;
148
+ _c.sent();
149
+ _c.label = 5;
139
150
  case 5: return [3 /*break*/, 3];
140
- case 6: return [2 /*return*/, {
141
- possuiIndiciosDeLiminarProtestosDoPassado: ocultos.length > 0,
142
- protestosDoPassadoIds: ocultos
143
- }];
151
+ case 6:
152
+ setData(function (prev) { return (__assign(__assign({}, prev), { protestosPagosBaixados: {
153
+ isLoaded: true,
154
+ protestos: parsedData.filter(function (item) { return item.missingAt; }).filter(function (item) { return !ocultos.includes(item.chave); })
155
+ } })); });
156
+ if (ocultos.length > 0 && posthog) {
157
+ posthog.capture('liminar_protestos_ocultos', {
158
+ documento: documento,
159
+ quantidade: ocultos.length,
160
+ instrumentos: ocultos
161
+ });
162
+ }
163
+ return [2 /*return*/, {
164
+ possuiIndiciosDeLiminarProtestosDoPassado: ocultos.length > 0,
165
+ protestosDoPassadoIds: ocultos
166
+ }];
144
167
  }
145
168
  });
146
169
  }); }, [client, documento, (_b = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _b === void 0 ? void 0 : _b.nmChaves]);
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const ProtestosPagosBaixados: React.FC;
3
+ export default ProtestosPagosBaixados;
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import Section from "../section";
3
+ import { RequestStatus } from '../webservice';
4
+ import ProtestosIcon from '../../assets/icones/protestos';
5
+ import { useGlobalData } from '../../contexts/globalDataContext';
6
+ import { ResultContent } from '../interface/result';
7
+ import AddItemField from '../common/addItem';
8
+ import { formatDocument } from '../../utils/string';
9
+ import { formatMoney } from '../../utils/number';
10
+ import StatusMessage from '../interface/statusMessage';
11
+ var ProtestosPagosBaixados = function () {
12
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
13
+ var data = useGlobalData().data;
14
+ return (React.createElement(Section, { ctx: {
15
+ type: ((_a = data === null || data === void 0 ? void 0 : data.protestosPagosBaixados) === null || _a === void 0 ? void 0 : _a.isLoaded) ? RequestStatus.Success : RequestStatus.Loading,
16
+ error: null,
17
+ response: undefined,
18
+ refetch: function () { },
19
+ document: '',
20
+ Section: Section,
21
+ progress: 90,
22
+ }, title: "Protestos pagos e/ou baixados", subtitle: "Protestos pagos e/ou baixados", description: React.createElement(StatusMessage, { type: ((_c = (_b = data === null || data === void 0 ? void 0 : data.protestosPagosBaixados) === null || _b === void 0 ? void 0 : _b.protestos) === null || _c === void 0 ? void 0 : _c.length) ? 'error' : 'default' }, !((_e = (_d = data === null || data === void 0 ? void 0 : data.protestosPagosBaixados) === null || _d === void 0 ? void 0 : _d.protestos) === null || _e === void 0 ? void 0 : _e.length)
23
+ ? 'Não foram encontradas ocorrências'
24
+ : ((_g = (_f = data === null || data === void 0 ? void 0 : data.protestosPagosBaixados) === null || _f === void 0 ? void 0 : _f.protestos) === null || _g === void 0 ? void 0 : _g.length) === 1
25
+ ? 'Foi encontrado um protesto'
26
+ : "Foram encontrados ".concat((_j = (_h = data === null || data === void 0 ? void 0 : data.protestosPagosBaixados) === null || _h === void 0 ? void 0 : _h.protestos) === null || _j === void 0 ? void 0 : _j.length, " protestos")), variant: ((_l = (_k = data === null || data === void 0 ? void 0 : data.protestosPagosBaixados) === null || _k === void 0 ? void 0 : _k.protestos) === null || _l === void 0 ? void 0 : _l.length) ? 'error' : 'default', icon: ProtestosIcon, onSuccess: function () {
27
+ var _a, _b;
28
+ return (React.createElement("div", null, (_b = (_a = data === null || data === void 0 ? void 0 : data.protestosPagosBaixados) === null || _a === void 0 ? void 0 : _a.protestos) === null || _b === void 0 ? void 0 : _b.map(function (protesto) { return (React.createElement(ResultContent, { key: protesto.chave, print: "repeat(7, 1fr)", desktop: "repeat(8, 1fr)", tablet: "repeat(4, 1fr)", mobile: "repeat(2, 1fr)" },
29
+ React.createElement(AddItemField, { name: "Quem Protestou", value: protesto.nomeCedente }),
30
+ React.createElement(AddItemField, { name: "Atrav\u00E9s De", value: protesto.nomeApresentante }),
31
+ React.createElement(AddItemField, { name: "CPF/CNPJ Protestado", value: formatDocument(protesto.cpfCnpj) }),
32
+ React.createElement(AddItemField, { name: "Data Do Protesto", value: protesto.dataProtesto }),
33
+ React.createElement(AddItemField, { name: "Possui Anu\u00EAncia / Protesto Pago", value: protesto.temAnuencia ? 'Sim' : 'Não' }),
34
+ React.createElement(AddItemField, { name: "Valor Do Protesto", value: formatMoney(protesto.valor) }),
35
+ protesto.custas && (React.createElement(AddItemField, { name: "Custas de Cart\u00F3rio para Baixa", value: formatMoney(protesto.custas) })))); })));
36
+ } }));
37
+ };
38
+ export default ProtestosPagosBaixados;
@@ -159,4 +159,13 @@ export declare const Queries: {
159
159
  urlData?: Client.Form;
160
160
  }>>;
161
161
  };
162
+ Falencia: React.Context<RequestContext<Document>> & {
163
+ Request: React.FC<React.PropsWithChildren<{
164
+ data?: {
165
+ documento: string;
166
+ } | undefined;
167
+ depends?: RequestContext<unknown>[];
168
+ urlData?: Client.Form;
169
+ }>>;
170
+ };
162
171
  };
@@ -365,5 +365,6 @@ export var Queries = {
365
365
  LiminarCenprot: query("SELECT FROM 'LIMINAR'.'CENPROT'"),
366
366
  ReclameAqui: query("SELECT FROM 'RECLAMEAQUI'.'CONSULTA'"),
367
367
  Dominios: query("SELECT FROM 'DOMINIOS'.'CONSULTA'"),
368
- GraficosAnaliticos: query("SELECT FROM 'DOCUMENTHISTORY'.'BASICHISTORY'")
368
+ GraficosAnaliticos: query("SELECT FROM 'DOCUMENTHISTORY'.'BASICHISTORY'"),
369
+ Falencia: query("SELECT FROM 'ValorEconomico'.'Falencia'")
369
370
  };
@@ -1,7 +1,10 @@
1
+ import { PostHog } from 'posthog-js';
1
2
  import React from 'react';
2
3
  import { HasCreditsType } from './components/consultasComplementares';
4
+ type ConsultaSimplesPosthog = PostHog;
3
5
  type ConsultaSimplesProps = {
4
6
  onClickQSA: (cpfCnpj: string) => void;
7
+ posthog?: ConsultaSimplesPosthog;
5
8
  documento: string;
6
9
  apiKey: string;
7
10
  onClose?: () => void;
@@ -6,21 +6,25 @@ import { Chart, registerables } from 'chart.js';
6
6
  import React, { useContext } from 'react';
7
7
  import styled, { ThemeProvider } from 'styled-components';
8
8
  import { Addresses, BankAccounts, CCF, ChartSystem, Contacts, DividasPublicas, Dossie, Partners, ProcessosJuridicos, Protestos, Queries, RefinBoaVista, RefinSerasa, useQuery, Veiculos, WebServiceProvider } from './';
9
+ import Modal from './components/common/modal';
9
10
  import { ConsultaRfbProvider } from './components/consultaRfb';
10
11
  import ConsultaSimplesSection from './components/consultaSimplesSection/consultaSimplesSection';
11
12
  import { ConsultasComplementaresProvider } from './components/consultasComplementares';
12
13
  import Dominios from './components/dominios/dominios';
14
+ import Falencia from './components/falencia/falencia';
13
15
  import ConsultaImoveis from './components/imoveis/imoveisService';
16
+ import Liminar from './components/liminar/liminar';
14
17
  import ProtestosSP from './components/protestos/protestosSp';
18
+ import ProtestosPagosBaixados from './components/protestosPagosBaixados';
15
19
  import ConsultaScore from './components/score/scoreService';
16
20
  import ConsultaScoreSerasa from './components/scoreSerasa/scoreSerasa';
17
21
  import ConsultaSCR from './components/scr/scr';
22
+ import { PostHogProvider } from './contexts/PostHogContext';
18
23
  import { ErrorModalProvider } from './contexts/errorModalContext';
19
24
  import { GlobalDataProvider } from './contexts/globalDataContext';
25
+ import useToggle from './hooks/useToggle';
20
26
  import GlobalStyle from './styles/globalStyle';
21
27
  import theme from './styles/theme';
22
- import useToggle from './hooks/useToggle';
23
- import Modal from './components/common/modal';
24
28
  Chart.register.apply(Chart, registerables);
25
29
  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"])));
26
30
  var FinderDependency = function (_a) {
@@ -49,48 +53,53 @@ var HasCreditsVerification = function (_a) {
49
53
  React.createElement("p", { style: { fontSize: 18 } },
50
54
  "Voc\u00EA n\u00E3o possui cr\u00E9ditos para realizar esta consulta.",
51
55
  React.createElement("br", null),
52
- "Para adquirir cr\u00E9ditos, fa\u00E7a recarga no ",
56
+ "Para adquirir cr\u00E9ditos, fa\u00E7a recarga no",
57
+ ' ',
53
58
  React.createElement("a", { href: "https://painel.credithub.com.br/?apiKey=".concat(apiKey), target: "_blank", rel: "noopener noreferrer" }, "painel.credithub.com.br"),
54
59
  ".")));
55
60
  };
56
61
  var ConsultaSimples = function (_a) {
57
- var _documento = _a.documento, onClickConsultarProcessoJuridico = _a.onClickConsultarProcessoJuridico, onClickQSA = _a.onClickQSA, onClickPrint = _a.onClickPrint, apiKey = _a.apiKey, onClose = _a.onClose, hasCredits = _a.hasCredits, _b = _a.initRefinBoaVista, initRefinBoaVista = _b === void 0 ? false : _b, _c = _a.initRefinSerasa, initRefinSerasa = _c === void 0 ? false : _c, _d = _a.initVeiculos, initVeiculos = _d === void 0 ? false : _d, _e = _a.printMode, printMode = _e === void 0 ? false : _e, _f = _a.isFinancial, isFinancial = _f === void 0 ? false : _f, _g = _a.tags, tags = _g === void 0 ? [] : _g;
62
+ var _documento = _a.documento, onClickConsultarProcessoJuridico = _a.onClickConsultarProcessoJuridico, onClickQSA = _a.onClickQSA, onClickPrint = _a.onClickPrint, apiKey = _a.apiKey, onClose = _a.onClose, hasCredits = _a.hasCredits, _b = _a.initRefinBoaVista, initRefinBoaVista = _b === void 0 ? false : _b, _c = _a.initRefinSerasa, initRefinSerasa = _c === void 0 ? false : _c, _d = _a.initVeiculos, initVeiculos = _d === void 0 ? false : _d, _e = _a.printMode, printMode = _e === void 0 ? false : _e, _f = _a.isFinancial, isFinancial = _f === void 0 ? false : _f, _g = _a.tags, tags = _g === void 0 ? [] : _g, posthog = _a.posthog;
58
63
  var documento = _documento.replace(/\D+/g, '');
59
64
  return (React.createElement(ThemeProvider, { theme: theme },
60
65
  React.createElement(ErrorModalProvider, null,
61
- React.createElement(ConsultasComplementaresProvider, { hasCredits: hasCredits, initRefinBoaVista: initRefinBoaVista, initRefinSerasa: initRefinSerasa, initVeiculos: initVeiculos },
62
- React.createElement(WebServiceProvider, { credential: apiKey },
63
- React.createElement(HasCreditsVerification, { documento: documento, apiKey: apiKey },
64
- React.createElement(Queries.Dominios.Request, { data: { documento: documento, cnpj: documento } },
65
- React.createElement(Queries.Finder.Request, { data: { documento: documento } },
66
- React.createElement(FinderDependency, { documento: documento },
67
- React.createElement(Queries.ProcessosJuridicos.Request, { data: { documento: documento } },
68
- React.createElement(Queries.Liminar.Request, { data: { documento: documento } },
69
- React.createElement(Queries.LiminarCenprot.Request, { data: { documento: documento } },
70
- React.createElement(Wrapper, null,
71
- React.createElement(GlobalDataProvider, null,
72
- React.createElement(ConsultaSimplesSection, { documento: documento, onClose: onClose, onClickPrint: onClickPrint, isFinancial: isFinancial },
73
- React.createElement(ConsultaRfbProvider, { documento: documento },
74
- React.createElement(Dossie, { documento: documento, printMode: printMode, isFinancial: isFinancial }),
75
- React.createElement(Addresses, { apiKey: apiKey }),
76
- React.createElement(Contacts, null),
77
- React.createElement(Partners, { onClickQSA: onClickQSA })),
78
- React.createElement(Dominios, null),
79
- React.createElement(BankAccounts, null),
80
- React.createElement(GraficosAnaliticosDependency, { documento: documento },
81
- React.createElement(ChartSystem, { documento: documento }),
82
- React.createElement(ConsultaSCR, { documento: documento }),
83
- React.createElement(RefinBoaVista, { documento: documento }),
84
- React.createElement(RefinSerasa, { documento: documento }),
85
- React.createElement(ConsultaScore, { documento: documento }),
86
- React.createElement(ConsultaScoreSerasa, { documento: documento }),
87
- React.createElement(ConsultaImoveis, { documento: documento }),
88
- React.createElement(Veiculos, { documento: documento })),
89
- React.createElement(ProtestosSP, null),
90
- React.createElement(Protestos, null),
91
- React.createElement(CCF, null),
92
- React.createElement(DividasPublicas, null),
93
- React.createElement(ProcessosJuridicos, { onClickConsultarProcessoJuridico: onClickConsultarProcessoJuridico })))))))))))))),
66
+ React.createElement(PostHogProvider, { posthog: posthog },
67
+ React.createElement(ConsultasComplementaresProvider, { hasCredits: hasCredits, initRefinBoaVista: initRefinBoaVista, initRefinSerasa: initRefinSerasa, initVeiculos: initVeiculos },
68
+ React.createElement(WebServiceProvider, { credential: apiKey },
69
+ React.createElement(HasCreditsVerification, { documento: documento, apiKey: apiKey },
70
+ React.createElement(Queries.Dominios.Request, { data: { documento: documento, cnpj: documento } },
71
+ React.createElement(Queries.Finder.Request, { data: { documento: documento } },
72
+ React.createElement(FinderDependency, { documento: documento },
73
+ React.createElement(Queries.ProcessosJuridicos.Request, { data: { documento: documento } },
74
+ React.createElement(Queries.Liminar.Request, { data: { documento: documento } },
75
+ React.createElement(Queries.LiminarCenprot.Request, { data: { documento: documento } },
76
+ React.createElement(Wrapper, null,
77
+ React.createElement(GlobalDataProvider, null,
78
+ React.createElement(ConsultaSimplesSection, { documento: documento, onClose: onClose, onClickPrint: onClickPrint, isFinancial: isFinancial },
79
+ React.createElement(ConsultaRfbProvider, { documento: documento },
80
+ React.createElement(Dossie, { documento: documento, printMode: printMode, isFinancial: isFinancial }),
81
+ React.createElement(Liminar, { isFinancial: isFinancial, hasCredits: hasCredits, tags: tags }),
82
+ React.createElement(Falencia, { documento: documento }),
83
+ React.createElement(Addresses, { apiKey: apiKey }),
84
+ React.createElement(Contacts, null),
85
+ React.createElement(Partners, { onClickQSA: onClickQSA })),
86
+ React.createElement(Dominios, null),
87
+ React.createElement(BankAccounts, null),
88
+ React.createElement(GraficosAnaliticosDependency, { documento: documento },
89
+ React.createElement(ChartSystem, { documento: documento }),
90
+ React.createElement(ConsultaSCR, { documento: documento }),
91
+ React.createElement(RefinBoaVista, { documento: documento }),
92
+ React.createElement(RefinSerasa, { documento: documento }),
93
+ React.createElement(ConsultaScore, { documento: documento }),
94
+ React.createElement(ConsultaScoreSerasa, { documento: documento }),
95
+ React.createElement(ConsultaImoveis, { documento: documento }),
96
+ React.createElement(Veiculos, { documento: documento })),
97
+ React.createElement(ProtestosSP, null),
98
+ React.createElement(Protestos, null),
99
+ React.createElement(ProtestosPagosBaixados, null),
100
+ React.createElement(CCF, null),
101
+ React.createElement(DividasPublicas, null),
102
+ React.createElement(ProcessosJuridicos, { onClickConsultarProcessoJuridico: onClickConsultarProcessoJuridico }))))))))))))))),
94
103
  React.createElement(GlobalStyle, null)));
95
104
  };
96
105
  export default ConsultaSimples;
@@ -0,0 +1,13 @@
1
+ import { PostHog } from 'posthog-js';
2
+ import React from 'react';
3
+ type PostHogContextType = {
4
+ posthog: PostHog | undefined;
5
+ };
6
+ declare const PostHogContext: React.Context<PostHogContextType>;
7
+ interface PostHogProviderProps {
8
+ posthog: PostHog | undefined;
9
+ children: React.ReactNode;
10
+ }
11
+ export declare const PostHogProvider: React.FC<PostHogProviderProps>;
12
+ export declare const usePostHog: () => PostHogContextType;
13
+ export default PostHogContext;
@@ -0,0 +1,15 @@
1
+ import React, { createContext, useContext } from 'react';
2
+ // Create the context with a default value
3
+ var PostHogContext = createContext({
4
+ posthog: undefined,
5
+ });
6
+ // Provider component
7
+ export var PostHogProvider = function (_a) {
8
+ var posthog = _a.posthog, children = _a.children;
9
+ return (React.createElement(PostHogContext.Provider, { value: { posthog: posthog } }, children));
10
+ };
11
+ // Hook to use the PostHog context
12
+ export var usePostHog = function () {
13
+ return useContext(PostHogContext);
14
+ };
15
+ export default PostHogContext;