@atlaskit/profilecard 24.40.2 → 24.42.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 (121) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/afm-cc/tsconfig.json +0 -6
  3. package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +1 -1
  4. package/dist/cjs/client/getTeamFromAGG.js +1 -1
  5. package/dist/cjs/components/Agent/Actions.js +8 -25
  6. package/dist/cjs/components/Agent/AgentProfileCard.js +6 -3
  7. package/dist/cjs/components/Agent/AgentProfileCardResourced.js +2 -1
  8. package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +1 -1
  9. package/dist/cjs/components/Agent/AgentProfileCardWrapper.js +1 -1
  10. package/dist/cjs/components/Agent/hooks/useAgentActions.js +20 -72
  11. package/dist/cjs/components/Team/TeamForbiddenErrorState.js +8 -18
  12. package/dist/cjs/components/Team/TeamLoadingState.js +8 -18
  13. package/dist/cjs/components/Team/TeamProfileCard.js +76 -162
  14. package/dist/cjs/components/Team/TeamProfileCardTrigger.js +2 -4
  15. package/dist/cjs/components/User/OverflowProfileCardButtons.js +9 -19
  16. package/dist/cjs/components/User/ProfileCard.js +37 -85
  17. package/dist/cjs/components/User/ProfileCardDetails.js +3 -4
  18. package/dist/cjs/components/User/ProfileCardResourced.js +10 -3
  19. package/dist/cjs/components/User/ProfileCardTrigger.js +20 -11
  20. package/dist/cjs/components/User/ReportingLinesDetails.js +15 -35
  21. package/dist/cjs/components/common/ProfileCardTrigger.js +9 -17
  22. package/dist/cjs/components/common/ProfileCardWrapper.js +1 -1
  23. package/dist/cjs/components/team-profile-card/main.js +5 -21
  24. package/dist/cjs/components/team-profile-card/team-connections/main.js +7 -23
  25. package/dist/cjs/components/team-profile-card/team-containers-skeleton/index.js +1 -1
  26. package/dist/cjs/components/team-profile-card/team-containers-skeleton/linked-container-card-skeleton/index.js +1 -1
  27. package/dist/cjs/styled/Card.js +1 -1
  28. package/dist/cjs/styled/CoverImage.js +1 -1
  29. package/dist/cjs/styled/Error.js +1 -1
  30. package/dist/cjs/styled/ReportingLines.js +1 -1
  31. package/dist/cjs/styled/TeamCard.js +1 -1
  32. package/dist/cjs/styled/TeamTrigger.js +1 -1
  33. package/dist/cjs/styled/UserTrigger.js +1 -1
  34. package/dist/cjs/util/analytics.js +3 -31
  35. package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +1 -1
  36. package/dist/es2019/client/getTeamFromAGG.js +1 -1
  37. package/dist/es2019/components/Agent/Actions.js +8 -26
  38. package/dist/es2019/components/Agent/AgentProfileCard.js +5 -3
  39. package/dist/es2019/components/Agent/AgentProfileCardResourced.js +2 -1
  40. package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +1 -1
  41. package/dist/es2019/components/Agent/AgentProfileCardWrapper.js +1 -1
  42. package/dist/es2019/components/Agent/hooks/useAgentActions.js +20 -73
  43. package/dist/es2019/components/Team/TeamForbiddenErrorState.js +8 -16
  44. package/dist/es2019/components/Team/TeamLoadingState.js +8 -16
  45. package/dist/es2019/components/Team/TeamProfileCard.js +72 -146
  46. package/dist/es2019/components/Team/TeamProfileCardTrigger.js +2 -4
  47. package/dist/es2019/components/User/OverflowProfileCardButtons.js +9 -17
  48. package/dist/es2019/components/User/ProfileCard.js +35 -79
  49. package/dist/es2019/components/User/ProfileCardDetails.js +3 -4
  50. package/dist/es2019/components/User/ProfileCardResourced.js +10 -3
  51. package/dist/es2019/components/User/ProfileCardTrigger.js +12 -3
  52. package/dist/es2019/components/User/ReportingLinesDetails.js +14 -30
  53. package/dist/es2019/components/common/ProfileCardTrigger.js +9 -17
  54. package/dist/es2019/components/common/ProfileCardWrapper.js +1 -1
  55. package/dist/es2019/components/team-profile-card/main.js +5 -22
  56. package/dist/es2019/components/team-profile-card/team-connections/main.js +7 -24
  57. package/dist/es2019/components/team-profile-card/team-containers-skeleton/index.js +1 -1
  58. package/dist/es2019/components/team-profile-card/team-containers-skeleton/linked-container-card-skeleton/index.js +1 -1
  59. package/dist/es2019/styled/Card.js +1 -1
  60. package/dist/es2019/styled/CoverImage.js +1 -1
  61. package/dist/es2019/styled/Error.js +1 -1
  62. package/dist/es2019/styled/ReportingLines.js +1 -1
  63. package/dist/es2019/styled/TeamCard.js +1 -1
  64. package/dist/es2019/styled/TeamTrigger.js +1 -1
  65. package/dist/es2019/styled/UserTrigger.js +1 -1
  66. package/dist/es2019/util/analytics.js +2 -29
  67. package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +1 -1
  68. package/dist/esm/client/getTeamFromAGG.js +1 -1
  69. package/dist/esm/components/Agent/Actions.js +8 -25
  70. package/dist/esm/components/Agent/AgentProfileCard.js +6 -3
  71. package/dist/esm/components/Agent/AgentProfileCardResourced.js +2 -1
  72. package/dist/esm/components/Agent/AgentProfileCardTrigger.js +1 -1
  73. package/dist/esm/components/Agent/AgentProfileCardWrapper.js +1 -1
  74. package/dist/esm/components/Agent/hooks/useAgentActions.js +20 -72
  75. package/dist/esm/components/Team/TeamForbiddenErrorState.js +9 -19
  76. package/dist/esm/components/Team/TeamLoadingState.js +9 -19
  77. package/dist/esm/components/Team/TeamProfileCard.js +77 -163
  78. package/dist/esm/components/Team/TeamProfileCardTrigger.js +2 -4
  79. package/dist/esm/components/User/OverflowProfileCardButtons.js +10 -20
  80. package/dist/esm/components/User/ProfileCard.js +38 -86
  81. package/dist/esm/components/User/ProfileCardDetails.js +3 -4
  82. package/dist/esm/components/User/ProfileCardResourced.js +10 -3
  83. package/dist/esm/components/User/ProfileCardTrigger.js +20 -11
  84. package/dist/esm/components/User/ReportingLinesDetails.js +16 -36
  85. package/dist/esm/components/common/ProfileCardTrigger.js +10 -18
  86. package/dist/esm/components/common/ProfileCardWrapper.js +1 -1
  87. package/dist/esm/components/team-profile-card/main.js +5 -21
  88. package/dist/esm/components/team-profile-card/team-connections/main.js +7 -23
  89. package/dist/esm/components/team-profile-card/team-containers-skeleton/index.js +1 -1
  90. package/dist/esm/components/team-profile-card/team-containers-skeleton/linked-container-card-skeleton/index.js +1 -1
  91. package/dist/esm/styled/Card.js +1 -1
  92. package/dist/esm/styled/CoverImage.js +1 -1
  93. package/dist/esm/styled/Error.js +1 -1
  94. package/dist/esm/styled/ReportingLines.js +1 -1
  95. package/dist/esm/styled/TeamCard.js +1 -1
  96. package/dist/esm/styled/TeamTrigger.js +1 -1
  97. package/dist/esm/styled/UserTrigger.js +1 -1
  98. package/dist/esm/util/analytics.js +2 -31
  99. package/dist/types/components/Agent/AgentProfileCard.d.ts +1 -1
  100. package/dist/types/components/Agent/AgentProfileCardResourced.d.ts +2 -0
  101. package/dist/types/components/Agent/lazyAgentProfileCard.d.ts +1 -1
  102. package/dist/types/components/Team/TeamForbiddenErrorState.d.ts +1 -2
  103. package/dist/types/components/Team/TeamLoadingState.d.ts +1 -2
  104. package/dist/types/components/User/ProfileCard.d.ts +2 -3
  105. package/dist/types/components/User/ProfileCardTrigger.d.ts +1 -1
  106. package/dist/types/components/User/lazyProfileCard.d.ts +1 -1
  107. package/dist/types/components/common/types.d.ts +1 -3
  108. package/dist/types/types.d.ts +26 -10
  109. package/dist/types/util/analytics.d.ts +2 -17
  110. package/dist/types-ts4.5/components/Agent/AgentProfileCard.d.ts +1 -1
  111. package/dist/types-ts4.5/components/Agent/AgentProfileCardResourced.d.ts +2 -0
  112. package/dist/types-ts4.5/components/Agent/lazyAgentProfileCard.d.ts +1 -1
  113. package/dist/types-ts4.5/components/Team/TeamForbiddenErrorState.d.ts +1 -2
  114. package/dist/types-ts4.5/components/Team/TeamLoadingState.d.ts +1 -2
  115. package/dist/types-ts4.5/components/User/ProfileCard.d.ts +2 -3
  116. package/dist/types-ts4.5/components/User/ProfileCardTrigger.d.ts +1 -1
  117. package/dist/types-ts4.5/components/User/lazyProfileCard.d.ts +1 -1
  118. package/dist/types-ts4.5/components/common/types.d.ts +1 -3
  119. package/dist/types-ts4.5/types.d.ts +26 -10
  120. package/dist/types-ts4.5/util/analytics.d.ts +2 -17
  121. package/package.json +10 -9
