@atlaskit/profilecard 24.13.7 → 24.14.1

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 (161) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/__tests__/vr-tests/__snapshots__/user-profilecard/error-state--default.png +0 -0
  3. package/__tests__/vr-tests/agent-profilecard.vr.tsx +7 -1
  4. package/__tests__/vr-tests/user-profilecard.vr.tsx +42 -6
  5. package/afm-cc/tsconfig.json +6 -0
  6. package/afm-dev-agents/tsconfig.json +6 -0
  7. package/afm-jira/tsconfig.json +6 -0
  8. package/afm-passionfruit/tsconfig.json +6 -0
  9. package/afm-post-office/tsconfig.json +6 -0
  10. package/afm-rovo-extension/tsconfig.json +6 -0
  11. package/afm-townsquare/tsconfig.json +6 -0
  12. package/dist/cjs/client/ProfileCardClient.js +2 -2
  13. package/dist/cjs/client/UserProfileCardClient.js +45 -11
  14. package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +1 -1
  15. package/dist/cjs/client/getTeamFromAGG.js +1 -1
  16. package/dist/cjs/components/Agent/Actions.js +5 -2
  17. package/dist/cjs/components/Agent/ActionsCompiled.compiled.css +19 -0
  18. package/dist/cjs/components/Agent/ActionsCompiled.js +140 -0
  19. package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +2 -4
  20. package/dist/cjs/components/Agent/AgentProfileCard.js +8 -1
  21. package/dist/cjs/components/Agent/AgentProfileCardCompiled.compiled.css +8 -0
  22. package/dist/cjs/components/Agent/AgentProfileCardCompiled.js +242 -0
  23. package/dist/cjs/components/Agent/AgentProfileCardResourced.js +2 -1
  24. package/dist/cjs/components/Agent/AgentProfileCardWrapper.compiled.css +1 -0
  25. package/dist/cjs/components/Agent/AgentProfileCardWrapper.js +9 -8
  26. package/dist/cjs/components/Agent/ConversationStarters.js +2 -4
  27. package/dist/cjs/components/Error/ErrorMessage.js +20 -9
  28. package/dist/cjs/components/Team/TeamProfileCardTrigger.js +3 -3
  29. package/dist/cjs/components/User/OverflowProfileCardButtons.js +22 -7
  30. package/dist/cjs/components/User/ProfileCard.js +80 -28
  31. package/dist/cjs/components/User/ProfileCardDetails.compiled.css +0 -1
  32. package/dist/cjs/components/User/ProfileCardDetails.js +4 -5
  33. package/dist/cjs/components/User/ProfileCardResourced.js +40 -16
  34. package/dist/cjs/components/User/ProfileCardTrigger.js +52 -12
  35. package/dist/cjs/components/User/ReportingLinesDetails.js +40 -12
  36. package/dist/cjs/components/User/ReportingLinesDetailsCompiled.compiled.css +11 -0
  37. package/dist/cjs/components/User/ReportingLinesDetailsCompiled.js +109 -0
  38. package/dist/cjs/components/User/UserLoadingState.js +15 -3
  39. package/dist/cjs/components/common/LoadingState.js +17 -3
  40. package/dist/cjs/components/common/ProfileCardTrigger.js +29 -7
  41. package/dist/cjs/components/common/ProfileCardWrapper.compiled.css +1 -0
  42. package/dist/cjs/components/common/ProfileCardWrapper.js +12 -9
  43. package/dist/cjs/components/team-profile-card/team-actions/more-actions/index.js +2 -4
  44. package/dist/cjs/styled/CoverImage.compiled.css +2 -0
  45. package/dist/cjs/styled/CoverImage.js +4 -2
  46. package/dist/cjs/styled/Error.compiled.css +0 -2
  47. package/dist/cjs/styled/Error.js +5 -3
  48. package/dist/cjs/util/analytics.js +7 -3
  49. package/dist/es2019/client/ProfileCardClient.js +2 -2
  50. package/dist/es2019/client/UserProfileCardClient.js +50 -13
  51. package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +1 -1
  52. package/dist/es2019/client/getTeamFromAGG.js +1 -1
  53. package/dist/es2019/components/Agent/Actions.js +5 -2
  54. package/dist/es2019/components/Agent/ActionsCompiled.compiled.css +19 -0
  55. package/dist/es2019/components/Agent/ActionsCompiled.js +116 -0
  56. package/dist/es2019/components/Agent/AgentDeleteConfirmationModal.js +1 -2
  57. package/dist/es2019/components/Agent/AgentProfileCard.js +8 -1
  58. package/dist/es2019/components/Agent/AgentProfileCardCompiled.compiled.css +8 -0
  59. package/dist/es2019/components/Agent/AgentProfileCardCompiled.js +186 -0
  60. package/dist/es2019/components/Agent/AgentProfileCardResourced.js +2 -1
  61. package/dist/es2019/components/Agent/AgentProfileCardWrapper.compiled.css +1 -0
  62. package/dist/es2019/components/Agent/AgentProfileCardWrapper.js +8 -7
  63. package/dist/es2019/components/Agent/ConversationStarters.js +1 -3
  64. package/dist/es2019/components/Error/ErrorMessage.js +18 -8
  65. package/dist/es2019/components/Team/TeamProfileCardTrigger.js +1 -2
  66. package/dist/es2019/components/User/OverflowProfileCardButtons.js +18 -7
  67. package/dist/es2019/components/User/ProfileCard.js +72 -25
  68. package/dist/es2019/components/User/ProfileCardDetails.compiled.css +0 -1
  69. package/dist/es2019/components/User/ProfileCardDetails.js +3 -5
  70. package/dist/es2019/components/User/ProfileCardResourced.js +25 -4
  71. package/dist/es2019/components/User/ProfileCardTrigger.js +54 -13
  72. package/dist/es2019/components/User/ReportingLinesDetails.js +34 -10
  73. package/dist/es2019/components/User/ReportingLinesDetailsCompiled.compiled.css +11 -0
  74. package/dist/es2019/components/User/ReportingLinesDetailsCompiled.js +96 -0
  75. package/dist/es2019/components/User/UserLoadingState.js +14 -4
  76. package/dist/es2019/components/common/LoadingState.js +16 -4
  77. package/dist/es2019/components/common/ProfileCardTrigger.js +26 -7
  78. package/dist/es2019/components/common/ProfileCardWrapper.compiled.css +1 -0
  79. package/dist/es2019/components/common/ProfileCardWrapper.js +11 -8
  80. package/dist/es2019/components/team-profile-card/team-actions/more-actions/index.js +1 -2
  81. package/dist/es2019/styled/CoverImage.compiled.css +2 -0
  82. package/dist/es2019/styled/CoverImage.js +4 -2
  83. package/dist/es2019/styled/Error.compiled.css +0 -2
  84. package/dist/es2019/styled/Error.js +6 -4
  85. package/dist/es2019/util/analytics.js +6 -2
  86. package/dist/esm/client/ProfileCardClient.js +2 -2
  87. package/dist/esm/client/UserProfileCardClient.js +46 -12
  88. package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +1 -1
  89. package/dist/esm/client/getTeamFromAGG.js +1 -1
  90. package/dist/esm/components/Agent/Actions.js +5 -2
  91. package/dist/esm/components/Agent/ActionsCompiled.compiled.css +19 -0
  92. package/dist/esm/components/Agent/ActionsCompiled.js +131 -0
  93. package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +1 -2
  94. package/dist/esm/components/Agent/AgentProfileCard.js +8 -1
  95. package/dist/esm/components/Agent/AgentProfileCardCompiled.compiled.css +8 -0
  96. package/dist/esm/components/Agent/AgentProfileCardCompiled.js +233 -0
  97. package/dist/esm/components/Agent/AgentProfileCardResourced.js +2 -1
  98. package/dist/esm/components/Agent/AgentProfileCardWrapper.compiled.css +1 -0
  99. package/dist/esm/components/Agent/AgentProfileCardWrapper.js +8 -7
  100. package/dist/esm/components/Agent/ConversationStarters.js +1 -3
  101. package/dist/esm/components/Error/ErrorMessage.js +20 -8
  102. package/dist/esm/components/Team/TeamProfileCardTrigger.js +1 -2
  103. package/dist/esm/components/User/OverflowProfileCardButtons.js +23 -8
  104. package/dist/esm/components/User/ProfileCard.js +80 -28
  105. package/dist/esm/components/User/ProfileCardDetails.compiled.css +0 -1
  106. package/dist/esm/components/User/ProfileCardDetails.js +3 -5
  107. package/dist/esm/components/User/ProfileCardResourced.js +40 -16
  108. package/dist/esm/components/User/ProfileCardTrigger.js +53 -13
  109. package/dist/esm/components/User/ReportingLinesDetails.js +41 -12
  110. package/dist/esm/components/User/ReportingLinesDetailsCompiled.compiled.css +11 -0
  111. package/dist/esm/components/User/ReportingLinesDetailsCompiled.js +102 -0
  112. package/dist/esm/components/User/UserLoadingState.js +16 -4
  113. package/dist/esm/components/common/LoadingState.js +18 -4
  114. package/dist/esm/components/common/ProfileCardTrigger.js +30 -8
  115. package/dist/esm/components/common/ProfileCardWrapper.compiled.css +1 -0
  116. package/dist/esm/components/common/ProfileCardWrapper.js +11 -8
  117. package/dist/esm/components/team-profile-card/team-actions/more-actions/index.js +1 -2
  118. package/dist/esm/styled/CoverImage.compiled.css +2 -0
  119. package/dist/esm/styled/CoverImage.js +4 -2
  120. package/dist/esm/styled/Error.compiled.css +0 -2
  121. package/dist/esm/styled/Error.js +6 -4
  122. package/dist/esm/util/analytics.js +6 -2
  123. package/dist/types/client/ProfileCardClient.d.ts +2 -1
  124. package/dist/types/client/UserProfileCardClient.d.ts +2 -1
  125. package/dist/types/components/Agent/Actions.d.ts +10 -1
  126. package/dist/types/components/Agent/ActionsCompiled.d.ts +14 -0
  127. package/dist/types/components/Agent/AgentProfileCard.d.ts +13 -3
  128. package/dist/types/components/Agent/AgentProfileCardCompiled.d.ts +4 -0
  129. package/dist/types/components/Agent/lazyAgentProfileCard.d.ts +12 -1
  130. package/dist/types/components/Error/ErrorMessage.d.ts +2 -0
  131. package/dist/types/components/User/ProfileCard.d.ts +3 -2
  132. package/dist/types/components/User/ProfileCardResourced.d.ts +4 -2
  133. package/dist/types/components/User/ReportingLinesDetails.d.ts +2 -2
  134. package/dist/types/components/User/ReportingLinesDetailsCompiled.d.ts +5 -0
  135. package/dist/types/components/User/UserLoadingState.d.ts +3 -1
  136. package/dist/types/components/User/lazyProfileCard.d.ts +1 -1
  137. package/dist/types/components/common/LoadingState.d.ts +3 -1
  138. package/dist/types/components/common/ProfileCardWrapper.d.ts +2 -1
  139. package/dist/types/components/common/types.d.ts +3 -0
  140. package/dist/types/types.d.ts +13 -6
  141. package/dist/types/util/analytics.d.ts +5 -0
  142. package/dist/types-ts4.5/client/ProfileCardClient.d.ts +2 -1
  143. package/dist/types-ts4.5/client/UserProfileCardClient.d.ts +2 -1
  144. package/dist/types-ts4.5/components/Agent/Actions.d.ts +10 -1
  145. package/dist/types-ts4.5/components/Agent/ActionsCompiled.d.ts +14 -0
  146. package/dist/types-ts4.5/components/Agent/AgentProfileCard.d.ts +13 -3
  147. package/dist/types-ts4.5/components/Agent/AgentProfileCardCompiled.d.ts +4 -0
  148. package/dist/types-ts4.5/components/Agent/lazyAgentProfileCard.d.ts +12 -1
  149. package/dist/types-ts4.5/components/Error/ErrorMessage.d.ts +2 -0
  150. package/dist/types-ts4.5/components/User/ProfileCard.d.ts +3 -2
  151. package/dist/types-ts4.5/components/User/ProfileCardResourced.d.ts +4 -2
  152. package/dist/types-ts4.5/components/User/ReportingLinesDetails.d.ts +2 -2
  153. package/dist/types-ts4.5/components/User/ReportingLinesDetailsCompiled.d.ts +5 -0
  154. package/dist/types-ts4.5/components/User/UserLoadingState.d.ts +3 -1
  155. package/dist/types-ts4.5/components/User/lazyProfileCard.d.ts +1 -1
  156. package/dist/types-ts4.5/components/common/LoadingState.d.ts +3 -1
  157. package/dist/types-ts4.5/components/common/ProfileCardWrapper.d.ts +2 -1
  158. package/dist/types-ts4.5/components/common/types.d.ts +3 -0
  159. package/dist/types-ts4.5/types.d.ts +13 -6
  160. package/dist/types-ts4.5/util/analytics.d.ts +5 -0
  161. package/package.json +20 -9
