@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.
Files changed (70) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/afm-cc/tsconfig.json +0 -6
  3. package/afm-jira/tsconfig.json +0 -6
  4. package/afm-products/tsconfig.json +0 -6
  5. package/dist/cjs/components/Agent/Actions.js +7 -24
  6. package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +4 -2
  7. package/dist/cjs/components/Agent/AgentProfileCard.js +2 -1
  8. package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +3 -3
  9. package/dist/cjs/components/Agent/hooks/useAgentActions.js +20 -72
  10. package/dist/cjs/components/Team/TeamForbiddenErrorState.js +8 -18
  11. package/dist/cjs/components/Team/TeamLoadingState.js +8 -18
  12. package/dist/cjs/components/Team/TeamProfileCard.js +76 -162
  13. package/dist/cjs/components/Team/TeamProfileCardTrigger.js +2 -4
  14. package/dist/cjs/components/User/OverflowProfileCardButtons.js +9 -19
  15. package/dist/cjs/components/User/ProfileCard.js +37 -85
  16. package/dist/cjs/components/User/ProfileCardDetails.js +1 -2
  17. package/dist/cjs/components/User/ReportingLinesDetails.js +14 -34
  18. package/dist/cjs/components/common/ProfileCardTrigger.js +9 -17
  19. package/dist/cjs/components/team-profile-card/main.js +4 -20
  20. package/dist/cjs/components/team-profile-card/team-connections/main.js +6 -22
  21. package/dist/cjs/util/analytics.js +1 -29
  22. package/dist/es2019/components/Agent/Actions.js +7 -25
  23. package/dist/es2019/components/Agent/AgentDeleteConfirmationModal.js +4 -2
  24. package/dist/es2019/components/Agent/AgentProfileCard.js +2 -1
  25. package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +2 -2
  26. package/dist/es2019/components/Agent/hooks/useAgentActions.js +20 -73
  27. package/dist/es2019/components/Team/TeamForbiddenErrorState.js +8 -16
  28. package/dist/es2019/components/Team/TeamLoadingState.js +8 -16
  29. package/dist/es2019/components/Team/TeamProfileCard.js +72 -146
  30. package/dist/es2019/components/Team/TeamProfileCardTrigger.js +2 -4
  31. package/dist/es2019/components/User/OverflowProfileCardButtons.js +9 -17
  32. package/dist/es2019/components/User/ProfileCard.js +35 -79
  33. package/dist/es2019/components/User/ProfileCardDetails.js +1 -2
  34. package/dist/es2019/components/User/ReportingLinesDetails.js +13 -29
  35. package/dist/es2019/components/common/ProfileCardTrigger.js +9 -17
  36. package/dist/es2019/components/team-profile-card/main.js +4 -21
  37. package/dist/es2019/components/team-profile-card/team-connections/main.js +6 -23
  38. package/dist/es2019/util/analytics.js +0 -27
  39. package/dist/esm/components/Agent/Actions.js +7 -24
  40. package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +4 -2
  41. package/dist/esm/components/Agent/AgentProfileCard.js +2 -1
  42. package/dist/esm/components/Agent/AgentProfileCardTrigger.js +2 -2
  43. package/dist/esm/components/Agent/hooks/useAgentActions.js +20 -72
  44. package/dist/esm/components/Team/TeamForbiddenErrorState.js +9 -19
  45. package/dist/esm/components/Team/TeamLoadingState.js +9 -19
  46. package/dist/esm/components/Team/TeamProfileCard.js +77 -163
  47. package/dist/esm/components/Team/TeamProfileCardTrigger.js +2 -4
  48. package/dist/esm/components/User/OverflowProfileCardButtons.js +10 -20
  49. package/dist/esm/components/User/ProfileCard.js +38 -86
  50. package/dist/esm/components/User/ProfileCardDetails.js +1 -2
  51. package/dist/esm/components/User/ReportingLinesDetails.js +15 -35
  52. package/dist/esm/components/common/ProfileCardTrigger.js +10 -18
  53. package/dist/esm/components/team-profile-card/main.js +4 -20
  54. package/dist/esm/components/team-profile-card/team-connections/main.js +6 -22
  55. package/dist/esm/util/analytics.js +0 -29
  56. package/dist/types/components/Team/TeamForbiddenErrorState.d.ts +1 -2
  57. package/dist/types/components/Team/TeamLoadingState.d.ts +1 -2
  58. package/dist/types/components/User/ProfileCard.d.ts +2 -3
  59. package/dist/types/components/User/lazyProfileCard.d.ts +1 -1
  60. package/dist/types/components/common/types.d.ts +1 -3
  61. package/dist/types/types.d.ts +3 -10
  62. package/dist/types/util/analytics.d.ts +2 -17
  63. package/dist/types-ts4.5/components/Team/TeamForbiddenErrorState.d.ts +1 -2
  64. package/dist/types-ts4.5/components/Team/TeamLoadingState.d.ts +1 -2
  65. package/dist/types-ts4.5/components/User/ProfileCard.d.ts +2 -3
  66. package/dist/types-ts4.5/components/User/lazyProfileCard.d.ts +1 -1
  67. package/dist/types-ts4.5/components/common/types.d.ts +1 -3
  68. package/dist/types-ts4.5/types.d.ts +3 -10
  69. package/dist/types-ts4.5/util/analytics.d.ts +2 -17
  70. package/package.json +4 -9
