@credithub/harlan-components 1.32.0 → 1.33.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/assets/btn/buttonAtualizarDadosRfb.d.ts +3 -0
- package/dist/assets/btn/buttonAtualizarDadosRfb.js +10 -0
- package/dist/components/common/button.d.ts +1 -0
- package/dist/components/common/button.js +11 -24
- package/dist/components/consultaRfb.d.ts +2 -0
- package/dist/components/consultaRfb.js +18 -14
- package/dist/components/dossie/dossie.js +1 -1
- package/dist/components/dossie/summary/cardsAndProducts.js +2 -2
- package/dist/components/dossie/summary/styles.d.ts +11 -0
- package/dist/components/dossie/summary/styles.js +13 -0
- package/dist/components/dossie/summary/summary.js +7 -16
- package/dist/components/webservice.js +1 -1
- package/dist/hooks/useConsultaRfb.d.ts +1 -0
- package/lib/cjs/index.js +156 -155
- package/lib/esm/index.js +156 -155
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Button from '../../components/common/button';
|
|
3
|
+
import { useConsultaRfb } from '../../hooks/useConsultaRfb';
|
|
4
|
+
var ButtonAtualizarDadosRfb = function () {
|
|
5
|
+
var _a = useConsultaRfb(), executeFallback = _a.executeFallback, isLoading = _a.isLoading;
|
|
6
|
+
return (React.createElement(Button, { disabled: isLoading, isLoading: isLoading, onClick: function () {
|
|
7
|
+
executeFallback && executeFallback();
|
|
8
|
+
} }, "Atualizar Dados RFB"));
|
|
9
|
+
};
|
|
10
|
+
export default ButtonAtualizarDadosRfb;
|
|
@@ -24,32 +24,19 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
24
24
|
}
|
|
25
25
|
return t;
|
|
26
26
|
};
|
|
27
|
+
import theme from '../../styles/theme';
|
|
27
28
|
import classNames from 'classnames';
|
|
28
29
|
import React from 'react';
|
|
29
|
-
import styled from 'styled-components';
|
|
30
|
-
var StyledButton = styled.button(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}, function (_a) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
var theme = _a.theme;
|
|
38
|
-
return theme.typography.headline14.fontSize;
|
|
39
|
-
}, function (_a) {
|
|
40
|
-
var theme = _a.theme;
|
|
41
|
-
return theme.typography.headline14.lineHeight;
|
|
42
|
-
}, function (_a) {
|
|
43
|
-
var theme = _a.theme;
|
|
44
|
-
return theme.colors.azulCredithub;
|
|
45
|
-
}, function (_a) {
|
|
46
|
-
var theme = _a.theme;
|
|
47
|
-
return theme.colors.white;
|
|
48
|
-
}, function (_a) {
|
|
49
|
-
var theme = _a.theme;
|
|
50
|
-
return theme.colors.azulApoio;
|
|
30
|
+
import styled, { css } from 'styled-components';
|
|
31
|
+
var StyledButton = styled.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n line-height: ", ";\n background-color: ", ";\n color: ", ";\n\n padding: 8px 20px;\n border: none;\n border-radius: 60px;\n cursor: ", ";\n\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n text-align: center;\n\n transition:\n background-color 0.3s ease-in-out,\n color 0.3s ease-in-out;\n\n ", "\n\n width: 100% !important;\n min-height: 40px;\n"], ["\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n line-height: ", ";\n background-color: ", ";\n color: ", ";\n\n padding: 8px 20px;\n border: none;\n border-radius: 60px;\n cursor: ", ";\n\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n text-align: center;\n\n transition:\n background-color 0.3s ease-in-out,\n color 0.3s ease-in-out;\n\n ", "\n\n width: 100% !important;\n min-height: 40px;\n"])), theme.typography.headline14.fontStyle, theme.typography.headline14.fontWeight, theme.typography.headline14.fontSize, theme.typography.headline14.lineHeight, function (props) {
|
|
32
|
+
return props.isLoading ? theme.colors.cinzaClaro : theme.colors.azulCredithub;
|
|
33
|
+
}, theme.colors.white, function (props) { return (!props.isLoading ? 'pointer' : 'wait'); }, function (props) {
|
|
34
|
+
return !props.isLoading && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:hover {\n background-color: ", ";\n }\n "], ["\n &:hover {\n background-color: ", ";\n }\n "])), function (_a) {
|
|
35
|
+
var theme = _a.theme;
|
|
36
|
+
return theme.colors.azulApoio;
|
|
37
|
+
});
|
|
51
38
|
});
|
|
52
|
-
var SmallContent = styled.small(
|
|
39
|
+
var SmallContent = styled.small(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n color: ", ";\n display: block;\n margin-top: 4px;\n\n @media print {\n display: none;\n }\n"], ["\n color: ", ";\n display: block;\n margin-top: 4px;\n\n @media print {\n display: none;\n }\n"])), function (_a) {
|
|
53
40
|
var theme = _a.theme;
|
|
54
41
|
return theme.colors.alerta;
|
|
55
42
|
});
|
|
@@ -61,4 +48,4 @@ var Button = function (_a) {
|
|
|
61
48
|
smallContent && React.createElement(SmallContent, null, smallContent)));
|
|
62
49
|
};
|
|
63
50
|
export default Button;
|
|
64
|
-
var templateObject_1, templateObject_2;
|
|
51
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -4,12 +4,14 @@ export type ConsultaRfbContextProps = Partial<{
|
|
|
4
4
|
refetch: () => void;
|
|
5
5
|
error: Error | null;
|
|
6
6
|
isLoading: boolean;
|
|
7
|
+
executeFallback: () => void;
|
|
7
8
|
}>;
|
|
8
9
|
export declare const ConsultaRfbContext: React.Context<Partial<{
|
|
9
10
|
rfbResponse: Document;
|
|
10
11
|
refetch: () => void;
|
|
11
12
|
error: Error | null;
|
|
12
13
|
isLoading: boolean;
|
|
14
|
+
executeFallback: () => void;
|
|
13
15
|
}> | null>;
|
|
14
16
|
export declare const ConsultaRfbProvider: React.FC<PropsWithChildren<{
|
|
15
17
|
documento: string;
|
|
@@ -1,21 +1,25 @@
|
|
|
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
|
-
};
|
|
12
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
13
|
-
import React, { createContext } from 'react';
|
|
2
|
+
import React, { createContext, useEffect, useState } from 'react';
|
|
14
3
|
import { useQuery } from './webservice';
|
|
15
4
|
export var ConsultaRfbContext = createContext(null);
|
|
16
5
|
export var ConsultaRfbProvider = function (_a) {
|
|
17
|
-
var _b, _c;
|
|
6
|
+
var _b, _c, _d, _e;
|
|
18
7
|
var children = _a.children, documento = _a.documento;
|
|
8
|
+
var _f = useState(false), enableFallback = _f[0], setEnableFallback = _f[1];
|
|
19
9
|
var query = useQuery("SELECT FROM 'RFB'.'CERTIDAO'", { documento: documento }, documento.length > 11);
|
|
20
|
-
|
|
10
|
+
var queryFallback = useQuery("SELECT FROM 'RECEITAWS'.'CNPJ'", { documento: documento }, enableFallback);
|
|
11
|
+
var executeFallback = function () { return setEnableFallback(true); };
|
|
12
|
+
useEffect(function () {
|
|
13
|
+
if (enableFallback) {
|
|
14
|
+
queryFallback.refetch();
|
|
15
|
+
}
|
|
16
|
+
}, [enableFallback]);
|
|
17
|
+
console.log('query.isLoading', query.isLoading);
|
|
18
|
+
return (React.createElement(ConsultaRfbContext.Provider, { value: {
|
|
19
|
+
rfbResponse: (_e = (_c = (_b = queryFallback === null || queryFallback === void 0 ? void 0 : queryFallback.response) === null || _b === void 0 ? void 0 : _b.document) !== null && _c !== void 0 ? _c : (_d = query === null || query === void 0 ? void 0 : query.response) === null || _d === void 0 ? void 0 : _d.document) !== null && _e !== void 0 ? _e : undefined,
|
|
20
|
+
executeFallback: executeFallback,
|
|
21
|
+
refetch: query.refetch,
|
|
22
|
+
error: query.error || queryFallback.error,
|
|
23
|
+
isLoading: query.isLoading || queryFallback.isLoading
|
|
24
|
+
} }, children));
|
|
21
25
|
};
|
|
@@ -13,10 +13,10 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
};
|
|
14
14
|
return __assign.apply(this, arguments);
|
|
15
15
|
};
|
|
16
|
-
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
17
16
|
import { useConsultaRfb } from '../../hooks/useConsultaRfb';
|
|
18
17
|
import { formatCnpj, formatCpf } from '../../utils/string';
|
|
19
18
|
import XPathUtils from '../../utils/xpath';
|
|
19
|
+
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
20
20
|
import React, { useContext, useState } from 'react';
|
|
21
21
|
import styled from 'styled-components';
|
|
22
22
|
import { ReclameAquiCarousel } from '../reclameAqui/reclameAquiCarousel';
|
|
@@ -9,11 +9,11 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import { getAtividadesEconomicasSecundarias, getField, getFieldRfb, getProductsPrices } from './utils';
|
|
14
12
|
import { useConsultasComplementares } from '../../../hooks/useConsultasComplementares';
|
|
15
13
|
import { formatMoney } from '../../../utils/number';
|
|
16
14
|
import XPathUtils from '../../../utils/xpath';
|
|
15
|
+
import React from 'react';
|
|
16
|
+
import { getAtividadesEconomicasSecundarias, getField, getFieldRfb, getProductsPrices } from './utils';
|
|
17
17
|
var useCardsAndProducts = function (_a) {
|
|
18
18
|
var _b, _c, _d, _e, _f;
|
|
19
19
|
var finderResponse = _a.finderResponse, rfbResponse = _a.rfbResponse;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const ContainerSummary: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
2
|
+
export declare const ContentSummary: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
3
|
+
export declare const FieldSummary: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
4
|
+
fullRow?: boolean;
|
|
5
|
+
}, never>;
|
|
6
|
+
export declare const ButtonsSummary: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
7
|
+
export declare const ButtonsWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
8
|
+
export declare const SummaryButton: import("styled-components").StyledComponent<import("react").FC<import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
9
|
+
smallContent?: import("react").ReactNode;
|
|
10
|
+
isLoading?: boolean;
|
|
11
|
+
}>, import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -0,0 +1,13 @@
|
|
|
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 styled from 'styled-components';
|
|
6
|
+
import Button from '../../../components/common/button';
|
|
7
|
+
export var ContainerSummary = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n padding: 0 20px;\n width: 100%;\n justify-content: space-between;\n @media (max-width: 768px) {\n padding: 0px;\n }\n\n @media (max-width: 992px) {\n flex-direction: column;\n }\n"], ["\n display: flex;\n padding: 0 20px;\n width: 100%;\n justify-content: space-between;\n @media (max-width: 768px) {\n padding: 0px;\n }\n\n @media (max-width: 992px) {\n flex-direction: column;\n }\n"])));
|
|
8
|
+
export var ContentSummary = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: grid;\n grid-row: 1 / 8;\n grid-template-columns: repeat(4, 1fr);\n gap: 0 16px;\n\n @media (max-width: 1280px) {\n grid-template-columns: repeat(3, 1fr);\n justify-content: center;\n align-items: center;\n }\n\n @media (max-width: 768px) {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n flex-direction: row;\n width: 100%;\n }\n"], ["\n display: grid;\n grid-row: 1 / 8;\n grid-template-columns: repeat(4, 1fr);\n gap: 0 16px;\n\n @media (max-width: 1280px) {\n grid-template-columns: repeat(3, 1fr);\n justify-content: center;\n align-items: center;\n }\n\n @media (max-width: 768px) {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n flex-direction: row;\n width: 100%;\n }\n"])));
|
|
9
|
+
export var FieldSummary = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n align-items: center;\n margin-bottom: 16px;\n grid-column: ", ";\n"], ["\n align-items: center;\n margin-bottom: 16px;\n grid-column: ", ";\n"])), function (props) { return (props.fullRow ? '1 / 3' : 'auto'); });
|
|
10
|
+
export var ButtonsSummary = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: 8px;\n\n @media (max-width: 768px) {\n align-items: center;\n max-width: 100%;\n }\n"], ["\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: 8px;\n\n @media (max-width: 768px) {\n align-items: center;\n max-width: 100%;\n }\n"])));
|
|
11
|
+
export var ButtonsWrapper = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n gap: 10px;\n min-width: fit-content;\n flex-direction: column;\n\n @media (max-width: 1000px) {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n flex-direction: row;\n }\n\n @media (max-width: 768px) {\n display: grid;\n grid-template-columns: repeat(1, 1fr);\n flex-direction: row;\n }\n\n @media print {\n display: none;\n }\n"], ["\n display: flex;\n gap: 10px;\n min-width: fit-content;\n flex-direction: column;\n\n @media (max-width: 1000px) {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n flex-direction: row;\n }\n\n @media (max-width: 768px) {\n display: grid;\n grid-template-columns: repeat(1, 1fr);\n flex-direction: row;\n }\n\n @media print {\n display: none;\n }\n"])));
|
|
12
|
+
export var SummaryButton = styled(Button)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n height: 100%;\n"], ["\n height: 100%;\n"])));
|
|
13
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -1,19 +1,9 @@
|
|
|
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 React from 'react';
|
|
6
1
|
import AddItemField from '../../../components/common/addItem';
|
|
7
|
-
import
|
|
2
|
+
import React from 'react';
|
|
8
3
|
import { formatMoney } from '../../../utils/number';
|
|
9
4
|
import useCardsAndProducts from './cardsAndProducts';
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
var ContentSummary = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: grid;\n grid-row: 1 / 8;\n grid-template-columns: repeat(4, 1fr);\n gap: 0 16px;\n\n @media (max-width: 1280px) {\n grid-template-columns: repeat(3, 1fr);\n justify-content: center;\n align-items: center;\n }\n\n @media (max-width: 768px) {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n flex-direction: row;\n width: 100%;\n }\n"], ["\n display: grid;\n grid-row: 1 / 8;\n grid-template-columns: repeat(4, 1fr);\n gap: 0 16px;\n\n @media (max-width: 1280px) {\n grid-template-columns: repeat(3, 1fr);\n justify-content: center;\n align-items: center;\n }\n\n @media (max-width: 768px) {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n flex-direction: row;\n width: 100%;\n }\n"])));
|
|
13
|
-
var FieldSummary = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n align-items: center;\n margin-bottom: 16px;\n grid-column: ", ";\n"], ["\n align-items: center;\n margin-bottom: 16px;\n grid-column: ", ";\n"])), function (props) { return (props.fullRow ? '1 / 3' : 'auto'); });
|
|
14
|
-
var ButtonsSummary = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: 8px;\n\n @media (max-width: 768px) {\n align-items: center;\n max-width: 100%;\n }\n"], ["\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n gap: 8px;\n\n @media (max-width: 768px) {\n align-items: center;\n max-width: 100%;\n }\n"])));
|
|
15
|
-
var ButtonsWrapper = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n gap: 10px;\n min-width: fit-content;\n flex-direction: column;\n\n @media (max-width: 1000px) {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n flex-direction: row;\n }\n\n @media (max-width: 768px) {\n display: grid;\n grid-template-columns: repeat(1, 1fr);\n flex-direction: row;\n }\n\n @media print {\n display: none;\n }\n"], ["\n display: flex;\n gap: 10px;\n min-width: fit-content;\n flex-direction: column;\n\n @media (max-width: 1000px) {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n flex-direction: row;\n }\n\n @media (max-width: 768px) {\n display: grid;\n grid-template-columns: repeat(1, 1fr);\n flex-direction: row;\n }\n\n @media print {\n display: none;\n }\n"])));
|
|
16
|
-
var SummaryButton = styled(Button)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n height: 100%;\n"], ["\n height: 100%;\n"])));
|
|
5
|
+
import { ButtonsSummary, ButtonsWrapper, ContainerSummary, ContentSummary, FieldSummary, SummaryButton } from './styles';
|
|
6
|
+
import ButtonAtualizarDadosRfb from '../../../assets/btn/buttonAtualizarDadosRfb';
|
|
17
7
|
export var Summary = function (_a) {
|
|
18
8
|
var finderResponse = _a.finderResponse, rfbResponse = _a.rfbResponse;
|
|
19
9
|
var _b = useCardsAndProducts({
|
|
@@ -24,8 +14,9 @@ export var Summary = function (_a) {
|
|
|
24
14
|
React.createElement(ContainerSummary, { className: "credithub-container-summary" },
|
|
25
15
|
React.createElement(ContentSummary, { className: "credithub-content-summary" }, cards.map(function (card, index) { return (React.createElement(FieldSummary, { key: index, fullRow: card.header === 'Nome' || card.header === 'Nome Da Mãe' },
|
|
26
16
|
React.createElement(AddItemField, { name: card.header, value: card.title }))); })),
|
|
27
|
-
React.createElement(ButtonsWrapper, null,
|
|
28
|
-
React.createElement(
|
|
17
|
+
React.createElement(ButtonsWrapper, null,
|
|
18
|
+
React.createElement(ButtonAtualizarDadosRfb, null),
|
|
19
|
+
products.map(function (product, index) { return (React.createElement(ButtonsSummary, { key: index, style: { display: (product === null || product === void 0 ? void 0 : product.hide) ? 'none' : '', width: '100%' } },
|
|
20
|
+
React.createElement(SummaryButton, { onClick: function () { return (product === null || product === void 0 ? void 0 : product.onClick) && (product === null || product === void 0 ? void 0 : product.onClick()); }, smallContent: product.price ? formatMoney(product.price) : undefined }, product.title))); })))));
|
|
29
21
|
};
|
|
30
22
|
export default Summary;
|
|
31
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -104,7 +104,7 @@ export function useQuery(query, data, enabled) {
|
|
|
104
104
|
var abortController = useMemo(function () { return new AbortController(); }, []);
|
|
105
105
|
var _a = useState(null), response = _a[0], setResponse = _a[1];
|
|
106
106
|
var _b = useState(null), error = _b[0], setError = _b[1];
|
|
107
|
-
var _c = useState(
|
|
107
|
+
var _c = useState(false), isLoading = _c[0], setIsLoading = _c[1];
|
|
108
108
|
var fetch = useCallback(function () {
|
|
109
109
|
setIsLoading(true);
|
|
110
110
|
client
|