@@ -5,12 +5,14 @@ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
5
5
  import Avatar from '@atlaskit/avatar';
6
6
  import { LinkButton } from '@atlaskit/button/new';
7
7
  import { fg } from '@atlaskit/platform-feature-flags';
8
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
8
9
  import Spinner from '@atlaskit/spinner';
10
+ import { useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics';
9
11
  import { N0 } from '@atlaskit/theme/colors';
10
12
  import messages from '../../messages';
11
13
  import { ActionButtonGroup, ActionsFlexSpacer, AnimatedKudosButton, AnimationWrapper, CardContainer, CardContent, KudosBlobAnimation, ProfileImage } from '../../styled/Card';
12
14
  import { CardWrapper, SpinnerContainer } from '../../styled/UserTrigger';
13
- import { actionClicked, fireEvent, profileCardRendered } from '../../util/analytics';
15
+ import { actionClicked, fireEvent, PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
14
16
  import { isBasicClick } from '../../util/click';
15
17
  import { getPageTime } from '../../util/performance';
16
18
  import { ErrorMessage } from '../Error';
@@ -54,6 +56,9 @@ export const ProfilecardInternal = props => {
54
56
  const {
55
57
  createAnalyticsEvent
56
58
  } = props;
59
+ const {
60
+ fireEvent: fireEventNext
61
+ } = useAnalyticsEvents();
57
62
  const fireAnalytics = useCallback(payload => {
58
63
  if (createAnalyticsEvent) {
59
64
  fireEvent(createAnalyticsEvent, payload);
@@ -64,6 +69,11 @@ export const ProfilecardInternal = props => {
64
69
  const event = generator(elapsed);
65
70
  fireAnalytics(event);
66
71
  }, [fireAnalytics, openTime]);
72
+ const fireAnalyticsWithDurationNext = useCallback((eventKey, generator) => {
73
+ const duration = getPageTime() - openTime;
74
+ const attributes = generator(duration);
75
+ fireEventNext(eventKey, attributes);
76
+ }, [openTime, fireEventNext]);
67
77
  const {
68
78
  kudosAction
69
79
  } = useKudos(props.cloudId, props.userId, props.teamCentralBaseUrl, props.openKudosDrawer);
@@ -87,22 +97,33 @@ export const ProfilecardInternal = props => {
87
97
  const canRender = !hasError && !isLoading && !!(fullName || status === 'closed');
88
98
  useEffect(() => {
89
99
  if (canRender) {
90
- fireAnalyticsWithDuration(duration => profileCardRendered('user', 'content', {
91
- duration,
92
- numActions: realActions.length
93
- }));
100
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
101
+ fireAnalyticsWithDurationNext('ui.profilecard.rendered.content', duration => ({
102
+ duration,
103
+ numActions: realActions.length,
104
+ firedAt: Math.round(getPageTime()),
105
+ ...PACKAGE_META_DATA
106
+ }));
107
+ } else {
108
+ fireAnalyticsWithDuration(duration => profileCardRendered('user', 'content', {
109
+ duration,
110
+ numActions: realActions.length
111
+ }));
112
+ }
94
113
  }
95
- }, [canRender, fireAnalyticsWithDuration, realActions]);
114
+ }, [canRender, fireAnalyticsWithDuration, fireAnalyticsWithDurationNext, realActions]);
96
115
  if (hasError) {
97
116
  return /*#__PURE__*/React.createElement(Wrapper, null, /*#__PURE__*/React.createElement(ErrorMessage, {
98
117
  reload: props.clientFetchProfile,
99
118
  errorType: props.errorType || null,
100
- fireAnalytics: fireAnalytics
119
+ fireAnalytics: fireAnalytics,
120
+ fireAnalyticsNext: fireEventNext
101
121
  }));
102
122
  }
103
123
  if (isLoading) {
104
124
  return /*#__PURE__*/React.createElement(Wrapper, null, /*#__PURE__*/React.createElement(LoadingView, {
105
- fireAnalyticsWithDuration: fireAnalyticsWithDuration
125
+ fireAnalyticsWithDuration: fireAnalyticsWithDuration,
126
+ fireAnalyticsWithDurationNext: fireAnalyticsWithDurationNext
106
127
  }));
107
128
  }
108
129
  if (!canRender) {
@@ -118,35 +139,51 @@ export const ProfilecardInternal = props => {
118
139
  borderColor: `var(--ds-shadow-overlay, ${N0})`
119
140
  })), /*#__PURE__*/React.createElement(CardContent, null, /*#__PURE__*/React.createElement(ProfileCardDetails, _extends({}, props, {
120
141
  status: status,
121
- fireAnalyticsWithDuration: fireAnalyticsWithDuration
142
+ fireAnalyticsWithDuration: fireAnalyticsWithDuration,
143
+ fireAnalyticsWithDurationNext: fireAnalyticsWithDurationNext
122
144
  })), 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') && {
123
145
  fullName
124
146
  }, {
125
147
  fullName: fullName,
126
148
  actions: realActions,
127
149
  fireAnalyticsWithDuration: fireAnalyticsWithDuration,
128
- isTriggeredUsingKeyboard: props.isTriggeredUsingKeyboard
150
+ isTriggeredUsingKeyboard: props.isTriggeredUsingKeyboard,
151
+ fireAnalyticsWithDurationNext: fireAnalyticsWithDurationNext
129
152
  }))))));