@@ -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;
@@ -1,4 +1,4 @@
1
- /* ProfileCardDetails.tsx generated by @compiled/babel-plugin v0.38.1 */
1
+ /* ProfileCardDetails.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./ProfileCardDetails.compiled.css";
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -169,11 +169,10 @@ export const ProfileCardDetails = props => {
169
169
  icon: "companyName"
170
170
  }, props.companyName), /*#__PURE__*/React.createElement(IconLabel, {
171
171
  icon: "location"
172
- }, props.location)), /*#__PURE__*/React.createElement(ReportingLinesDetails, {
172
+ }, props.location)), !(fg('jira_ai_profilecard_hide_reportinglines') && props.hideReportingLines) && /*#__PURE__*/React.createElement(ReportingLinesDetails, {
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
  };
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import React, { Suspense } from 'react';
4
4
  import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  import { useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics';
6
7
  import filterActions from '../../internal/filterActions';
7
8
  import { CardWrapper } from '../../styled/UserTrigger';
@@ -49,7 +50,11 @@ class ProfileCardResourced extends React.PureComponent {
49
50
  hasError: false,
50
51
  data: null
51
52
  }, () => {
52
- 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({
53
+ const shouldHideReportingLines = fg('jira_ai_profilecard_hide_reportinglines') && this.props.hideReportingLines;
54
+ const requests = Promise.all([this.props.resourceClient.getProfile(cloudId, userId, this.fireAnalytics), shouldHideReportingLines ? Promise.resolve({
55
+ managers: [],
56
+ reports: []
57
+ }) : this.props.resourceClient.getReportingLines(userId), this.props.resourceClient.shouldShowGiveKudos(), this.props.resourceClient.getTeamCentralBaseUrl({
53
58
  withOrgContext: true,
54
59
  withSiteContext: true
55
60
  })]);
@@ -124,7 +129,8 @@ class ProfileCardResourced extends React.PureComponent {
124
129
  onReportingLinesClick,
125
130
  cloudId,
126
131
  userId,
127
- addFlag
132
+ addFlag,
133
+ hideReportingLines
128
134
  } = this.props;
129
135
  const isFetchingOrNotStartToFetchYet = isLoading === true || isLoading === undefined;
130
136
  if (isFetchingOrNotStartToFetchYet) {
@@ -152,7 +158,8 @@ class ProfileCardResourced extends React.PureComponent {
152
158
  ...data,
153
159
  isKudosEnabled,
154
160
  teamCentralBaseUrl,
155
- openKudosDrawer: this.openKudosDrawer
161
+ openKudosDrawer: this.openKudosDrawer,
162
+ hideReportingLines: fg('jira_ai_profilecard_hide_reportinglines') && hideReportingLines
156
163
  };
157
164
  return /*#__PURE__*/React.createElement(CardWrapper, null, /*#__PURE__*/React.createElement(React.Fragment, null, isKudosEnabled && newProps.teamCentralBaseUrl && /*#__PURE__*/React.createElement(Suspense, {
158
165
  fallback: null
@@ -42,6 +42,7 @@ function ProfileCardContent({
42
42
  onConversationStartersClick: agentActions === null || agentActions === void 0 ? void 0 : agentActions.onConversationStartersClick,
43
43
  addFlag: addFlag,
44
44
  hideMoreActions: fg('jira_ai_profilecard_hide_agent_actions') && !!hideAgentMoreActions,
45
+ hideConversationStarters: fg('jira_ai_hide_conversation_starters_profilecard') && !!profilecardProps.hideAgentConversationStarters,
45
46
  hideAiDisclaimer: hideAiDisclaimer
46
47
  });
47
48
  } else {
@@ -79,6 +80,8 @@ export default function ProfilecardTriggerNext({
79
80
  agentActions,
80
81
  hideAgentMoreActions,
81
82
  hideAiDisclaimer,
83
+ hideAgentConversationStarters,
84
+ hideReportingLines,
82
85
  ariaHideProfileTrigger = false,
83
86
  isVisible: propsIsVisible,
84
87
  isRenderedInPortal,
@@ -183,7 +186,11 @@ export default function ProfilecardTriggerNext({
183
186
  setError(null);
184
187
  setData(null);
185
188
  try {
186
- const requests = Promise.all([resourceClient.getProfile(cloudId || '', userId, fireAnalytics), resourceClient.getReportingLines(userId), resourceClient.shouldShowGiveKudos(), resourceClient.getTeamCentralBaseUrl({
189
+ const shouldHideReportingLines = fg('jira_ai_profilecard_hide_reportinglines') && hideReportingLines;
190
+ const requests = Promise.all([resourceClient.getProfile(cloudId || '', userId, fireAnalytics), shouldHideReportingLines ? Promise.resolve({
191
+ managers: [],
192
+ reports: []
193
+ }) : resourceClient.getReportingLines(userId), resourceClient.shouldShowGiveKudos(), resourceClient.getTeamCentralBaseUrl({
187
194
  withOrgContext: true,
188
195
  withSiteContext: true
189
196
  })]);
@@ -192,7 +199,7 @@ export default function ProfilecardTriggerNext({
192
199
  } catch (err) {
193
200
  handleClientError(err);
194
201
  }
195
- }, [cloudId, fireAnalytics, isLoading, resourceClient, userId, handleClientSuccess, handleClientError]);
202
+ }, [cloudId, fireAnalytics, isLoading, resourceClient, userId, handleClientSuccess, handleClientError, hideReportingLines]);
196
203
  const showProfilecard = useCallback(() => {
197
204
  clearTimeout(hideTimer.current);
198
205
  clearTimeout(showTimer.current);
@@ -298,7 +305,9 @@ export default function ProfilecardTriggerNext({
298
305
  cloudId: cloudId,
299
306
  openKudosDrawer: openKudosDrawer,
300
307
  isTriggeredUsingKeyboard: isTriggeredUsingKeyboard,
301
- disabledAriaAttributes: disabledAriaAttributes
308
+ disabledAriaAttributes: disabledAriaAttributes,
309
+ hideReportingLines: fg('jira_ai_profilecard_hide_reportinglines') && hideReportingLines,
310
+ hideAgentConversationStarters: fg('jira_ai_hide_conversation_starters_profilecard') && hideAgentConversationStarters
302
311
  };
303
312
  const ssrPlaceholderProp = ssrPlaceholderId ? {
304
313
  'data-ssr-placeholder-replace': ssrPlaceholderId
@@ -1,4 +1,4 @@
1
- /* ReportingLinesDetails.tsx generated by @compiled/babel-plugin v0.38.1 */
1
+ /* ReportingLinesDetails.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  import "./ReportingLinesDetails.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
@@ -6,11 +6,10 @@ import { FormattedMessage, useIntl } from 'react-intl-next';
6
6
  import Avatar from '@atlaskit/avatar';
7
7
  import AvatarGroup from '@atlaskit/avatar-group';
8
8
  import { cx } from '@atlaskit/css';
9
- import { fg } from '@atlaskit/platform-feature-flags';
10
9
  import { Box, Pressable } from '@atlaskit/primitives/compiled';
11
10
  import messages from '../../messages';
12
11
  import { ManagerName, ManagerSection, OffsetWrapper, ReportingLinesSection } from '../../styled/ReportingLines';
13
- import { PACKAGE_META_DATA, reportingLinesClicked } from '../../util/analytics';
12
+ import { PACKAGE_META_DATA } from '../../util/analytics';
14
13
  import { getPageTime } from '../../util/performance';
15
14
  function getProfileHref(userId, profileUrl) {
16
15
  return profileUrl ? profileUrl + userId : undefined;
@@ -28,7 +27,6 @@ const ReportingLinesDetails = props => {
28
27
  } = useIntl();
29
28
  const {
30
29
  fireAnalyticsWithDuration,
31
- fireAnalyticsWithDurationNext,
32
30
  reportingLines = {},
33
31
  reportingLinesProfileUrl,
34
32
  onReportingLinesClick
@@ -40,19 +38,12 @@ const ReportingLinesDetails = props => {
40
38
  const manager = managers.length >= 1 ? managers[0] : undefined;
41
39
  const hasReports = reports.length > 0;
42
40
  const getReportingLinesOnClick = (user, userType) => onReportingLinesClick ? () => {
43
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
44
- fireAnalyticsWithDurationNext('ui.profilecard.clicked.reportingLines', duration => ({
45
- duration,
46
- userType,
47
- firedAt: Math.round(getPageTime()),
48
- ...PACKAGE_META_DATA
49
- }));
50
- } else {
51
- fireAnalyticsWithDuration(duration => reportingLinesClicked({
52
- duration,
53
- userType
54
- }));
55
- }
41
+ fireAnalyticsWithDuration('ui.profilecard.clicked.reportingLines', duration => ({
42
+ duration,
43
+ userType,
44
+ firedAt: Math.round(getPageTime()),
45
+ ...PACKAGE_META_DATA
46
+ }));
56
47
  onReportingLinesClick(user);
57
48
  } : undefined;
58
49
  const onReportingLinksClick = (user, userType, href) => {
@@ -60,19 +51,12 @@ const ReportingLinesDetails = props => {
60
51
  if (onReportingLinesClick) {
61
52
  shouldPreventDefault = onReportingLinesClick(user) === false;
62
53
  }
63
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
64
- fireAnalyticsWithDurationNext('ui.profilecard.clicked.reportingLines', duration => ({
65
- duration,
66
- userType,
67
- firedAt: Math.round(getPageTime()),
68
- ...PACKAGE_META_DATA
69
- }));
70
- } else {
71
- fireAnalyticsWithDuration(duration => reportingLinesClicked({
72
- duration,
73
- userType
74
- }));
75
- }
54
+ fireAnalyticsWithDuration('ui.profilecard.clicked.reportingLines', duration => ({
55
+ duration,
56
+ userType,
57
+ firedAt: Math.round(getPageTime()),
58
+ ...PACKAGE_META_DATA
59
+ }));
76
60
  if (shouldPreventDefault) {
77
61
  return;
78
62
  }
@@ -1,9 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
3
- import { fg } from '@atlaskit/platform-feature-flags';
4
3
  import Popup from '@atlaskit/popup';
5
4
  import { layers } from '@atlaskit/theme/constants';
6
- import { cardTriggered, getActionSubject, PACKAGE_META_DATA } from '../../util/analytics';
5
+ import { getActionSubject, PACKAGE_META_DATA } from '../../util/analytics';
7
6
  import { getPageTime } from '../../util/performance';
8
7
  import { useProfileInfo } from '../../util/useProfileInfo';
9
8
  import { LoadingState } from './LoadingState';
@@ -21,7 +20,6 @@ function ProfileCardTriggerInner({
21
20
  profileCardType,
22
21
  testId,
23
22
  fireAnalytics,
24
- fireAnalyticsNext,
25
23
  ...popupProps
26
24
  }, ref) {
27
25
  var _popupProps$autoFocus;
@@ -61,22 +59,16 @@ function ProfileCardTriggerInner({
61
59
  if (!visible) {
62
60
  getProfileData === null || getProfileData === void 0 ? void 0 : getProfileData();
63
61
  setVisible(true);
64
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
65
- if (fireAnalyticsNext) {
66
- fireAnalyticsNext(`ui.${getActionSubject(profileCardType)}.triggered`, {
67
- method: trigger,
68
- ...PACKAGE_META_DATA,
69
- firedAt: Math.round(getPageTime())
70
- });
71
- }
72
- } else {
73
- if (fireAnalytics) {
74
- fireAnalytics(cardTriggered(profileCardType, trigger));
75
- }
62
+ if (fireAnalytics) {
63
+ fireAnalytics(`ui.${getActionSubject(profileCardType)}.triggered`, {
64
+ method: trigger,
65
+ ...PACKAGE_META_DATA,
66
+ firedAt: Math.round(getPageTime())
67
+ });
76
68
  }
77
69
  }
78
70
  }, showDelay);
79
- }, [showDelay, visible, getProfileData, fireAnalytics, profileCardType, trigger, fireAnalyticsNext]);
71
+ }, [showDelay, visible, getProfileData, fireAnalytics, profileCardType, trigger]);
80
72
  const onMouseEnter = useCallback(() => {
81
73
  showProfilecard();
82
74
  }, [showProfilecard]);
@@ -113,7 +105,7 @@ function ProfileCardTriggerInner({
113
105
  }, isLoading ? /*#__PURE__*/React.createElement(ProfileCardWrapper, {
114
106
  testId: "profilecard.profilecardtrigger.loading"
115
107
  }, /*#__PURE__*/React.createElement(LoadingState, {
116
- fireAnalytics: fireAnalyticsNext,
108
+ fireAnalytics: fireAnalytics,
117
109
  profileType: profileCardType
118
110
  })) : renderProfileCard({
119
111
  profileData,
@@ -1,4 +1,4 @@
1
- /* ProfileCardWrapper.tsx generated by @compiled/babel-plugin v0.38.1 */
1
+ /* ProfileCardWrapper.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  import "./ProfileCardWrapper.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
@@ -1,21 +1,18 @@
1
- /* main.tsx generated by @compiled/babel-plugin v0.38.1 */
1
+ /* main.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./main.compiled.css";
4
4
  import * as React from 'react';
5
5
  import { ax, ix } from "@compiled/react/runtime";
6
6
  import { useCallback, useMemo } from 'react';
7
7
  import { FormattedMessage } from 'react-intl-next';
8
- import { useAnalyticsEvents } from '@atlaskit/analytics-next';
9
8
  import AvatarGroup from '@atlaskit/avatar-group';
10
9
  import Heading from '@atlaskit/heading';
11
10
  import LinkItem from '@atlaskit/menu/link-item';
12
11
  import { VerifiedTeamIcon } from '@atlaskit/people-teams-ui-public/verified-team-icon';
13
- import { fg } from '@atlaskit/platform-feature-flags';
14
12
  import { Box, Flex, Inline, Stack, Text } from '@atlaskit/primitives/compiled';
15
- import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
13
+ import { useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics';
16
14
  import TeamAvatar from '@atlaskit/teams-avatar';
17
15
  import { TeamContainers, useTeamContainers } from '@atlaskit/teams-public';
18
- import { fireEvent } from '../../util/analytics';
19
16
  import TeamAppTile from '../common/assets/TeamAppTile.svg';
20
17
  import { TeamActions } from './team-actions';
21
18
  import { TeamConnections } from './team-connections/main';
@@ -52,27 +49,13 @@ export const TeamProfileCard = ({
52
49
  loading
53
50
  } = useTeamContainers(teamId);
54
51
  const {
55
- createAnalyticsEvent
52
+ fireEvent
56
53
  } = useAnalyticsEvents();
57
- const {
58
- fireEvent: fireEventNext
59
- } = useAnalyticsEventsNext();
60
54
  // Ensure that the current container is not the only connection for this team before showing the "Where we work" section
61
55
  const hasOtherTeamConnections = useMemo(() => teamContainers.filter(tc => tc.id === containerId).length < teamContainers.length, [containerId, teamContainers]);
62
56
  const onClick = useCallback(() => {
63
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
64
- fireEventNext('ui.button.clicked.viewTeamProfileButton', {});
65
- } else {
66
- if (createAnalyticsEvent) {
67
- fireEvent(createAnalyticsEvent, {
68
- action: 'clicked',
69
- actionSubject: 'button',
70
- actionSubjectId: 'viewTeamProfileButton',
71
- attributes: {}
72
- });
73
- }
74
- }
75
- }, [createAnalyticsEvent, fireEventNext]);
57
+ fireEvent('ui.button.clicked.viewTeamProfileButton', {});
58
+ }, [fireEvent]);
76
59
  return /*#__PURE__*/React.createElement(Box, {
77
60
  xcss: styles.wrapperStyles,
78
61
  testId: `team-card-${teamId}`
@@ -1,14 +1,11 @@
1
- /* main.tsx generated by @compiled/babel-plugin v0.38.1 */
1
+ /* main.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  import "./main.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useCallback } from 'react';
5
- import { useAnalyticsEvents } from '@atlaskit/analytics-next';
6
5
  import { LinkItem } from '@atlaskit/menu';
7
- import { fg } from '@atlaskit/platform-feature-flags';
8
6
  import { Box, Inline, Text } from '@atlaskit/primitives/compiled';
9
- import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
7
+ import { useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics';
10
8
  import { ContainerIcon, getContainerProperties } from '@atlaskit/teams-public';
11
- import { fireEvent } from '../../../util/analytics';
12
9
  const styles = {
13
10
  containerTypeIconButtonStyles: "_18u01wug _4t3i7vkz _1bsb7vkz"
14
11
  };
@@ -28,27 +25,13 @@ export const TeamConnections = ({
28
25
  isDisplayedOnProfileCard: true
29
26
  });
30
27
  const {
31
- createAnalyticsEvent
28
+ fireEvent
32
29
  } = useAnalyticsEvents();
33
- const {
34
- fireEvent: fireEventNext
35
- } = useAnalyticsEventsNext();
36
30
  const onClick = useCallback(() => {
37
- if (fg('ptc-enable-profile-card-analytics-refactor')) {
38
- fireEventNext('ui.teamConnectionItem.clicked.teamProfileCard', {
39
- container: containerType
40
- });
41
- } else {
42
- fireEvent(createAnalyticsEvent, {
43
- action: 'clicked',
44
- actionSubject: 'teamConnectionItem',
45
- actionSubjectId: 'teamProfileCard',
46
- attributes: {
47
- container: containerType
48
- }
49
- });
50
- }
51
- }, [containerType, createAnalyticsEvent, fireEventNext]);
31
+ fireEvent('ui.teamConnectionItem.clicked.teamProfileCard', {
32
+ container: containerType
33
+ });
34
+ }, [containerType, fireEvent]);
52
35
  return /*#__PURE__*/React.createElement(LinkItem, {
53
36
  href: link,
54
37
  onClick: onClick,
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  import "./index.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  import "./index.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React from 'react';
@@ -1,4 +1,4 @@
1
- /* Card.tsx generated by @compiled/babel-plugin v0.38.1 */
1
+ /* Card.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  /* eslint-disable @atlaskit/design-system/no-styled-tagged-template-expression -- needs manual remediation */
3
3
  import "./Card.compiled.css";
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* CoverImage.tsx generated by @compiled/babel-plugin v0.38.1 */
1
+ /* CoverImage.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  import "./CoverImage.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useRef } from 'react';
@@ -1,4 +1,4 @@
1
- /* Error.tsx generated by @compiled/babel-plugin v0.38.1 */
1
+ /* Error.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./Error.compiled.css";
4
4
  import { ax, ix } from "@compiled/react/runtime";