@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.
Files changed (87) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/__tests__/vr-tests/agent-profilecard.vr.tsx +5 -5
  3. package/__tests__/vr-tests/user-profilecard.vr.tsx +30 -30
  4. package/dist/cjs/client/ProfileCardClient.js +10 -10
  5. package/dist/cjs/client/RovoAgentCardClient.js +172 -56
  6. package/dist/cjs/client/TeamProfileCardClient.js +44 -14
  7. package/dist/cjs/client/UserProfileCardClient.js +2 -9
  8. package/dist/cjs/client/errorUtils.js +83 -5
  9. package/dist/cjs/components/Agent/Actions.js +20 -9
  10. package/dist/cjs/components/Agent/ActionsCompiled.js +18 -8
  11. package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +3 -1
  12. package/dist/cjs/components/Agent/AgentProfileCard.js +24 -14
  13. package/dist/cjs/components/Agent/AgentProfileCardCompiled.js +23 -8
  14. package/dist/cjs/components/Agent/AgentProfileCardResourced.js +8 -5
  15. package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +6 -2
  16. package/dist/cjs/components/Agent/hooks/useAgentActions.js +61 -30
  17. package/dist/cjs/components/Team/TeamForbiddenErrorState.js +21 -6
  18. package/dist/cjs/components/Team/TeamLoadingState.js +21 -6
  19. package/dist/cjs/components/Team/TeamProfileCard.js +155 -60
  20. package/dist/cjs/components/Team/TeamProfileCardTrigger.js +104 -33
  21. package/dist/cjs/components/common/ProfileCardTrigger.js +3 -1
  22. package/dist/cjs/components/team-profile-card/main.js +18 -9
  23. package/dist/cjs/components/team-profile-card/team-connections/main.js +36 -17
  24. package/dist/cjs/util/analytics.js +55 -0
  25. package/dist/es2019/client/ProfileCardClient.js +10 -10
  26. package/dist/es2019/client/RovoAgentCardClient.js +186 -58
  27. package/dist/es2019/client/TeamProfileCardClient.js +49 -16
  28. package/dist/es2019/client/UserProfileCardClient.js +3 -10
  29. package/dist/es2019/client/errorUtils.js +84 -3
  30. package/dist/es2019/components/Agent/Actions.js +21 -9
  31. package/dist/es2019/components/Agent/ActionsCompiled.js +19 -8
  32. package/dist/es2019/components/Agent/AgentDeleteConfirmationModal.js +3 -1
  33. package/dist/es2019/components/Agent/AgentProfileCard.js +24 -13
  34. package/dist/es2019/components/Agent/AgentProfileCardCompiled.js +23 -9
  35. package/dist/es2019/components/Agent/AgentProfileCardResourced.js +9 -5
  36. package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +7 -2
  37. package/dist/es2019/components/Agent/hooks/useAgentActions.js +62 -30
  38. package/dist/es2019/components/Team/TeamForbiddenErrorState.js +17 -6
  39. package/dist/es2019/components/Team/TeamLoadingState.js +17 -6
  40. package/dist/es2019/components/Team/TeamProfileCard.js +144 -54
  41. package/dist/es2019/components/Team/TeamProfileCardTrigger.js +74 -10
  42. package/dist/es2019/components/common/ProfileCardTrigger.js +3 -1
  43. package/dist/es2019/components/team-profile-card/main.js +19 -9
  44. package/dist/es2019/components/team-profile-card/team-connections/main.js +38 -17
  45. package/dist/es2019/util/analytics.js +55 -0
  46. package/dist/esm/client/ProfileCardClient.js +10 -10
  47. package/dist/esm/client/RovoAgentCardClient.js +174 -58
  48. package/dist/esm/client/TeamProfileCardClient.js +46 -16
  49. package/dist/esm/client/UserProfileCardClient.js +3 -10
  50. package/dist/esm/client/errorUtils.js +82 -4
  51. package/dist/esm/components/Agent/Actions.js +20 -9
  52. package/dist/esm/components/Agent/ActionsCompiled.js +18 -8
  53. package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +3 -1
  54. package/dist/esm/components/Agent/AgentProfileCard.js +25 -13
  55. package/dist/esm/components/Agent/AgentProfileCardCompiled.js +24 -9
  56. package/dist/esm/components/Agent/AgentProfileCardResourced.js +8 -5
  57. package/dist/esm/components/Agent/AgentProfileCardTrigger.js +6 -2
  58. package/dist/esm/components/Agent/hooks/useAgentActions.js +61 -30
  59. package/dist/esm/components/Team/TeamForbiddenErrorState.js +22 -7
  60. package/dist/esm/components/Team/TeamLoadingState.js +22 -7
  61. package/dist/esm/components/Team/TeamProfileCard.js +156 -61
  62. package/dist/esm/components/Team/TeamProfileCardTrigger.js +105 -34
  63. package/dist/esm/components/common/ProfileCardTrigger.js +3 -1
  64. package/dist/esm/components/team-profile-card/main.js +18 -9
  65. package/dist/esm/components/team-profile-card/team-connections/main.js +36 -17
  66. package/dist/esm/util/analytics.js +55 -0
  67. package/dist/types/client/ProfileCardClient.d.ts +5 -5
  68. package/dist/types/client/RovoAgentCardClient.d.ts +5 -4
  69. package/dist/types/client/TeamProfileCardClient.d.ts +2 -1
  70. package/dist/types/client/errorUtils.d.ts +2 -1
  71. package/dist/types/client/types.d.ts +14 -2
  72. package/dist/types/components/Team/TeamForbiddenErrorState.d.ts +2 -1
  73. package/dist/types/components/Team/TeamLoadingState.d.ts +2 -1
  74. package/dist/types/components/Team/TeamProfileCardTrigger.d.ts +7 -2
  75. package/dist/types/types.d.ts +2 -0
  76. package/dist/types/util/analytics.d.ts +46 -2
  77. package/dist/types-ts4.5/client/ProfileCardClient.d.ts +5 -5
  78. package/dist/types-ts4.5/client/RovoAgentCardClient.d.ts +5 -4
  79. package/dist/types-ts4.5/client/TeamProfileCardClient.d.ts +2 -1
  80. package/dist/types-ts4.5/client/errorUtils.d.ts +2 -1
  81. package/dist/types-ts4.5/client/types.d.ts +14 -2
  82. package/dist/types-ts4.5/components/Team/TeamForbiddenErrorState.d.ts +2 -1
  83. package/dist/types-ts4.5/components/Team/TeamLoadingState.d.ts +2 -1
  84. package/dist/types-ts4.5/components/Team/TeamProfileCardTrigger.d.ts +7 -2
  85. package/dist/types-ts4.5/types.d.ts +2 -0
  86. package/dist/types-ts4.5/util/analytics.d.ts +46 -2
  87. package/package.json +8 -8
