@credithub/harlan-components 1.85.4 → 1.86.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/contacts/contacts.js +37 -35
- package/dist/components/liminar/liminar.js +1 -4
- package/lib/cjs/index.js +39 -39
- package/lib/esm/index.js +39 -39
- package/package.json +1 -1
|
@@ -45,54 +45,56 @@ var Contacts = function (_a) {
|
|
|
45
45
|
var ctx = useContext(Queries.Finder);
|
|
46
46
|
var rfbResponse = useConsultaRfb().rfbResponse;
|
|
47
47
|
var setData = useGlobalData().setData;
|
|
48
|
-
var
|
|
48
|
+
var extractContacts = useCallback(function (data) {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
var document = XPathUtils.select('string(//cpf|//cnpj)', data);
|
|
51
|
+
var telefonesRfb = ((_a = XPathUtils.select('string(//RFB/telefones)', rfbResponse)) === null || _a === void 0 ? void 0 : _a.match(/\(\d{2}\)\s?\d{4,5}-\d{4}/g)) || [];
|
|
52
|
+
var telefones = __spreadArray(__spreadArray([], telefonesRfb.map(function (telefone) { return ({
|
|
53
|
+
type: ContactType.TELEFONE,
|
|
54
|
+
value: telefone
|
|
55
|
+
}); }), true), __spreadArray(__spreadArray([], XPathUtils.selectArray('//telefones/fixos/fixos', data) || [], true), XPathUtils.selectArray('//telefones/moveis/moveis', data) || [], true).map(function (telefone) { return ({
|
|
56
|
+
type: ContactType.TELEFONE,
|
|
57
|
+
value: phoneMask(XPathUtils.select('string(./telefone)', telefone))
|
|
58
|
+
}); }), true);
|
|
59
|
+
var emails = __spreadArray([
|
|
60
|
+
{
|
|
61
|
+
type: ContactType.EMAIL,
|
|
62
|
+
value: (_b = XPathUtils.select('string(//RFB/email)', rfbResponse)) === null || _b === void 0 ? void 0 : _b.toLowerCase()
|
|
63
|
+
}
|
|
64
|
+
], XPathUtils.selectArray('//emails/emails', data).map(function (email) { return ({
|
|
65
|
+
type: ContactType.EMAIL,
|
|
66
|
+
value: XPathUtils.select('string(./email)', email)
|
|
67
|
+
}); }), true).filter(function (e) { return e.value; });
|
|
68
|
+
return { telefones: telefones, emails: emails, document: document };
|
|
69
|
+
}, [rfbResponse, ctx === null || ctx === void 0 ? void 0 : ctx.document]);
|
|
70
|
+
var updateGlobalState = useCallback(function () {
|
|
49
71
|
if (ctx.type === RequestStatus.Success && ctx.document) {
|
|
50
|
-
var
|
|
72
|
+
var telefones_1 = XPathUtils.selectArray('//telefones/*/*', ctx.document).map(function (telefone) { return ({
|
|
51
73
|
type: ContactType.TELEFONE,
|
|
52
74
|
value: phoneMask(XPathUtils.select('string(./telefone)', telefone))
|
|
53
75
|
}); });
|
|
54
|
-
var
|
|
76
|
+
var emails_1 = XPathUtils.selectArray('//emails/emails', ctx.document).map(function (email) { return ({
|
|
55
77
|
type: ContactType.EMAIL,
|
|
56
78
|
value: XPathUtils.select('string(./email)', email)
|
|
57
79
|
}); });
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
contacts: __spreadArray(__spreadArray([], telefones, true), emails, true)
|
|
61
|
-
};
|
|
62
|
-
setData(function (prevState) { return (__assign(__assign({}, prevState), { contacts: contactState_1.contacts })); });
|
|
80
|
+
if (telefones_1.length > 0 || emails_1.length > 0) {
|
|
81
|
+
setData(function (prevState) { return (__assign(__assign({}, prevState), { contacts: __spreadArray(__spreadArray([], telefones_1, true), emails_1, true) })); });
|
|
63
82
|
}
|
|
64
83
|
}
|
|
65
84
|
}, [ctx.type, ctx.document]);
|
|
66
85
|
useEffect(function () {
|
|
67
|
-
|
|
68
|
-
}, [
|
|
86
|
+
updateGlobalState();
|
|
87
|
+
}, [updateGlobalState]);
|
|
88
|
+
var renderContactItems = function (items, document, columns, tabletColumns, mobileColumns) { return (React.createElement(ResultContent, { desktop: columns, tablet: tabletColumns, mobile: mobileColumns }, items.map(function (_a, key) {
|
|
89
|
+
var type = _a.type, value = _a.value;
|
|
90
|
+
return (React.createElement(ContactLikeDislikeSection, { key: key, type: type, value: value, document: document }));
|
|
91
|
+
}))); };
|
|
69
92
|
return (React.createElement(Section, { ctx: ctx, title: "Contato", subtitle: "Informa\u00E7\u00F5es de contato do documento pesquisado.", description: "(Telefone, e-mail e outros)", minimized: false, icon: ContatoIcon, onSuccess: function (data) {
|
|
70
|
-
var _a;
|
|
71
|
-
var document = XPathUtils.select('string(//cpf|//cnpj)', data);
|
|
72
|
-
var telefones = __spreadArray(__spreadArray([], (XPathUtils.selectArray('//telefones/fixos/fixos', data) || []), true), (XPathUtils.selectArray('//telefones/moveis/moveis', data) || []), true).map(function (telefone) { return ({
|
|
73
|
-
type: ContactType.TELEFONE,
|
|
74
|
-
value: phoneMask(XPathUtils.select('string(./telefone)', telefone))
|
|
75
|
-
}); });
|
|
76
|
-
var emails = __spreadArray([
|
|
77
|
-
{
|
|
78
|
-
type: ContactType.EMAIL,
|
|
79
|
-
value: (_a = XPathUtils.select('string(//RFB/email)', rfbResponse)) === null || _a === void 0 ? void 0 : _a.toLowerCase()
|
|
80
|
-
}
|
|
81
|
-
], XPathUtils.selectArray('//emails/emails', data).map(function (email) { return ({
|
|
82
|
-
type: ContactType.EMAIL,
|
|
83
|
-
value: XPathUtils.select('string(./email)', email)
|
|
84
|
-
}); }), true).filter(function (e) { return e.value; });
|
|
85
|
-
var children = (React.createElement(Result, { resultContentStriped: false },
|
|
86
|
-
React.createElement(ResultContent, { desktop: "1fr 1fr 1fr", tablet: "1fr 1fr", mobile: "1fr 1fr" }, telefones.map(function (_a, key) {
|
|
87
|
-
var type = _a.type, value = _a.value;
|
|
88
|
-
return (React.createElement(ContactLikeDislikeSection, { key: key, type: type, value: value, document: document }));
|
|
89
|
-
})),
|
|
90
|
-
React.createElement(ResultContent, { desktop: "1fr 1fr 1fr", tablet: "1fr 1fr", mobile: "1fr" }, emails.map(function (_a, key) {
|
|
91
|
-
var type = _a.type, value = _a.value;
|
|
92
|
-
return (React.createElement(ContactLikeDislikeSection, { key: key, type: type, value: value, document: document }));
|
|
93
|
-
}))));
|
|
93
|
+
var _a = extractContacts(data), telefones = _a.telefones, emails = _a.emails, document = _a.document;
|
|
94
94
|
return {
|
|
95
|
-
children:
|
|
95
|
+
children: (React.createElement(Result, { resultContentStriped: false },
|
|
96
|
+
renderContactItems(telefones, document, "1fr 1fr 1fr", "1fr 1fr", "1fr 1fr"),
|
|
97
|
+
renderContactItems(emails, document, "1fr 1fr 1fr", "1fr 1fr", "1fr"))),
|
|
96
98
|
actions: (React.createElement(BtnWrapper, null,
|
|
97
99
|
React.createElement(Button, { onClick: onClickConsultarEmail }, "Consultar E-mail em Dom\u00EDnio")))
|
|
98
100
|
};
|
|
@@ -49,7 +49,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
49
49
|
import ProtestosIcon from '../../assets/icones/protestos';
|
|
50
50
|
import { useGlobalData } from '../../contexts/globalDataContext';
|
|
51
51
|
import theme from '../../styles/theme';
|
|
52
|
-
import { isDocumentHistoryReady } from '../../utils/isGlobalReady';
|
|
53
52
|
import { formatMoney } from '../../utils/number';
|
|
54
53
|
import { normalizeName, normalizeNameStrong, similarCompanyNames } from '../../utils/similarNames';
|
|
55
54
|
import { hasOneOfTags } from '../../utils/tags';
|
|
@@ -181,10 +180,9 @@ var Liminar = function (_a) {
|
|
|
181
180
|
processosComAssuntoValido,
|
|
182
181
|
(_f = globalData === null || globalData === void 0 ? void 0 : globalData.liminar) === null || _f === void 0 ? void 0 : _f.indiciosDeLiminarProtestosDoPassado
|
|
183
182
|
]), origensDetectadas = _w.origensDetectadas, foundBusinessEntity = _w.foundBusinessEntity;
|
|
184
|
-
var documentHistoryReady = useMemo(function () { return isDocumentHistoryReady(globalData); }, [globalData]);
|
|
185
183
|
var protestosIsReady = useMemo(function () { var _a; return (_a = globalData === null || globalData === void 0 ? void 0 : globalData.protestosData) === null || _a === void 0 ? void 0 : _a.isLoaded; }, [globalData]);
|
|
186
184
|
useEffect(function () {
|
|
187
|
-
if (!
|
|
185
|
+
if (!protestosIsReady)
|
|
188
186
|
return;
|
|
189
187
|
var fetch = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
190
188
|
var dossie, processosJuridicos, depsLoaded, newIds, hash, indiciosApi, indiciosDeLiminarProtestosDoPassado, protestosDoPassadoIds, _a, possuiIndiciosDeLiminarProtestosDoPassado, protestosIds, finalStatus, descricaoLiminar;
|
|
@@ -258,7 +256,6 @@ var Liminar = function (_a) {
|
|
|
258
256
|
ctx.document,
|
|
259
257
|
globalData === null || globalData === void 0 ? void 0 : globalData.dossie,
|
|
260
258
|
globalData === null || globalData === void 0 ? void 0 : globalData.processosJuridicosData,
|
|
261
|
-
globalData === null || globalData === void 0 ? void 0 : globalData.documentHistory,
|
|
262
259
|
processosComAssuntoValido,
|
|
263
260
|
setData,
|
|
264
261
|
foundBusinessEntity
|