130
153
  };
131
154
  const Actions = ({
132
155
  actions,
133
156
  fireAnalyticsWithDuration,
157
+ fireAnalyticsWithDurationNext,
134
158
  isTriggeredUsingKeyboard,
135
159
  fullName
136
160
  }) => {
137
161
  const onActionClick = useCallback((action, args, event, index) => {
138
- fireAnalyticsWithDuration(duration => actionClicked('user', {
139
- duration,
140
- hasHref: !!action.link,
141
- hasOnClick: !!action.callback,
142
- index,
143
- actionId: action.id || 'no-id-specified'
144
- }));
162
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
163
+ fireAnalyticsWithDurationNext('ui.profilecard.clicked.action', duration => ({
164
+ method: 'click',
165
+ firedAt: Math.round(getPageTime()),
166
+ duration,
167
+ hasHref: !!action.link,
168
+ hasOnClick: !!action.callback,
169
+ index,
170
+ actionId: action.id || 'no-id-specified',
171
+ ...PACKAGE_META_DATA
172
+ }));
173
+ } else {
174
+ fireAnalyticsWithDuration(duration => actionClicked('user', {
175
+ duration,
176
+ hasHref: !!action.link,
177
+ hasOnClick: !!action.callback,
178
+ index,
179
+ actionId: action.id || 'no-id-specified'
180
+ }));
181
+ }
145
182
  if (action.callback && isBasicClick(event)) {
146
183
  event.preventDefault();
147
184
  action.callback(event, ...args);
148
185
  }
149
- }, [fireAnalyticsWithDuration]);
186
+ }, [fireAnalyticsWithDuration, fireAnalyticsWithDurationNext]);
150
187
  if (!actions || actions.length === 0) {
151
188
  return null;
152
189
  }