@@ -8,6 +8,7 @@ import { getATLContextUrl } from '@atlaskit/atlassian-context';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import { useRovoPostMessageToPubsub } from '@atlaskit/rovo-triggers';
10
10
  import { navigateToTeamsApp } from '@atlaskit/teams-app-config/navigation';
11
+ import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
11
12
  import { fireEvent } from '../../../util/analytics';
12
13
  import { encodeParamsToUrl } from '../../../util/url';
13
14
  export var firstCharUpper = function firstCharUpper(str) {
@@ -31,6 +32,8 @@ export var useAgentUrlActions = function useAgentUrlActions(_ref3) {
31
32
  publishWithPostMessage = _useRovoPostMessageTo.publishWithPostMessage;
32
33
  var _useAnalyticsEvents = useAnalyticsEvents(),
33
34
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
35
+ var _useAnalyticsEventsNe = useAnalyticsEventsNext(),
36
+ fireEventNext = _useAnalyticsEventsNe.fireEvent;
34
37
  var onEditAgent = useCallback(function (agentId) {
35
38
  var url = "".concat(getATLContextUrl('home'), "/chat/agents/").concat(agentId, "/edit");
36
39
  var urlWithParams = encodeParamsToUrl(url, _objectSpread({
@@ -39,27 +42,41 @@ export var useAgentUrlActions = function useAgentUrlActions(_ref3) {
39
42
  cloudId: cloudId
40
43
  })));
41
44
  window.open(urlWithParams, '_blank', 'noopener, noreferrer');
42
- fireEvent(createAnalyticsEvent, {
43
- action: 'clicked',
44
- actionSubject: 'button',
45
- actionSubjectId: 'editAgentButton',
46
- attributes: {
45
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
46
+ fireEventNext('ui.button.clicked.editAgentButton', {
47
47
  agentId: agentId,
48
48
  source: source
49
- }
50
- });
51
- }, [cloudId, createAnalyticsEvent, source]);
49
+ });
50
+ } else {
51
+ fireEvent(createAnalyticsEvent, {
52
+ action: 'clicked',
53
+ actionSubject: 'button',
54
+ actionSubjectId: 'editAgentButton',
55
+ attributes: {
56
+ agentId: agentId,
57
+ source: source
58
+ }
59
+ });
60
+ }
61
+ }, [cloudId, createAnalyticsEvent, fireEventNext, source]);
52
62
  var onCopyAgent = function onCopyAgent(agentId) {
53
63
  navigator.clipboard.writeText("".concat(window.location.origin, "/people/agent/").concat(agentId));
54
- fireEvent(createAnalyticsEvent, {
55
- action: 'clicked',
56
- actionSubject: 'button',
57
- actionSubjectId: 'copyAgentLinkButton',
58
- attributes: {
64
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
65
+ fireEventNext('ui.button.clicked.copyAgentLinkButton', {
59
66
  agentId: agentId,
60
67
  source: source
61
- }
62
- });
68
+ });
69
+ } else {
70
+ fireEvent(createAnalyticsEvent, {
71
+ action: 'clicked',
72
+ actionSubject: 'button',
73
+ actionSubjectId: 'copyAgentLinkButton',
74
+ attributes: {
75
+ agentId: agentId,
76
+ source: source
77
+ }
78
+ });
79
+ }
63
80
  };
