@atlaskit/profilecard 24.41.0 → 24.43.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/CHANGELOG.md +24 -0
- package/afm-cc/tsconfig.json +0 -6
- package/afm-jira/tsconfig.json +0 -6
- package/afm-products/tsconfig.json +0 -6
- package/dist/cjs/components/Agent/Actions.js +7 -24
- package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +4 -2
- package/dist/cjs/components/Agent/AgentProfileCard.js +2 -1
- package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +3 -3
- package/dist/cjs/components/Agent/hooks/useAgentActions.js +20 -72
- package/dist/cjs/components/Team/TeamForbiddenErrorState.js +8 -18
- package/dist/cjs/components/Team/TeamLoadingState.js +8 -18
- package/dist/cjs/components/Team/TeamProfileCard.js +76 -162
- package/dist/cjs/components/Team/TeamProfileCardTrigger.js +2 -4
- package/dist/cjs/components/User/OverflowProfileCardButtons.js +9 -19
- package/dist/cjs/components/User/ProfileCard.js +37 -85
- package/dist/cjs/components/User/ProfileCardDetails.js +1 -2
- package/dist/cjs/components/User/ReportingLinesDetails.js +14 -34
- package/dist/cjs/components/common/ProfileCardTrigger.js +9 -17
- package/dist/cjs/components/team-profile-card/main.js +4 -20
- package/dist/cjs/components/team-profile-card/team-connections/main.js +6 -22
- package/dist/cjs/util/analytics.js +1 -29
- package/dist/es2019/components/Agent/Actions.js +7 -25
- package/dist/es2019/components/Agent/AgentDeleteConfirmationModal.js +4 -2
- package/dist/es2019/components/Agent/AgentProfileCard.js +2 -1
- package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +2 -2
- package/dist/es2019/components/Agent/hooks/useAgentActions.js +20 -73
- package/dist/es2019/components/Team/TeamForbiddenErrorState.js +8 -16
- package/dist/es2019/components/Team/TeamLoadingState.js +8 -16
- package/dist/es2019/components/Team/TeamProfileCard.js +72 -146
- package/dist/es2019/components/Team/TeamProfileCardTrigger.js +2 -4
- package/dist/es2019/components/User/OverflowProfileCardButtons.js +9 -17
- package/dist/es2019/components/User/ProfileCard.js +35 -79
- package/dist/es2019/components/User/ProfileCardDetails.js +1 -2
- package/dist/es2019/components/User/ReportingLinesDetails.js +13 -29
- package/dist/es2019/components/common/ProfileCardTrigger.js +9 -17
- package/dist/es2019/components/team-profile-card/main.js +4 -21
- package/dist/es2019/components/team-profile-card/team-connections/main.js +6 -23
- package/dist/es2019/util/analytics.js +0 -27
- package/dist/esm/components/Agent/Actions.js +7 -24
- package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +4 -2
- package/dist/esm/components/Agent/AgentProfileCard.js +2 -1
- package/dist/esm/components/Agent/AgentProfileCardTrigger.js +2 -2
- package/dist/esm/components/Agent/hooks/useAgentActions.js +20 -72
- package/dist/esm/components/Team/TeamForbiddenErrorState.js +9 -19
- package/dist/esm/components/Team/TeamLoadingState.js +9 -19
- package/dist/esm/components/Team/TeamProfileCard.js +77 -163
- package/dist/esm/components/Team/TeamProfileCardTrigger.js +2 -4
- package/dist/esm/components/User/OverflowProfileCardButtons.js +10 -20
- package/dist/esm/components/User/ProfileCard.js +38 -86
- package/dist/esm/components/User/ProfileCardDetails.js +1 -2
- package/dist/esm/components/User/ReportingLinesDetails.js +15 -35
- package/dist/esm/components/common/ProfileCardTrigger.js +10 -18
- package/dist/esm/components/team-profile-card/main.js +4 -20
- package/dist/esm/components/team-profile-card/team-connections/main.js +6 -22
- package/dist/esm/util/analytics.js +0 -29
- package/dist/types/components/Team/TeamForbiddenErrorState.d.ts +1 -2
- package/dist/types/components/Team/TeamLoadingState.d.ts +1 -2
- package/dist/types/components/User/ProfileCard.d.ts +2 -3
- package/dist/types/components/User/lazyProfileCard.d.ts +1 -1
- package/dist/types/components/common/types.d.ts +1 -3
- package/dist/types/types.d.ts +3 -10
- package/dist/types/util/analytics.d.ts +2 -17
- package/dist/types-ts4.5/components/Team/TeamForbiddenErrorState.d.ts +1 -2
- package/dist/types-ts4.5/components/Team/TeamLoadingState.d.ts +1 -2
- package/dist/types-ts4.5/components/User/ProfileCard.d.ts +2 -3
- package/dist/types-ts4.5/components/User/lazyProfileCard.d.ts +1 -1
- package/dist/types-ts4.5/components/common/types.d.ts +1 -3
- package/dist/types-ts4.5/types.d.ts +3 -10
- package/dist/types-ts4.5/util/analytics.d.ts +2 -17
- package/package.json +4 -9
|
@@ -6,18 +6,16 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
8
8
|
import { FormattedMessage, useIntl } from 'react-intl-next';
|
|
9
|
-
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
9
|
import Avatar from '@atlaskit/avatar';
|
|
11
10
|
import { LinkButton } from '@atlaskit/button/new';
|
|
12
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
-
import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
14
12
|
import Spinner from '@atlaskit/spinner';
|
|
15
13
|
import { useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics';
|
|
16
14
|
import { N0 } from '@atlaskit/theme/colors';
|
|
17
15
|
import messages from '../../messages';
|
|
18
16
|
import { ActionButtonGroup, ActionsFlexSpacer, AnimatedKudosButton, AnimationWrapper, CardContainer, CardContent, KudosBlobAnimation, ProfileImage } from '../../styled/Card';
|
|
19
17
|
import { CardWrapper, SpinnerContainer } from '../../styled/UserTrigger';
|
|
20
|
-
import {
|
|
18
|
+
import { PACKAGE_META_DATA } from '../../util/analytics';
|
|
21
19
|
import { isBasicClick } from '../../util/click';
|
|
22
20
|
import { getPageTime } from '../../util/performance';
|
|
23
21
|
import { ErrorMessage } from '../Error';
|
|
@@ -64,24 +62,13 @@ export var ProfilecardInternal = function ProfilecardInternal(props) {
|
|
|
64
62
|
_useState2 = _slicedToArray(_useState, 1),
|
|
65
63
|
openTime = _useState2[0];
|
|
66
64
|
var intl = useIntl();
|
|
67
|
-
var createAnalyticsEvent = props.createAnalyticsEvent;
|
|
68
65
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
69
|
-
|
|
70
|
-
var
|
|
71
|
-
if (createAnalyticsEvent) {
|
|
72
|
-
fireEvent(createAnalyticsEvent, payload);
|
|
73
|
-
}
|
|
74
|
-
}, [createAnalyticsEvent]);
|
|
75
|
-
var fireAnalyticsWithDuration = useCallback(function (generator) {
|
|
76
|
-
var elapsed = getPageTime() - openTime;
|
|
77
|
-
var event = generator(elapsed);
|
|
78
|
-
fireAnalytics(event);
|
|
79
|
-
}, [fireAnalytics, openTime]);
|
|
80
|
-
var fireAnalyticsWithDurationNext = useCallback(function (eventKey, generator) {
|
|
66
|
+
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
67
|
+
var fireAnalyticsWithDuration = useCallback(function (eventKey, generator) {
|
|
81
68
|
var duration = getPageTime() - openTime;
|
|
82
69
|
var attributes = generator(duration);
|
|
83
|
-
|
|
84
|
-
}, [openTime,
|
|
70
|
+
fireEvent(eventKey, attributes);
|
|
71
|
+
}, [openTime, fireEvent]);
|
|
85
72
|
var _useKudos = useKudos(props.cloudId, props.userId, props.teamCentralBaseUrl, props.openKudosDrawer),
|
|
86
73
|
kudosAction = _useKudos.kudosAction;
|
|
87
74
|
var _props$actions = props.actions,
|
|
@@ -102,39 +89,29 @@ export var ProfilecardInternal = function ProfilecardInternal(props) {
|
|
|
102
89
|
var canRender = !hasError && !isLoading && !!(fullName || status === 'closed');
|
|
103
90
|
useEffect(function () {
|
|
104
91
|
if (canRender) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
});
|
|
113
|
-
} else {
|
|
114
|
-
fireAnalyticsWithDuration(function (duration) {
|
|
115
|
-
return profileCardRendered('user', 'content', {
|
|
116
|
-
duration: duration,
|
|
117
|
-
numActions: realActions.length
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
}
|
|
92
|
+
fireAnalyticsWithDuration('ui.profilecard.rendered.content', function (duration) {
|
|
93
|
+
return _objectSpread({
|
|
94
|
+
duration: duration,
|
|
95
|
+
numActions: realActions.length,
|
|
96
|
+
firedAt: Math.round(getPageTime())
|
|
97
|
+
}, PACKAGE_META_DATA);
|
|
98
|
+
});
|
|
121
99
|
}
|
|
122
|
-
}, [canRender, fireAnalyticsWithDuration,
|
|
100
|
+
}, [canRender, fireAnalyticsWithDuration, realActions]);
|
|
123
101
|
if (hasError) {
|
|
124
102
|
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
125
103
|
ariaLabel: intl.formatMessage(messages.errorDialogLabel)
|
|
126
104
|
}, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
127
105
|
reload: props.clientFetchProfile,
|
|
128
106
|
errorType: props.errorType || null,
|
|
129
|
-
fireAnalytics:
|
|
107
|
+
fireAnalytics: fireEvent
|
|
130
108
|
}));
|
|
131
109
|
}
|
|
132
110
|
if (isLoading) {
|
|
133
111
|
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
134
112
|
ariaLabel: intl.formatMessage(messages.loadingDialogLabel)
|
|
135
113
|
}, /*#__PURE__*/React.createElement(LoadingView, {
|
|
136
|
-
fireAnalyticsWithDuration: fireAnalyticsWithDuration
|
|
137
|
-
fireAnalyticsWithDurationNext: fireAnalyticsWithDurationNext
|
|
114
|
+
fireAnalyticsWithDuration: fireAnalyticsWithDuration
|
|
138
115
|
}));
|
|
139
116
|
}
|
|
140
117
|
if (!canRender) {
|
|
@@ -152,8 +129,7 @@ export var ProfilecardInternal = function ProfilecardInternal(props) {
|
|
|
152
129
|
borderColor: "var(--ds-shadow-overlay, ".concat(N0, ")")
|
|
153
130
|
})), /*#__PURE__*/React.createElement(CardContent, null, /*#__PURE__*/React.createElement(ProfileCardDetails, _extends({}, props, {
|
|
154
131
|
status: status,
|
|
155
|
-
fireAnalyticsWithDuration: fireAnalyticsWithDuration
|
|
156
|
-
fireAnalyticsWithDurationNext: fireAnalyticsWithDurationNext
|
|
132
|
+
fireAnalyticsWithDuration: fireAnalyticsWithDuration
|
|
157
133
|
})), realActions && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ActionsFlexSpacer, null), /*#__PURE__*/React.createElement(Actions, _extends({}, fg('jfp_a11y_team_profile_card_actions_label') && {
|
|
158
134
|
fullName: fullName
|
|
159
135
|
}, {
|
|
@@ -161,46 +137,32 @@ export var ProfilecardInternal = function ProfilecardInternal(props) {
|
|
|
161
137
|
actions: realActions,
|
|
162
138
|
fireAnalyticsWithDuration: fireAnalyticsWithDuration,
|
|
163
139
|
isTriggeredUsingKeyboard: props.isTriggeredUsingKeyboard,
|
|
164
|
-
isRenderedInPortal: props.isRenderedInPortal
|
|
165
|
-
fireAnalyticsWithDurationNext: fireAnalyticsWithDurationNext
|
|
140
|
+
isRenderedInPortal: props.isRenderedInPortal
|
|
166
141
|
}))))));
|
|
167
142
|
};
|
|
168
143
|
var Actions = function Actions(_ref) {
|
|
169
144
|
var actions = _ref.actions,
|
|
170
145
|
fireAnalyticsWithDuration = _ref.fireAnalyticsWithDuration,
|
|
171
|
-
fireAnalyticsWithDurationNext = _ref.fireAnalyticsWithDurationNext,
|
|
172
146
|
isTriggeredUsingKeyboard = _ref.isTriggeredUsingKeyboard,
|
|
173
147
|
isRenderedInPortal = _ref.isRenderedInPortal,
|
|
174
148
|
fullName = _ref.fullName;
|
|
175
149
|
var onActionClick = useCallback(function (action, args, event, index) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
});
|
|
188
|
-
} else {
|
|
189
|
-
fireAnalyticsWithDuration(function (duration) {
|
|
190
|
-
return actionClicked('user', {
|
|
191
|
-
duration: duration,
|
|
192
|
-
hasHref: !!action.link,
|
|
193
|
-
hasOnClick: !!action.callback,
|
|
194
|
-
index: index,
|
|
195
|
-
actionId: action.id || 'no-id-specified'
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
}
|
|
150
|
+
fireAnalyticsWithDuration('ui.profilecard.clicked.action', function (duration) {
|
|
151
|
+
return _objectSpread({
|
|
152
|
+
method: 'click',
|
|
153
|
+
firedAt: Math.round(getPageTime()),
|
|
154
|
+
duration: duration,
|
|
155
|
+
hasHref: !!action.link,
|
|
156
|
+
hasOnClick: !!action.callback,
|
|
157
|
+
index: index,
|
|
158
|
+
actionId: action.id || 'no-id-specified'
|
|
159
|
+
}, PACKAGE_META_DATA);
|
|
160
|
+
});
|
|
199
161
|
if (action.callback && isBasicClick(event)) {
|
|
200
162
|
event.preventDefault();
|
|
201
163
|
action.callback.apply(action, [event].concat(_toConsumableArray(args)));
|
|
202
164
|
}
|
|
203
|
-
}, [fireAnalyticsWithDuration
|
|
165
|
+
}, [fireAnalyticsWithDuration]);
|
|
204
166
|
if (!actions || actions.length === 0) {
|
|
205
167
|
return null;
|
|
206
168
|
}
|
|
@@ -234,7 +196,6 @@ var Actions = function Actions(_ref) {
|
|
|
234
196
|
}), overflowActions && /*#__PURE__*/React.createElement(OverflowProfileCardButtons, _extends({
|
|
235
197
|
actions: overflowActions,
|
|
236
198
|
fireAnalyticsWithDuration: fireAnalyticsWithDuration,
|
|
237
|
-
fireAnalyticsWithDurationNext: fireAnalyticsWithDurationNext,
|
|
238
199
|
onItemClick: function onItemClick(action, args, event, index) {
|
|
239
200
|
return onActionClick(action, args, event, index + ACTION_OVERFLOW_THRESHOLD);
|
|
240
201
|
}
|
|
@@ -243,26 +204,17 @@ var Actions = function Actions(_ref) {
|
|
|
243
204
|
})));
|
|
244
205
|
};
|
|
245
206
|
export var LoadingView = function LoadingView(_ref2) {
|
|
246
|
-
var fireAnalyticsWithDuration = _ref2.fireAnalyticsWithDuration
|
|
247
|
-
fireAnalyticsWithDurationNext = _ref2.fireAnalyticsWithDurationNext;
|
|
207
|
+
var fireAnalyticsWithDuration = _ref2.fireAnalyticsWithDuration;
|
|
248
208
|
useEffect(function () {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
} else {
|
|
257
|
-
fireAnalyticsWithDuration(function (duration) {
|
|
258
|
-
return profileCardRendered('user', 'spinner', {
|
|
259
|
-
duration: duration
|
|
260
|
-
});
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
}, [fireAnalyticsWithDuration, fireAnalyticsWithDurationNext]);
|
|
209
|
+
fireAnalyticsWithDuration('ui.profilecard.rendered.spinner', function (duration) {
|
|
210
|
+
return _objectSpread({
|
|
211
|
+
firedAt: Math.round(getPageTime()),
|
|
212
|
+
duration: duration
|
|
213
|
+
}, PACKAGE_META_DATA);
|
|
214
|
+
});
|
|
215
|
+
}, [fireAnalyticsWithDuration]);
|
|
264
216
|
return /*#__PURE__*/React.createElement(SpinnerContainer, {
|
|
265
217
|
testId: "profilecard-spinner-container"
|
|
266
218
|
}, /*#__PURE__*/React.createElement(Spinner, null));
|
|
267
219
|
};
|
|
268
|
-
export default
|
|
220
|
+
export default ProfilecardInternal;
|
|
@@ -170,7 +170,6 @@ export var ProfileCardDetails = function ProfileCardDetails(props) {
|
|
|
170
170
|
reportingLines: props.reportingLines,
|
|
171
171
|
reportingLinesProfileUrl: props.reportingLinesProfileUrl,
|
|
172
172
|
onReportingLinesClick: props.onReportingLinesClick,
|
|
173
|
-
fireAnalyticsWithDuration: props.fireAnalyticsWithDuration
|
|
174
|
-
fireAnalyticsWithDurationNext: props.fireAnalyticsWithDurationNext
|
|
173
|
+
fireAnalyticsWithDuration: props.fireAnalyticsWithDuration
|
|
175
174
|
}));
|
|
176
175
|
};
|
|
@@ -9,11 +9,10 @@ import { FormattedMessage, useIntl } from 'react-intl-next';
|
|
|
9
9
|
import Avatar from '@atlaskit/avatar';
|
|
10
10
|
import AvatarGroup from '@atlaskit/avatar-group';
|
|
11
11
|
import { cx } from '@atlaskit/css';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import { Box, Pressable } from '@atlaskit/primitives/compiled';
|
|
14
13
|
import messages from '../../messages';
|
|
15
14
|
import { ManagerName, ManagerSection, OffsetWrapper, ReportingLinesSection } from '../../styled/ReportingLines';
|
|
16
|
-
import { PACKAGE_META_DATA
|
|
15
|
+
import { PACKAGE_META_DATA } from '../../util/analytics';
|
|
17
16
|
import { getPageTime } from '../../util/performance';
|
|
18
17
|
function getProfileHref(userId, profileUrl) {
|
|
19
18
|
return profileUrl ? profileUrl + userId : undefined;
|
|
@@ -29,7 +28,6 @@ var ReportingLinesDetails = function ReportingLinesDetails(props) {
|
|
|
29
28
|
var _useIntl = useIntl(),
|
|
30
29
|
formatMessage = _useIntl.formatMessage;
|
|
31
30
|
var fireAnalyticsWithDuration = props.fireAnalyticsWithDuration,
|
|
32
|
-
fireAnalyticsWithDurationNext = props.fireAnalyticsWithDurationNext,
|
|
33
31
|
_props$reportingLines = props.reportingLines,
|
|
34
32
|
reportingLines = _props$reportingLines === void 0 ? {} : _props$reportingLines,
|
|
35
33
|
reportingLinesProfileUrl = props.reportingLinesProfileUrl,
|
|
@@ -42,22 +40,13 @@ var ReportingLinesDetails = function ReportingLinesDetails(props) {
|
|
|
42
40
|
var hasReports = reports.length > 0;
|
|
43
41
|
var getReportingLinesOnClick = function getReportingLinesOnClick(user, userType) {
|
|
44
42
|
return onReportingLinesClick ? function () {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
} else {
|
|
54
|
-
fireAnalyticsWithDuration(function (duration) {
|
|
55
|
-
return reportingLinesClicked({
|
|
56
|
-
duration: duration,
|
|
57
|
-
userType: userType
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}
|
|
43
|
+
fireAnalyticsWithDuration('ui.profilecard.clicked.reportingLines', function (duration) {
|
|
44
|
+
return _objectSpread({
|
|
45
|
+
duration: duration,
|
|
46
|
+
userType: userType,
|
|
47
|
+
firedAt: Math.round(getPageTime())
|
|
48
|
+
}, PACKAGE_META_DATA);
|
|
49
|
+
});
|
|
61
50
|
onReportingLinesClick(user);
|
|
62
51
|
} : undefined;
|
|
63
52
|
};
|
|
@@ -66,22 +55,13 @@ var ReportingLinesDetails = function ReportingLinesDetails(props) {
|
|
|
66
55
|
if (onReportingLinesClick) {
|
|
67
56
|
shouldPreventDefault = onReportingLinesClick(user) === false;
|
|
68
57
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
});
|
|
77
|
-
} else {
|
|
78
|
-
fireAnalyticsWithDuration(function (duration) {
|
|
79
|
-
return reportingLinesClicked({
|
|
80
|
-
duration: duration,
|
|
81
|
-
userType: userType
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
}
|
|
58
|
+
fireAnalyticsWithDuration('ui.profilecard.clicked.reportingLines', function (duration) {
|
|
59
|
+
return _objectSpread({
|
|
60
|
+
duration: duration,
|
|
61
|
+
userType: userType,
|
|
62
|
+
firedAt: Math.round(getPageTime())
|
|
63
|
+
}, PACKAGE_META_DATA);
|
|
64
|
+
});
|
|
85
65
|
if (shouldPreventDefault) {
|
|
86
66
|
return;
|
|
87
67
|
}
|
|
@@ -3,16 +3,15 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
6
|
-
var _excluded = ["trigger", "ariaLabelledBy", "children", "renderProfileCard", "fetchProfile", "disabledAriaAttributes", "profileCardType", "testId", "fireAnalytics"
|
|
6
|
+
var _excluded = ["trigger", "ariaLabelledBy", "children", "renderProfileCard", "fetchProfile", "disabledAriaAttributes", "profileCardType", "testId", "fireAnalytics"],
|
|
7
7
|
_excluded2 = ["aria-expanded", "aria-haspopup"];
|
|
8
8
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
9
9
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
10
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
11
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import Popup from '@atlaskit/popup';
|
|
14
13
|
import { layers } from '@atlaskit/theme/constants';
|
|
15
|
-
import {
|
|
14
|
+
import { getActionSubject, PACKAGE_META_DATA } from '../../util/analytics';
|
|
16
15
|
import { getPageTime } from '../../util/performance';
|
|
17
16
|
import { useProfileInfo } from '../../util/useProfileInfo';
|
|
18
17
|
import { LoadingState } from './LoadingState';
|
|
@@ -31,7 +30,6 @@ function ProfileCardTriggerInner(_ref, ref) {
|
|
|
31
30
|
profileCardType = _ref.profileCardType,
|
|
32
31
|
testId = _ref.testId,
|
|
33
32
|
fireAnalytics = _ref.fireAnalytics,
|
|
34
|
-
fireAnalyticsNext = _ref.fireAnalyticsNext,
|
|
35
33
|
popupProps = _objectWithoutProperties(_ref, _excluded);
|
|
36
34
|
var showDelay = _trigger === 'click' ? 0 : DELAY_MS_SHOW;
|
|
37
35
|
var hideDelay = _trigger === 'click' ? 0 : DELAY_MS_HIDE;
|
|
@@ -76,18 +74,12 @@ function ProfileCardTriggerInner(_ref, ref) {
|
|
|
76
74
|
if (!visible) {
|
|
77
75
|
getProfileData === null || getProfileData === void 0 || getProfileData();
|
|
78
76
|
setVisible(true);
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}));
|
|
86
|
-
}
|
|
87
|
-
} else {
|
|
88
|
-
if (fireAnalytics) {
|
|
89
|
-
fireAnalytics(cardTriggered(profileCardType, _trigger));
|
|
90
|
-
}
|
|
77
|
+
if (fireAnalytics) {
|
|
78
|
+
fireAnalytics("ui.".concat(getActionSubject(profileCardType), ".triggered"), _objectSpread(_objectSpread({
|
|
79
|
+
method: _trigger
|
|
80
|
+
}, PACKAGE_META_DATA), {}, {
|
|
81
|
+
firedAt: Math.round(getPageTime())
|
|
82
|
+
}));
|
|
91
83
|
}
|
|
92
84
|
}
|
|
93
85
|
}, showDelay);
|
|
@@ -96,7 +88,7 @@ function ProfileCardTriggerInner(_ref, ref) {
|
|
|
96
88
|
return _context.stop();
|
|
97
89
|
}
|
|
98
90
|
}, _callee);
|
|
99
|
-
})), [showDelay, visible, getProfileData, fireAnalytics, profileCardType, _trigger
|
|
91
|
+
})), [showDelay, visible, getProfileData, fireAnalytics, profileCardType, _trigger]);
|
|
100
92
|
var onMouseEnter = useCallback(function () {
|
|
101
93
|
showProfilecard();
|
|
102
94
|
}, [showProfilecard]);
|
|
@@ -132,7 +124,7 @@ function ProfileCardTriggerInner(_ref, ref) {
|
|
|
132
124
|
}, isLoading ? /*#__PURE__*/React.createElement(ProfileCardWrapper, {
|
|
133
125
|
testId: "profilecard.profilecardtrigger.loading"
|
|
134
126
|
}, /*#__PURE__*/React.createElement(LoadingState, {
|
|
135
|
-
fireAnalytics:
|
|
127
|
+
fireAnalytics: fireAnalytics,
|
|
136
128
|
profileType: profileCardType
|
|
137
129
|
})) : renderProfileCard({
|
|
138
130
|
profileData: profileData,
|
|
@@ -7,17 +7,14 @@ import * as React from 'react';
|
|
|
7
7
|
import { ax, ix } from "@compiled/react/runtime";
|
|
8
8
|
import { useCallback, useMemo } from 'react';
|
|
9
9
|
import { FormattedMessage } from 'react-intl-next';
|
|
10
|
-
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
11
10
|
import AvatarGroup from '@atlaskit/avatar-group';
|
|
12
11
|
import Heading from '@atlaskit/heading';
|
|
13
12
|
import LinkItem from '@atlaskit/menu/link-item';
|
|
14
13
|
import { VerifiedTeamIcon } from '@atlaskit/people-teams-ui-public/verified-team-icon';
|
|
15
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
14
|
import { Box, Flex, Inline, Stack, Text } from '@atlaskit/primitives/compiled';
|
|
17
|
-
import { useAnalyticsEvents
|
|
15
|
+
import { useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics';
|
|
18
16
|
import TeamAvatar from '@atlaskit/teams-avatar';
|
|
19
17
|
import { TeamContainers, useTeamContainers } from '@atlaskit/teams-public';
|
|
20
|
-
import { fireEvent } from '../../util/analytics';
|
|
21
18
|
import TeamAppTile from '../common/assets/TeamAppTile.svg';
|
|
22
19
|
import { TeamActions } from './team-actions';
|
|
23
20
|
import { TeamConnections } from './team-connections/main';
|
|
@@ -52,9 +49,7 @@ export var TeamProfileCard = function TeamProfileCard(_ref) {
|
|
|
52
49
|
teamContainers = _useTeamContainers.teamContainers,
|
|
53
50
|
loading = _useTeamContainers.loading;
|
|
54
51
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
55
|
-
|
|
56
|
-
var _useAnalyticsEventsNe = useAnalyticsEventsNext(),
|
|
57
|
-
fireEventNext = _useAnalyticsEventsNe.fireEvent;
|
|
52
|
+
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
58
53
|
// Ensure that the current container is not the only connection for this team before showing the "Where we work" section
|
|
59
54
|
var hasOtherTeamConnections = useMemo(function () {
|
|
60
55
|
return teamContainers.filter(function (tc) {
|
|
@@ -62,19 +57,8 @@ export var TeamProfileCard = function TeamProfileCard(_ref) {
|
|
|
62
57
|
}).length < teamContainers.length;
|
|
63
58
|
}, [containerId, teamContainers]);
|
|
64
59
|
var onClick = useCallback(function () {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
} else {
|
|
68
|
-
if (createAnalyticsEvent) {
|
|
69
|
-
fireEvent(createAnalyticsEvent, {
|
|
70
|
-
action: 'clicked',
|
|
71
|
-
actionSubject: 'button',
|
|
72
|
-
actionSubjectId: 'viewTeamProfileButton',
|
|
73
|
-
attributes: {}
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}, [createAnalyticsEvent, fireEventNext]);
|
|
60
|
+
fireEvent('ui.button.clicked.viewTeamProfileButton', {});
|
|
61
|
+
}, [fireEvent]);
|
|
78
62
|
return /*#__PURE__*/React.createElement(Box, {
|
|
79
63
|
xcss: styles.wrapperStyles,
|
|
80
64
|
testId: "team-card-".concat(teamId)
|
|
@@ -2,13 +2,10 @@
|
|
|
2
2
|
import "./main.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useCallback } from 'react';
|
|
5
|
-
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
6
5
|
import { LinkItem } from '@atlaskit/menu';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
6
|
import { Box, Inline, Text } from '@atlaskit/primitives/compiled';
|
|
9
|
-
import { useAnalyticsEvents
|
|
7
|
+
import { useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics';
|
|
10
8
|
import { ContainerIcon, getContainerProperties } from '@atlaskit/teams-public';
|
|
11
|
-
import { fireEvent } from '../../../util/analytics';
|
|
12
9
|
var styles = {
|
|
13
10
|
containerTypeIconButtonStyles: "_18u01wug _4t3i7vkz _1bsb7vkz"
|
|
14
11
|
};
|
|
@@ -26,25 +23,12 @@ export var TeamConnections = function TeamConnections(_ref) {
|
|
|
26
23
|
icon = _getContainerProperti.icon,
|
|
27
24
|
containerTypeText = _getContainerProperti.containerTypeText;
|
|
28
25
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
29
|
-
|
|
30
|
-
var _useAnalyticsEventsNe = useAnalyticsEventsNext(),
|
|
31
|
-
fireEventNext = _useAnalyticsEventsNe.fireEvent;
|
|
26
|
+
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
32
27
|
var onClick = useCallback(function () {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} else {
|
|
38
|
-
fireEvent(createAnalyticsEvent, {
|
|
39
|
-
action: 'clicked',
|
|
40
|
-
actionSubject: 'teamConnectionItem',
|
|
41
|
-
actionSubjectId: 'teamProfileCard',
|
|
42
|
-
attributes: {
|
|
43
|
-
container: containerType
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}, [containerType, createAnalyticsEvent, fireEventNext]);
|
|
28
|
+
fireEvent('ui.teamConnectionItem.clicked.teamProfileCard', {
|
|
29
|
+
container: containerType
|
|
30
|
+
});
|
|
31
|
+
}, [containerType, fireEvent]);
|
|
48
32
|
return /*#__PURE__*/React.createElement(LinkItem, {
|
|
49
33
|
href: link,
|
|
50
34
|
onClick: onClick,
|
|
@@ -2,39 +2,10 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { getPageTime } from './performance';
|
|
5
|
-
|
|
6
|
-
/** Below lines are copied from teams common analytics */
|
|
7
|
-
var ANALYTICS_CHANNEL = 'peopleTeams';
|
|
8
5
|
export var PACKAGE_META_DATA = {
|
|
9
6
|
packageName: "@atlaskit/profilecard",
|
|
10
7
|
packageVersion: "0.0.0-development"
|
|
11
8
|
};
|
|
12
|
-
var runItLater = function runItLater(cb) {
|
|
13
|
-
var requestIdleCallback = window.requestIdleCallback;
|
|
14
|
-
if (typeof requestIdleCallback === 'function') {
|
|
15
|
-
return requestIdleCallback(cb);
|
|
16
|
-
}
|
|
17
|
-
if (typeof window.requestAnimationFrame === 'function') {
|
|
18
|
-
return window.requestAnimationFrame(cb);
|
|
19
|
-
}
|
|
20
|
-
return function () {
|
|
21
|
-
return setTimeout(cb);
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* @private
|
|
26
|
-
* @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
|
|
27
|
-
*/
|
|
28
|
-
export var fireEvent = function fireEvent(createAnalyticsEvent, body) {
|
|
29
|
-
if (!createAnalyticsEvent) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
runItLater(function () {
|
|
33
|
-
createAnalyticsEvent(body).fire(ANALYTICS_CHANNEL);
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
/** Above lines are copied from teams common analytics */
|
|
37
|
-
|
|
38
9
|
var TEAM_SUBJECT = 'teamProfileCard';
|
|
39
10
|
var USER_SUBJECT = 'profilecard';
|
|
40
11
|
var AGENT_SUBJECT = 'rovoAgentProfilecard';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type AnalyticsFunction
|
|
2
|
+
import { type AnalyticsFunction } from '../../types';
|
|
3
3
|
declare const _default: (props: {
|
|
4
4
|
analytics: AnalyticsFunction;
|
|
5
|
-
analyticsNext: AnalyticsFunctionNext;
|
|
6
5
|
}) => React.JSX.Element;
|
|
7
6
|
export default _default;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type AnalyticsFunction
|
|
2
|
+
import { type AnalyticsFunction } from '../../types';
|
|
3
3
|
declare const _default: (props: {
|
|
4
4
|
analytics: AnalyticsFunction;
|
|
5
|
-
analyticsNext: AnalyticsFunctionNext;
|
|
6
5
|
}) => React.JSX.Element;
|
|
7
6
|
export default _default;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type AnalyticsProps, type AnalyticsWithDurationProps, type ProfilecardProps } from '../../types';
|
|
3
3
|
export declare const ProfilecardInternal: (props: ProfilecardProps & AnalyticsProps) => React.JSX.Element | null;
|
|
4
|
-
export declare const LoadingView: ({ fireAnalyticsWithDuration,
|
|
5
|
-
|
|
6
|
-
export default _default;
|
|
4
|
+
export declare const LoadingView: ({ fireAnalyticsWithDuration, }: AnalyticsWithDurationProps) => React.JSX.Element;
|
|
5
|
+
export default ProfilecardInternal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const ProfileCardLazy: import("react").LazyExoticComponent<
|
|
1
|
+
export declare const ProfileCardLazy: import("react").LazyExoticComponent<(props: import("../..").ProfilecardProps & import("../../types").AnalyticsProps) => React.JSX.Element | null>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type AnalyticsEventPayload } from '@atlaskit/analytics-next';
|
|
2
1
|
import { type PopupProps } from '@atlaskit/popup';
|
|
3
2
|
import type { AnalyticsEventAttributes } from '@atlaskit/teams-app-internal-analytics';
|
|
4
3
|
import { type ProfileCardErrorType, type ProfileType } from '../../types';
|
|
@@ -14,6 +13,5 @@ export type ProfileCardTriggerProps<T> = {
|
|
|
14
13
|
fetchProfile?: () => Promise<T>;
|
|
15
14
|
profileCardType: ProfileType;
|
|
16
15
|
testId?: string;
|
|
17
|
-
fireAnalytics?: (
|
|
18
|
-
fireAnalyticsNext?: <K extends keyof AnalyticsEventAttributes>(eventKey: K, attributes: AnalyticsEventAttributes[K]) => void;
|
|
16
|
+
fireAnalytics?: <K extends keyof AnalyticsEventAttributes>(eventKey: K, attributes: AnalyticsEventAttributes[K]) => void;
|
|
19
17
|
} & Omit<PopupProps, 'trigger' | 'isOpen' | 'content'>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { type IntlShape } from 'react-intl-next';
|
|
3
|
-
import { type AnalyticsEventPayload, type CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
4
3
|
import { type ConversationStarter } from '@atlaskit/rovo-agent-components/ui/AgentConversationStarters';
|
|
5
4
|
import type { AnalyticsEventAttributes, FireEventType, useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics';
|
|
6
5
|
import { type TeamCentralScopes } from './client/ProfileCardClient';
|
|
@@ -482,19 +481,15 @@ export interface ProfilecardProps {
|
|
|
482
481
|
/** When true (and feature-gated), hide the agent conversation starters section */
|
|
483
482
|
hideAgentConversationStarters?: boolean;
|
|
484
483
|
}
|
|
485
|
-
export type AnalyticsFromDuration = (duration: number) =>
|
|
486
|
-
export type AnalyticsFromDurationNext = <K extends keyof AnalyticsEventAttributes>(eventKey: K, duration: number) => {
|
|
484
|
+
export type AnalyticsFromDuration = <K extends keyof AnalyticsEventAttributes>(eventKey: K, duration: number) => {
|
|
487
485
|
attributes: AnalyticsEventAttributes[K];
|
|
488
486
|
};
|
|
489
|
-
export type AnalyticsFunction = (generator:
|
|
490
|
-
export type AnalyticsFunctionNext = <K extends keyof AnalyticsEventAttributes>(eventKey: K, generator: (duration: number) => AnalyticsEventAttributes[K]) => void;
|
|
487
|
+
export type AnalyticsFunction = <K extends keyof AnalyticsEventAttributes>(eventKey: K, generator: (duration: number) => AnalyticsEventAttributes[K]) => void;
|
|
491
488
|
export interface AnalyticsProps {
|
|
492
|
-
createAnalyticsEvent?: CreateUIAnalyticsEvent;
|
|
493
489
|
fireEvent?: ReturnType<typeof useAnalyticsEvents>['fireEvent'];
|
|
494
490
|
}
|
|
495
491
|
export interface AnalyticsWithDurationProps {
|
|
496
492
|
fireAnalyticsWithDuration: AnalyticsFunction;
|
|
497
|
-
fireAnalyticsWithDurationNext: AnalyticsFunctionNext;
|
|
498
493
|
}
|
|
499
494
|
export interface TeamProfilecardProps extends TeamProfilecardCoreProps {
|
|
500
495
|
/** Indicates whether the team's details are still loading. */
|
|
@@ -507,10 +502,8 @@ export interface TeamProfilecardProps extends TeamProfilecardCoreProps {
|
|
|
507
502
|
team?: Team;
|
|
508
503
|
/** A callback that will try to re-fetch data in case an error occurred. */
|
|
509
504
|
clientFetchProfile?: () => void;
|
|
510
|
-
/** Details relevant to passing around analytics. */
|
|
511
|
-
analytics: AnalyticsFunction;
|
|
512
505
|
/** Details relevant to passing around analytics with @atlaskit/teams-app-internal-analytics. */
|
|
513
|
-
|
|
506
|
+
analytics: AnalyticsFunction;
|
|
514
507
|
/** Set auto focus for actionable items */
|
|
515
508
|
isTriggeredByKeyboard?: boolean;
|
|
516
509
|
}
|
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
import { type AnalyticsEventPayload } from '@atlaskit/analytics-next';
|
|
2
|
-
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
|
|
3
|
-
import { type ErrorAttributes } from '../client/types';
|
|
4
1
|
import { type ProfileType } from '../types';
|
|
2
|
+
type AnalyticsEventPayload = Record<string, any>;
|
|
5
3
|
export declare const PACKAGE_META_DATA: {
|
|
6
4
|
packageName: string;
|
|
7
5
|
packageVersion: string;
|
|
8
6
|
};
|
|
9
|
-
type GenericAttributes = Record<string, string | number | boolean | undefined | string[]
|
|
10
|
-
interface AnalyticsEvent {
|
|
11
|
-
action?: string;
|
|
12
|
-
actionSubject?: string;
|
|
13
|
-
actionSubjectId?: string;
|
|
14
|
-
attributes?: GenericAttributes;
|
|
15
|
-
name?: string;
|
|
16
|
-
source?: string;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* @private
|
|
20
|
-
* @deprecated Analytics events should be fired using the `@atlaskit/teams-app-internal-analytics` package.
|
|
21
|
-
*/
|
|
22
|
-
export declare const fireEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent | undefined, body: AnalyticsEvent) => void;
|
|
7
|
+
type GenericAttributes = Record<string, string | number | boolean | undefined | string[]>;
|
|
23
8
|
export declare const getActionSubject: (type: string) => "teamProfileCard" | "profilecard" | "rovoAgentProfilecard" | "user";
|
|
24
9
|
/**
|
|
25
10
|
* @private
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type AnalyticsFunction
|
|
2
|
+
import { type AnalyticsFunction } from '../../types';
|
|
3
3
|
declare const _default: (props: {
|
|
4
4
|
analytics: AnalyticsFunction;
|
|
5
|
-
analyticsNext: AnalyticsFunctionNext;
|
|
6
5
|
}) => React.JSX.Element;
|
|
7
6
|
export default _default;
|