@@ -175,21 +212,31 @@ const Actions = ({
175
212
  }), overflowActions && /*#__PURE__*/React.createElement(OverflowProfileCardButtons, _extends({
176
213
  actions: overflowActions,
177
214
  fireAnalyticsWithDuration: fireAnalyticsWithDuration,
215
+ fireAnalyticsWithDurationNext: fireAnalyticsWithDurationNext,
178
216
  onItemClick: (action, args, event, index) => onActionClick(action, args, event, index + ACTION_OVERFLOW_THRESHOLD)
179
217
  }, fg('jfp_a11y_team_profile_card_actions_label') && {
180
218
  fullName
181
219
  })));
182
220
  };
183
- const LoadingView = ({
184
- fireAnalyticsWithDuration
221
+ export const LoadingView = ({
222
+ fireAnalyticsWithDuration,
223
+ fireAnalyticsWithDurationNext
185
224
  }) => {
186
225
  useEffect(() => {
187
- fireAnalyticsWithDuration(duration => profileCardRendered('user', 'spinner', {
188
- duration
189
- }));
190
- }, [fireAnalyticsWithDuration]);
226
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
227
+ fireAnalyticsWithDurationNext('ui.profilecard.rendered.spinner', duration => ({
228
+ firedAt: Math.round(getPageTime()),
229
+ duration,
230
+ ...PACKAGE_META_DATA
231
+ }));
232
+ } else {
233
+ fireAnalyticsWithDuration(duration => profileCardRendered('user', 'spinner', {
234
+ duration
235
+ }));
236
+ }
237
+ }, [fireAnalyticsWithDuration, fireAnalyticsWithDurationNext]);
191
238
  return /*#__PURE__*/React.createElement(SpinnerContainer, {
192
239
  testId: "profilecard-spinner-container"
193
240
  }, /*#__PURE__*/React.createElement(Spinner, null));
194
241
  };
195
- export default withAnalyticsEvents()(ProfilecardInternal);
242
+ export default componentWithFG('ptc-enable-profile-card-analytics-refactor', ProfilecardInternal, withAnalyticsEvents()(ProfilecardInternal));
@@ -5,7 +5,6 @@
5
5
  ._18u0ze3t{margin-left:var(--ds-space-0,0)}
6
6
  ._19bvze3t{padding-left:var(--ds-space-0,0)}
7
7
  ._19pkxy5q{margin-top:var(--ds-space-400,2pc)}
8
- ._19pkze3t{margin-top:var(--ds-space-0,0)}
9
8
  ._1bguutpp#profilecard-name-label{margin-bottom:var(--ds-space-150,9pt)}
10
9
  ._1bto1l2s{text-overflow:ellipsis}
11
10
  ._1hpmutpp#profilecard-name-label{margin-top:var(--ds-space-150,9pt)}
@@ -7,16 +7,13 @@ import { cx } from '@compiled/react';
7
7
  import { FormattedMessage } from 'react-intl-next';
8
8
  import Lozenge from '@atlaskit/lozenge';
9
9
  import { fg } from '@atlaskit/platform-feature-flags';
10
- // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
11
- import { Text } from '@atlaskit/primitives';
12
- import { Box } from '@atlaskit/primitives/compiled';
10
+ import { Box, Text } from '@atlaskit/primitives/compiled';
13
11
  import relativeDate from '../../internal/relative-date';
14
12
  import messages from '../../messages';
15
13
  import { AppTitleLabel, CustomLozengeContainer, DetailsGroup, DisabledInfo, JobTitleLabel, LozengeWrapper } from '../../styled/Card';
16
14
  import { IconLabel } from '../Icon';
17
15
  import ReportingLinesDetails from './ReportingLinesDetails';