64
81
  var onDuplicateAgent = useCallback(function (agentId) {
65
82
  var baseUrl = "".concat(getATLContextUrl('home'), "/chat/agents/new");
@@ -71,16 +88,23 @@ export var useAgentUrlActions = function useAgentUrlActions(_ref3) {
71
88
  pathway: 'agents-create'
72
89
  })));
73
90
  window.open(urlWithParams, '_blank', 'noopener, noreferrer');
74
- fireEvent(createAnalyticsEvent, {
75
- action: 'clicked',
76
- actionSubject: 'button',
77
- actionSubjectId: 'duplicateAgentButton',
78
- attributes: {
91
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
92
+ fireEventNext('ui.button.clicked.duplicateAgentButton', {
79
93
  agentId: agentId,
80
94
  source: source
81
- }
82
- });
83
- }, [cloudId, createAnalyticsEvent, source]);
95
+ });
96
+ } else {
97
+ fireEvent(createAnalyticsEvent, {
98
+ action: 'clicked',
99
+ actionSubject: 'button',
100
+ actionSubjectId: 'duplicateAgentButton',
101
+ attributes: {
102
+ agentId: agentId,
103
+ source: source
104
+ }
105
+ });
106
+ }
107
+ }, [cloudId, createAnalyticsEvent, fireEventNext, source]);
84
108
  var onConversationStarter = function onConversationStarter(_ref4) {
85
109
  var agentId = _ref4.agentId,
86
110
  prompt = _ref4.prompt;
@@ -155,15 +179,22 @@ export var useAgentUrlActions = function useAgentUrlActions(_ref3) {
155
179
  } else {
156
180
  window.open("".concat(window.location.origin, "/people/agent/").concat(agentId), '_blank', 'noopener, noreferrer');
157
181
  }
158
- fireEvent(createAnalyticsEvent, {
159
- action: 'clicked',
160
- actionSubject: 'button',
161
- actionSubjectId: 'viewAgentFullProfileButton',
162
- attributes: {
182
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
183
+ fireEventNext('ui.button.clicked.viewAgentFullProfileButton', {
163
184
  agentId: agentId,
164
185
  source: source
165
- }
166
- });
186
+ });
187
+ } else {
188
+ fireEvent(createAnalyticsEvent, {
189
+ action: 'clicked',
190
+ actionSubject: 'button',
191
+ actionSubjectId: 'viewAgentFullProfileButton',
192
+ attributes: {
193
+ agentId: agentId,
194
+ source: source
195
+ }
196
+ });
197
+ }
167
198
  };
168
199
  return {
169
200
  onEditAgent: onEditAgent,
@@ -1,20 +1,35 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
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
+ 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; }
1
4
  import React, { useEffect } from 'react';
