@credithub/harlan-components 1.101.3 → 1.102.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.
@@ -43,7 +43,7 @@ var spin = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObjec
43
43
  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);
44
44
  var ConsultaSimplesSection = function (_a) {
45
45
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
46
- var documento = _a.documento, children = _a.children, onClose = _a.onClose, isFinancial = _a.isFinancial, ctime = _a.ctime, rest = __rest(_a, ["documento", "children", "onClose", "isFinancial", "ctime"]);
46
+ var documento = _a.documento, children = _a.children, onClose = _a.onClose, isFinancial = _a.isFinancial, ctime = _a.ctime, printMode = _a.printMode, rest = __rest(_a, ["documento", "children", "onClose", "isFinancial", "ctime", "printMode"]);
47
47
  var ctx = useContext(Queries.Finder);
48
48
  var data = useGlobalData().data;
49
49
  var posthog = usePostHog().posthog;
@@ -157,7 +157,7 @@ var ConsultaSimplesSection = function (_a) {
157
157
  })), onClose: onClose, icon: ConsultaSimplesIcon, variant: isLoading ? 'loading' : 'default', ctx: ctx, loadingProps: {
158
158
  percentage: (ctx === null || ctx === void 0 ? void 0 : ctx.progress) || 0,
159
159
  hidden: !isLoading
160
- } }, rest), children));
160
+ }, printMode: printMode }, rest), children));
161
161
  };
162
162
  export default ConsultaSimplesSection;
163
163
  var templateObject_1, templateObject_2;
@@ -7,6 +7,7 @@ export interface SectionProps extends React.PropsWithChildren<{
7
7
  minimized?: boolean;
8
8
  contentClassName?: string;
9
9
  ctx?: RequestContext<any>;
10
+ printMode?: boolean;
10
11
  } & HeaderProps> {
11
12
  }
12
13
  declare const Section: React.FC<SectionProps>;