@@ -18,7 +18,7 @@ import { AnimatedKudosButton, AnimationWrapper, KudosBlobAnimation } from '../..
18
18
  import { ErrorWrapper, TeamErrorText } from '../../styled/Error';
19
19
  import { ActionButtons, ArchiveLozengeWrapper, AvatarSection, Description, DescriptionWrapper, MemberCount, MoreButton, TeamName, WrappedButton } from '../../styled/TeamCard';
20
20
  import { CardContent, CardHeader, CardWrapper } from '../../styled/TeamTrigger';
21
- import { actionClicked, errorRetryClicked, moreActionsClicked, moreMembersClicked, PACKAGE_META_DATA, profileCardRendered, teamAvatarClicked } from '../../util/analytics';
21
+ import { PACKAGE_META_DATA } from '../../util/analytics';
22
22
  import { isBasicClick } from '../../util/click';
23
23
  import { getPageTime } from '../../util/performance';
24
24
  import { ErrorIllustration } from '../Error';
@@ -27,25 +27,16 @@ import TeamLoadingState from './TeamLoadingState';
27
27
  const LARGE_MEMBER_COUNT = 50;
28
28
  const GIVE_KUDOS_ACTION_ID = 'give-kudos';
29
29
  const avatarGroupMaxCount = 9;