2
5
  import { useIntl } from 'react-intl-next';
3
6
  import EmptyState from '@atlaskit/empty-state';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
4
8
  import messages from '../../messages';
5
9
  import { AccessLockSVGWrapper, TeamForbiddenErrorStateWrapper } from '../../styled/TeamCard';
6
- import { profileCardRendered } from '../../util/analytics';
10
+ import { PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
11
+ import { getPageTime } from '../../util/performance';
7
12
  import AccessLockSVG from '../Error/AccessLockSVG';
8
13
  export default (function (props) {
9
- var analytics = props.analytics;
14
+ var analytics = props.analytics,
15
+ analyticsNext = props.analyticsNext;
10
16
  var intl = useIntl();
11
17
  useEffect(function () {
12
- analytics(function (duration) {
13
- return profileCardRendered('team', 'error', {
14
- duration: duration
18
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
19
+ analyticsNext('ui.teamProfileCard.rendered.error', function (duration) {
20
+ return _objectSpread({
21
+ duration: duration,
22
+ firedAt: Math.round(getPageTime())
23
+ }, PACKAGE_META_DATA);
15
24
  });
16
- });
17
- }, [analytics]);
25
+ } else {
26
+ analytics(function (duration) {
27
+ return profileCardRendered('team', 'error', {
28
+ duration: duration
29
+ });
30
+ });
31
+ }
32
+ }, [analytics, analyticsNext]);
18
33
  return /*#__PURE__*/React.createElement(TeamForbiddenErrorStateWrapper, {
19
34
  testId: "team-profilecard-forbidden-error-state"
20
35
  }, /*#__PURE__*/React.createElement(EmptyState, {
@@ -1,16 +1,31 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
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
+ 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; }
1
4
  import React, { useEffect } from 'react';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
2
6
  import Spinner from '@atlaskit/spinner';
3
7
  import { CardContent, CardHeader, CardWrapper, LoadingWrapper } from '../../styled/TeamTrigger';
4
- import { profileCardRendered } from '../../util/analytics';
8
+ import { PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
9
+ import { getPageTime } from '../../util/performance';
5
10
  export default (function (props) {
6
- var analytics = props.analytics;
11
+ var analytics = props.analytics,
12
+ analyticsNext = props.analyticsNext;
7
13
  useEffect(function () {
8
- analytics(function (duration) {
9
- return profileCardRendered('team', 'spinner', {
10
- duration: duration
14
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
15
+ analyticsNext('ui.teamProfileCard.rendered.spinner', function (duration) {
16
+ return _objectSpread({
17
+ duration: duration,
18
+ firedAt: Math.round(getPageTime())
19
+ }, PACKAGE_META_DATA);
11
20
  });
12
- });
13
- }, [analytics]);
21
+ } else {
22
+ analytics(function (duration) {
23
+ return profileCardRendered('team', 'spinner', {
24
+ duration: duration
25
+ });
26
+ });
27
+ }
28
+ }, [analytics, analyticsNext]);
14
29
  return /*#__PURE__*/React.createElement(CardWrapper, {
15
30
  testId: "team-profilecard"
16
31
  }, /*#__PURE__*/React.createElement(CardHeader, {
@@ -1,7 +1,7 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
3
  import _extends from "@babel/runtime/helpers/extends";
4
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  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; }
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, useRef, useState } from 'react';
@@ -22,24 +22,37 @@ import { AnimatedKudosButton, AnimationWrapper, KudosBlobAnimation } from '../..
22
22
  import { ErrorWrapper, TeamErrorText } from '../../styled/Error';
23
23
  import { ActionButtons, AvatarSection, Description, DescriptionWrapper, MemberCount, MoreButton, TeamName, WrappedButton } from '../../styled/TeamCard';
24
24
  import { CardContent, CardHeader, CardWrapper } from '../../styled/TeamTrigger';
25
- import { actionClicked, errorRetryClicked, moreActionsClicked, moreMembersClicked, profileCardRendered, teamAvatarClicked } from '../../util/analytics';
25
+ import { actionClicked, errorRetryClicked, moreActionsClicked, moreMembersClicked, PACKAGE_META_DATA, profileCardRendered, teamAvatarClicked } from '../../util/analytics';
26
26
  import { isBasicClick } from '../../util/click';
27
+ import { getPageTime } from '../../util/performance';
27
28
  import { ErrorIllustration } from '../Error';
28
29
  import TeamForbiddenErrorState from './TeamForbiddenErrorState';
29
30
  import TeamLoadingState from './TeamLoadingState';
30
31
  var LARGE_MEMBER_COUNT = 50;
31
32
  var GIVE_KUDOS_ACTION_ID = 'give-kudos';
32
33
  var avatarGroupMaxCount = 9;
33
- function onMemberClick(callback, userId, analytics, index, hasHref) {
34
+ function onMemberClick(callback, userId, analytics, analyticsNext, index, hasHref) {
34
35
  return function (event) {
35
- analytics(function (duration) {
36
- return teamAvatarClicked({
37
- duration: duration,
38
- hasHref: hasHref,
39
- hasOnClick: !!callback,
40
- index: index
36
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
37
+ analyticsNext('ui.teamProfileCard.clicked.avatar', function (duration) {
38
+ return _objectSpread({
39
+ duration: duration,
40
+ hasHref: hasHref,
41
+ hasOnClick: !!callback,
42
+ index: index,
43
+ firedAt: Math.round(getPageTime())
44
+ }, PACKAGE_META_DATA);
41
45
  });
42
- });
46
+ } else {
47
+ analytics(function (duration) {
48
+ return teamAvatarClicked({
49
+ duration: duration,
50
+ hasHref: hasHref,
51
+ hasOnClick: !!callback,
52
+ index: index
53
+ });
54
+ });
55
+ }
43
56
  if (callback) {
44
57
  callback(userId, event);
45
58
  }
@@ -51,6 +64,7 @@ var TeamMembers = function TeamMembers(_ref) {
51
64
  members = _ref.members,
52
65
  onUserClick = _ref.onUserClick,
53
66
  includingYou = _ref.includingYou,
67
+ analyticsNext = _ref.analyticsNext,
54
68
  isTriggeredByKeyboard = _ref.isTriggeredByKeyboard;
55
69
  var _useIntl = useIntl(),
56
70
  formatMessage = _useIntl.formatMessage;
@@ -71,15 +85,25 @@ var TeamMembers = function TeamMembers(_ref) {
71
85
  var onMoreClick = useCallback(function () {
72
86
  var isOpen = isMoreMembersOpen.current;
73
87
  if (!isOpen) {
74
- analytics(function (duration) {
75
- return moreMembersClicked({
76
- duration: duration,
77
- memberCount: count
88
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
89
+ analyticsNext('ui.teamProfileCard.clicked.moreMembers', function (duration) {
90
+ return _objectSpread({
91
+ duration: duration,
92
+ memberCount: count,
93
+ firedAt: Math.round(getPageTime())
94
+ }, PACKAGE_META_DATA);
78
95
  });
79
- });
96
+ } else {
97
+ analytics(function (duration) {
98
+ return moreMembersClicked({
99
+ duration: duration,
100
+ memberCount: count
101
+ });
102
+ });
103
+ }
80
104
  }
81
105
  isMoreMembersOpen.current = !isOpen;
82
- }, [analytics, count]);
106
+ }, [analytics, count, analyticsNext]);
83
107
  var showMoreButtonProps = {
84
108
  onClick: onMoreClick,
85
109
  'aria-label': formatMessage(messages.profileCardMoreMembersLabel, {
@@ -94,7 +118,7 @@ var TeamMembers = function TeamMembers(_ref) {
94
118
  appearance: "stack",
95
119
  data: members.map(function (member, index) {
96
120
  var href = generateUserLink === null || generateUserLink === void 0 ? void 0 : generateUserLink(member.id);
97
- var onClick = onMemberClick(onUserClick, member.id, analytics, index, !!generateUserLink);
121
+ var onClick = onMemberClick(onUserClick, member.id, analytics, analyticsNext, index, !!generateUserLink);
98
122
  return {
99
123
  key: member.id,
100
124
  name: member.fullName,
@@ -119,17 +143,30 @@ var TeamMembers = function TeamMembers(_ref) {
119
143
  }
120
144
  })));
121
145
  };
122
- function onActionClick(action, analytics, index) {
146
+ function onActionClick(action, analytics, analyticsNext, index) {
123
147
  return function (event) {
124
- analytics(function (duration) {
125
- return actionClicked('team', {
126
- duration: duration,
127
- hasHref: !!action.link,
128
- hasOnClick: !!action.callback,
129
- index: index,
130
- actionId: action.id || ''
148
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
149
+ analyticsNext('ui.teamProfileCard.clicked.action', function (duration) {
150
+ return _objectSpread({
151
+ duration: duration,
152
+ hasHref: !!action.link,
153
+ hasOnClick: !!action.callback,
154
+ index: index,
155
+ actionId: action.id || '',
156
+ firedAt: Math.round(getPageTime())
157
+ }, PACKAGE_META_DATA);
131
158
  });
132
- });
159
+ } else {
160
+ analytics(function (duration) {
161
+ return actionClicked('team', {
162
+ duration: duration,
163
+ hasHref: !!action.link,
164
+ hasOnClick: !!action.callback,
165
+ index: index,
166
+ actionId: action.id || ''
167
+ });
168
+ });
169
+ }
133
170
  if (action.callback && isBasicClick(event)) {
134
171
  event.preventDefault();
135
172
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -142,11 +179,12 @@ function onActionClick(action, analytics, index) {
142
179
  var ActionButton = function ActionButton(_ref2) {
143
180
  var action = _ref2.action,
144
181
  analytics = _ref2.analytics,
182
+ analyticsNext = _ref2.analyticsNext,
145
183
  index = _ref2.index;
146
184
  var isGiveKudosActionButton = action.id === GIVE_KUDOS_ACTION_ID;
147
185
  var actionButton = /*#__PURE__*/React.createElement(LinkButton, {
148
186
  key: action.id || index,
149
- onClick: onActionClick(action, analytics, index),
187
+ onClick: onActionClick(action, analytics, analyticsNext, index),
150
188
  href: action.link || '',
151
189
  target: action.target,
152
190
  shouldFitContainer: true
@@ -158,7 +196,8 @@ var ActionButton = function ActionButton(_ref2) {
158
196
  };
159
197
  var ExtraActions = function ExtraActions(_ref3) {
160
198
  var actions = _ref3.actions,
161
- analytics = _ref3.analytics;
199
+ analytics = _ref3.analytics,
200
+ analyticsNext = _ref3.analyticsNext;
162
201
  var _useState = useState(false),
163
202
  _useState2 = _slicedToArray(_useState, 2),
164
203
  isOpen = _useState2[0],
@@ -167,15 +206,25 @@ var ExtraActions = function ExtraActions(_ref3) {
167
206
  var onMoreClick = useCallback(function (shouldBeOpen) {
168
207
  if (shouldBeOpen) {
169
208
  // Only fire this event when OPENING the dropdown
170
- analytics(function (duration) {
171
- return moreActionsClicked('team', {
172
- duration: duration,
173
- numActions: count + 2
209
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
210
+ analyticsNext('ui.teamProfileCard.clicked.moreActions', function (duration) {
211
+ return _objectSpread({
212
+ duration: duration,
213
+ numActions: count + 2,
214
+ firedAt: Math.round(getPageTime())
215
+ }, PACKAGE_META_DATA);
174
216
  });
175
- });
217
+ } else {
218
+ analytics(function (duration) {
219
+ return moreActionsClicked('team', {
220
+ duration: duration,
221
+ numActions: count + 2
222
+ });
223
+ });
224
+ }
176
225
  }
177
226
  setOpen(shouldBeOpen);
178
- }, [analytics, count]);
227
+ }, [analytics, count, analyticsNext]);
179
228
  if (!count) {
180
229
  return null;
181
230
  }
@@ -188,7 +237,7 @@ var ExtraActions = function ExtraActions(_ref3) {
188
237
  content: function content() {
189
238
  return /*#__PURE__*/React.createElement(MenuGroup, null, actions.map(function (action, index) {
190
239
  return /*#__PURE__*/React.createElement(LinkItem, {
191
- onClick: onActionClick(action, analytics, index + 2),
240
+ onClick: onActionClick(action, analytics, analyticsNext, index + 2),
192
241
  key: action.id || index,
193
242
  href: action.link
194
243
  }, action.label);
@@ -212,7 +261,8 @@ var ExtraActions = function ExtraActions(_ref3) {
212
261
  };
213
262
  var ButtonSection = function ButtonSection(_ref4) {
214
263
  var actions = _ref4.actions,
215
- analytics = _ref4.analytics;
264
+ analytics = _ref4.analytics,
265
+ analyticsNext = _ref4.analyticsNext;
216
266
  if (!actions) {
217
267
  return null;
218
268
  }
@@ -222,17 +272,20 @@ var ButtonSection = function ButtonSection(_ref4) {
222
272
  return /*#__PURE__*/React.createElement(ActionButton, {
223
273
  action: action,
224
274
  analytics: analytics,
275
+ analyticsNext: analyticsNext,
225
276
  index: index,
226
277
  key: index
227
278
  });
228
279
  }), extraActions && /*#__PURE__*/React.createElement(ExtraActions, {
229
280
  actions: extraActions,
230
- analytics: analytics
281
+ analytics: analytics,
282
+ analyticsNext: analyticsNext
231
283
  }));
232
284
  };
233
285
  var TeamProfilecardContent = function TeamProfilecardContent(_ref5) {
234
286
  var actions = _ref5.actions,
235
287
  analytics = _ref5.analytics,
288
+ analyticsNext = _ref5.analyticsNext,
236
289
  team = _ref5.team,
237
290
  viewingUserId = _ref5.viewingUserId,
238
291
  generateUserLink = _ref5.generateUserLink,
@@ -250,17 +303,33 @@ var TeamProfilecardContent = function TeamProfilecardContent(_ref5) {
250
303
  return member.id === viewingUserId;
251
304
  });
252
305
  useEffect(function () {
253
- analytics(function (duration) {
254
- var _team$members;
255
- return profileCardRendered('team', 'content', {
256
- duration: duration,
257
- numActions: allActions.length,
258
- memberCount: (_team$members = team.members) === null || _team$members === void 0 ? void 0 : _team$members.length,
259
- includingYou: includingYou,
260
- descriptionLength: team.description.length,
261
- titleLength: team.displayName.length
306
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
307
+ analyticsNext('ui.teamProfileCard.rendered.content', function (duration) {
308
+ var _team$members$length, _team$members;
309
+ return _objectSpread({
310
+ duration: duration,
311
+ numActions: allActions.length,
312
+ 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,
313
+ includingYou: includingYou !== null && includingYou !== void 0 ? includingYou : null,
314
+ descriptionLength: team.description.length,
315
+ titleLength: team.displayName.length,
316
+ firedAt: Math.round(getPageTime())
317
+ }, PACKAGE_META_DATA);
262
318
  });
263
- });
319
+ } else {
320
+ analytics(function (duration) {
321
+ var _team$members2;
322
+ return profileCardRendered('team', 'content', {
323
+ duration: duration,
324
+ numActions: allActions.length,
325
+ memberCount: (_team$members2 = team.members) === null || _team$members2 === void 0 ? void 0 : _team$members2.length,
326
+ includingYou: includingYou,
327
+ descriptionLength: team.description.length,
328
+ titleLength: team.displayName.length
329
+ });
330
+ });
331
+ }
332
+
264
333
  // eslint-disable-next-line react-hooks/exhaustive-deps
265
334
  }, [analytics]);
266
335
  return /*#__PURE__*/React.createElement(CardWrapper, {
@@ -272,6 +341,7 @@ var TeamProfilecardContent = function TeamProfilecardContent(_ref5) {
272
341
  content: team.displayName
273
342
  }, /*#__PURE__*/React.createElement(Inline, null, /*#__PURE__*/React.createElement(TeamName, null, team.displayName), team.isVerified && /*#__PURE__*/React.createElement(VerifiedTeamIcon, null))), /*#__PURE__*/React.createElement(TeamMembers, {
274
343
  analytics: analytics,
344
+ analyticsNext: analyticsNext,
275
345
  members: team.members,
276
346
  generateUserLink: generateUserLink,
277
347
  includingYou: includingYou,
@@ -279,32 +349,53 @@ var TeamProfilecardContent = function TeamProfilecardContent(_ref5) {
279
349
  isTriggeredByKeyboard: isTriggeredByKeyboard
280
350
  }), team.description.trim() && /*#__PURE__*/React.createElement(DescriptionWrapper, null, /*#__PURE__*/React.createElement(Description, null, team.description)), /*#__PURE__*/React.createElement(ButtonSection, {
281
351
  actions: allActions,
282
- analytics: analytics
352
+ analytics: analytics,
353
+ analyticsNext: analyticsNext
283
354
  })));
284
355
  };
285
356
  var ErrorMessage = function ErrorMessage(_ref6) {
286
357
  var analytics = _ref6.analytics,
358
+ analyticsNext = _ref6.analyticsNext,
287
359
  clientFetchProfile = _ref6.clientFetchProfile,
288
360
  isLoading = _ref6.isLoading;
289
361
  var hasRetry = !!clientFetchProfile;
290
362
  useEffect(function () {
291
- analytics(function (duration) {
292
- return profileCardRendered('team', 'error', {
293
- duration: duration,
294
- hasRetry: hasRetry
363
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
364
+ analyticsNext('ui.teamProfileCard.rendered.error', function (duration) {
365
+ return _objectSpread({
366
+ duration: duration,
367
+ hasRetry: hasRetry,
368
+ firedAt: Math.round(getPageTime())
369
+ }, PACKAGE_META_DATA);
295
370
  });
296
- });
297
- }, [analytics, hasRetry]);
371
+ } else {
372
+ analytics(function (duration) {
373
+ return profileCardRendered('team', 'error', {
374
+ duration: duration,
375
+ hasRetry: hasRetry
376
+ });
377
+ });
378
+ }
379
+ }, [analytics, analyticsNext, hasRetry]);
298
380
  var retry = useCallback(function () {
299
- analytics(function (duration) {
300
- return errorRetryClicked({
301
- duration: duration
381
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
382
+ analyticsNext('ui.teamProfileCard.clicked.errorRetry', function (duration) {
383
+ return _objectSpread({
384
+ duration: duration,
385
+ firedAt: Math.round(getPageTime())
386
+ }, PACKAGE_META_DATA);
302
387
  });
303
- });
388
+ } else {
389
+ analytics(function (duration) {
390
+ return errorRetryClicked({
391
+ duration: duration
392
+ });
393
+ });
394
+ }
304
395
  if (clientFetchProfile) {
305
396
  clientFetchProfile();
306
397
  }
307
- }, [analytics, clientFetchProfile]);
398
+ }, [analytics, analyticsNext, clientFetchProfile]);
308
399
  return /*#__PURE__*/React.createElement(ErrorWrapper, {
309
400
  testId: "team-profilecard-error"
310
401
  }, /*#__PURE__*/React.createElement(ErrorIllustration, null), /*#__PURE__*/React.createElement(Text, {
@@ -319,6 +410,7 @@ var ErrorMessage = function ErrorMessage(_ref6) {
319
410
  };
320
411
  var TeamProfileCard = function TeamProfileCard(props) {
321
412
  var analytics = props.analytics,
413
+ analyticsNext = props.analyticsNext,
322
414
  clientFetchProfile = props.clientFetchProfile,
323
415
  hasError = props.hasError,
324
416
  isLoading = props.isLoading,
@@ -327,13 +419,15 @@ var TeamProfileCard = function TeamProfileCard(props) {
327
419
  if (hasError) {
328
420
  if ((errorType === null || errorType === void 0 ? void 0 : errorType.reason) === 'TEAMS_FORBIDDEN') {
329
421
  return /*#__PURE__*/React.createElement(TeamForbiddenErrorState, {
330
- analytics: analytics
422
+ analytics: analytics,
423
+ analyticsNext: analyticsNext
331
424
  });
332
425
  } else {
333
426
  return /*#__PURE__*/React.createElement(CardWrapper, {
334
427
  testId: "team-profilecard"
335
428
  }, /*#__PURE__*/React.createElement(ErrorMessage, {
336
429
  analytics: analytics,
430
+ analyticsNext: analyticsNext,
337
431
  clientFetchProfile: clientFetchProfile,
338
432
  isLoading: isLoading
339
433
  }));
@@ -341,7 +435,8 @@ var TeamProfileCard = function TeamProfileCard(props) {
341
435
  }
342
436
  if (isLoading) {
343
437
  return /*#__PURE__*/React.createElement(TeamLoadingState, {
344
- analytics: analytics
438
+ analytics: analytics,
439
+ analyticsNext: analyticsNext
345
440
  });
346
441
  }
347
442
  if (team) {