@credithub/harlan-components 1.46.6 → 1.47.1
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/common/modalMaintenance.d.ts +9 -0
- package/dist/components/common/modalMaintenance.js +81 -0
- package/dist/components/dossie/summary/cardsAndProducts.d.ts +3 -1
- package/dist/components/dossie/summary/cardsAndProducts.js +9 -6
- package/dist/components/dossie/summary/summary.js +6 -4
- package/lib/cjs/index.js +354 -140
- package/lib/esm/index.js +354 -140
- package/package.json +2 -1
|
@@ -0,0 +1,81 @@
|
|
|
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 { Wrench } from 'phosphor-react';
|
|
6
|
+
import React, { useEffect } from 'react';
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
var Overlay = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.5);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 1000;\n"], ["\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.5);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 1000;\n"])));
|
|
9
|
+
var ModalContainer = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: ", ";\n border-radius: 12px;\n max-width: 500px;\n width: 90%;\n padding: 32px;\n box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);\n animation: fadeIn 0.3s ease-out;\n position: relative;\n\n @keyframes fadeIn {\n from {\n opacity: 0;\n transform: translateY(-20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n"], ["\n background: ", ";\n border-radius: 12px;\n max-width: 500px;\n width: 90%;\n padding: 32px;\n box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);\n animation: fadeIn 0.3s ease-out;\n position: relative;\n\n @keyframes fadeIn {\n from {\n opacity: 0;\n transform: translateY(-20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n"])), function (_a) {
|
|
10
|
+
var theme = _a.theme;
|
|
11
|
+
return theme.colors.white;
|
|
12
|
+
});
|
|
13
|
+
var IconContainer = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 16px;\n\n svg {\n color: ", ";\n width: 48px;\n height: 48px;\n }\n"], ["\n display: flex;\n justify-content: center;\n align-items: center;\n margin-bottom: 16px;\n\n svg {\n color: ", ";\n width: 48px;\n height: 48px;\n }\n"])), function (_a) {
|
|
14
|
+
var theme = _a.theme;
|
|
15
|
+
return theme.colors.azulCredithub;
|
|
16
|
+
});
|
|
17
|
+
var Title = styled.h2(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", ";\n color: ", ";\n text-align: center;\n margin-bottom: 8px;\n"], ["\n ", ";\n color: ", ";\n text-align: center;\n margin-bottom: 8px;\n"])), function (_a) {
|
|
18
|
+
var theme = _a.theme;
|
|
19
|
+
return theme.typography.headline20;
|
|
20
|
+
}, function (_a) {
|
|
21
|
+
var theme = _a.theme;
|
|
22
|
+
return theme.colors.azulCredithub;
|
|
23
|
+
});
|
|
24
|
+
var CloseButton = styled.button(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n all: unset;\n position: absolute;\n top: 12px;\n right: 12px;\n width: 32px;\n height: 32px;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 1.5rem;\n font-weight: bold;\n cursor: pointer;\n color: ", ";\n border-radius: 50%;\n transition:\n background 0.3s ease,\n color 0.3s ease;\n\n &:hover {\n background: ", ";\n color: ", ";\n }\n"], ["\n all: unset;\n position: absolute;\n top: 12px;\n right: 12px;\n width: 32px;\n height: 32px;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 1.5rem;\n font-weight: bold;\n cursor: pointer;\n color: ", ";\n border-radius: 50%;\n transition:\n background 0.3s ease,\n color 0.3s ease;\n\n &:hover {\n background: ", ";\n color: ", ";\n }\n"])), function (_a) {
|
|
25
|
+
var theme = _a.theme;
|
|
26
|
+
return theme.colors.cinzaEscuro;
|
|
27
|
+
}, function (_a) {
|
|
28
|
+
var theme = _a.theme;
|
|
29
|
+
return theme.colors.cinzaBase;
|
|
30
|
+
}, function (_a) {
|
|
31
|
+
var theme = _a.theme;
|
|
32
|
+
return theme.colors.azulCredithub;
|
|
33
|
+
});
|
|
34
|
+
var Message = styled.p(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n ", ";\n color: ", ";\n line-height: 1.6;\n text-align: center;\n margin-top: 16px;\n margin-bottom: 24px;\n"], ["\n ", ";\n color: ", ";\n line-height: 1.6;\n text-align: center;\n margin-top: 16px;\n margin-bottom: 24px;\n"])), function (_a) {
|
|
35
|
+
var theme = _a.theme;
|
|
36
|
+
return theme.typography.body16;
|
|
37
|
+
}, function (_a) {
|
|
38
|
+
var theme = _a.theme;
|
|
39
|
+
return theme.colors.cinzaEscuro;
|
|
40
|
+
});
|
|
41
|
+
var IncidentButton = styled.a(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n align-items: center;\n margin: 0 auto;\n padding: 10px 20px;\n background: ", ";\n color: ", ";\n border-radius: 6px;\n font-size: 14px;\n font-weight: 500;\n text-decoration: none;\n cursor: pointer;\n transition:\n background 0.2s ease,\n color 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n\n &:hover {\n background: ", ";\n color: ", ";\n }\n"], ["\n display: flex;\n justify-content: center;\n align-items: center;\n margin: 0 auto;\n padding: 10px 20px;\n background: ", ";\n color: ", ";\n border-radius: 6px;\n font-size: 14px;\n font-weight: 500;\n text-decoration: none;\n cursor: pointer;\n transition:\n background 0.2s ease,\n color 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n\n &:hover {\n background: ", ";\n color: ", ";\n }\n"])), function (_a) {
|
|
42
|
+
var theme = _a.theme;
|
|
43
|
+
return theme.colors.cinzaBase;
|
|
44
|
+
}, function (_a) {
|
|
45
|
+
var theme = _a.theme;
|
|
46
|
+
return theme.colors.cinzaEscuro;
|
|
47
|
+
}, function (_a) {
|
|
48
|
+
var theme = _a.theme;
|
|
49
|
+
return theme.colors.cinzaClaro;
|
|
50
|
+
}, function (_a) {
|
|
51
|
+
var theme = _a.theme;
|
|
52
|
+
return theme.colors.azulCredithub;
|
|
53
|
+
});
|
|
54
|
+
var Modal = function (_a) {
|
|
55
|
+
var isOpen = _a.isOpen, onClose = _a.onClose, title = _a.title, message = _a.message, incidentUrl = _a.incidentUrl;
|
|
56
|
+
useEffect(function () {
|
|
57
|
+
if (!isOpen)
|
|
58
|
+
return;
|
|
59
|
+
var handleKeyDown = function (event) {
|
|
60
|
+
if (event.key === 'Escape') {
|
|
61
|
+
onClose();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
window.addEventListener('keydown', handleKeyDown);
|
|
65
|
+
return function () {
|
|
66
|
+
window.removeEventListener('keydown', handleKeyDown);
|
|
67
|
+
};
|
|
68
|
+
}, [isOpen, onClose]);
|
|
69
|
+
if (!isOpen)
|
|
70
|
+
return null;
|
|
71
|
+
return (React.createElement(Overlay, { onClick: onClose },
|
|
72
|
+
React.createElement(ModalContainer, { onClick: function (e) { return e.stopPropagation(); } },
|
|
73
|
+
React.createElement(CloseButton, { onClick: onClose }, "\u00D7"),
|
|
74
|
+
React.createElement(IconContainer, null,
|
|
75
|
+
React.createElement(Wrench, { weight: "bold" })),
|
|
76
|
+
React.createElement(Title, null, title),
|
|
77
|
+
React.createElement(Message, null, message),
|
|
78
|
+
incidentUrl && (React.createElement(IncidentButton, { href: incidentUrl, target: "_blank", rel: "noopener noreferrer" }, "Ver Atualiza\u00E7\u00F5es do Incidente")))));
|
|
79
|
+
};
|
|
80
|
+
export default Modal;
|
|
81
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|
|
@@ -8,10 +8,12 @@ declare const useCardsAndProducts: ({ finderResponse, rfbResponse }: {
|
|
|
8
8
|
}[];
|
|
9
9
|
products: {
|
|
10
10
|
title: string;
|
|
11
|
-
onClick: () => Promise<void>;
|
|
12
11
|
price: number;
|
|
12
|
+
onClick: () => void;
|
|
13
13
|
hide: boolean;
|
|
14
14
|
isLoading: boolean;
|
|
15
15
|
}[];
|
|
16
|
+
isModalOpen: boolean;
|
|
17
|
+
closeModal: () => void;
|
|
16
18
|
};
|
|
17
19
|
export default useCardsAndProducts;
|
|
@@ -53,8 +53,11 @@ import { getAtividadesEconomicasSecundarias, getField, getFieldRfb, getProductsP
|
|
|
53
53
|
var useCardsAndProducts = function (_a) {
|
|
54
54
|
var _b, _c, _d, _e, _f, _g;
|
|
55
55
|
var finderResponse = _a.finderResponse, rfbResponse = _a.rfbResponse;
|
|
56
|
-
var _h =
|
|
57
|
-
var _j =
|
|
56
|
+
var _h = useState(false), isModalOpen = _h[0], setModalOpen = _h[1];
|
|
57
|
+
var _j = useConsultasComplementares(), consultasComplementares = _j.consultasComplementares, setConsultasComplementares = _j.setConsultasComplementares, hasCredits = _j.hasCredits;
|
|
58
|
+
var _k = useState({}), loadingButtons = _k[0], setLoadingButtons = _k[1];
|
|
59
|
+
var handleModalClick = function () { return setModalOpen(true); };
|
|
60
|
+
var closeModal = function () { return setModalOpen(false); };
|
|
58
61
|
var isPF = !!getField('cpf', finderResponse);
|
|
59
62
|
var productsPrices = getProductsPrices(isPF);
|
|
60
63
|
var handleOnClick = function (key) {
|
|
@@ -99,7 +102,7 @@ var useCardsAndProducts = function (_a) {
|
|
|
99
102
|
});
|
|
100
103
|
}); };
|
|
101
104
|
};
|
|
102
|
-
var
|
|
105
|
+
var _l = {
|
|
103
106
|
cards: [
|
|
104
107
|
{
|
|
105
108
|
title: getField('sexo', finderResponse, function (value) {
|
|
@@ -276,7 +279,7 @@ var useCardsAndProducts = function (_a) {
|
|
|
276
279
|
{
|
|
277
280
|
title: 'Consultar Pefin/Refin Serasa',
|
|
278
281
|
price: productsPrices === null || productsPrices === void 0 ? void 0 : productsPrices.refinSerasa,
|
|
279
|
-
onClick:
|
|
282
|
+
onClick: handleModalClick,
|
|
280
283
|
hide: (_f = consultasComplementares === null || consultasComplementares === void 0 ? void 0 : consultasComplementares.refinSerasa) === null || _f === void 0 ? void 0 : _f.consultaRealizada,
|
|
281
284
|
isLoading: loadingButtons['refinSerasa']
|
|
282
285
|
},
|
|
@@ -288,7 +291,7 @@ var useCardsAndProducts = function (_a) {
|
|
|
288
291
|
isLoading: loadingButtons['imoveis']
|
|
289
292
|
}
|
|
290
293
|
]
|
|
291
|
-
}, cards =
|
|
292
|
-
return { cards: cards, products: products };
|
|
294
|
+
}, cards = _l.cards, products = _l.products;
|
|
295
|
+
return { cards: cards, products: products, isModalOpen: isModalOpen, closeModal: closeModal };
|
|
293
296
|
};
|
|
294
297
|
export default useCardsAndProducts;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import AddItemField from '../../../components/common/addItem';
|
|
2
|
-
import React from 'react';
|
|
3
1
|
import ButtonAtualizarDadosRfb from '../../../assets/btn/buttonAtualizarDadosRfb';
|
|
2
|
+
import AddItemField from '../../../components/common/addItem';
|
|
3
|
+
import Modal from '../../../components/common/modalMaintenance';
|
|
4
4
|
import { formatMoney } from '../../../utils/number';
|
|
5
|
+
import React from 'react';
|
|
5
6
|
import useCardsAndProducts from './cardsAndProducts';
|
|
6
7
|
import { ButtonsSummary, ButtonsWrapper, ContainerSummary, ContentSummary, FieldSummary, Spinner, SummaryButton } from './styles';
|
|
7
8
|
export var Summary = function (_a) {
|
|
@@ -9,7 +10,7 @@ export var Summary = function (_a) {
|
|
|
9
10
|
var _b = useCardsAndProducts({
|
|
10
11
|
finderResponse: finderResponse,
|
|
11
12
|
rfbResponse: rfbResponse
|
|
12
|
-
}), cards = _b.cards, products = _b.products;
|
|
13
|
+
}), cards = _b.cards, products = _b.products, isModalOpen = _b.isModalOpen, closeModal = _b.closeModal;
|
|
13
14
|
return (React.createElement(React.Fragment, null,
|
|
14
15
|
React.createElement(ContainerSummary, { className: "credithub-container-summary" },
|
|
15
16
|
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' },
|
|
@@ -17,6 +18,7 @@ export var Summary = function (_a) {
|
|
|
17
18
|
React.createElement(ButtonsWrapper, null,
|
|
18
19
|
React.createElement(ButtonAtualizarDadosRfb, null),
|
|
19
20
|
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()); }, disabled: product.isLoading, smallContent: product.price ? formatMoney(product.price) : undefined }, product.isLoading ? React.createElement(Spinner, null) : product.title))); }))
|
|
21
|
+
React.createElement(SummaryButton, { onClick: function () { return (product === null || product === void 0 ? void 0 : product.onClick) && (product === null || product === void 0 ? void 0 : product.onClick()); }, disabled: product.isLoading, smallContent: product.price ? formatMoney(product.price) : undefined }, product.isLoading ? React.createElement(Spinner, null) : product.title))); })),
|
|
22
|
+
React.createElement(Modal, { isOpen: isModalOpen, onClose: closeModal, title: "\uD83D\uDEA7 Consulta temporariamente indispon\u00EDvel", message: "A consulta Pefin/Refin Serasa est\u00E1 fora do ar devido a mudan\u00E7as na fonte. Nossa equipe j\u00E1 est\u00E1 trabalhando para resolver, mas ainda n\u00E3o h\u00E1 previs\u00E3o de normaliza\u00E7\u00E3o.", incidentUrl: "https://credithub.statuspage.io/incidents/hnvx1dxby7rk" }))));
|
|
21
23
|
};
|
|
22
24
|
export default Summary;
|