18
16
  const styles = {
19
- detailedListWrapper: "_19pkze3t _2hwxze3t _otyrze3t _18u0ze3t _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t",
20
17
  detailedListWrapperNext: "_19pkxy5q _2hwxze3t _otyrze3t _18u0ze3t _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t",
21
18
  fullNameLabel: "_1reo15vq _18m915vq _11c81ixg _1bto1l2s _o5721q9c",
22
19
  noMetaLabel: "_2hwxidpf _18u0idpf _rcujxy5q _1l6uutpp",
@@ -137,6 +134,7 @@ export const ProfileCardDetails = props => {
137
134
  reportingLines: props.reportingLines,
138
135
  reportingLinesProfileUrl: props.reportingLinesProfileUrl,
139
136
  onReportingLinesClick: props.onReportingLinesClick,
140
- fireAnalyticsWithDuration: props.fireAnalyticsWithDuration
137
+ fireAnalyticsWithDuration: props.fireAnalyticsWithDuration,
138
+ fireAnalyticsWithDurationNext: props.fireAnalyticsWithDurationNext
141
139
  }));
142
140
  };
@@ -3,6 +3,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React, { Suspense } from 'react';
4
4
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
5
5
  import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
6
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
7
+ import { useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics';
6
8
  import filterActions from '../../internal/filterActions';
7
9
  import { CardWrapper } from '../../styled/UserTrigger';
8
10
  import { fireEvent } from '../../util/analytics';
@@ -33,6 +35,15 @@ class ProfileCardResourced extends React.PureComponent {
33
35
  fireEvent(this.props.createAnalyticsEvent, payload);
34
36
  }
35
37
  });