30
- function onMemberClick(callback, userId, analytics, analyticsNext, index, hasHref) {
30
+ function onMemberClick(callback, userId, analytics, index, hasHref) {
31
31
  return event => {
32
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
33
- analyticsNext('ui.teamProfileCard.clicked.avatar', duration => ({
34
- duration,
35
- hasHref,
36
- hasOnClick: !!callback,
37
- index,
38
- firedAt: Math.round(getPageTime()),
39
- ...PACKAGE_META_DATA
40
- }));
41
- } else {
42
- analytics(duration => teamAvatarClicked({
43
- duration,
44
- hasHref,
45
- hasOnClick: !!callback,
46
- index
47
- }));
48
- }
32
+ analytics('ui.teamProfileCard.clicked.avatar', duration => ({
33
+ duration,
34
+ hasHref,
35
+ hasOnClick: !!callback,
36
+ index,
37
+ firedAt: Math.round(getPageTime()),
38
+ ...PACKAGE_META_DATA
39
+ }));
49
40
  if (callback) {
50
41
  callback(userId, event);
51
42
  }
@@ -58,7 +49,6 @@ const TeamMembers = ({
58
49
  isArchived,
59
50
  onUserClick,
60
51
  includingYou,
61
- analyticsNext,
62
52
  isTriggeredByKeyboard
63
53
  }) => {
64
54
  const {
@@ -83,22 +73,15 @@ const TeamMembers = ({
83
73
  current: isOpen
84
74
  } = isMoreMembersOpen;
85
75
  if (!isOpen) {
86
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
87
- analyticsNext('ui.teamProfileCard.clicked.moreMembers', duration => ({
88
- duration,
89
- memberCount: count,
90
- firedAt: Math.round(getPageTime()),
91
- ...PACKAGE_META_DATA
92
- }));
93
- } else {
94
- analytics(duration => moreMembersClicked({
95
- duration,
96
- memberCount: count
97
- }));
98
- }
76
+ analytics('ui.teamProfileCard.clicked.moreMembers', duration => ({
77
+ duration,
78
+ memberCount: count,
79
+ firedAt: Math.round(getPageTime()),
80
+ ...PACKAGE_META_DATA
81
+ }));
99
82
  }
100
83
  isMoreMembersOpen.current = !isOpen;
101
- }, [analytics, count, analyticsNext]);
84
+ }, [analytics, count]);
102
85
  const showMoreButtonProps = {
103
86
  onClick: onMoreClick,
104
87
  'aria-label': formatMessage(messages.profileCardMoreMembersLabel, {
@@ -116,7 +99,7 @@ const TeamMembers = ({
116
99
  appearance: "stack",
117
100
  data: members.map((member, index) => {
118
101
  const href = generateUserLink === null || generateUserLink === void 0 ? void 0 : generateUserLink(member.id);
119
- const onClick = onMemberClick(onUserClick, member.id, analytics, analyticsNext, index, !!generateUserLink);
102
+ const onClick = onMemberClick(onUserClick, member.id, analytics, index, !!generateUserLink);
120
103
  return {
121
104
  key: member.id,
122
105
  name: member.fullName,
@@ -139,27 +122,17 @@ const TeamMembers = ({
139
122
  }
140
123
  })));
141
124
  };
142
- function onActionClick(action, analytics, analyticsNext, index) {
125
+ function onActionClick(action, analytics, index) {
143
126
  return (event, ...args) => {
144
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
145
- analyticsNext('ui.teamProfileCard.clicked.action', duration => ({
146
- duration,
147
- hasHref: !!action.link,
148
- hasOnClick: !!action.callback,
149
- index,
150
- actionId: action.id || '',
151
- firedAt: Math.round(getPageTime()),
152
- ...PACKAGE_META_DATA
153
- }));
154
- } else {
155
- analytics(duration => actionClicked('team', {
156
- duration,
157
- hasHref: !!action.link,
158
- hasOnClick: !!action.callback,
159
- index,
160
- actionId: action.id || ''
161
- }));
162
- }
127
+ analytics('ui.teamProfileCard.clicked.action', duration => ({
128
+ duration,
129
+ hasHref: !!action.link,
130
+ hasOnClick: !!action.callback,
131
+ index,
132
+ actionId: action.id || '',
133
+ firedAt: Math.round(getPageTime()),
134
+ ...PACKAGE_META_DATA
135
+ }));
163
136
  if (action.callback && isBasicClick(event)) {
164
137
  event.preventDefault();
165
138
  action.callback(event, ...args);
@@ -169,13 +142,12 @@ function onActionClick(action, analytics, analyticsNext, index) {
169
142
  const ActionButton = ({
170
143
  action,
171
144
  analytics,
172
- analyticsNext,
173
145
  index
174
146
  }) => {
175
147
  const isGiveKudosActionButton = action.id === GIVE_KUDOS_ACTION_ID;
176
148
  const actionButton = /*#__PURE__*/React.createElement(LinkButton, {
177
149
  key: action.id || index,
178
- onClick: onActionClick(action, analytics, analyticsNext, index),
150
+ onClick: onActionClick(action, analytics, index),
179
151
  href: action.link || '',
180
152
  target: action.target,
181
153
  shouldFitContainer: true
@@ -187,30 +159,22 @@ const ActionButton = ({
187
159
  };
188
160
  const ExtraActions = ({
189
161
  actions,
190
- analytics,
191
- analyticsNext
162
+ analytics
192
163
  }) => {
193
164
  const [isOpen, setOpen] = useState(false);
194
165
  const count = actions.length;
195
166
  const onMoreClick = useCallback(shouldBeOpen => {
196
167
  if (shouldBeOpen) {
197
168
  // Only fire this event when OPENING the dropdown
198
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
199
- analyticsNext('ui.teamProfileCard.clicked.moreActions', duration => ({
200
- duration,
201
- numActions: count + 2,
202
- firedAt: Math.round(getPageTime()),
203
- ...PACKAGE_META_DATA
204
- }));
205
- } else {
206
- analytics(duration => moreActionsClicked('team', {
207
- duration,
208
- numActions: count + 2
209
- }));
210
- }
169
+ analytics('ui.teamProfileCard.clicked.moreActions', duration => ({
170
+ duration,
171
+ numActions: count + 2,
172
+ firedAt: Math.round(getPageTime()),
173
+ ...PACKAGE_META_DATA
174
+ }));
211
175
  }
212
176
  setOpen(shouldBeOpen);
213
- }, [analytics, count, analyticsNext]);
177
+ }, [analytics, count]);
214
178
  if (!count) {
215
179
  return null;
216
180
  }
@@ -219,7 +183,7 @@ const ExtraActions = ({
219
183
  onClose: () => setOpen(false),
220
184
  placement: "bottom-start",
221
185
  content: () => /*#__PURE__*/React.createElement(MenuGroup, null, actions.map((action, index) => /*#__PURE__*/React.createElement(LinkItem, {
222
- onClick: onActionClick(action, analytics, analyticsNext, index + 2),
186
+ onClick: onActionClick(action, analytics, index + 2),
223
187
  key: action.id || index,
224
188
  href: action.link
225
189
  }, action.label))),
@@ -239,8 +203,7 @@ const ExtraActions = ({
239
203
  };
240
204
  const ButtonSection = ({
241
205
  actions,
242
- analytics,
243
- analyticsNext
206
+ analytics
244
207
  }) => {
245
208
  if (!actions) {
246
209
  return null;
@@ -250,19 +213,16 @@ const ButtonSection = ({
250
213
  return /*#__PURE__*/React.createElement(ActionButtons, null, initialActions.map((action, index) => /*#__PURE__*/React.createElement(ActionButton, {
251
214
  action: action,
252
215
  analytics: analytics,
253
- analyticsNext: analyticsNext,
254
216
  index: index,
255
217
  key: index
256
218
  })), extraActions && /*#__PURE__*/React.createElement(ExtraActions, {
257
219
  actions: extraActions,
258
- analytics: analytics,
259
- analyticsNext: analyticsNext
220
+ analytics: analytics
260
221
  }));
261
222
  };
262
223
  const TeamProfilecardContent = ({
263
224
  actions,
264
225
  analytics,
265
- analyticsNext,
266
226
  team,
267
227
  viewingUserId,
268
228
  generateUserLink,
@@ -280,36 +240,22 @@ const TeamProfilecardContent = ({
280
240
  }, ...(isTeamArchived ? [] : actions || [])];
281
241
  const includingYou = team.members && team.members.some(member => member.id === viewingUserId);
282
242
  useEffect(() => {
283
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
284
- analyticsNext('ui.teamProfileCard.rendered.content', duration => {
285
- var _team$members$length, _team$members;
286
- return {
287
- duration,
288
- numActions: allActions.length,
289
- 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,
290
- includingYou: includingYou !== null && includingYou !== void 0 ? includingYou : null,
291
- descriptionLength: team.description.length,
292
- titleLength: team.displayName.length,
293
- firedAt: Math.round(getPageTime()),
294
- ...PACKAGE_META_DATA
295
- };
296
- });
297
- } else {
298
- analytics(duration => {
299
- var _team$members2;
300
- return profileCardRendered('team', 'content', {
301
- duration,
302
- numActions: allActions.length,
303
- memberCount: (_team$members2 = team.members) === null || _team$members2 === void 0 ? void 0 : _team$members2.length,
304
- includingYou,
305
- descriptionLength: team.description.length,
306
- titleLength: team.displayName.length
307
- });
308
- });
309
- }
310
-
311
- // eslint-disable-next-line react-hooks/exhaustive-deps
312
- }, [analytics]);
243
+ analytics('ui.teamProfileCard.rendered.content', duration => {
244
+ var _team$members$length, _team$members;
245
+ return {
246
+ duration,
247
+ numActions: allActions.length,
248
+ 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,
249
+ includingYou: includingYou !== null && includingYou !== void 0 ? includingYou : null,
250
+ descriptionLength: team.description.length,
251
+ titleLength: team.displayName.length,
252
+ firedAt: Math.round(getPageTime()),
253
+ ...PACKAGE_META_DATA
254
+ };
255
+ });
256
+ },
257
+ // eslint-disable-next-line react-hooks/exhaustive-deps
258
+ [analytics]);
313
259
  return /*#__PURE__*/React.createElement(CardWrapper, {
314
260
  testId: "team-profilecard"
315
261
  }, /*#__PURE__*/React.createElement(CardHeader, {
@@ -320,7 +266,6 @@ const TeamProfilecardContent = ({
320
266
  content: team.displayName
321
267
  }, /*#__PURE__*/React.createElement(Inline, null, /*#__PURE__*/React.createElement(TeamName, null, team.displayName), team.isVerified && /*#__PURE__*/React.createElement(VerifiedTeamIcon, null))), /*#__PURE__*/React.createElement(TeamMembers, {
322
268
  analytics: analytics,
323
- analyticsNext: analyticsNext,
324
269
  members: team.members,
325
270
  isArchived: isTeamArchived,
326
271
  generateUserLink: generateUserLink,
@@ -329,48 +274,33 @@ const TeamProfilecardContent = ({
329
274
  isTriggeredByKeyboard: isTriggeredByKeyboard
330
275
  }), team.description.trim() && /*#__PURE__*/React.createElement(DescriptionWrapper, null, /*#__PURE__*/React.createElement(Description, null, team.description)), /*#__PURE__*/React.createElement(ButtonSection, {
331
276
  actions: allActions,
332
- analytics: analytics,
333
- analyticsNext: analyticsNext
277
+ analytics: analytics
334
278
  })));
335
279
  };
336
280
  const ErrorMessage = ({
337
281
  analytics,
338
- analyticsNext,
339
282
  clientFetchProfile,
340
283
  isLoading
341
284
  }) => {
342
285
  const hasRetry = !!clientFetchProfile;
343
286
  useEffect(() => {
344
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
345
- analyticsNext('ui.teamProfileCard.rendered.error', duration => ({
346
- duration,
347
- hasRetry,
348
- firedAt: Math.round(getPageTime()),
349
- ...PACKAGE_META_DATA
350
- }));
351
- } else {
352
- analytics(duration => profileCardRendered('team', 'error', {
353
- duration,
354
- hasRetry
355
- }));
356
- }
357
- }, [analytics, analyticsNext, hasRetry]);
287
+ analytics('ui.teamProfileCard.rendered.error', duration => ({
288
+ duration,
289
+ hasRetry,
290
+ firedAt: Math.round(getPageTime()),
291
+ ...PACKAGE_META_DATA
292
+ }));
293
+ }, [analytics, hasRetry]);
358
294
  const retry = useCallback(() => {
359
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
360
- analyticsNext('ui.teamProfileCard.clicked.errorRetry', duration => ({
361
- duration,
362
- firedAt: Math.round(getPageTime()),
363
- ...PACKAGE_META_DATA
364
- }));
365
- } else {
366
- analytics(duration => errorRetryClicked({
367
- duration
368
- }));
369
- }
295
+ analytics('ui.teamProfileCard.clicked.errorRetry', duration => ({
296
+ duration,
297
+ firedAt: Math.round(getPageTime()),
298
+ ...PACKAGE_META_DATA
299
+ }));
370
300
  if (clientFetchProfile) {
371
301
  clientFetchProfile();
372
302
  }
373
- }, [analytics, analyticsNext, clientFetchProfile]);
303
+ }, [analytics, clientFetchProfile]);
374
304
  return /*#__PURE__*/React.createElement(ErrorWrapper, {
375
305
  testId: "team-profilecard-error"
376
306
  }, /*#__PURE__*/React.createElement(ErrorIllustration, null), /*#__PURE__*/React.createElement(Text, {
@@ -390,7 +320,6 @@ const ErrorMessage = ({
390
320
  const TeamProfileCard = props => {
391
321
  const {
392
322
  analytics,
393
- analyticsNext,
394
323
  clientFetchProfile,
395
324
  hasError,
396
325
  isLoading,
@@ -400,15 +329,13 @@ const TeamProfileCard = props => {
400
329
  if (hasError) {
401
330
  if ((errorType === null || errorType === void 0 ? void 0 : errorType.reason) === 'TEAMS_FORBIDDEN') {
402
331
  return /*#__PURE__*/React.createElement(TeamForbiddenErrorState, {
403
- analytics: analytics,
404
- analyticsNext: analyticsNext
332
+ analytics: analytics
405
333
  });
406
334
  } else {
407
335
  return /*#__PURE__*/React.createElement(CardWrapper, {
408
336
  testId: "team-profilecard"
409
337
  }, /*#__PURE__*/React.createElement(ErrorMessage, {
410
338
  analytics: analytics,
411
- analyticsNext: analyticsNext,
412
339
  clientFetchProfile: clientFetchProfile,
413
340
  isLoading: isLoading
414
341
  }));
@@ -416,8 +343,7 @@ const TeamProfileCard = props => {
416
343
  }
417
344
  if (isLoading) {
418
345
  return /*#__PURE__*/React.createElement(TeamLoadingState, {
419
- analytics: analytics,
420
- analyticsNext: analyticsNext
346
+ analytics: analytics
421
347
  });
422
348
  }
423
349
  if (team) {
@@ -225,8 +225,7 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
225
225
  const newProps = {
226
226
  clientFetchProfile: this.clientFetchProfile,
227
227
  actions: this.filterActions(),
228
- analytics: () => {},
229
- analyticsNext: this.fireAnalyticsWithDuration,
228
+ analytics: this.fireAnalyticsWithDuration,
230
229
  team: data || undefined,
231
230
  generateUserLink,
232
231
  onUserClick,
@@ -236,8 +235,7 @@ export class TeamProfileCardTriggerInternal extends React.PureComponent {
236
235
  };
237
236
  return /*#__PURE__*/React.createElement("div", this.cardListeners, this.state.visible && /*#__PURE__*/React.createElement(Suspense, {
238
237
  fallback: /*#__PURE__*/React.createElement(TeamLoadingState, {
239
- analytics: () => {},
240
- analyticsNext: this.fireAnalyticsWithDuration
238
+ analytics: this.fireAnalyticsWithDuration
241
239
  })
242
240
  }, /*#__PURE__*/React.createElement(TeamProfileCardLazy, _extends({}, newProps, {
243
241
  isLoading: isLoading,
@@ -7,7 +7,7 @@ import MoreIcon from '@atlaskit/icon/core/show-more-horizontal';
7
7
  import { fg } from '@atlaskit/platform-feature-flags';
8
8
  import messages from '../../messages';
9
9
  import { OverflowActionButtonsWrapper } from '../../styled/Card';
10
- import { moreActionsClicked, PACKAGE_META_DATA } from '../../util/analytics';
10
+ import { PACKAGE_META_DATA } from '../../util/analytics';
11
11
  import { getPageTime } from '../../util/performance';
12
12
  export const ACTION_OVERFLOW_THRESHOLD = 2;
13
13
  export const OverflowProfileCardButtons = props => {
@@ -16,8 +16,7 @@ export const OverflowProfileCardButtons = props => {
16
16
  const {
17
17
  actions,
18
18
  onItemClick,
19
- fireAnalyticsWithDuration,
20
- fireAnalyticsWithDurationNext
19
+ fireAnalyticsWithDuration
21
20
  } = props;
22
21
  const numActions = actions.length + ACTION_OVERFLOW_THRESHOLD;
23
22
  const onOpenChange = useCallback(({
@@ -25,23 +24,16 @@ export const OverflowProfileCardButtons = props => {
25
24
  }) => {
26
25
  setOpen(prevOpen => {
27
26
  if (nextOpen && !prevOpen) {
28
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
29
- fireAnalyticsWithDurationNext('ui.profilecard.clicked.moreActions', duration => ({
30
- duration,
31
- numActions,
32
- firedAt: Math.round(getPageTime()),
33
- ...PACKAGE_META_DATA
34
- }));
35
- } else {
36
- fireAnalyticsWithDuration(duration => moreActionsClicked('user', {
37
- duration,
38
- numActions
39
- }));
40
- }
27
+ fireAnalyticsWithDuration('ui.profilecard.clicked.moreActions', duration => ({
28
+ duration,
29
+ numActions,
30
+ firedAt: Math.round(getPageTime()),
31
+ ...PACKAGE_META_DATA
32
+ }));
41
33
  }
42
34
  return nextOpen;
43
35
  });
44
- }, [numActions, fireAnalyticsWithDuration, fireAnalyticsWithDurationNext]);
36
+ }, [numActions, fireAnalyticsWithDuration]);
45
37
  return /*#__PURE__*/React.createElement(OverflowActionButtonsWrapper, {
46
38
  testId: "profilecard-actions-overflow"
47
39
  }, /*#__PURE__*/React.createElement(DropdownMenu, {
@@ -1,18 +1,16 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
3
3
  import { FormattedMessage, useIntl } from 'react-intl-next';
4
- import { withAnalyticsEvents } from '@atlaskit/analytics-next';
5
4
  import Avatar from '@atlaskit/avatar';
6
5
  import { LinkButton } from '@atlaskit/button/new';
7
6
  import { fg } from '@atlaskit/platform-feature-flags';
8
- import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
9
7
  import Spinner from '@atlaskit/spinner';
10
8
  import { useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics';
11
9
  import { N0 } from '@atlaskit/theme/colors';
12
10
  import messages from '../../messages';
13
11
  import { ActionButtonGroup, ActionsFlexSpacer, AnimatedKudosButton, AnimationWrapper, CardContainer, CardContent, KudosBlobAnimation, ProfileImage } from '../../styled/Card';
14
12
  import { CardWrapper, SpinnerContainer } from '../../styled/UserTrigger';
15
- import { actionClicked, fireEvent, PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
13
+ import { PACKAGE_META_DATA } from '../../util/analytics';
16
14
  import { isBasicClick } from '../../util/click';
17
15
  import { getPageTime } from '../../util/performance';
18
16
  import { ErrorMessage } from '../Error';
@@ -56,26 +54,13 @@ export const ProfilecardInternal = props => {
56
54
  const [openTime] = useState(getPageTime());
57
55
  const intl = useIntl();
58
56
  const {
59
- createAnalyticsEvent
60
- } = props;
61
- const {
62
- fireEvent: fireEventNext
57
+ fireEvent
63
58
  } = useAnalyticsEvents();
64
- const fireAnalytics = useCallback(payload => {
65
- if (createAnalyticsEvent) {
66
- fireEvent(createAnalyticsEvent, payload);
67
- }
68
- }, [createAnalyticsEvent]);
69
- const fireAnalyticsWithDuration = useCallback(generator => {
70
- const elapsed = getPageTime() - openTime;
71
- const event = generator(elapsed);
72
- fireAnalytics(event);
73
- }, [fireAnalytics, openTime]);
74
- const fireAnalyticsWithDurationNext = useCallback((eventKey, generator) => {
59
+ const fireAnalyticsWithDuration = useCallback((eventKey, generator) => {
75
60
  const duration = getPageTime() - openTime;
76
61
  const attributes = generator(duration);
77
- fireEventNext(eventKey, attributes);
78
- }, [openTime, fireEventNext]);
62
+ fireEvent(eventKey, attributes);
63
+ }, [openTime, fireEvent]);
79
64
  const {
80
65
  kudosAction
81
66
  } = useKudos(props.cloudId, props.userId, props.teamCentralBaseUrl, props.openKudosDrawer);
@@ -99,36 +84,28 @@ export const ProfilecardInternal = props => {
99
84
  const canRender = !hasError && !isLoading && !!(fullName || status === 'closed');
100
85
  useEffect(() => {
101
86
  if (canRender) {
102
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
103
- fireAnalyticsWithDurationNext('ui.profilecard.rendered.content', duration => ({
104
- duration,
105
- numActions: realActions.length,
106
- firedAt: Math.round(getPageTime()),
107
- ...PACKAGE_META_DATA
108
- }));
109
- } else {
110
- fireAnalyticsWithDuration(duration => profileCardRendered('user', 'content', {
111
- duration,
112
- numActions: realActions.length
113
- }));
114
- }
87
+ fireAnalyticsWithDuration('ui.profilecard.rendered.content', duration => ({
88
+ duration,
89
+ numActions: realActions.length,
90
+ firedAt: Math.round(getPageTime()),
91
+ ...PACKAGE_META_DATA
92
+ }));
115
93
  }
116
- }, [canRender, fireAnalyticsWithDuration, fireAnalyticsWithDurationNext, realActions]);
94
+ }, [canRender, fireAnalyticsWithDuration, realActions]);
117
95
  if (hasError) {
118
96
  return /*#__PURE__*/React.createElement(Wrapper, {
119
97
  ariaLabel: intl.formatMessage(messages.errorDialogLabel)
120
98
  }, /*#__PURE__*/React.createElement(ErrorMessage, {
121
99
  reload: props.clientFetchProfile,
122
100
  errorType: props.errorType || null,
123
- fireAnalytics: fireEventNext
101
+ fireAnalytics: fireEvent
124
102
  }));
125
103
  }
126
104
  if (isLoading) {
127
105
  return /*#__PURE__*/React.createElement(Wrapper, {
128
106
  ariaLabel: intl.formatMessage(messages.loadingDialogLabel)
129
107
  }, /*#__PURE__*/React.createElement(LoadingView, {
130
- fireAnalyticsWithDuration: fireAnalyticsWithDuration,
131
- fireAnalyticsWithDurationNext: fireAnalyticsWithDurationNext
108
+ fireAnalyticsWithDuration: fireAnalyticsWithDuration
132
109
  }));
133
110
  }
134
111
  if (!canRender) {
@@ -146,8 +123,7 @@ export const ProfilecardInternal = props => {
146
123
  borderColor: `var(--ds-shadow-overlay, ${N0})`
147
124
  })), /*#__PURE__*/React.createElement(CardContent, null, /*#__PURE__*/React.createElement(ProfileCardDetails, _extends({}, props, {
148
125
  status: status,
149
- fireAnalyticsWithDuration: fireAnalyticsWithDuration,
150
- fireAnalyticsWithDurationNext: fireAnalyticsWithDurationNext
126
+ fireAnalyticsWithDuration: fireAnalyticsWithDuration
151
127
  })), 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') && {
152
128
  fullName
153
129
  }, {
@@ -155,44 +131,32 @@ export const ProfilecardInternal = props => {
155
131
  actions: realActions,
156
132
  fireAnalyticsWithDuration: fireAnalyticsWithDuration,
157
133
  isTriggeredUsingKeyboard: props.isTriggeredUsingKeyboard,
158
- isRenderedInPortal: props.isRenderedInPortal,
159
- fireAnalyticsWithDurationNext: fireAnalyticsWithDurationNext
134
+ isRenderedInPortal: props.isRenderedInPortal
160
135
  }))))));
161
136
  };
162
137
  const Actions = ({
163
138
  actions,
164
139
  fireAnalyticsWithDuration,
165
- fireAnalyticsWithDurationNext,
166
140
  isTriggeredUsingKeyboard,
167
141
  isRenderedInPortal,
168
142
  fullName
169
143
  }) => {
170
144
  const onActionClick = useCallback((action, args, event, index) => {
171
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
172
- fireAnalyticsWithDurationNext('ui.profilecard.clicked.action', duration => ({
173
- method: 'click',
174
- firedAt: Math.round(getPageTime()),
175
- duration,
176
- hasHref: !!action.link,
177
- hasOnClick: !!action.callback,
178
- index,
179
- actionId: action.id || 'no-id-specified',
180
- ...PACKAGE_META_DATA
181
- }));
182
- } else {
183
- fireAnalyticsWithDuration(duration => actionClicked('user', {
184
- duration,
185
- hasHref: !!action.link,
186
- hasOnClick: !!action.callback,
187
- index,
188
- actionId: action.id || 'no-id-specified'
189
- }));
190
- }
145
+ fireAnalyticsWithDuration('ui.profilecard.clicked.action', duration => ({
146
+ method: 'click',
147
+ firedAt: Math.round(getPageTime()),
148
+ duration,
149
+ hasHref: !!action.link,
150
+ hasOnClick: !!action.callback,
151
+ index,
152
+ actionId: action.id || 'no-id-specified',
153
+ ...PACKAGE_META_DATA
154
+ }));
191
155
  if (action.callback && isBasicClick(event)) {
192
156
  event.preventDefault();
193
157
  action.callback(event, ...args);
194
158
  }
195
- }, [fireAnalyticsWithDuration, fireAnalyticsWithDurationNext]);
159
+ }, [fireAnalyticsWithDuration]);
196
160
  if (!actions || actions.length === 0) {
197
161
  return null;
198
162
  }
@@ -221,31 +185,23 @@ const Actions = ({
221
185
  }), overflowActions && /*#__PURE__*/React.createElement(OverflowProfileCardButtons, _extends({
222
186
  actions: overflowActions,
223
187
  fireAnalyticsWithDuration: fireAnalyticsWithDuration,
224
- fireAnalyticsWithDurationNext: fireAnalyticsWithDurationNext,
225
188
  onItemClick: (action, args, event, index) => onActionClick(action, args, event, index + ACTION_OVERFLOW_THRESHOLD)
226
189
  }, fg('jfp_a11y_team_profile_card_actions_label') && {
227
190
  fullName
228
191
  })));
229
192
  };
230
193
  export const LoadingView = ({
231
- fireAnalyticsWithDuration,
232
- fireAnalyticsWithDurationNext
194
+ fireAnalyticsWithDuration
233
195
  }) => {
234
196
  useEffect(() => {
235
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
236
- fireAnalyticsWithDurationNext('ui.profilecard.rendered.spinner', duration => ({
237
- firedAt: Math.round(getPageTime()),
238
- duration,
239
- ...PACKAGE_META_DATA
240
- }));
241
- } else {
242
- fireAnalyticsWithDuration(duration => profileCardRendered('user', 'spinner', {
243
- duration
244
- }));
245
- }
246
- }, [fireAnalyticsWithDuration, fireAnalyticsWithDurationNext]);
197
+ fireAnalyticsWithDuration('ui.profilecard.rendered.spinner', duration => ({
198
+ firedAt: Math.round(getPageTime()),
199
+ duration,
200
+ ...PACKAGE_META_DATA
201
+ }));
202
+ }, [fireAnalyticsWithDuration]);
247
203
  return /*#__PURE__*/React.createElement(SpinnerContainer, {
248
204
  testId: "profilecard-spinner-container"
249
205
  }, /*#__PURE__*/React.createElement(Spinner, null));
250
206
  };
251
- export default componentWithFG('ptc-enable-profile-card-analytics-refactor', ProfilecardInternal, withAnalyticsEvents()(ProfilecardInternal));
207
+ export default ProfilecardInternal;
@@ -173,7 +173,6 @@ export const ProfileCardDetails = props => {
173
173
  reportingLines: props.reportingLines,
174
174
  reportingLinesProfileUrl: props.reportingLinesProfileUrl,
175
175
  onReportingLinesClick: props.onReportingLinesClick,
176
- fireAnalyticsWithDuration: props.fireAnalyticsWithDuration,
177
- fireAnalyticsWithDurationNext: props.fireAnalyticsWithDurationNext
176
+ fireAnalyticsWithDuration: props.fireAnalyticsWithDuration
178
177
  }));
179
178
  };