@@ -16,18 +16,18 @@ import Header from './header';
16
16
  var SectionContaner = styled.section(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n @media screen {\n background-color: rgb(239, 239, 239);\n }\n page-break-before: avoid;\n page-break-after: avoid;\n page-break-inside: avoid;\n"], ["\n @media screen {\n background-color: rgb(239, 239, 239);\n }\n page-break-before: avoid;\n page-break-after: avoid;\n page-break-inside: avoid;\n"])));
17
17
  var ResultContainer = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: ", ";\n position: relative;\n margin-top: 20px;\n flex-direction: column;\n row-gap: 20px;\n @media screen {\n background-color: #efefef;\n }\n"], ["\n display: ", ";\n position: relative;\n margin-top: 20px;\n flex-direction: column;\n row-gap: 20px;\n @media screen {\n background-color: #efefef;\n }\n"])), function (props) { return (props.hide ? 'none' : 'flex'); });
18
18
  var Section = function (_a) {
19
- var title = _a.title, subtitle = _a.subtitle, description = _a.description, _b = _a.minimized, minimized = _b === void 0 ? false : _b, onClose = _a.onClose, variant = _a.variant, loadingProps = _a.loadingProps, icon = _a.icon, actions = _a.actions, children = _a.children, onClickPrint = _a.onClickPrint, className = _a.className, contentClassName = _a.contentClassName;
20
- var _c = useToggle(!minimized), isOpen = _c[0], toggleOpen = _c[1];
19
+ var title = _a.title, subtitle = _a.subtitle, description = _a.description, _b = _a.minimized, minimized = _b === void 0 ? false : _b, onClose = _a.onClose, variant = _a.variant, loadingProps = _a.loadingProps, icon = _a.icon, actions = _a.actions, children = _a.children, onClickPrint = _a.onClickPrint, className = _a.className, contentClassName = _a.contentClassName, _c = _a.printMode, printMode = _c === void 0 ? false : _c;
20
+ var _d = useToggle(!minimized), isOpen = _d[0], toggleOpen = _d[1];
21
21
  var sectionClass = classNames(className);
22
22
  var sectionContentClass = classNames(contentClassName);
23
23
  return (React.createElement(SectionContaner, { className: sectionClass },
24
- React.createElement(Header, { title: title, subtitle: subtitle, description: description, loadingProps: loadingProps, icon: icon, variant: variant, actions: React.createElement(React.Fragment, null,
24
+ React.createElement(Header, { title: title, subtitle: subtitle, description: description, loadingProps: loadingProps, icon: icon, variant: variant, actions: !printMode ? (React.createElement(React.Fragment, null,
25
25
  React.createElement(BtnWrapper, null,
26
26
  React.createElement(PrintIcon, { onClick: onClickPrint })),
27
27
  children && (React.createElement(BtnWrapper, { hidden: variant === 'loading', onClick: toggleOpen }, isOpen ? React.createElement(ChevronUp, null) : React.createElement(ChevronDown, null))),
28
28
  onClose && (React.createElement(BtnWrapper, { onClick: onClose },
29
29
  React.createElement(CloseIcon, null))),
30
- actions) }),
30
+ actions)) : undefined }),
31
31
  React.createElement(ResultContainer, { className: sectionContentClass, hide: !isOpen }, children)));
32
32
  };
33
33
  export default Section;
@@ -28,6 +28,7 @@ var _a;
28
28
  import BtnWrapper from '../assets/btn/btnWrapper';
29
29
  import ChevronDown from '../assets/btn/chevronDown';
30
30
  import ChevronUp from '../assets/btn/chevronUp';
31
+ import { usePrintMode } from '../contexts/printModeContext';
31
32
  import useToggle from '../hooks/useToggle';
32
33
  import cn from 'classnames';
33
34
  import React, { forwardRef, useCallback, useMemo } from 'react';
@@ -53,6 +54,7 @@ var Section = forwardRef(function (_a, ref) {
53
54
  };
54
55
  } : _b, _c = _a.onLoading, onLoading = _c === void 0 ? function () { return React.createElement(React.Fragment, null); } : _c, ctx = _a.ctx, className = _a.className, _d = _a.hideHeader, hideHeader = _d === void 0 ? false : _d, _e = _a.minimized, minimized = _e === void 0 ? false : _e, headerProps = __rest(_a, ["onSuccess", "isError", "onLoading", "ctx", "className", "hideHeader", "minimized"]);
55
56
  var _f = useToggle(!minimized), isOpen = _f[0], toggleOpen = _f[1];
57
+ var printMode = usePrintMode().printMode;
56
58
  if (!ctx)
57
59
  return null;
58
60
  var type = ctx.type, progress = ctx.progress;
@@ -60,16 +62,26 @@ var Section = forwardRef(function (_a, ref) {
60
62
  switch (type) {
61
63
  case RequestStatus.Success:
62
64
  return onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(ctx.document, ctx);
63
- case RequestStatus.Error:
64
- return isError(ctx.error, ctx);
65
+ case RequestStatus.Error: {
66
+ var errorResult = isError(ctx.error, ctx);
67
+ if (printMode &&
68
+ errorResult &&
69
+ typeof errorResult === 'object' &&
70
+ 'actions' in errorResult) {
71
+ return __assign(__assign({}, errorResult), { actions: null });
72
+ }
73
+ return errorResult;
74
+ }
65
75
  case RequestStatus.Loading:
66
76
  return onLoading(ctx);
67
77
  default:
68
78
  return null;
69
79
  }
70
- }, [type, onSuccess, isError, onLoading, ctx]);
80
+ }, [type, onSuccess, isError, onLoading, ctx, printMode]);
71
81
  var renderedResponse = renderResponse();
