@credithub/harlan-components 1.64.5 → 1.65.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.
@@ -1,6 +1,6 @@
1
1
  import { IconProps } from '@/@types/icon';
2
2
  import React, { ComponentType, DetailedHTMLProps, HTMLAttributes, ReactNode } from 'react';
3
- export type HeaderProps = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLElement> & {
3
+ export type HeaderProps = Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'title' | 'icon'> & {
4
4
  title?: ReactNode;
5
5
  subtitle?: ReactNode;
6
6
  description?: ReactNode;
@@ -13,16 +13,19 @@ export type HeaderProps = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTML
13
13
  showLoadingBar?: boolean;
14
14
  };
15
15
  icon?: ComponentType<IconProps>;
16
- iconProps?: IconProps;
16
+ iconProps?: Record<string, unknown>;
17
17
  titleClassName?: string;
18
18
  subtitleClassName?: string;
19
19
  descriptionClassName?: string;
20
20
  containerClassName?: string;
21
21
  contentClassName?: string;
22
22
  actionsClassName?: string;
23
- innerRef?: React.LegacyRef<HTMLDivElement>;
23
+ innerRef?: React.Ref<HTMLDivElement>;
24
24
  variant?: 'default' | 'error' | 'loading';
25
25
  printBar?: boolean;
26
26
  };
27
+ /** -----------------------------
28
+ * Component
29
+ * ----------------------------- */
27
30
  declare const Header: React.FC<HeaderProps>;
28
31
  export default Header;
@@ -28,6 +28,9 @@ import classNames from 'classnames';
28
28
  import React, { useMemo } from 'react';
29
29
  import styled, { useTheme } from 'styled-components';
30
30
  import LoadingBar from './loadingBar';
31
+ /** -----------------------------
32
+ * Styled helpers
33
+ * ----------------------------- */
31
34
  var Title = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n color: ", ";\n"], ["\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n color: ", ";\n"])), function (_a) {
32
35
  var theme = _a.theme;
33
36
  return theme.typography.headline24.fontSize;
@@ -72,7 +75,7 @@ var Description = styled.div(templateObject_3 || (templateObject_3 = __makeTempl
72
75
  });
73
76
  var HeaderUI = styled(function (_a) {
74
77
  var children = _a.children, props = __rest(_a, ["children"]);
75
- return React.createElement("header", __assign({}, props), children);
78
+ return (React.createElement("header", __assign({}, props), children));
76
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; });
77
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"])));
78
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"])));
@@ -82,8 +85,11 @@ var LoadingBarWrapper = styled.div(templateObject_9 || (templateObject_9 = __mak
82
85
  var hidden = _a.hidden;
83
86
  return (hidden ? 0 : 1);
84
87
  });
88
+ /** -----------------------------
89
+ * Component
90
+ * ----------------------------- */
85
91
  var Header = function (_a) {
86
- var title = _a.title, subtitle = _a.subtitle, description = _a.description, actions = _a.actions, Icon = _a.icon, _b = _a.variant, variant = _b === void 0 ? 'default' : _b, iconProps = _a.iconProps, _c = _a.loadingProps, loadingProps = _c === void 0 ? {} : _c, className = _a.className, titleClassName = _a.titleClassName, subtitleClassName = _a.subtitleClassName, descriptionClassName = _a.descriptionClassName, containerClassName = _a.containerClassName, actionsClassName = _a.actionsClassName, innerRef = _a.innerRef, _d = _a.printBar, printBar = _d === void 0 ? true : _d, props = __rest(_a, ["title", "subtitle", "description", "actions", "icon", "variant", "iconProps", "loadingProps", "className", "titleClassName", "subtitleClassName", "descriptionClassName", "containerClassName", "actionsClassName", "innerRef", "printBar"]);
92
+ var title = _a.title, subtitle = _a.subtitle, description = _a.description, actions = _a.actions, Icon = _a.icon, iconProps = _a.iconProps, _b = _a.variant, variant = _b === void 0 ? 'default' : _b, _c = _a.loadingProps, loadingProps = _c === void 0 ? {} : _c, className = _a.className, titleClassName = _a.titleClassName, subtitleClassName = _a.subtitleClassName, descriptionClassName = _a.descriptionClassName, containerClassName = _a.containerClassName, actionsClassName = _a.actionsClassName, innerRef = _a.innerRef, _d = _a.printBar, printBar = _d === void 0 ? true : _d, rest = __rest(_a, ["title", "subtitle", "description", "actions", "icon", "iconProps", "variant", "loadingProps", "className", "titleClassName", "subtitleClassName", "descriptionClassName", "containerClassName", "actionsClassName", "innerRef", "printBar"]);
87
93
  var theme = useTheme();
88
94
  var headerClass = classNames(className);
89
95
  var actionsClass = classNames(actionsClassName);
@@ -91,18 +97,21 @@ var Header = function (_a) {
91
97
  var isLoading = variant === 'loading';
92
98
  var variantColor = useMemo(function () { return getVariantColor(variant, theme); }, [variant, theme]);
93
99
  return (React.createElement("div", { ref: innerRef },
94
- React.createElement(HeaderUI, __assign({ className: headerClass, color: variantColor }, props),
100
+ React.createElement(HeaderUI, __assign({ className: headerClass, color: variantColor }, rest),
95
101
  React.createElement(HeaderContainer, { className: containerClass },
96
102
  React.createElement(IconWrapper, null, Icon && React.createElement(Icon, __assign({}, iconProps, { circleFill: variantColor }))),
97
103
  React.createElement(TextWrapper, { printBar: printBar },
98
- React.createElement(Title, { hidden: !title, className: classNames(titleClassName) }, title),
104
+ title && (React.createElement(Title, { className: classNames(titleClassName) }, title)),
99
105
  React.createElement("div", { className: "text-wrapper-subtitle-description" },
100
106
  React.createElement(Subtitle, { hidden: isLoading || !subtitle, className: subtitleClassName }, subtitle),
101
107
  React.createElement(Description, { hidden: isLoading || !description, className: descriptionClassName }, description)),
102
108
  React.createElement(LoadingBarWrapper, { hidden: !isLoading },
103
109
  React.createElement(LoadingBar, { percentage: (loadingProps === null || loadingProps === void 0 ? void 0 : loadingProps.percentage) || 0 })))),
104
- React.createElement(ActionsList, { className: actionsClass }, actions && actions))));
110
+ actions && (React.createElement(ActionsList, { className: actionsClass }, actions)))));
105
111
  };
