@atlaskit/profilecard 24.14.1 → 24.16.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 +22 -0
- package/__tests__/vr-tests/agent-profilecard.vr.tsx +5 -5
- package/__tests__/vr-tests/user-profilecard.vr.tsx +30 -30
- package/dist/cjs/client/ProfileCardClient.js +10 -10
- package/dist/cjs/client/RovoAgentCardClient.js +172 -56
- package/dist/cjs/client/TeamProfileCardClient.js +44 -14
- package/dist/cjs/client/UserProfileCardClient.js +2 -9
- package/dist/cjs/client/errorUtils.js +83 -5
- package/dist/cjs/components/Agent/Actions.js +20 -9
- package/dist/cjs/components/Agent/ActionsCompiled.js +18 -8
- package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +3 -1
- package/dist/cjs/components/Agent/AgentProfileCard.js +24 -14
- package/dist/cjs/components/Agent/AgentProfileCardCompiled.js +23 -8
- package/dist/cjs/components/Agent/AgentProfileCardResourced.js +8 -5
- package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +6 -2
- package/dist/cjs/components/Agent/hooks/useAgentActions.js +61 -30
- package/dist/cjs/components/Team/TeamForbiddenErrorState.js +21 -6
- package/dist/cjs/components/Team/TeamLoadingState.js +21 -6
- package/dist/cjs/components/Team/TeamProfileCard.js +155 -60
- package/dist/cjs/components/Team/TeamProfileCardTrigger.js +104 -33
- package/dist/cjs/components/common/ProfileCardTrigger.js +3 -1
- package/dist/cjs/components/team-profile-card/main.js +18 -9
- package/dist/cjs/components/team-profile-card/team-connections/main.js +36 -17
- package/dist/cjs/util/analytics.js +55 -0
- package/dist/es2019/client/ProfileCardClient.js +10 -10
- package/dist/es2019/client/RovoAgentCardClient.js +186 -58
- package/dist/es2019/client/TeamProfileCardClient.js +49 -16
- package/dist/es2019/client/UserProfileCardClient.js +3 -10
- package/dist/es2019/client/errorUtils.js +84 -3
- package/dist/es2019/components/Agent/Actions.js +21 -9
- package/dist/es2019/components/Agent/ActionsCompiled.js +19 -8
- package/dist/es2019/components/Agent/AgentDeleteConfirmationModal.js +3 -1
- package/dist/es2019/components/Agent/AgentProfileCard.js +24 -13
- package/dist/es2019/components/Agent/AgentProfileCardCompiled.js +23 -9
- package/dist/es2019/components/Agent/AgentProfileCardResourced.js +9 -5
- package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +7 -2
- package/dist/es2019/components/Agent/hooks/useAgentActions.js +62 -30
- package/dist/es2019/components/Team/TeamForbiddenErrorState.js +17 -6
- package/dist/es2019/components/Team/TeamLoadingState.js +17 -6
- package/dist/es2019/components/Team/TeamProfileCard.js +144 -54
- package/dist/es2019/components/Team/TeamProfileCardTrigger.js +74 -10
- package/dist/es2019/components/common/ProfileCardTrigger.js +3 -1
- package/dist/es2019/components/team-profile-card/main.js +19 -9
- package/dist/es2019/components/team-profile-card/team-connections/main.js +38 -17
- package/dist/es2019/util/analytics.js +55 -0
- package/dist/esm/client/ProfileCardClient.js +10 -10
- package/dist/esm/client/RovoAgentCardClient.js +174 -58
- package/dist/esm/client/TeamProfileCardClient.js +46 -16
- package/dist/esm/client/UserProfileCardClient.js +3 -10
- package/dist/esm/client/errorUtils.js +82 -4
- package/dist/esm/components/Agent/Actions.js +20 -9
- package/dist/esm/components/Agent/ActionsCompiled.js +18 -8
- package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +3 -1
- package/dist/esm/components/Agent/AgentProfileCard.js +25 -13
- package/dist/esm/components/Agent/AgentProfileCardCompiled.js +24 -9
- package/dist/esm/components/Agent/AgentProfileCardResourced.js +8 -5
- package/dist/esm/components/Agent/AgentProfileCardTrigger.js +6 -2
- package/dist/esm/components/Agent/hooks/useAgentActions.js +61 -30
- package/dist/esm/components/Team/TeamForbiddenErrorState.js +22 -7
- package/dist/esm/components/Team/TeamLoadingState.js +22 -7
- package/dist/esm/components/Team/TeamProfileCard.js +156 -61
- package/dist/esm/components/Team/TeamProfileCardTrigger.js +105 -34
- package/dist/esm/components/common/ProfileCardTrigger.js +3 -1
- package/dist/esm/components/team-profile-card/main.js +18 -9
- package/dist/esm/components/team-profile-card/team-connections/main.js +36 -17
- package/dist/esm/util/analytics.js +55 -0
- package/dist/types/client/ProfileCardClient.d.ts +5 -5
- package/dist/types/client/RovoAgentCardClient.d.ts +5 -4
- package/dist/types/client/TeamProfileCardClient.d.ts +2 -1
- package/dist/types/client/errorUtils.d.ts +2 -1
- package/dist/types/client/types.d.ts +14 -2
- package/dist/types/components/Team/TeamForbiddenErrorState.d.ts +2 -1
- package/dist/types/components/Team/TeamLoadingState.d.ts +2 -1
- package/dist/types/components/Team/TeamProfileCardTrigger.d.ts +7 -2
- package/dist/types/types.d.ts +2 -0
- package/dist/types/util/analytics.d.ts +46 -2
- package/dist/types-ts4.5/client/ProfileCardClient.d.ts +5 -5
- package/dist/types-ts4.5/client/RovoAgentCardClient.d.ts +5 -4
- package/dist/types-ts4.5/client/TeamProfileCardClient.d.ts +2 -1
- package/dist/types-ts4.5/client/errorUtils.d.ts +2 -1
- package/dist/types-ts4.5/client/types.d.ts +14 -2
- package/dist/types-ts4.5/components/Team/TeamForbiddenErrorState.d.ts +2 -1
- package/dist/types-ts4.5/components/Team/TeamLoadingState.d.ts +2 -1
- package/dist/types-ts4.5/components/Team/TeamProfileCardTrigger.d.ts +7 -2
- package/dist/types-ts4.5/types.d.ts +2 -0
- package/dist/types-ts4.5/util/analytics.d.ts +46 -2
- package/package.json +8 -8
|
@@ -17,22 +17,34 @@ import { AnimatedKudosButton, AnimationWrapper, KudosBlobAnimation } from '../..
|
|
|
17
17
|
import { ErrorWrapper, TeamErrorText } from '../../styled/Error';
|
|
18
18
|
import { ActionButtons, AvatarSection, Description, DescriptionWrapper, MemberCount, MoreButton, TeamName, WrappedButton } from '../../styled/TeamCard';
|
|
19
19
|
import { CardContent, CardHeader, CardWrapper } from '../../styled/TeamTrigger';
|
|
20
|
-
import { actionClicked, errorRetryClicked, moreActionsClicked, moreMembersClicked, profileCardRendered, teamAvatarClicked } from '../../util/analytics';
|
|
20
|
+
import { actionClicked, errorRetryClicked, moreActionsClicked, moreMembersClicked, PACKAGE_META_DATA, profileCardRendered, teamAvatarClicked } from '../../util/analytics';
|
|
21
21
|
import { isBasicClick } from '../../util/click';
|
|
22
|
+
import { getPageTime } from '../../util/performance';
|
|
22
23
|
import { ErrorIllustration } from '../Error';
|
|
23
24
|
import TeamForbiddenErrorState from './TeamForbiddenErrorState';
|
|
24
25
|
import TeamLoadingState from './TeamLoadingState';
|
|
25
26
|
const LARGE_MEMBER_COUNT = 50;
|
|
26
27
|
const GIVE_KUDOS_ACTION_ID = 'give-kudos';
|
|
27
28
|
const avatarGroupMaxCount = 9;
|
|
28
|
-
function onMemberClick(callback, userId, analytics, index, hasHref) {
|
|
29
|
+
function onMemberClick(callback, userId, analytics, analyticsNext, index, hasHref) {
|
|
29
30
|
return event => {
|
|
30
|
-
analytics
|
|
31
|
-
duration
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
32
|
+
analyticsNext('ui.teamProfileCard.clicked.avatar', duration => ({
|
|
33
|
+
duration,
|
|
34
|
+
hasHref,
|
|
35
|
+
hasOnClick: !!callback,
|
|
36
|
+
index,
|
|
37
|
+
firedAt: Math.round(getPageTime()),
|
|
38
|
+
...PACKAGE_META_DATA
|
|
39
|
+
}));
|
|
40
|
+
} else {
|
|
41
|
+
analytics(duration => teamAvatarClicked({
|
|
42
|
+
duration,
|
|
43
|
+
hasHref,
|
|
44
|
+
hasOnClick: !!callback,
|
|
45
|
+
index
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
36
48
|
if (callback) {
|
|
37
49
|
callback(userId, event);
|
|
38
50
|
}
|
|
@@ -44,6 +56,7 @@ const TeamMembers = ({
|
|
|
44
56
|
members,
|
|
45
57
|
onUserClick,
|
|
46
58
|
includingYou,
|
|
59
|
+
analyticsNext,
|
|
47
60
|
isTriggeredByKeyboard
|
|
48
61
|
}) => {
|
|
49
62
|
const {
|
|
@@ -68,13 +81,22 @@ const TeamMembers = ({
|
|
|
68
81
|
current: isOpen
|
|
69
82
|
} = isMoreMembersOpen;
|
|
70
83
|
if (!isOpen) {
|
|
71
|
-
analytics
|
|
72
|
-
duration
|
|
73
|
-
|
|
74
|
-
|
|
84
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
85
|
+
analyticsNext('ui.teamProfileCard.clicked.moreMembers', duration => ({
|
|
86
|
+
duration,
|
|
87
|
+
memberCount: count,
|
|
88
|
+
firedAt: Math.round(getPageTime()),
|
|
89
|
+
...PACKAGE_META_DATA
|
|
90
|
+
}));
|
|
91
|
+
} else {
|
|
92
|
+
analytics(duration => moreMembersClicked({
|
|
93
|
+
duration,
|
|
94
|
+
memberCount: count
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
75
97
|
}
|
|
76
98
|
isMoreMembersOpen.current = !isOpen;
|
|
77
|
-
}, [analytics, count]);
|
|
99
|
+
}, [analytics, count, analyticsNext]);
|
|
78
100
|
const showMoreButtonProps = {
|
|
79
101
|
onClick: onMoreClick,
|
|
80
102
|
'aria-label': formatMessage(messages.profileCardMoreMembersLabel, {
|
|
@@ -89,7 +111,7 @@ const TeamMembers = ({
|
|
|
89
111
|
appearance: "stack",
|
|
90
112
|
data: members.map((member, index) => {
|
|
91
113
|
const href = generateUserLink === null || generateUserLink === void 0 ? void 0 : generateUserLink(member.id);
|
|
92
|
-
const onClick = onMemberClick(onUserClick, member.id, analytics, index, !!generateUserLink);
|
|
114
|
+
const onClick = onMemberClick(onUserClick, member.id, analytics, analyticsNext, index, !!generateUserLink);
|
|
93
115
|
return {
|
|
94
116
|
key: member.id,
|
|
95
117
|
name: member.fullName,
|
|
@@ -112,15 +134,27 @@ const TeamMembers = ({
|
|
|
112
134
|
}
|
|
113
135
|
})));
|
|
114
136
|
};
|
|
115
|
-
function onActionClick(action, analytics, index) {
|
|
137
|
+
function onActionClick(action, analytics, analyticsNext, index) {
|
|
116
138
|
return (event, ...args) => {
|
|
117
|
-
|
|
118
|
-
duration
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
139
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
140
|
+
analyticsNext('ui.teamProfileCard.clicked.action', duration => ({
|
|
141
|
+
duration,
|
|
142
|
+
hasHref: !!action.link,
|
|
143
|
+
hasOnClick: !!action.callback,
|
|
144
|
+
index,
|
|
145
|
+
actionId: action.id || '',
|
|
146
|
+
firedAt: Math.round(getPageTime()),
|
|
147
|
+
...PACKAGE_META_DATA
|
|
148
|
+
}));
|
|
149
|
+
} else {
|
|
150
|
+
analytics(duration => actionClicked('team', {
|
|
151
|
+
duration,
|
|
152
|
+
hasHref: !!action.link,
|
|
153
|
+
hasOnClick: !!action.callback,
|
|
154
|
+
index,
|
|
155
|
+
actionId: action.id || ''
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
124
158
|
if (action.callback && isBasicClick(event)) {
|
|
125
159
|
event.preventDefault();
|
|
126
160
|
action.callback(event, ...args);
|
|
@@ -130,12 +164,13 @@ function onActionClick(action, analytics, index) {
|
|
|
130
164
|
const ActionButton = ({
|
|
131
165
|
action,
|
|
132
166
|
analytics,
|
|
167
|
+
analyticsNext,
|
|
133
168
|
index
|
|
134
169
|
}) => {
|
|
135
170
|
const isGiveKudosActionButton = action.id === GIVE_KUDOS_ACTION_ID;
|
|
136
171
|
const actionButton = /*#__PURE__*/React.createElement(LinkButton, {
|
|
137
172
|
key: action.id || index,
|
|
138
|
-
onClick: onActionClick(action, analytics, index),
|
|
173
|
+
onClick: onActionClick(action, analytics, analyticsNext, index),
|
|
139
174
|
href: action.link || '',
|
|
140
175
|
target: action.target,
|
|
141
176
|
shouldFitContainer: true
|
|
@@ -147,20 +182,30 @@ const ActionButton = ({
|
|
|
147
182
|
};
|
|
148
183
|
const ExtraActions = ({
|
|
149
184
|
actions,
|
|
150
|
-
analytics
|
|
185
|
+
analytics,
|
|
186
|
+
analyticsNext
|
|
151
187
|
}) => {
|
|
152
188
|
const [isOpen, setOpen] = useState(false);
|
|
153
189
|
const count = actions.length;
|
|
154
190
|
const onMoreClick = useCallback(shouldBeOpen => {
|
|
155
191
|
if (shouldBeOpen) {
|
|
156
192
|
// Only fire this event when OPENING the dropdown
|
|
157
|
-
|
|
158
|
-
duration
|
|
159
|
-
|
|
160
|
-
|
|
193
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
194
|
+
analyticsNext('ui.teamProfileCard.clicked.moreActions', duration => ({
|
|
195
|
+
duration,
|
|
196
|
+
numActions: count + 2,
|
|
197
|
+
firedAt: Math.round(getPageTime()),
|
|
198
|
+
...PACKAGE_META_DATA
|
|
199
|
+
}));
|
|
200
|
+
} else {
|
|
201
|
+
analytics(duration => moreActionsClicked('team', {
|
|
202
|
+
duration,
|
|
203
|
+
numActions: count + 2
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
161
206
|
}
|
|
162
207
|
setOpen(shouldBeOpen);
|
|
163
|
-
}, [analytics, count]);
|
|
208
|
+
}, [analytics, count, analyticsNext]);
|
|
164
209
|
if (!count) {
|
|
165
210
|
return null;
|
|
166
211
|
}
|
|
@@ -169,7 +214,7 @@ const ExtraActions = ({
|
|
|
169
214
|
onClose: () => setOpen(false),
|
|
170
215
|
placement: "bottom-start",
|
|
171
216
|
content: () => /*#__PURE__*/React.createElement(MenuGroup, null, actions.map((action, index) => /*#__PURE__*/React.createElement(LinkItem, {
|
|
172
|
-
onClick: onActionClick(action, analytics, index + 2),
|
|
217
|
+
onClick: onActionClick(action, analytics, analyticsNext, index + 2),
|
|
173
218
|
key: action.id || index,
|
|
174
219
|
href: action.link
|
|
175
220
|
}, action.label))),
|
|
@@ -189,7 +234,8 @@ const ExtraActions = ({
|
|
|
189
234
|
};
|
|
190
235
|
const ButtonSection = ({
|
|
191
236
|
actions,
|
|
192
|
-
analytics
|
|
237
|
+
analytics,
|
|
238
|
+
analyticsNext
|
|
193
239
|
}) => {
|
|
194
240
|
if (!actions) {
|
|
195
241
|
return null;
|
|
@@ -199,16 +245,19 @@ const ButtonSection = ({
|
|
|
199
245
|
return /*#__PURE__*/React.createElement(ActionButtons, null, initialActions.map((action, index) => /*#__PURE__*/React.createElement(ActionButton, {
|
|
200
246
|
action: action,
|
|
201
247
|
analytics: analytics,
|
|
248
|
+
analyticsNext: analyticsNext,
|
|
202
249
|
index: index,
|
|
203
250
|
key: index
|
|
204
251
|
})), extraActions && /*#__PURE__*/React.createElement(ExtraActions, {
|
|
205
252
|
actions: extraActions,
|
|
206
|
-
analytics: analytics
|
|
253
|
+
analytics: analytics,
|
|
254
|
+
analyticsNext: analyticsNext
|
|
207
255
|
}));
|
|
208
256
|
};
|
|
209
257
|
const TeamProfilecardContent = ({
|
|
210
258
|
actions,
|
|
211
259
|
analytics,
|
|
260
|
+
analyticsNext,
|
|
212
261
|
team,
|
|
213
262
|
viewingUserId,
|
|
214
263
|
generateUserLink,
|
|
@@ -225,17 +274,34 @@ const TeamProfilecardContent = ({
|
|
|
225
274
|
}, ...(actions || [])];
|
|
226
275
|
const includingYou = team.members && team.members.some(member => member.id === viewingUserId);
|
|
227
276
|
useEffect(() => {
|
|
228
|
-
analytics
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
277
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
278
|
+
analyticsNext('ui.teamProfileCard.rendered.content', duration => {
|
|
279
|
+
var _team$members$length, _team$members;
|
|
280
|
+
return {
|
|
281
|
+
duration,
|
|
282
|
+
numActions: allActions.length,
|
|
283
|
+
memberCount: (_team$members$length = (_team$members = team.members) === null || _team$members === void 0 ? void 0 : _team$members.length) !== null && _team$members$length !== void 0 ? _team$members$length : null,
|
|
284
|
+
includingYou: includingYou !== null && includingYou !== void 0 ? includingYou : null,
|
|
285
|
+
descriptionLength: team.description.length,
|
|
286
|
+
titleLength: team.displayName.length,
|
|
287
|
+
firedAt: Math.round(getPageTime()),
|
|
288
|
+
...PACKAGE_META_DATA
|
|
289
|
+
};
|
|
237
290
|
});
|
|
238
|
-
}
|
|
291
|
+
} else {
|
|
292
|
+
analytics(duration => {
|
|
293
|
+
var _team$members2;
|
|
294
|
+
return profileCardRendered('team', 'content', {
|
|
295
|
+
duration,
|
|
296
|
+
numActions: allActions.length,
|
|
297
|
+
memberCount: (_team$members2 = team.members) === null || _team$members2 === void 0 ? void 0 : _team$members2.length,
|
|
298
|
+
includingYou,
|
|
299
|
+
descriptionLength: team.description.length,
|
|
300
|
+
titleLength: team.displayName.length
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
|
|
239
305
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
240
306
|
}, [analytics]);
|
|
241
307
|
return /*#__PURE__*/React.createElement(CardWrapper, {
|
|
@@ -247,6 +313,7 @@ const TeamProfilecardContent = ({
|
|
|
247
313
|
content: team.displayName
|
|
248
314
|
}, /*#__PURE__*/React.createElement(Inline, null, /*#__PURE__*/React.createElement(TeamName, null, team.displayName), team.isVerified && /*#__PURE__*/React.createElement(VerifiedTeamIcon, null))), /*#__PURE__*/React.createElement(TeamMembers, {
|
|
249
315
|
analytics: analytics,
|
|
316
|
+
analyticsNext: analyticsNext,
|
|
250
317
|
members: team.members,
|
|
251
318
|
generateUserLink: generateUserLink,
|
|
252
319
|
includingYou: includingYou,
|
|
@@ -254,29 +321,48 @@ const TeamProfilecardContent = ({
|
|
|
254
321
|
isTriggeredByKeyboard: isTriggeredByKeyboard
|
|
255
322
|
}), team.description.trim() && /*#__PURE__*/React.createElement(DescriptionWrapper, null, /*#__PURE__*/React.createElement(Description, null, team.description)), /*#__PURE__*/React.createElement(ButtonSection, {
|
|
256
323
|
actions: allActions,
|
|
257
|
-
analytics: analytics
|
|
324
|
+
analytics: analytics,
|
|
325
|
+
analyticsNext: analyticsNext
|
|
258
326
|
})));
|
|
259
327
|
};
|
|
260
328
|
const ErrorMessage = ({
|
|
261
329
|
analytics,
|
|
330
|
+
analyticsNext,
|
|
262
331
|
clientFetchProfile,
|
|
263
332
|
isLoading
|
|
264
333
|
}) => {
|
|
265
334
|
const hasRetry = !!clientFetchProfile;
|
|
266
335
|
useEffect(() => {
|
|
267
|
-
|
|
268
|
-
duration
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
336
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
337
|
+
analyticsNext('ui.teamProfileCard.rendered.error', duration => ({
|
|
338
|
+
duration,
|
|
339
|
+
hasRetry,
|
|
340
|
+
firedAt: Math.round(getPageTime()),
|
|
341
|
+
...PACKAGE_META_DATA
|
|
342
|
+
}));
|
|
343
|
+
} else {
|
|
344
|
+
analytics(duration => profileCardRendered('team', 'error', {
|
|
345
|
+
duration,
|
|
346
|
+
hasRetry
|
|
347
|
+
}));
|
|
348
|
+
}
|
|
349
|
+
}, [analytics, analyticsNext, hasRetry]);
|
|
272
350
|
const retry = useCallback(() => {
|
|
273
|
-
analytics
|
|
274
|
-
duration
|
|
275
|
-
|
|
351
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
352
|
+
analyticsNext('ui.teamProfileCard.clicked.errorRetry', duration => ({
|
|
353
|
+
duration,
|
|
354
|
+
firedAt: Math.round(getPageTime()),
|
|
355
|
+
...PACKAGE_META_DATA
|
|
356
|
+
}));
|
|
357
|
+
} else {
|
|
358
|
+
analytics(duration => errorRetryClicked({
|
|
359
|
+
duration
|
|
360
|
+
}));
|
|
361
|
+
}
|
|
276
362
|
if (clientFetchProfile) {
|
|
277
363
|
clientFetchProfile();
|
|
278
364
|
}
|
|
279
|
-
}, [analytics, clientFetchProfile]);
|
|
365
|
+
}, [analytics, analyticsNext, clientFetchProfile]);
|
|
280
366
|
return /*#__PURE__*/React.createElement(ErrorWrapper, {
|
|
281
367
|
testId: "team-profilecard-error"
|
|
282
368
|
}, /*#__PURE__*/React.createElement(ErrorIllustration, null), /*#__PURE__*/React.createElement(Text, {
|
|
@@ -292,6 +378,7 @@ const ErrorMessage = ({
|
|
|
292
378
|
const TeamProfileCard = props => {
|
|
293
379
|
const {
|
|
294
380
|
analytics,
|
|
381
|
+
analyticsNext,
|
|
295
382
|
clientFetchProfile,
|
|
296
383
|
hasError,
|
|
297
384
|
isLoading,
|
|
@@ -301,13 +388,15 @@ const TeamProfileCard = props => {
|
|
|
301
388
|
if (hasError) {
|
|
302
389
|
if ((errorType === null || errorType === void 0 ? void 0 : errorType.reason) === 'TEAMS_FORBIDDEN') {
|
|
303
390
|
return /*#__PURE__*/React.createElement(TeamForbiddenErrorState, {
|
|
304
|
-
analytics: analytics
|
|
391
|
+
analytics: analytics,
|
|
392
|
+
analyticsNext: analyticsNext
|
|
305
393
|
});
|
|
306
394
|
} else {
|
|
307
395
|
return /*#__PURE__*/React.createElement(CardWrapper, {
|
|
308
396
|
testId: "team-profilecard"
|
|
309
397
|
}, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
310
398
|
analytics: analytics,
|
|
399
|
+
analyticsNext: analyticsNext,
|
|
311
400
|
clientFetchProfile: clientFetchProfile,
|
|
312
401
|
isLoading: isLoading
|
|
313
402
|
}));
|
|
@@ -315,7 +404,8 @@ const TeamProfileCard = props => {
|
|
|
315
404
|
}
|
|
316
405
|
if (isLoading) {
|
|
317
406
|
return /*#__PURE__*/React.createElement(TeamLoadingState, {
|
|
318
|
-
analytics: analytics
|
|
407
|
+
analytics: analytics,
|
|
408
|
+
analyticsNext: analyticsNext
|
|
319
409
|
});
|
|
320
410
|
}
|
|
321
411
|
if (team) {
|
|
@@ -5,12 +5,14 @@ import { FormattedMessage, injectIntl } from 'react-intl-next';
|
|
|
5
5
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
6
6
|
import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
8
9
|
import Popup from '@atlaskit/popup';
|
|
9
10
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
11
|
+
import { useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics';
|
|
10
12
|
import { layers } from '@atlaskit/theme/constants';
|
|
11
13
|
import filterActions from '../../internal/filterActions';
|
|
12
14
|
import messages from '../../messages';
|
|
13
|
-
import { cardTriggered, fireEvent, profileCardRendered } from '../../util/analytics';
|
|
15
|
+
import { cardTriggered, fireEvent, PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
|
|
14
16
|
import { isBasicClick } from '../../util/click';
|
|
15
17
|
import { DELAY_MS_HIDE, DELAY_MS_SHOW } from '../../util/config';
|
|
16
18
|
import { getPageTime } from '../../util/performance';
|
|
@@ -34,10 +36,24 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
|
|
|
34
36
|
fireEvent(this.props.createAnalyticsEvent, payload);
|
|
35
37
|
}
|
|
36
38
|
});
|
|
39
|
+
_defineProperty(this, "fireAnalyticsNext", (eventKey, ...attributes) => {
|
|
40
|
+
// Don't fire any analytics if the component is unmounted
|
|
41
|
+
if (!this._isMounted) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (this.props.fireEvent) {
|
|
45
|
+
this.props.fireEvent(eventKey, ...attributes);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
37
48
|
_defineProperty(this, "fireAnalyticsWithDuration", generator => {
|
|
38
49
|
const event = generator(getPageTime() - this.openTime);
|
|
39
50
|
this.fireAnalytics(event);
|
|
40
51
|
});
|
|
52
|
+
_defineProperty(this, "fireAnalyticsWithDurationNext", (eventKey, generator) => {
|
|
53
|
+
const duration = getPageTime() - this.openTime;
|
|
54
|
+
const attributes = generator(duration);
|
|
55
|
+
this.fireAnalyticsNext(eventKey, attributes);
|
|
56
|
+
});
|
|
41
57
|
_defineProperty(this, "hideProfilecard", (delay = 0) => {
|
|
42
58
|
clearTimeout(this.showTimer);
|
|
43
59
|
clearTimeout(this.hideTimer);
|
|
@@ -77,7 +93,16 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
|
|
|
77
93
|
this.openedByHover = false;
|
|
78
94
|
this.showProfilecard(0);
|
|
79
95
|
if (!this.state.visible) {
|
|
80
|
-
|
|
96
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
97
|
+
this.fireAnalyticsNext('ui.teamProfileCard.triggered', {
|
|
98
|
+
method: 'click',
|
|
99
|
+
...PACKAGE_META_DATA,
|
|
100
|
+
firedAt: Math.round(getPageTime()),
|
|
101
|
+
teamId: this.props.teamId
|
|
102
|
+
});
|
|
103
|
+
} else {
|
|
104
|
+
this.fireAnalytics(cardTriggered('team', 'click', this.props.teamId));
|
|
105
|
+
}
|
|
81
106
|
}
|
|
82
107
|
}
|
|
83
108
|
});
|
|
@@ -87,7 +112,16 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
|
|
|
87
112
|
}
|
|
88
113
|
if (!this.state.visible) {
|
|
89
114
|
this.openedByHover = true;
|
|
90
|
-
|
|
115
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
116
|
+
this.fireAnalyticsNext('ui.teamProfileCard.triggered', {
|
|
117
|
+
method: 'hover',
|
|
118
|
+
...PACKAGE_META_DATA,
|
|
119
|
+
firedAt: Math.round(getPageTime()),
|
|
120
|
+
teamId: this.props.teamId
|
|
121
|
+
});
|
|
122
|
+
} else {
|
|
123
|
+
this.fireAnalytics(cardTriggered('team', 'hover', this.props.teamId));
|
|
124
|
+
}
|
|
91
125
|
}
|
|
92
126
|
this.showProfilecard(DELAY_MS_SHOW);
|
|
93
127
|
});
|
|
@@ -107,7 +141,16 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
|
|
|
107
141
|
});
|
|
108
142
|
this.showProfilecard(0);
|
|
109
143
|
if (!this.state.visible) {
|
|
110
|
-
|
|
144
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
145
|
+
this.fireAnalyticsNext('ui.teamProfileCard.triggered', {
|
|
146
|
+
method: 'click',
|
|
147
|
+
firedAt: Math.round(getPageTime()),
|
|
148
|
+
teamId: this.props.teamId,
|
|
149
|
+
...PACKAGE_META_DATA
|
|
150
|
+
});
|
|
151
|
+
} else {
|
|
152
|
+
this.fireAnalytics(cardTriggered('team', 'click', this.props.teamId));
|
|
153
|
+
}
|
|
111
154
|
}
|
|
112
155
|
}
|
|
113
156
|
});
|
|
@@ -178,7 +221,10 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
|
|
|
178
221
|
const fireEvent = event => {
|
|
179
222
|
this.fireAnalytics(event);
|
|
180
223
|
};
|
|
181
|
-
const
|
|
224
|
+
const fireAnalyticsNext = (eventKey, ...attributes) => {
|
|
225
|
+
this.fireAnalyticsNext(eventKey, ...attributes);
|
|
226
|
+
};
|
|
227
|
+
const requests = Promise.all([this.props.resourceClient.getTeamProfile(teamId, orgId, fireEvent, fireAnalyticsNext), this.props.resourceClient.shouldShowGiveKudos(), this.props.resourceClient.getTeamCentralBaseUrl({
|
|
182
228
|
withOrgContext: true,
|
|
183
229
|
withSiteContext: true
|
|
184
230
|
})]);
|
|
@@ -186,9 +232,17 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
|
|
|
186
232
|
});
|
|
187
233
|
});
|
|
188
234
|
_defineProperty(this, "onErrorBoundary", () => {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
235
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
236
|
+
this.fireAnalyticsNext('ui.teamProfileCard.rendered.errorBoundary', {
|
|
237
|
+
...PACKAGE_META_DATA,
|
|
238
|
+
firedAt: Math.round(getPageTime()),
|
|
239
|
+
duration: 0
|
|
240
|
+
});
|
|
241
|
+
} else {
|
|
242
|
+
this.fireAnalytics(profileCardRendered('team', 'errorBoundary', {
|
|
243
|
+
duration: 0
|
|
244
|
+
}));
|
|
245
|
+
}
|
|
192
246
|
this.setState({
|
|
193
247
|
renderError: true
|
|
194
248
|
});
|
|
@@ -211,6 +265,7 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
|
|
|
211
265
|
clientFetchProfile: this.clientFetchProfile,
|
|
212
266
|
actions: this.filterActions(),
|
|
213
267
|
analytics: this.fireAnalyticsWithDuration,
|
|
268
|
+
analyticsNext: this.fireAnalyticsWithDurationNext,
|
|
214
269
|
team: data || undefined,
|
|
215
270
|
generateUserLink,
|
|
216
271
|
onUserClick,
|
|
@@ -220,7 +275,8 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
|
|
|
220
275
|
};
|
|
221
276
|
return /*#__PURE__*/React.createElement("div", this.cardListeners, this.state.visible && /*#__PURE__*/React.createElement(Suspense, {
|
|
222
277
|
fallback: /*#__PURE__*/React.createElement(TeamLoadingState, {
|
|
223
|
-
analytics: this.fireAnalyticsWithDuration
|
|
278
|
+
analytics: this.fireAnalyticsWithDuration,
|
|
279
|
+
analyticsNext: this.fireAnalyticsWithDurationNext
|
|
224
280
|
})
|
|
225
281
|
}, /*#__PURE__*/React.createElement(TeamProfileCardLazy, _extends({}, newProps, {
|
|
226
282
|
isLoading: isLoading,
|
|
@@ -371,4 +427,12 @@ _defineProperty(TeamProfileCardTriggerInternal, "defaultProps", {
|
|
|
371
427
|
triggerLinkType: 'link',
|
|
372
428
|
shouldRenderToParent: true
|
|
373
429
|
});
|
|
374
|
-
|
|
430
|
+
const TeamProfileCardTriggerWithAnalytics = props => {
|
|
431
|
+
const {
|
|
432
|
+
fireEvent
|
|
433
|
+
} = useAnalyticsEvents();
|
|
434
|
+
return /*#__PURE__*/React.createElement(TeamProfileCardTriggerInternal, _extends({}, props, {
|
|
435
|
+
fireEvent: fireEvent
|
|
436
|
+
}));
|
|
437
|
+
};
|
|
438
|
+
export default componentWithFG('ptc-enable-profile-card-analytics-refactor', injectIntl(TeamProfileCardTriggerWithAnalytics), withAnalyticsEvents()(injectIntl(TeamProfileCardTriggerInternal)));
|
|
@@ -107,7 +107,9 @@ function ProfileCardTriggerInner({
|
|
|
107
107
|
/*#__PURE__*/
|
|
108
108
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
109
109
|
React.createElement("div", {
|
|
110
|
-
onMouseEnter: onMouseEnter
|
|
110
|
+
onMouseEnter: onMouseEnter
|
|
111
|
+
// eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
|
|
112
|
+
,
|
|
111
113
|
onMouseLeave: hideProfilecard,
|
|
112
114
|
onFocus: showProfilecard,
|
|
113
115
|
"data-testid": "profile-card--trigger-content"
|
|
@@ -9,7 +9,9 @@ import AvatarGroup from '@atlaskit/avatar-group';
|
|
|
9
9
|
import Heading from '@atlaskit/heading';
|
|
10
10
|
import LinkItem from '@atlaskit/menu/link-item';
|
|
11
11
|
import { VerifiedTeamIcon } from '@atlaskit/people-teams-ui-public/verified-team-icon';
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
13
|
import { Box, Flex, Inline, Pressable, Stack, Text } from '@atlaskit/primitives/compiled';
|
|
14
|
+
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
13
15
|
import TeamAvatar from '@atlaskit/teams-avatar';
|
|
14
16
|
import { TeamContainers, useTeamContainers } from '@atlaskit/teams-public';
|
|
15
17
|
import { fireEvent } from '../../util/analytics';
|
|
@@ -72,24 +74,31 @@ export const TeamProfileCard = ({
|
|
|
72
74
|
const {
|
|
73
75
|
createAnalyticsEvent
|
|
74
76
|
} = useAnalyticsEvents();
|
|
77
|
+
const {
|
|
78
|
+
fireEvent: fireEventNext
|
|
79
|
+
} = useAnalyticsEventsNext();
|
|
75
80
|
// Ensure that the current container is not the only connection for this team before showing the "Where we work" section
|
|
76
81
|
const hasOtherTeamConnections = useMemo(() => teamContainers.filter(tc => tc.id === containerId).length < teamContainers.length, [containerId, teamContainers]);
|
|
77
82
|
|
|
78
83
|
// TODO: set isNewLayout to be true when clean up 'team-bi-directional-container-connection' experiment
|
|
79
84
|
const isNewLayout = Boolean(props.isKudosEnabled || props.otherActions);
|
|
80
85
|
const onClick = useCallback(() => {
|
|
81
|
-
if (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
87
|
+
fireEventNext('ui.button.clicked.viewTeamProfileButton', {});
|
|
88
|
+
} else {
|
|
89
|
+
if (createAnalyticsEvent) {
|
|
90
|
+
fireEvent(createAnalyticsEvent, {
|
|
91
|
+
action: 'clicked',
|
|
92
|
+
actionSubject: 'button',
|
|
93
|
+
actionSubjectId: 'viewTeamProfileButton',
|
|
94
|
+
attributes: {}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
88
97
|
}
|
|
89
98
|
if (!isNewLayout) {
|
|
90
99
|
window.open(teamProfileUrl, '_blank');
|
|
91
100
|
}
|
|
92
|
-
}, [createAnalyticsEvent, teamProfileUrl, isNewLayout]);
|
|
101
|
+
}, [createAnalyticsEvent, teamProfileUrl, isNewLayout, fireEventNext]);
|
|
93
102
|
if (isNewLayout) {
|
|
94
103
|
return /*#__PURE__*/React.createElement(Box, {
|
|
95
104
|
xcss: styles.wrapperStyles,
|
|
@@ -174,7 +183,8 @@ export const TeamProfileCard = ({
|
|
|
174
183
|
testId: "team-app-tile",
|
|
175
184
|
alt: "team-app-tile",
|
|
176
185
|
xcss: styles.teamAppTileStyles
|
|
177
|
-
})
|
|
186
|
+
}),
|
|
187
|
+
testId: "team-profile-card-profile-link-item"
|
|
178
188
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
179
189
|
maxLines: 1,
|
|
180
190
|
color: "color.text"
|
|
@@ -4,7 +4,9 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
4
4
|
import React, { useCallback } from 'react';
|
|
5
5
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
6
6
|
import { LinkItem } from '@atlaskit/menu';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { Box, Inline, Stack, Text } from '@atlaskit/primitives/compiled';
|
|
9
|
+
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
8
10
|
import { ContainerIcon, getContainerProperties } from '@atlaskit/teams-public';
|
|
9
11
|
import { fireEvent } from '../../../util/analytics';
|
|
10
12
|
const styles = {
|
|
@@ -30,16 +32,25 @@ export const TeamConnections = ({
|
|
|
30
32
|
const {
|
|
31
33
|
createAnalyticsEvent
|
|
32
34
|
} = useAnalyticsEvents();
|
|
35
|
+
const {
|
|
36
|
+
fireEvent: fireEventNext
|
|
37
|
+
} = useAnalyticsEventsNext();
|
|
33
38
|
const onClick = useCallback(() => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
actionSubject: 'teamConnectionItem',
|
|
37
|
-
actionSubjectId: 'teamProfileCard',
|
|
38
|
-
attributes: {
|
|
39
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
40
|
+
fireEventNext('ui.teamConnectionItem.clicked.teamProfileCard', {
|
|
39
41
|
container: containerType
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
42
|
+
});
|
|
43
|
+
} else {
|
|
44
|
+
fireEvent(createAnalyticsEvent, {
|
|
45
|
+
action: 'clicked',
|
|
46
|
+
actionSubject: 'teamConnectionItem',
|
|
47
|
+
actionSubjectId: 'teamProfileCard',
|
|
48
|
+
attributes: {
|
|
49
|
+
container: containerType
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}, [containerType, createAnalyticsEvent, fireEventNext]);
|
|
43
54
|
return /*#__PURE__*/React.createElement(LinkItem, {
|
|
44
55
|
href: link,
|
|
45
56
|
onClick: onClick,
|
|
@@ -87,16 +98,25 @@ export const NewTeamConnections = ({
|
|
|
87
98
|
const {
|
|
88
99
|
createAnalyticsEvent
|
|
89
100
|
} = useAnalyticsEvents();
|
|
101
|
+
const {
|
|
102
|
+
fireEvent: fireEventNext
|
|
103
|
+
} = useAnalyticsEventsNext();
|
|
90
104
|
const onClick = useCallback(() => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
actionSubject: 'teamConnectionItem',
|
|
94
|
-
actionSubjectId: 'teamProfileCard',
|
|
95
|
-
attributes: {
|
|
105
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
106
|
+
fireEventNext('ui.teamConnectionItem.clicked.teamProfileCard', {
|
|
96
107
|
container: containerType
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
108
|
+
});
|
|
109
|
+
} else {
|
|
110
|
+
fireEvent(createAnalyticsEvent, {
|
|
111
|
+
action: 'clicked',
|
|
112
|
+
actionSubject: 'teamConnectionItem',
|
|
113
|
+
actionSubjectId: 'teamProfileCard',
|
|
114
|
+
attributes: {
|
|
115
|
+
container: containerType
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}, [containerType, createAnalyticsEvent, fireEventNext]);
|
|
100
120
|
return /*#__PURE__*/React.createElement(LinkItem, {
|
|
101
121
|
href: link,
|
|
102
122
|
onClick: onClick,
|
|
@@ -120,7 +140,8 @@ export const NewTeamConnections = ({
|
|
|
120
140
|
backgroundColor: 'color.background.neutral.subtle',
|
|
121
141
|
xcss: styles.containerTypeIconButtonStyles,
|
|
122
142
|
testId: "container-type-icon"
|
|
123
|
-
}, icon)
|
|
143
|
+
}, icon),
|
|
144
|
+
testId: "team-connection-item"
|
|
124
145
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
125
146
|
maxLines: 1,
|
|
126
147
|
color: "color.text"
|