38
+ _defineProperty(this, "fireAnalyticsNext", (eventKey, ...attributes) => {
39
+ // Don't fire analytics if the component is unmounted
40
+ if (!this._isMounted) {
41
+ return;
42
+ }
43
+ if (this.props.fireEvent) {
44
+ this.props.fireEvent(eventKey, ...attributes);
45
+ }
46
+ });
36
47
  _defineProperty(this, "clientFetchProfile", () => {
37
48
  const {
38
49
  cloudId,
@@ -50,7 +61,7 @@ class ProfileCardResourced extends React.PureComponent {
50
61
  hasError: false,
51
62
  data: null
52
63
  }, () => {
53
- const requests = Promise.all([this.props.resourceClient.getProfile(cloudId, userId, this.fireAnalytics), this.props.resourceClient.getReportingLines(userId), this.props.resourceClient.shouldShowGiveKudos(), this.props.resourceClient.getTeamCentralBaseUrl({
64
+ const requests = Promise.all([this.props.resourceClient.getProfile(cloudId, userId, this.fireAnalytics, this.fireAnalyticsNext), this.props.resourceClient.getReportingLines(userId), this.props.resourceClient.shouldShowGiveKudos(), this.props.resourceClient.getTeamCentralBaseUrl({
54
65
  withOrgContext: true,
55
66
  withSiteContext: true
56
67
  })]);
@@ -130,7 +141,8 @@ class ProfileCardResourced extends React.PureComponent {
130
141
  const isFetchingOrNotStartToFetchYet = isLoading === true || isLoading === undefined;
131
142
  if (isFetchingOrNotStartToFetchYet) {
132
143
  return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(UserLoadingState, {
133
- fireAnalytics: this.fireAnalytics
144
+ fireAnalytics: this.fireAnalytics,
145
+ fireAnalyticsNext: this.fireAnalyticsNext
134
146
  }));
135
147
  } else if (hasError) {
136
148
  return /*#__PURE__*/React.createElement(CardWrapper, {
@@ -138,7 +150,8 @@ class ProfileCardResourced extends React.PureComponent {
138
150
  }, /*#__PURE__*/React.createElement(ErrorMessage, {
139
151
  errorType: error,
140
152
  reload: this.clientFetchProfile,
141
- fireAnalytics: this.fireAnalytics
153
+ fireAnalytics: this.fireAnalytics,
154
+ fireAnalyticsNext: this.fireAnalyticsNext
142
155
  }));
143
156
  }
144
157
  const newProps = {
@@ -177,4 +190,12 @@ _defineProperty(ProfileCardResourced, "defaultProps", {
177
190
  actions: []
178
191
  });
179
192
  export const ProfileCardResourcedInternal = ProfileCardResourced;
180
- export default withAnalyticsEvents()(ProfileCardResourced);
193
+ const ProfileCardResourcedWithAnalytics = props => {
194
+ const {
195
+ fireEvent
196
+ } = useAnalyticsEvents();
197
+ return /*#__PURE__*/React.createElement(ProfileCardResourced, _extends({
198
+ fireEvent: fireEvent
199
+ }, props));
200
+ };
201
+ export default componentWithFG('ptc-enable-profile-card-analytics-refactor', ProfileCardResourcedWithAnalytics, withAnalyticsEvents()(ProfileCardResourced));
@@ -9,12 +9,14 @@ import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
9
9
  import { fg } from '@atlaskit/platform-feature-flags';
10
10
  import Popup from '@atlaskit/popup';
11
11
  import { Box } from '@atlaskit/primitives/compiled';
12
+ import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
12
13
  import { layers } from '@atlaskit/theme/constants';
13
14
  import filterActionsInner from '../../internal/filterActions';
14
15
  import getLabelMessage from '../../internal/getLabelMessage';
15
16
  import { CardWrapper } from '../../styled/UserTrigger';
16
- import { cardTriggered, fireEvent } from '../../util/analytics';
17
+ import { cardTriggered, fireEvent, PACKAGE_META_DATA } from '../../util/analytics';
17
18
  import { DELAY_MS_HIDE, DELAY_MS_SHOW } from '../../util/config';
19
+ import { getPageTime } from '../../util/performance';
18
20
  import { AgentProfileCardResourced } from '../Agent/AgentProfileCardResourced';
19
21
  import { ProfileCardLazy } from './lazyProfileCard';
20
22
  import UserLoadingState from './UserLoadingState';
@@ -105,6 +107,9 @@ export default function ProfilecardTriggerNext({
105
107
  const [kudosDrawerOpen, setKudosDrawerOpen] = useState(false);
106
108
  const [isTriggeredUsingKeyboard, setTriggeredUsingKeyboard] = useState(false);
107
109
  const triggerRef = useRef(null);
110
+ const {
111
+ fireEvent: fireEventNext
112
+ } = useAnalyticsEventsNext();
108
113
  useEffect(() => {
109
114
  isMounted.current = true;
110
115
  return () => {
@@ -123,6 +128,14 @@ export default function ProfilecardTriggerNext({
123
128
  setShouldShowGiveKudos(false);
124
129
  setTeamCentralBaseUrl(undefined);
125
130
  }, [userId]);
131
+
132
+ // Create a wrapper function that has the same interface as fireEventNext but includes isMounted check
133
+ const fireAnalyticsNext = useCallback((eventKey, ...attributes) => {
134
+ if (!isMounted.current) {
135
+ return;
136
+ }
137
+ fireEventNext(eventKey, ...attributes);
138
+ }, [fireEventNext]);
126
139
  const fireAnalytics = useCallback(payload => {
127
140
  // Don't fire any analytics if the component is unmounted
128
141
  if (!isMounted.current) {
@@ -180,7 +193,7 @@ export default function ProfilecardTriggerNext({
180
193
  setError(null);
181
194
  setData(null);
182
195
  try {
183
- const requests = Promise.all([resourceClient.getProfile(cloudId || '', userId, fireAnalytics), resourceClient.getReportingLines(userId), resourceClient.shouldShowGiveKudos(), resourceClient.getTeamCentralBaseUrl({
196
+ const requests = Promise.all([resourceClient.getProfile(cloudId || '', userId, fireAnalytics, fireAnalyticsNext), resourceClient.getReportingLines(userId), resourceClient.shouldShowGiveKudos(), resourceClient.getTeamCentralBaseUrl({
184
197
  withOrgContext: true,
185
198
  withSiteContext: true
186
199
  })]);
@@ -189,7 +202,7 @@ export default function ProfilecardTriggerNext({
189
202
  } catch (err) {
190
203
  handleClientError(err);
191
204
  }
192
- }, [cloudId, fireAnalytics, isLoading, resourceClient, userId, handleClientSuccess, handleClientError]);
205
+ }, [cloudId, fireAnalytics, fireAnalyticsNext, isLoading, resourceClient, userId, handleClientSuccess, handleClientError]);
193
206
  const showProfilecard = useCallback(() => {
194
207
  clearTimeout(hideTimer.current);
195
208
  clearTimeout(showTimer.current);
@@ -208,25 +221,49 @@ export default function ProfilecardTriggerNext({
208
221
  event.stopPropagation();
209
222
  showProfilecard();
210
223
  if (!visible) {
211
- fireAnalytics(cardTriggered('user', 'click'));
224
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
225
+ fireAnalyticsNext('ui.profilecard.triggered', {
226
+ method: 'click',
227
+ firedAt: Math.round(getPageTime()),
228
+ ...PACKAGE_META_DATA
229
+ });
230
+ } else {
231
+ fireAnalytics(cardTriggered('user', 'click'));
232
+ }
212
233
  }
213
- }, [fireAnalytics, showProfilecard, visible]);
234
+ }, [fireAnalytics, fireAnalyticsNext, showProfilecard, visible]);
214
235
  const onMouseEnter = useCallback(() => {
215
236
  showProfilecard();
216
237
  if (!visible) {
217
- fireAnalytics(cardTriggered('user', 'hover'));
238
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
239
+ fireAnalyticsNext('ui.profilecard.triggered', {
240
+ method: 'hover',
241
+ firedAt: Math.round(getPageTime()),
242
+ ...PACKAGE_META_DATA
243
+ });
244
+ } else {
245
+ fireAnalytics(cardTriggered('user', 'hover'));
246
+ }
218
247
  }
219
- }, [fireAnalytics, showProfilecard, visible]);
248
+ }, [fireAnalytics, fireAnalyticsNext, showProfilecard, visible]);
220
249
  const onKeyPress = useCallback(event => {
221
250
  if (event.key === 'Enter' || event.key === ' ') {
222
251
  event.preventDefault();
223
252
  setTriggeredUsingKeyboard(true);
224
253
  showProfilecard();
225
254
  if (!visible) {
226
- fireAnalytics(cardTriggered('user', 'click'));
255
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
256
+ fireAnalyticsNext('ui.profilecard.triggered', {
257
+ method: 'click',
258
+ firedAt: Math.round(getPageTime()),
259
+ ...PACKAGE_META_DATA
260
+ });
261
+ } else {
262
+ fireAnalytics(cardTriggered('user', 'click'));
263
+ }
227
264
  }
228
265
  }
229
- }, [fireAnalytics, showProfilecard, visible]);
266
+ }, [fireAnalytics, fireAnalyticsNext, showProfilecard, visible]);
230
267
  const onFocus = useCallback(() => {
231
268
  showProfilecard();
232
269
  }, [showProfilecard]);
@@ -301,7 +338,8 @@ export default function ProfilecardTriggerNext({
301
338
  placement: position,
302
339
  offset: offset !== null && offset !== void 0 ? offset : [0, 8],
303
340
  content: () => /*#__PURE__*/React.createElement("div", wrapperProps, showLoading ? /*#__PURE__*/React.createElement(LoadingView, {
304
- fireAnalytics: fireAnalytics
341
+ fireAnalytics: fireAnalytics,
342
+ fireAnalyticsNext: fireAnalyticsNext
305
343
  }) : visible && /*#__PURE__*/React.createElement(ProfileCardContent, {
306
344
  profilecardProps: profilecardProps,
307
345
  isAgent: !!(data !== null && data !== void 0 && data.isAgent),
@@ -378,7 +416,8 @@ export default function ProfilecardTriggerNext({
378
416
  placement: position,
379
417
  offset: offset !== null && offset !== void 0 ? offset : [0, 8],
380
418
  content: () => /*#__PURE__*/React.createElement("div", wrapperProps, showLoading ? /*#__PURE__*/React.createElement(LoadingView, {
381
- fireAnalytics: fireAnalytics
419
+ fireAnalytics: fireAnalytics,
420
+ fireAnalyticsNext: fireAnalyticsNext
382
421
  }) : visible && /*#__PURE__*/React.createElement(ProfileCardContent, {
383
422
  profilecardProps: profilecardProps,
384
423
  isAgent: !!(data !== null && data !== void 0 && data.isAgent),
@@ -447,9 +486,11 @@ export default function ProfilecardTriggerNext({
447
486
  })));
448
487
  }
449
488
  const LoadingView = ({
450
- fireAnalytics
489
+ fireAnalytics,
490
+ fireAnalyticsNext
451
491
  }) => /*#__PURE__*/React.createElement(CardWrapper, {
452
492
  testId: "profilecard.profilecardtrigger.loading"
453
493
  }, /*#__PURE__*/React.createElement(UserLoadingState, {
454
- fireAnalytics: fireAnalytics
494
+ fireAnalytics: fireAnalytics,
495
+ fireAnalyticsNext: fireAnalyticsNext
455
496
  }));
@@ -5,12 +5,16 @@ import React from 'react';
5
5
  import { FormattedMessage, useIntl } from 'react-intl-next';
6
6
  import Avatar from '@atlaskit/avatar';
7
7
  import AvatarGroup from '@atlaskit/avatar-group';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
9
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
8
10
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
9
11
  import { Box, xcss } from '@atlaskit/primitives';
10
12
  import { Pressable } from '@atlaskit/primitives/compiled';
11
13
  import messages from '../../messages';
12
14
  import { ManagerName, ManagerSection, OffsetWrapper, ReportingLinesSection } from '../../styled/ReportingLines';
13
- import { reportingLinesClicked } from '../../util/analytics';
15
+ import { PACKAGE_META_DATA, reportingLinesClicked } from '../../util/analytics';
16
+ import { getPageTime } from '../../util/performance';
17
+ import { default as ReportingLinesDetailsCompiled } from './ReportingLinesDetailsCompiled';
14
18
  function getProfileHref(userId, profileUrl) {
15
19
  return profileUrl ? profileUrl + userId : undefined;
16
20
  }
@@ -34,6 +38,7 @@ const ReportingLinesDetails = props => {
34
38
  } = useIntl();
35
39
  const {
36
40
  fireAnalyticsWithDuration,
41
+ fireAnalyticsWithDurationNext,
37
42
  reportingLines = {},
38
43
  reportingLinesProfileUrl,
39
44
  onReportingLinesClick
@@ -45,10 +50,19 @@ const ReportingLinesDetails = props => {
45
50
  const manager = managers.length >= 1 ? managers[0] : undefined;
46
51
  const hasReports = reports.length > 0;
47
52
  const getReportingLinesOnClick = (user, userType) => onReportingLinesClick ? () => {
48
- fireAnalyticsWithDuration(duration => reportingLinesClicked({
49
- duration,
50
- userType
51
- }));
53
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
54
+ fireAnalyticsWithDurationNext('ui.profilecard.clicked.reportingLines', duration => ({
55
+ duration,
56
+ userType,
57
+ firedAt: Math.round(getPageTime()),
58
+ ...PACKAGE_META_DATA
59
+ }));
60
+ } else {
61
+ fireAnalyticsWithDuration(duration => reportingLinesClicked({
62
+ duration,
63
+ userType
64
+ }));
65
+ }
52
66
  onReportingLinesClick(user);
53
67
  } : undefined;
54
68
  const onReportingLinksClick = (user, userType, href) => {
@@ -56,10 +70,19 @@ const ReportingLinesDetails = props => {
56
70
  if (onReportingLinesClick) {
57
71
  shouldPreventDefault = onReportingLinesClick(user) === false;
58
72
  }
59
- fireAnalyticsWithDuration(duration => reportingLinesClicked({
60
- duration,
61
- userType
62
- }));
73
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
74
+ fireAnalyticsWithDurationNext('ui.profilecard.clicked.reportingLines', duration => ({
75
+ duration,
76
+ userType,
77
+ firedAt: Math.round(getPageTime()),
78
+ ...PACKAGE_META_DATA
79
+ }));
80
+ } else {
81
+ fireAnalyticsWithDuration(duration => reportingLinesClicked({
82
+ duration,
83
+ userType
84
+ }));
85
+ }
63
86
  if (shouldPreventDefault) {
64
87
  return;
65
88
  }
@@ -101,4 +124,5 @@ const ReportingLinesDetails = props => {
101
124
  showMoreButtonProps: showMoreButtonProps
102
125
  })));
103
126
  };
104
- export default ReportingLinesDetails;
127
+ const ReportingLinesDetailsExport = componentWithFG('profilecard_primitives_compiled', ReportingLinesDetailsCompiled, ReportingLinesDetails);
128
+ export default ReportingLinesDetailsExport;
@@ -0,0 +1,11 @@
1
+ ._11c81vhk{font:var(--ds-font-heading-xxsmall,normal 600 9pt/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
2
+ ._19bvze3t{padding-left:var(--ds-space-0,0)}
3
+ ._bfhksm61{background-color:var(--ds-background-neutral-subtle,#00000000)}
4
+ ._ca0qze3t{padding-top:var(--ds-space-0,0)}
5
+ ._k48p1pd9{font-weight:var(--ds-font-weight-semibold,600)}
6
+ ._n3tdze3t{padding-bottom:var(--ds-space-0,0)}
7
+ ._otyru2gc{margin-bottom:var(--ds-space-100,8px)}
8
+ ._otyrze3t{margin-bottom:var(--ds-space-0,0)}
9
+ ._syaz1fxt{color:var(--ds-text,#172b4d)}
10
+ ._u5f3ze3t{padding-right:var(--ds-space-0,0)}
11
+ ._irr3166n:hover{background-color:var(--ds-background-neutral-subtle-hovered,#091e420f)}
@@ -0,0 +1,96 @@
1
+ /* ReportingLinesDetailsCompiled.tsx generated by @compiled/babel-plugin v0.38.1 */
2
+ import "./ReportingLinesDetailsCompiled.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import React from 'react';
5
+ import { FormattedMessage, useIntl } from 'react-intl-next';
6
+ import Avatar from '@atlaskit/avatar';
7
+ import AvatarGroup from '@atlaskit/avatar-group';
8
+ import { cx } from '@atlaskit/css';
9
+ import { Box, Pressable } from '@atlaskit/primitives/compiled';
10
+ import messages from '../../messages';
11
+ import { ManagerName, ManagerSection, OffsetWrapper, ReportingLinesSection } from '../../styled/ReportingLines';
12
+ import { reportingLinesClicked } from '../../util/analytics';
13
+ function getProfileHref(userId, profileUrl) {
14
+ return profileUrl ? profileUrl + userId : undefined;
15
+ }
16
+ const styles = {
17
+ reportingLinesButton: "_ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t _bfhksm61 _irr3166n",
18
+ reportingLinesHeadingDefaultStyles: "_11c81vhk _syaz1fxt _k48p1pd9 _otyru2gc",
19
+ reportingLinesHeadingStyles: "_otyrze3t"
20
+ };
21
+ const avatarGroupMaxCount = 5;
22
+ const ReportingLinesDetails = props => {
23
+ var _manager$pii, _manager$pii2;
24
+ const {
25
+ formatMessage
26
+ } = useIntl();
27
+ const {
28
+ fireAnalyticsWithDuration,
29
+ reportingLines = {},
30
+ reportingLinesProfileUrl,
31
+ onReportingLinesClick
32
+ } = props;
33
+ const {
34
+ managers = [],
35
+ reports = []
36
+ } = reportingLines;
37
+ const manager = managers.length >= 1 ? managers[0] : undefined;
38
+ const hasReports = reports.length > 0;
39
+ const getReportingLinesOnClick = (user, userType) => onReportingLinesClick ? () => {
40
+ fireAnalyticsWithDuration(duration => reportingLinesClicked({
41
+ duration,
42
+ userType
43
+ }));
44
+ onReportingLinesClick(user);
45
+ } : undefined;
46
+ const onReportingLinksClick = (user, userType, href) => {
47
+ let shouldPreventDefault = false;
48
+ if (onReportingLinesClick) {
49
+ shouldPreventDefault = onReportingLinesClick(user) === false;
50
+ }
51
+ fireAnalyticsWithDuration(duration => reportingLinesClicked({
52
+ duration,
53
+ userType
54
+ }));
55
+ if (shouldPreventDefault) {
56
+ return;
57
+ }
58
+ if (href) {
59
+ window.location.href = href;
60
+ }
61
+ };
62
+ const showMoreButtonProps = {
63
+ 'aria-label': formatMessage(messages.profileCardMoreReportingLinesLabel, {
64
+ count: reports.length - avatarGroupMaxCount + 1
65
+ })
66
+ };
67
+ return /*#__PURE__*/React.createElement(React.Fragment, null, manager && /*#__PURE__*/React.createElement(ReportingLinesSection, null, /*#__PURE__*/React.createElement(Box, {
68
+ xcss: cx(styles.reportingLinesHeadingDefaultStyles, styles.reportingLinesHeadingStyles)
69
+ }, /*#__PURE__*/React.createElement(FormattedMessage, messages.managerSectionHeading)), /*#__PURE__*/React.createElement(OffsetWrapper, null, /*#__PURE__*/React.createElement(Pressable, {
70
+ onClick: () => onReportingLinksClick(manager, 'manager', getProfileHref(manager.accountIdentifier, reportingLinesProfileUrl)),
71
+ isDisabled: !onReportingLinesClick,
72
+ xcss: styles.reportingLinesButton
73
+ }, /*#__PURE__*/React.createElement(ManagerSection, null, /*#__PURE__*/React.createElement(Avatar, {
74
+ size: "xsmall",
75
+ src: (_manager$pii = manager.pii) === null || _manager$pii === void 0 ? void 0 : _manager$pii.picture
76
+ }), /*#__PURE__*/React.createElement(ManagerName, null, (_manager$pii2 = manager.pii) === null || _manager$pii2 === void 0 ? void 0 : _manager$pii2.name))))), hasReports && /*#__PURE__*/React.createElement(ReportingLinesSection, null, /*#__PURE__*/React.createElement(Box, {
77
+ xcss: styles.reportingLinesHeadingDefaultStyles
78
+ }, /*#__PURE__*/React.createElement(FormattedMessage, messages.directReportsSectionHeading)), /*#__PURE__*/React.createElement(AvatarGroup, {
79
+ appearance: "stack",
80
+ size: "small",
81
+ data: reports.map(member => {
82
+ var _member$pii, _member$pii2;
83
+ return {
84
+ key: member.accountIdentifier,
85
+ name: ((_member$pii = member.pii) === null || _member$pii === void 0 ? void 0 : _member$pii.name) || '',
86
+ src: (_member$pii2 = member.pii) === null || _member$pii2 === void 0 ? void 0 : _member$pii2.picture,
87
+ href: getProfileHref(member.accountIdentifier, reportingLinesProfileUrl),
88
+ onClick: getReportingLinesOnClick(member, 'direct-report')
89
+ };
90
+ }),
91
+ maxCount: avatarGroupMaxCount,
92
+ testId: "profilecard-reports-avatar-group",
93
+ showMoreButtonProps: showMoreButtonProps
94
+ })));
95
+ };
96
+ export default ReportingLinesDetails;
@@ -1,13 +1,23 @@
1
1
  import React, { useEffect } from 'react';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  import AkSpinner from '@atlaskit/spinner';
3
4
  import { SpinnerContainer } from '../../styled/UserTrigger';
4
- import { profileCardRendered } from '../../util/analytics';
5
+ import { PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
6
+ import { getPageTime } from '../../util/performance';
5
7
  const UserLoadingState = ({
6
- fireAnalytics
8
+ fireAnalytics,
9
+ fireAnalyticsNext
7
10
  }) => {
8
11
  useEffect(() => {
9
- fireAnalytics(profileCardRendered('user', 'spinner'));
10
- }, [fireAnalytics]);
12
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
13
+ fireAnalyticsNext('ui.profilecard.rendered.spinner', {
14
+ firedAt: Math.round(getPageTime()),
15
+ ...PACKAGE_META_DATA
16
+ });
17
+ } else {
18
+ fireAnalytics(profileCardRendered('user', 'spinner'));
19
+ }
20
+ }, [fireAnalytics, fireAnalyticsNext]);
11
21
  return /*#__PURE__*/React.createElement(SpinnerContainer, null, /*#__PURE__*/React.createElement(AkSpinner, null));
12
22
  };
13
23
  export default UserLoadingState;