112
+ /** -----------------------------
113
+ * Helpers
114
+ * ----------------------------- */
106
115
  var getVariantColor = function (type, theme) {
107
116
  if (type === void 0) { type = 'default'; }
108
117
  var options = {
@@ -12,11 +12,11 @@ var __assign = (this && this.__assign) || function () {
12
12
  import ProtestosIcon from '../../assets/icones/protestos';
13
13
  import { useGlobalData } from '../../contexts/globalDataContext';
14
14
  import { normalizeName, similarNames } from '../../utils/similarNames';
15
- import React, { useContext, useEffect, useMemo, useRef } from 'react';
15
+ import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
16
16
  import StatusMessage from '../interface/statusMessage';
17
17
  import Section from '../section';
18
18
  import { Queries, RequestStatus } from '../webservice';
19
- // Lista de assuntos válidos para identificação de liminares
19
+ import { TitleWithTooltip, TooltipContainer, TooltipIcon, TooltipText } from './liminarStyles';
20
20
  var validAssuntos = [
21
21
  'protesto indevido de título',
22
22
  'protesto indevido de títulos',
@@ -26,6 +26,14 @@ var validAssuntos = [
26
26
  'inexequibilidade do titulo / inexequibilidade da obrigação',
27
27
  'inexequibilidade do titulo / inexequibilidade da obrigação | tutela de urgência | protesto indevido de título'
28
28
  ].map(normalizeName);
29
+ var businessTypes = [
30
+ 'factoring',
31
+ 'fidc',
32
+ 'securitizadora',
33
+ 'fintech',
34
+ 'banco',
35
+ 'cooperativa'
36
+ ];
29
37
  var Liminar = function () {
30
38
  var _a, _b;
31
39
  var ctx = useContext(Queries.LiminarCenprot);
@@ -34,6 +42,7 @@ var Liminar = function () {
34
42
  var processingRef = useRef(true);
35
43
  var resultRef = useRef('Não encontrado');
36
44
  var dataHashRef = useRef('');
45
+ var _d = useState(false), showInversionInfo = _d[0], setShowInversionInfo = _d[1];
37
46
  var tiposDocumento = useMemo(function () {
38
47
  var _a;
39
48
  var tipoRaw = (_a = ctx.document) === null || _a === void 0 ? void 0 : _a.type;
@@ -69,7 +78,7 @@ var Liminar = function () {
69
78
  labels.add(label);
70
79
  });
71
80
  }
72
- // 2) Sempre verificar processos jurídicos
81
+ // Processos Judiciais sempre checados
73
82
  var carouselName = ((_c = (_b = globalData === null || globalData === void 0 ? void 0 : globalData.dossie) === null || _b === void 0 ? void 0 : _b.carousel) === null || _c === void 0 ? void 0 : _c.name) || '';
74
83
  var empresas = (_d = globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData) === null || _d === void 0 ? void 0 : _d.empresa;
75
84
  if (carouselName && Array.isArray(empresas)) {
@@ -91,6 +100,18 @@ var Liminar = function () {
91
100
  });
92
101
  if (hasJudicial) {
93
102
  labels.add('Liminar no Judiciário');
103
+ var foundBusinessEntity = empresas.some(function (processo) {
104
+ var _a;
105
+ return (_a = processo.envolvidos_ultima_movimentacao) === null || _a === void 0 ? void 0 : _a.some(function (e) {
106
+ if (e.envolvido_tipo !== 'Ativo')
107
+ return false;
108
+ var nomeNorm = normalizeName(e.nome_sem_filtro);
109
+ return businessTypes.some(function (type) { return nomeNorm.includes(type); });
110
+ });
111
+ });
112
+ if (foundBusinessEntity) {
113
+ setShowInversionInfo(true);
114
+ }
94
115
  }
95
116
  }
96
117
  return Array.from(labels);
@@ -150,7 +171,12 @@ var Liminar = function () {
150
171
  if (processedRef.current && resultRef.current === 'Não encontrado') {
151
172
  return null;
152
173
  }
153
- return (React.createElement(Section, { title: "Liminares para Remo\u00E7\u00E3o de Protesto", subtitle: processingRef.current
174
+ return (React.createElement(Section, { title: React.createElement(React.Fragment, null,
175
+ React.createElement(TitleWithTooltip, null,
176
+ "Liminares para Remo\u00E7\u00E3o de Protesto",
177
+ showInversionInfo && (React.createElement(TooltipContainer, null,
178
+ React.createElement(TooltipIcon, null),
179
+ React.createElement(TooltipText, null, "Aten\u00E7\u00E3o: Em alguns casos, o sistema judicial pode registrar os pap\u00E9is das partes de forma invertida, dificultando a interpreta\u00E7\u00E3o direta. Por isso, utilizamos algoritmos internos para detectar esse padr\u00E3o com base em contexto e palavras-chave."))))), subtitle: processingRef.current
154
180
  ? 'Carregando liminar...'
155
181
  : 'Indícios de liminares para ocultação de registros.', icon: ProtestosIcon, ctx: processingRef.current
156
182
  ? __assign(__assign({}, ctx), { type: RequestStatus.Loading }) : derivedCtx, onSuccess: processingRef.current
@@ -0,0 +1,7 @@
1
+ export declare const TooltipContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
2
+ export declare const TooltipIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("phosphor-react").IconProps & import("react").RefAttributes<SVGSVGElement>>, import("styled-components").DefaultTheme, {
3
+ weight: "fill";
4
+ size: 24;
5
+ }, "size" | "weight">;
6
+ export declare const TooltipText: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
7
+ export declare const TitleWithTooltip: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -0,0 +1,15 @@
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 theme from '../../styles/theme';
6
+ import { WarningCircle } from 'phosphor-react';
7
+ import styled from 'styled-components';
8
+ export var TooltipContainer = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n display: inline-flex;\n align-items: center;\n margin-left: 8px;\n\n &:hover {\n span {\n visibility: visible;\n opacity: 1;\n transform: translateY(0);\n }\n }\n"], ["\n position: relative;\n display: inline-flex;\n align-items: center;\n margin-left: 8px;\n\n &:hover {\n span {\n visibility: visible;\n opacity: 1;\n transform: translateY(0);\n }\n }\n"])));
9
+ export var TooltipIcon = styled(WarningCircle).attrs({
10
+ weight: 'fill',
11
+ size: 24
12
+ })(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n color: ", ";\n cursor: pointer;\n transition: transform 0.2s ease;\n\n &:hover {\n transform: scale(1.2);\n }\n"], ["\n color: ", ";\n cursor: pointer;\n transition: transform 0.2s ease;\n\n &:hover {\n transform: scale(1.2);\n }\n"])), theme.colors.laranja);
13
+ export var TooltipText = styled.span(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n visibility: hidden;\n width: 380px;\n max-width: 90vw;\n background-color: ", ";\n color: ", ";\n text-align: left;\n border-radius: 10px;\n padding: 16px 18px;\n font-size: 15px;\n font-weight: 500;\n font-style: normal;\n line-height: 1.5;\n position: absolute;\n z-index: 10;\n top: 130%;\n left: 0;\n opacity: 0;\n transform: translateY(-10px);\n transition:\n opacity 0.3s ease-in-out,\n transform 0.3s ease-in-out;\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);\n\n @media screen and (max-width: 768px) {\n font-size: 14px;\n padding: 14px;\n }\n"], ["\n visibility: hidden;\n width: 380px;\n max-width: 90vw;\n background-color: ", ";\n color: ", ";\n text-align: left;\n border-radius: 10px;\n padding: 16px 18px;\n font-size: 15px;\n font-weight: 500;\n font-style: normal;\n line-height: 1.5;\n position: absolute;\n z-index: 10;\n top: 130%;\n left: 0;\n opacity: 0;\n transform: translateY(-10px);\n transition:\n opacity 0.3s ease-in-out,\n transform 0.3s ease-in-out;\n box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);\n\n @media screen and (max-width: 768px) {\n font-size: 14px;\n padding: 14px;\n }\n"])), theme.colors.cinzaBase, theme.colors.erroApoio);
14
+ export var TitleWithTooltip = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: 8px;\n"], ["\n display: flex;\n align-items: center;\n gap: 8px;\n"])));
15
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4;