@credithub/harlan-components 1.95.5 → 1.97.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.
|
@@ -29,11 +29,12 @@ import { useGlobalData } from '../../contexts/globalDataContext';
|
|
|
29
29
|
import { formatMoney } from '../../utils/number';
|
|
30
30
|
import { formatDocument } from '../../utils/string';
|
|
31
31
|
import { format } from 'date-fns';
|
|
32
|
-
import React, { useContext } from 'react';
|
|
32
|
+
import React, { useContext, useEffect } from 'react';
|
|
33
33
|
import styled, { keyframes } from 'styled-components';
|
|
34
34
|
import Section from '../interface/section';
|
|
35
35
|
import StatusMessage from '../interface/statusMessage';
|
|
36
36
|
import { Queries, RequestStatus } from '../webservice';
|
|
37
|
+
import { usePostHog } from '../../contexts/PostHogContext';
|
|
37
38
|
// Animação do spinner
|
|
38
39
|
var spin = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n"], ["\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n"])));
|
|
39
40
|
// Componente Spinner sutil
|
|
@@ -43,6 +44,7 @@ var ConsultaSimplesSection = function (_a) {
|
|
|
43
44
|
var documento = _a.documento, children = _a.children, onClose = _a.onClose, isFinancial = _a.isFinancial, rest = __rest(_a, ["documento", "children", "onClose", "isFinancial"]);
|
|
44
45
|
var ctx = useContext(Queries.Finder);
|
|
45
46
|
var data = useGlobalData().data;
|
|
47
|
+
var posthog = usePostHog().posthog;
|
|
46
48
|
// Extraindo valores do globalData
|
|
47
49
|
var receitaStatus = ((_c = (_b = data.dossie) === null || _b === void 0 ? void 0 : _b.summary) === null || _c === void 0 ? void 0 : _c.receitaStatus) &&
|
|
48
50
|
['ATIVA', 'REGULAR'].indexOf(data.dossie.summary.receitaStatus) === -1
|
|
@@ -104,6 +106,16 @@ var ConsultaSimplesSection = function (_a) {
|
|
|
104
106
|
receitaStatus ||
|
|
105
107
|
((_p = data.liminar) === null || _p === void 0 ? void 0 : _p.message) === 'Encontrado';
|
|
106
108
|
var statusType = isError ? 'warning' : hasPendencias ? 'error' : 'success';
|
|
109
|
+
useEffect(function () {
|
|
110
|
+
if (posthog && pendencias.every(function (pendencia) { return pendencia.loaded; }))
|
|
111
|
+
posthog === null || posthog === void 0 ? void 0 : posthog.capture('consulta_simples', {
|
|
112
|
+
documento: documento,
|
|
113
|
+
pendencias: pendencias.map(function (pendencia) { return ({
|
|
114
|
+
label: pendencia.label,
|
|
115
|
+
text: pendencia.text,
|
|
116
|
+
}); }),
|
|
117
|
+
});
|
|
118
|
+
}, [posthog, pendencias]);
|
|
107
119
|
return (React.createElement(Section, __assign({ title: "Consulta Simples", subtitle: "Consulta de informa\u00E7\u00F5es do documento.", description: React.createElement(React.Fragment, null,
|
|
108
120
|
React.createElement(StatusMessage, null, format(new Date(), "dd/MM/yyyy 'às' HH:mm")),
|
|
109
121
|
React.createElement(StatusMessage, { type: "found" }, formatDocument(documento)),
|