72
- var defaultHeaderActions = useMemo(function () { return (React.createElement(BtnWrapper, { hidden: type === RequestStatus.Loading, onClick: toggleOpen }, isOpen ? React.createElement(ChevronUp, null) : React.createElement(ChevronDown, null))); }, [type, isOpen, toggleOpen]);
82
+ var defaultHeaderActions = useMemo(function () {
83
+ return !printMode ? (React.createElement(BtnWrapper, { hidden: type === RequestStatus.Loading, onClick: toggleOpen }, isOpen ? React.createElement(ChevronUp, null) : React.createElement(ChevronDown, null))) : null;
84
+ }, [type, isOpen, toggleOpen, printMode]);
73
85
  var renderHeader = function (props) { return (React.createElement(Header, __assign({ printBar: renderedResponse !== null && isOpen }, props, { className: cn(className, type !== undefined && headerStatus[type]
74
86
  ? headerStatus[type]
75
87
  : '', props.className), variant: type === RequestStatus.Loading ? 'loading' : props.variant, loadingProps: {
@@ -21,6 +21,7 @@ import ConsultaSCR from './components/scr/scr';
21
21
  import { PostHogProvider } from './contexts/PostHogContext';
22
22
  import { ErrorModalProvider } from './contexts/errorModalContext';
23
23
  import { GlobalDataProvider } from './contexts/globalDataContext';
24
+ import { PrintModeProvider } from './contexts/printModeContext';
24
25
  import useToggle from './hooks/useToggle';
25
26
  import GlobalStyle from './styles/globalStyle';
26
27
  import theme from './styles/theme';
@@ -67,42 +68,43 @@ var ConsultaSimples = function (_a) {
67
68
  return (React.createElement(ThemeProvider, { theme: theme },
68
69
  React.createElement(ErrorModalProvider, null,
69
70
  React.createElement(PostHogProvider, { posthog: posthog },
70
- React.createElement(ConsultasComplementaresProvider, { hasCredits: hasCredits, initRefinBoaVista: initRefinBoaVista, initRefinSerasa: initRefinSerasa, initVeiculos: initVeiculos },
71
- React.createElement(WebServiceProvider, { credential: apiKey, defaultData: queryParams === null || queryParams === void 0 ? void 0 : queryParams.data, defaultUrlData: queryParams === null || queryParams === void 0 ? void 0 : queryParams.urlData },
72
- React.createElement(HasCreditsVerification, { documento: documento, apiKey: apiKey },
73
- React.createElement(Queries.Dominios.Request, { data: { documento: documento, cnpj: documento } },
74
- React.createElement(Queries.Finder.Request, { data: { documento: documento } },
75
- React.createElement(FinderDependency, { documento: documento },
76
- React.createElement(Queries.ProcessosJuridicos.Request, { data: { documento: documento } },
77
- React.createElement(Queries.Liminar.Request, { data: { documento: documento } },
78
- React.createElement(Queries.LiminarCenprot.Request, { data: { documento: documento } },
79
- React.createElement(Wrapper, null,
80
- React.createElement(GlobalDataProvider, null,
81
- React.createElement(ConsultaSimplesSection, { documento: documento, onClose: onClose, onClickPrint: onClickPrint, isFinancial: isFinancial, ctime: ctimeProp },
82
- React.createElement(ConsultaRfbProvider, { documento: documento },
83
- React.createElement(Dossie, { documento: documento, printMode: printMode, isFinancial: isFinancial }),
84
- React.createElement(Liminar, { isFinancial: isFinancial, hasCredits: hasCredits, tags: tags }),
85
- React.createElement(Falencia, { documento: documento }),
86
- React.createElement(Addresses, { apiKey: apiKey }),
87
- React.createElement(Contacts, null),
88
- React.createElement(Partners, { onClickQSA: onClickQSA })),
89
- React.createElement(Dominios, null),
90
- React.createElement(BankAccounts, null),
91
- React.createElement(GraficosAnaliticosDependency, { documento: documento },
92
- React.createElement(ChartSystem, { documento: documento }),
93
- React.createElement(ConsultaSCR, { documento: documento }),
94
- React.createElement(RefinBoaVista, { documento: documento }),
95
- React.createElement(RefinSerasa, { documento: documento }),
96
- React.createElement(ConsultaScore, { documento: documento }),
97
- React.createElement(ConsultaScoreSerasa, { documento: documento }),
98
- React.createElement(ConsultaImoveis, { documento: documento }),
99
- React.createElement(Veiculos, { documento: documento })),
100
- React.createElement(ProtestosSP, null),
101
- React.createElement(Protestos, null),
102
- React.createElement(ProtestosPagosBaixados, { isFinancial: isFinancial }),
103
- React.createElement(CCF, null),
104
- React.createElement(DividasPublicas, null),
105
- React.createElement(ProcessosJuridicos, { onClickConsultarProcessoJuridico: onClickConsultarProcessoJuridico }))))))))))))))),
71
+ React.createElement(PrintModeProvider, { printMode: printMode },
72
+ React.createElement(ConsultasComplementaresProvider, { hasCredits: hasCredits, initRefinBoaVista: initRefinBoaVista, initRefinSerasa: initRefinSerasa, initVeiculos: initVeiculos },
73
+ React.createElement(WebServiceProvider, { credential: apiKey, defaultData: queryParams === null || queryParams === void 0 ? void 0 : queryParams.data, defaultUrlData: queryParams === null || queryParams === void 0 ? void 0 : queryParams.urlData },
74
+ React.createElement(HasCreditsVerification, { documento: documento, apiKey: apiKey },
75
+ React.createElement(Queries.Dominios.Request, { data: { documento: documento, cnpj: documento } },
76
+ React.createElement(Queries.Finder.Request, { data: { documento: documento } },
77
+ React.createElement(FinderDependency, { documento: documento },
78
+ React.createElement(Queries.ProcessosJuridicos.Request, { data: { documento: documento } },
79
+ React.createElement(Queries.Liminar.Request, { data: { documento: documento } },
80
+ React.createElement(Queries.LiminarCenprot.Request, { data: { documento: documento } },
81
+ React.createElement(Wrapper, null,
82
+ React.createElement(GlobalDataProvider, null,
83
+ React.createElement(ConsultaSimplesSection, { documento: documento, onClose: onClose, onClickPrint: onClickPrint, isFinancial: isFinancial, ctime: ctimeProp, printMode: printMode },
84
+ React.createElement(ConsultaRfbProvider, { documento: documento },
85
+ React.createElement(Dossie, { documento: documento, printMode: printMode, isFinancial: isFinancial }),
86
+ React.createElement(Liminar, { isFinancial: isFinancial, hasCredits: hasCredits, tags: tags }),
87
+ React.createElement(Falencia, { documento: documento }),
88
+ React.createElement(Addresses, { apiKey: apiKey }),
89
+ React.createElement(Contacts, null),
90
+ React.createElement(Partners, { onClickQSA: onClickQSA })),
91
+ React.createElement(Dominios, null),
92
+ React.createElement(BankAccounts, null),
93
+ React.createElement(GraficosAnaliticosDependency, { documento: documento },
94
+ React.createElement(ChartSystem, { documento: documento }),
95
+ React.createElement(ConsultaSCR, { documento: documento }),
96
+ React.createElement(RefinBoaVista, { documento: documento }),
97
+ React.createElement(RefinSerasa, { documento: documento }),
98
+ React.createElement(ConsultaScore, { documento: documento }),
99
+ React.createElement(ConsultaScoreSerasa, { documento: documento }),
100
+ React.createElement(ConsultaImoveis, { documento: documento }),
101
+ React.createElement(Veiculos, { documento: documento })),
102
+ React.createElement(ProtestosSP, null),
103
+ React.createElement(Protestos, null),
104
+ React.createElement(ProtestosPagosBaixados, { isFinancial: isFinancial }),
105
+ React.createElement(CCF, null),
106
+ React.createElement(DividasPublicas, null),
107
+ React.createElement(ProcessosJuridicos, { onClickConsultarProcessoJuridico: onClickConsultarProcessoJuridico })))))))))))))))),
106
108
  React.createElement(GlobalStyle, null)));
107
109
  };
108
110
  export default ConsultaSimples;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface PrintModeContextType {
3
+ printMode: boolean;
4
+ }
5
+ export declare const usePrintMode: () => PrintModeContextType;
6
+ export declare const PrintModeProvider: React.FC<React.PropsWithChildren<{
7
+ printMode: boolean;
8
+ }>>;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import React, { createContext, useContext } from 'react';
2
+ var PrintModeContext = createContext({
3
+ printMode: false
4
+ });
5
+ export var usePrintMode = function () { return useContext(PrintModeContext); };
6
+ export var PrintModeProvider = function (_a) {
7
+ var children = _a.children, printMode = _a.printMode;
8
+ return (React.createElement(PrintModeContext.Provider, { value: { printMode: printMode } }, children));
9
+ };
@@ -5,7 +5,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
5
5
  // src/styles/globalStyle.tsx
6
6
  import React from 'react';
7
7
  import { createGlobalStyle } from 'styled-components';
8
- var GlobalStyle = createGlobalStyle(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n /* Reset + fonte padr\u00E3o para toda a aplica\u00E7\u00E3o (inclui modais e portais) */\n *, *::before, *::after {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n font-family: 'Open Sans Condensed', sans-serif;\n }\n\n body {\n -webkit-font-smoothing: antialiased;\n }\n\n /* Oculta bot\u00F5es na impress\u00E3o */\n @media print {\n button,\n [class*=\"Button\"],\n [class^=\"Button\"],\n [class*=\"btn\"],\n [class^=\"btn\"],\n .button,\n .btn {\n display: none !important;\n }\n }\n\n /* Anima\u00E7\u00F5es utilit\u00E1rias */\n @keyframes highlight {\n from {\n background-color: rgba(255, 215, 0, 0.35);\n }\n to {\n background-color: transparent;\n }\n }\n\n .highlighted-process {\n animation: highlight 3s ease-out forwards !important;\n }\n\n @keyframes blueHighlight {\n from {\n background-color: rgba(0, 122, 255, 0.35);\n }\n to {\n background-color: rgba(0, 122, 255, 0.15);\n }\n }\n\n .blue-highlighted-process {\n animation: blueHighlight 2.5s ease-in-out;\n background-color: rgba(0, 122, 255, 0.15);\n transition: background-color 0.3s ease-in-out;\n }\n"], ["\n /* Reset + fonte padr\u00E3o para toda a aplica\u00E7\u00E3o (inclui modais e portais) */\n *, *::before, *::after {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n font-family: 'Open Sans Condensed', sans-serif;\n }\n\n body {\n -webkit-font-smoothing: antialiased;\n }\n\n /* Oculta bot\u00F5es na impress\u00E3o */\n @media print {\n button,\n [class*=\"Button\"],\n [class^=\"Button\"],\n [class*=\"btn\"],\n [class^=\"btn\"],\n .button,\n .btn {\n display: none !important;\n }\n }\n\n /* Anima\u00E7\u00F5es utilit\u00E1rias */\n @keyframes highlight {\n from {\n background-color: rgba(255, 215, 0, 0.35);\n }\n to {\n background-color: transparent;\n }\n }\n\n .highlighted-process {\n animation: highlight 3s ease-out forwards !important;\n }\n\n @keyframes blueHighlight {\n from {\n background-color: rgba(0, 122, 255, 0.35);\n }\n to {\n background-color: rgba(0, 122, 255, 0.15);\n }\n }\n\n .blue-highlighted-process {\n animation: blueHighlight 2.5s ease-in-out;\n background-color: rgba(0, 122, 255, 0.15);\n transition: background-color 0.3s ease-in-out;\n }\n"])));
8
+ var GlobalStyle = createGlobalStyle(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n /* Reset + fonte padr\u00E3o para toda a aplica\u00E7\u00E3o (inclui modais e portais) */\n *, *::before, *::after {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n font-family: 'Open Sans Condensed', sans-serif;\n }\n\n body {\n -webkit-font-smoothing: antialiased;\n }\n\n /* Oculta bot\u00F5es na impress\u00E3o */\n @media print {\n button,\n [role=\"button\"],\n [class*=\"Button\"],\n [class^=\"Button\"],\n [class*=\"btn\"],\n [class^=\"btn\"],\n .button,\n .btn {\n display: none !important;\n }\n }\n\n /* Anima\u00E7\u00F5es utilit\u00E1rias */\n @keyframes highlight {\n from {\n background-color: rgba(255, 215, 0, 0.35);\n }\n to {\n background-color: transparent;\n }\n }\n\n .highlighted-process {\n animation: highlight 3s ease-out forwards !important;\n }\n\n @keyframes blueHighlight {\n from {\n background-color: rgba(0, 122, 255, 0.35);\n }\n to {\n background-color: rgba(0, 122, 255, 0.15);\n }\n }\n\n .blue-highlighted-process {\n animation: blueHighlight 2.5s ease-in-out;\n background-color: rgba(0, 122, 255, 0.15);\n transition: background-color 0.3s ease-in-out;\n }\n"], ["\n /* Reset + fonte padr\u00E3o para toda a aplica\u00E7\u00E3o (inclui modais e portais) */\n *, *::before, *::after {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n font-family: 'Open Sans Condensed', sans-serif;\n }\n\n body {\n -webkit-font-smoothing: antialiased;\n }\n\n /* Oculta bot\u00F5es na impress\u00E3o */\n @media print {\n button,\n [role=\"button\"],\n [class*=\"Button\"],\n [class^=\"Button\"],\n [class*=\"btn\"],\n [class^=\"btn\"],\n .button,\n .btn {\n display: none !important;\n }\n }\n\n /* Anima\u00E7\u00F5es utilit\u00E1rias */\n @keyframes highlight {\n from {\n background-color: rgba(255, 215, 0, 0.35);\n }\n to {\n background-color: transparent;\n }\n }\n\n .highlighted-process {\n animation: highlight 3s ease-out forwards !important;\n }\n\n @keyframes blueHighlight {\n from {\n background-color: rgba(0, 122, 255, 0.35);\n }\n to {\n background-color: rgba(0, 122, 255, 0.15);\n }\n }\n\n .blue-highlighted-process {\n animation: blueHighlight 2.5s ease-in-out;\n background-color: rgba(0, 122, 255, 0.15);\n transition: background-color 0.3s ease-in-out;\n }\n"])));
9
9
  // Componente que aplica os estilos globais da aplicação.
10
10
  // A fonte "Open Sans Condensed" já é carregada via index.html.
11
11
  var GlobalStyleProvider = function () { return (React.createElement(React.Fragment, null,