@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.
- package/dist/components/consultaSimplesSection/consultaSimplesSection.js +2 -2
- package/dist/components/interface/section.d.ts +1 -0
- package/dist/components/interface/section.js +4 -4
- package/dist/components/section.js +16 -4
- package/dist/consultaSimples.js +38 -36
- package/dist/contexts/printModeContext.d.ts +9 -0
- package/dist/contexts/printModeContext.js +9 -0
- package/dist/styles/globalStyle.js +1 -1
- package/lib/cjs/index.js +69 -48
- package/lib/esm/index.js +69 -48
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -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
|
|
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
|
-
|
|
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 () {
|
|
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: {
|
package/dist/consultaSimples.js
CHANGED
|
@@ -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(
|
|
71
|
-
React.createElement(
|
|
72
|
-
React.createElement(
|
|
73
|
-
React.createElement(
|
|
74
|
-
React.createElement(Queries.
|
|
75
|
-
React.createElement(
|
|
76
|
-
React.createElement(
|
|
77
|
-
React.createElement(Queries.
|
|
78
|
-
React.createElement(Queries.
|
|
79
|
-
React.createElement(
|
|
80
|
-
React.createElement(
|
|
81
|
-
React.createElement(
|
|
82
|
-
React.createElement(
|
|
83
|
-
React.createElement(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
React.createElement(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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,
|