@atlaskit/profilecard 24.13.7 → 24.14.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 +11 -0
  2. package/afm-cc/tsconfig.json +6 -0
  3. package/afm-dev-agents/tsconfig.json +6 -0
  4. package/afm-jira/tsconfig.json +6 -0
  5. package/afm-passionfruit/tsconfig.json +6 -0
  6. package/afm-post-office/tsconfig.json +6 -0
  7. package/afm-rovo-extension/tsconfig.json +6 -0
  8. package/afm-townsquare/tsconfig.json +6 -0
  9. package/dist/cjs/client/ProfileCardClient.js +2 -2
  10. package/dist/cjs/client/UserProfileCardClient.js +45 -11
  11. package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +1 -1
  12. package/dist/cjs/client/getTeamFromAGG.js +1 -1
  13. package/dist/cjs/components/Agent/AgentProfileCard.js +3 -0
  14. package/dist/cjs/components/Agent/AgentProfileCardResourced.js +2 -1
  15. package/dist/cjs/components/Error/ErrorMessage.js +18 -7
  16. package/dist/cjs/components/User/OverflowProfileCardButtons.js +22 -7
  17. package/dist/cjs/components/User/ProfileCard.js +80 -28
  18. package/dist/cjs/components/User/ProfileCardDetails.js +2 -1
  19. package/dist/cjs/components/User/ProfileCardResourced.js +40 -16
  20. package/dist/cjs/components/User/ProfileCardTrigger.js +52 -12
  21. package/dist/cjs/components/User/ReportingLinesDetails.js +36 -11
  22. package/dist/cjs/components/User/UserLoadingState.js +15 -3
  23. package/dist/cjs/components/common/LoadingState.js +17 -3
  24. package/dist/cjs/components/common/ProfileCardTrigger.js +29 -7
  25. package/dist/cjs/components/common/ProfileCardWrapper.js +4 -2
  26. package/dist/cjs/util/analytics.js +7 -3
  27. package/dist/es2019/client/ProfileCardClient.js +2 -2
  28. package/dist/es2019/client/UserProfileCardClient.js +50 -13
  29. package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +1 -1
  30. package/dist/es2019/client/getTeamFromAGG.js +1 -1
  31. package/dist/es2019/components/Agent/AgentProfileCard.js +3 -0
  32. package/dist/es2019/components/Agent/AgentProfileCardResourced.js +2 -1
  33. package/dist/es2019/components/Error/ErrorMessage.js +17 -6
  34. package/dist/es2019/components/User/OverflowProfileCardButtons.js +18 -7
  35. package/dist/es2019/components/User/ProfileCard.js +72 -25
  36. package/dist/es2019/components/User/ProfileCardDetails.js +2 -1
  37. package/dist/es2019/components/User/ProfileCardResourced.js +25 -4
  38. package/dist/es2019/components/User/ProfileCardTrigger.js +54 -13
  39. package/dist/es2019/components/User/ReportingLinesDetails.js +30 -9
  40. package/dist/es2019/components/User/UserLoadingState.js +14 -4
  41. package/dist/es2019/components/common/LoadingState.js +16 -4
  42. package/dist/es2019/components/common/ProfileCardTrigger.js +26 -7
  43. package/dist/es2019/components/common/ProfileCardWrapper.js +4 -2
  44. package/dist/es2019/util/analytics.js +6 -2
  45. package/dist/esm/client/ProfileCardClient.js +2 -2
  46. package/dist/esm/client/UserProfileCardClient.js +46 -12
  47. package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +1 -1
  48. package/dist/esm/client/getTeamFromAGG.js +1 -1
  49. package/dist/esm/components/Agent/AgentProfileCard.js +3 -0
  50. package/dist/esm/components/Agent/AgentProfileCardResourced.js +2 -1
  51. package/dist/esm/components/Error/ErrorMessage.js +19 -6
  52. package/dist/esm/components/User/OverflowProfileCardButtons.js +23 -8
  53. package/dist/esm/components/User/ProfileCard.js +80 -28
  54. package/dist/esm/components/User/ProfileCardDetails.js +2 -1
  55. package/dist/esm/components/User/ProfileCardResourced.js +40 -16
  56. package/dist/esm/components/User/ProfileCardTrigger.js +53 -13
  57. package/dist/esm/components/User/ReportingLinesDetails.js +37 -11
  58. package/dist/esm/components/User/UserLoadingState.js +16 -4
  59. package/dist/esm/components/common/LoadingState.js +18 -4
  60. package/dist/esm/components/common/ProfileCardTrigger.js +30 -8
  61. package/dist/esm/components/common/ProfileCardWrapper.js +4 -2
  62. package/dist/esm/util/analytics.js +6 -2
  63. package/dist/types/client/ProfileCardClient.d.ts +2 -1
  64. package/dist/types/client/UserProfileCardClient.d.ts +2 -1
  65. package/dist/types/components/Error/ErrorMessage.d.ts +2 -0
  66. package/dist/types/components/User/ProfileCard.d.ts +3 -2
  67. package/dist/types/components/User/ProfileCardResourced.d.ts +4 -2
  68. package/dist/types/components/User/UserLoadingState.d.ts +3 -1
  69. package/dist/types/components/User/lazyProfileCard.d.ts +1 -1
  70. package/dist/types/components/common/LoadingState.d.ts +3 -1
  71. package/dist/types/components/common/ProfileCardWrapper.d.ts +2 -1
  72. package/dist/types/components/common/types.d.ts +3 -0
  73. package/dist/types/types.d.ts +13 -6
  74. package/dist/types/util/analytics.d.ts +5 -0
  75. package/dist/types-ts4.5/client/ProfileCardClient.d.ts +2 -1
  76. package/dist/types-ts4.5/client/UserProfileCardClient.d.ts +2 -1
  77. package/dist/types-ts4.5/components/Error/ErrorMessage.d.ts +2 -0
  78. package/dist/types-ts4.5/components/User/ProfileCard.d.ts +3 -2
  79. package/dist/types-ts4.5/components/User/ProfileCardResourced.d.ts +4 -2
  80. package/dist/types-ts4.5/components/User/UserLoadingState.d.ts +3 -1
  81. package/dist/types-ts4.5/components/User/lazyProfileCard.d.ts +1 -1
  82. package/dist/types-ts4.5/components/common/LoadingState.d.ts +3 -1
  83. package/dist/types-ts4.5/components/common/ProfileCardWrapper.d.ts +2 -1
  84. package/dist/types-ts4.5/components/common/types.d.ts +3 -0
  85. package/dist/types-ts4.5/types.d.ts +13 -6
  86. package/dist/types-ts4.5/util/analytics.d.ts +5 -0
  87. package/package.json +10 -5
@@ -5,12 +5,14 @@ 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';
8
9
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
9
10
  import { Box, xcss } from '@atlaskit/primitives';
10
11
  import { Pressable } from '@atlaskit/primitives/compiled';
11
12
  import messages from '../../messages';
12
13
  import { ManagerName, ManagerSection, OffsetWrapper, ReportingLinesSection } from '../../styled/ReportingLines';
13
- import { reportingLinesClicked } from '../../util/analytics';
14
+ import { PACKAGE_META_DATA, reportingLinesClicked } from '../../util/analytics';
15
+ import { getPageTime } from '../../util/performance';
14
16
  function getProfileHref(userId, profileUrl) {
15
17
  return profileUrl ? profileUrl + userId : undefined;
16
18
  }
@@ -34,6 +36,7 @@ const ReportingLinesDetails = props => {
34
36
  } = useIntl();
35
37
  const {
36
38
  fireAnalyticsWithDuration,
39
+ fireAnalyticsWithDurationNext,
37
40
  reportingLines = {},
38
41
  reportingLinesProfileUrl,
39
42
  onReportingLinesClick
@@ -45,10 +48,19 @@ const ReportingLinesDetails = props => {
45
48
  const manager = managers.length >= 1 ? managers[0] : undefined;
46
49
  const hasReports = reports.length > 0;
47
50
  const getReportingLinesOnClick = (user, userType) => onReportingLinesClick ? () => {
48
- fireAnalyticsWithDuration(duration => reportingLinesClicked({
49
- duration,
50
- userType
51
- }));
51
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
52
+ fireAnalyticsWithDurationNext('ui.profilecard.clicked.reportingLines', duration => ({
53
+ duration,
54
+ userType,
55
+ firedAt: Math.round(getPageTime()),
56
+ ...PACKAGE_META_DATA
57
+ }));
58
+ } else {
59
+ fireAnalyticsWithDuration(duration => reportingLinesClicked({
60
+ duration,
61
+ userType
62
+ }));
63
+ }
52
64
  onReportingLinesClick(user);
53
65
  } : undefined;
54
66
  const onReportingLinksClick = (user, userType, href) => {
@@ -56,10 +68,19 @@ const ReportingLinesDetails = props => {
56
68
  if (onReportingLinesClick) {
57
69
  shouldPreventDefault = onReportingLinesClick(user) === false;
58
70
  }
59
- fireAnalyticsWithDuration(duration => reportingLinesClicked({
60
- duration,
61
- userType
62
- }));
71
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
72
+ fireAnalyticsWithDurationNext('ui.profilecard.clicked.reportingLines', duration => ({
73
+ duration,
74
+ userType,
75
+ firedAt: Math.round(getPageTime()),
76
+ ...PACKAGE_META_DATA
77
+ }));
78
+ } else {
79
+ fireAnalyticsWithDuration(duration => reportingLinesClicked({
80
+ duration,
81
+ userType
82
+ }));
83
+ }
63
84
  if (shouldPreventDefault) {
64
85
  return;
65
86
  }
@@ -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;
@@ -1,15 +1,27 @@
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 { getActionSubject, PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
6
+ import { getPageTime } from '../../util/performance';
5
7
  export const LoadingState = ({
6
8
  fireAnalytics,
9
+ fireAnalyticsNext,
7
10
  profileType
8
11
  }) => {
9
12
  useEffect(() => {
10
- if (fireAnalytics) {
11
- fireAnalytics(profileCardRendered(profileType, 'spinner'));
13
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
14
+ if (fireAnalyticsNext) {
15
+ fireAnalyticsNext(`ui.${getActionSubject(profileType)}.rendered.spinner`, {
16
+ firedAt: Math.round(getPageTime()),
17
+ ...PACKAGE_META_DATA
18
+ });
19
+ }
20
+ } else {
21
+ if (fireAnalytics) {
22
+ fireAnalytics(profileCardRendered(profileType, 'spinner'));
23
+ }
12
24
  }
13
- }, [fireAnalytics, profileType]);
25
+ }, [fireAnalytics, fireAnalyticsNext, profileType]);
14
26
  return /*#__PURE__*/React.createElement(SpinnerContainer, null, /*#__PURE__*/React.createElement(AkSpinner, null));
15
27
  };
@@ -1,8 +1,10 @@
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';
3
4
  import Popup from '@atlaskit/popup';
4
5
  import { layers } from '@atlaskit/theme/constants';
5
- import { cardTriggered } from '../../util/analytics';
6
+ import { cardTriggered, getActionSubject, PACKAGE_META_DATA } from '../../util/analytics';
7
+ import { getPageTime } from '../../util/performance';
6
8
  import { useProfileInfo } from '../../util/useProfileInfo';
7
9
  import { LoadingState } from './LoadingState';
8
10
  import { PopupTrigger } from './PopupTrigger';
@@ -17,7 +19,9 @@ function ProfileCardTriggerInner({
17
19
  fetchProfile,
18
20
  disabledAriaAttributes,
19
21
  profileCardType,
22
+ testId,
20
23
  fireAnalytics,
24
+ fireAnalyticsNext,
21
25
  ...popupProps
22
26
  }, ref) {
23
27
  var _popupProps$autoFocus;
@@ -57,12 +61,22 @@ function ProfileCardTriggerInner({
57
61
  if (!visible) {
58
62
  getProfileData === null || getProfileData === void 0 ? void 0 : getProfileData();
59
63
  setVisible(true);
60
- if (fireAnalytics) {
61
- fireAnalytics(cardTriggered(profileCardType, trigger));
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
76
  }
63
77
  }
64
78
  }, showDelay);
65
- }, [showDelay, visible, getProfileData, fireAnalytics, profileCardType, trigger]);
79
+ }, [showDelay, visible, getProfileData, fireAnalytics, profileCardType, trigger, fireAnalyticsNext]);
66
80
  const onMouseEnter = useCallback(() => {
67
81
  showProfilecard();
68
82
  }, [showProfilecard]);
@@ -85,7 +99,8 @@ function ProfileCardTriggerInner({
85
99
  showProfilecard: showProfilecard,
86
100
  children: children,
87
101
  ariaLabelledBy: ariaLabelledBy,
88
- trigger: trigger
102
+ trigger: trigger,
103
+ "data-testid": testId
89
104
  }));
90
105
  },
91
106
  content: () =>
@@ -94,9 +109,13 @@ function ProfileCardTriggerInner({
94
109
  React.createElement("div", {
95
110
  onMouseEnter: onMouseEnter,
96
111
  onMouseLeave: hideProfilecard,
97
- onFocus: showProfilecard
98
- }, isLoading ? /*#__PURE__*/React.createElement(ProfileCardWrapper, null, /*#__PURE__*/React.createElement(LoadingState, {
112
+ onFocus: showProfilecard,
113
+ "data-testid": "profile-card--trigger-content"
114
+ }, isLoading ? /*#__PURE__*/React.createElement(ProfileCardWrapper, {
115
+ testId: "profilecard.profilecardtrigger.loading"
116
+ }, /*#__PURE__*/React.createElement(LoadingState, {
99
117
  fireAnalytics: fireAnalytics,
118
+ fireAnalyticsNext: fireAnalyticsNext,
100
119
  profileType: profileCardType
101
120
  })) : renderProfileCard({
102
121
  profileData,
@@ -6,9 +6,11 @@ const styles = xcss({
6
6
  width: '360px'
7
7
  });
8
8
  export const ProfileCardWrapper = ({
9
- children
9
+ children,
10
+ testId
10
11
  }) => {
11
12
  return /*#__PURE__*/React.createElement(Box, {
12
- xcss: styles
13
+ xcss: styles,
14
+ testId: testId
13
15
  }, children);
14
16
  };
@@ -2,6 +2,10 @@ import { getPageTime } from './performance';
2
2
 
3
3
  /** Below lines are copied from teams common analytics */
4
4
  const ANALYTICS_CHANNEL = 'peopleTeams';
5
+ export const PACKAGE_META_DATA = {
6
+ packageName: "@atlaskit/profilecard",
7
+ packageVersion: "24.13.7"
8
+ };
5
9
  const runItLater = cb => {
6
10
  const requestIdleCallback = window.requestIdleCallback;
7
11
  if (typeof requestIdleCallback === 'function') {
@@ -41,12 +45,12 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
41
45
  actionSubjectId,
42
46
  attributes: {
43
47
  packageName: "@atlaskit/profilecard",
44
- packageVersion: "24.13.6",
48
+ packageVersion: "24.13.7",
45
49
  ...attributes,
46
50
  firedAt: Math.round(getPageTime())
47
51
  }
48
52
  });
49
- const getActionSubject = type => {
53
+ export const getActionSubject = type => {
50
54
  switch (type) {
51
55
  case 'user':
52
56
  return USER_SUBJECT;
@@ -37,8 +37,8 @@ var ProfileCardClient = /*#__PURE__*/function () {
37
37
  }
38
38
  }, {
39
39
  key: "getProfile",
40
- value: function getProfile(cloudId, userId, analytics) {
41
- return this.userClient.getProfile(cloudId, userId, analytics);
40
+ value: function getProfile(cloudId, userId, analytics, analyticsNext) {
41
+ return this.userClient.getProfile(cloudId, userId, analytics, analyticsNext);
42
42
  }
43
43
  }, {
44
44
  key: "getTeamProfile",
@@ -15,7 +15,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
15
15
  import { print } from 'graphql';
16
16
  import gql from 'graphql-tag';
17
17
  import { fg } from '@atlaskit/platform-feature-flags';
18
- import { userRequestAnalytics } from '../util/analytics';
18
+ import { PACKAGE_META_DATA, userRequestAnalytics } from '../util/analytics';
19
19
  import { localTime } from '../util/date';
20
20
  import { getPageTime } from '../util/performance';
21
21
  import CachingClient from './CachingClient';
@@ -147,7 +147,7 @@ var UserProfileCardClient = /*#__PURE__*/function (_CachingClient) {
147
147
  }()
148
148
  }, {
149
149
  key: "getProfile",
150
- value: function getProfile(cloudId, userId, analytics) {
150
+ value: function getProfile(cloudId, userId, analytics, analyticsNext) {
151
151
  var _this2 = this;
152
152
  if (!userId) {
153
153
  return Promise.reject(new Error('userId missing'));
@@ -159,24 +159,58 @@ var UserProfileCardClient = /*#__PURE__*/function (_CachingClient) {
159
159
  }
160
160
  return new Promise(function (resolve, reject) {
161
161
  var startTime = getPageTime();
162
- if (analytics) {
163
- analytics(userRequestAnalytics('triggered'));
162
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
163
+ if (analyticsNext) {
164
+ analyticsNext('operational.profilecard.triggered.request', _objectSpread({
165
+ firedAt: Math.round(getPageTime())
166
+ }, PACKAGE_META_DATA));
167
+ }
168
+ } else {
169
+ if (analytics) {
170
+ analytics(userRequestAnalytics('triggered'));
171
+ }
164
172
  }
165
173
  _this2.makeRequest(cloudId, userId).then(function (data) {
166
174
  if (_this2.cache) {
167
175
  _this2.setCachedProfile(cacheIdentifier, data);
168
176
  }
169
- if (analytics) {
170
- analytics(userRequestAnalytics('succeeded', {
171
- duration: getPageTime() - startTime
172
- }));
177
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
178
+ if (analyticsNext) {
179
+ analyticsNext('operational.profilecard.succeeded.request', _objectSpread({
180
+ duration: getPageTime() - startTime,
181
+ firedAt: Math.round(getPageTime())
182
+ }, PACKAGE_META_DATA));
183
+ }
184
+ } else {
185
+ if (analytics) {
186
+ analytics(userRequestAnalytics('succeeded', {
187
+ duration: getPageTime() - startTime
188
+ }));
189
+ }
173
190
  }
174
191
  resolve(data);
175
192
  }).catch(function (error) {
176
- if (analytics) {
177
- analytics(userRequestAnalytics('failed', _objectSpread({
178
- duration: getPageTime() - startTime
179
- }, getErrorAttributes(error))));
193
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
194
+ if (analyticsNext) {
195
+ var errorAttributes = getErrorAttributes(error);
196
+ analyticsNext('operational.profilecard.failed.request', _objectSpread(_objectSpread({
197
+ duration: getPageTime() - startTime
198
+ }, errorAttributes), {}, {
199
+ traceId: errorAttributes.traceId || null,
200
+ errorCategory: errorAttributes.errorCategory || null,
201
+ errorType: errorAttributes.errorType || null,
202
+ errorPath: errorAttributes.errorPath || null,
203
+ errorNumber: errorAttributes.errorNumber || null,
204
+ errorStatusCode: errorAttributes.errorStatusCode || null,
205
+ firedAt: Math.round(getPageTime())
206
+ }, PACKAGE_META_DATA));
207
+ }
208
+ } else {
209
+ if (analytics) {
210
+ analytics(userRequestAnalytics('failed', _objectSpread({
211
+ duration: getPageTime() - startTime
212
+ }, getErrorAttributes(error))));
213
+ }
180
214
  }
181
215
  reject(error);
182
216
  });
@@ -4,7 +4,7 @@ import { AGGQuery } from './graphqlUtils';
4
4
  var ORG_ID_FROM_CLOUD_ID_QUERY = "query OrgIdFromCloudId($cloudId: ID!) {\n\ttenantContexts(cloudIds: [$cloudId]) {\n\t\torgId\n\t}\n}";
5
5
  var addHeaders = function addHeaders(headers) {
6
6
  headers.append('atl-client-name', "@atlaskit/profilecard");
7
- headers.append('atl-client-version', "24.13.6");
7
+ headers.append('atl-client-version', "24.13.7");
8
8
  return headers;
9
9
  };
10
10
  export function getOrgIdForCloudIdFromAGG(_x, _x2) {
@@ -59,7 +59,7 @@ export var addHeaders = function addHeaders(headers) {
59
59
  headers.append('X-ExperimentalApi', 'teams-beta');
60
60
  headers.append('X-ExperimentalApi', 'team-members-beta');
61
61
  headers.append('atl-client-name', "@atlaskit/profilecard");
62
- headers.append('atl-client-version', "24.13.6");
62
+ headers.append('atl-client-version', "24.13.7");
63
63
  return headers;
64
64
  };
65
65
  export function getTeamFromAGG(_x, _x2, _x3) {
@@ -164,6 +164,9 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
164
164
  return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(ErrorMessage, {
165
165
  errorType: errorType,
166
166
  fireAnalytics: fireAnalytics
167
+ // TODO: Add fireAnalyticsNext
168
+ ,
169
+ fireAnalyticsNext: function fireAnalyticsNext() {}
167
170
  }));
168
171
  }
169
172
  return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(Box, {
@@ -148,7 +148,8 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
148
148
  fetchData();
149
149
  },
150
150
  errorType: error || null,
151
- fireAnalytics: function fireAnalytics() {}
151
+ fireAnalytics: function fireAnalytics() {},
152
+ fireAnalyticsNext: function fireAnalyticsNext() {}
152
153
  }));
153
154
  }
154
155
  return /*#__PURE__*/React.createElement(Suspense, {
@@ -1,25 +1,38 @@
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 Button from '@atlaskit/button/new';
3
6
  import CrossCircleIcon from '@atlaskit/icon/core/cross-circle';
4
7
  import IconError from '@atlaskit/icon/glyph/cross-circle';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
5
9
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
6
10
  import { Text } from '@atlaskit/primitives';
7
11
  import { ErrorTitle, ErrorWrapper } from '../../styled/Error';
8
- import { profileCardRendered } from '../../util/analytics';
12
+ import { PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
9
13
  var ErrorMessage = function ErrorMessage(props) {
10
14
  var errorType = props.errorType || {
11
15
  reason: 'default'
12
16
  };
13
17
  var errorReason = errorType.reason;
14
18
  var fireAnalytics = props.fireAnalytics,
19
+ fireAnalyticsNext = props.fireAnalyticsNext,
15
20
  reload = props.reload;
16
21
  var hasRetry = !!reload;
17
22
  useEffect(function () {
18
- fireAnalytics(profileCardRendered('user', 'error', {
19
- hasRetry: hasRetry,
20
- errorType: errorReason
21
- }));
22
- }, [errorReason, fireAnalytics, hasRetry]);
23
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
24
+ fireAnalyticsNext('ui.profilecard.rendered.error', _objectSpread({
25
+ hasRetry: hasRetry,
26
+ errorType: errorReason,
27
+ firedAt: Math.round(performance.now())
28
+ }, PACKAGE_META_DATA));
29
+ } else {
30
+ fireAnalytics(profileCardRendered('user', 'error', {
31
+ hasRetry: hasRetry,
32
+ errorType: errorReason
33
+ }));
34
+ }
35
+ }, [errorReason, fireAnalytics, fireAnalyticsNext, hasRetry]);
23
36
  var errorContent = function errorContent() {
24
37
  if (errorReason === 'NotFound') {
25
38
  return /*#__PURE__*/React.createElement(ErrorTitle, null, "The user is no longer available for the site");
@@ -1,7 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
5
  var _excluded = ["triggerRef", "isSelected", "testId"];
6
+ 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; }
7
+ 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; }
5
8
  import React, { useCallback, useState } from 'react';
6
9
  import { useIntl } from 'react-intl-next';
7
10
  import { IconButton } from '@atlaskit/button/new';
@@ -10,7 +13,8 @@ import MoreIcon from '@atlaskit/icon/core/migration/show-more-horizontal--more';
10
13
  import { fg } from '@atlaskit/platform-feature-flags';
11
14
  import messages from '../../messages';
12
15
  import { OverflowActionButtonsWrapper } from '../../styled/Card';
13
- import { moreActionsClicked } from '../../util/analytics';
16
+ import { moreActionsClicked, PACKAGE_META_DATA } from '../../util/analytics';
17
+ import { getPageTime } from '../../util/performance';
14
18
  export var ACTION_OVERFLOW_THRESHOLD = 2;
15
19
  export var OverflowProfileCardButtons = function OverflowProfileCardButtons(props) {
16
20
  var intl = useIntl();
@@ -19,22 +23,33 @@ export var OverflowProfileCardButtons = function OverflowProfileCardButtons(prop
19
23
  setOpen = _useState2[1];
20
24
  var actions = props.actions,
21
25
  onItemClick = props.onItemClick,
22
- fireAnalyticsWithDuration = props.fireAnalyticsWithDuration;
26
+ fireAnalyticsWithDuration = props.fireAnalyticsWithDuration,
27
+ fireAnalyticsWithDurationNext = props.fireAnalyticsWithDurationNext;
23
28
  var numActions = actions.length + ACTION_OVERFLOW_THRESHOLD;
24
29
  var onOpenChange = useCallback(function (_ref) {
25
30
  var nextOpen = _ref.isOpen;
26
31
  setOpen(function (prevOpen) {
27
32
  if (nextOpen && !prevOpen) {
28
- fireAnalyticsWithDuration(function (duration) {
29
- return moreActionsClicked('user', {
30
- duration: duration,
31
- numActions: numActions
33
+ if (fg('ptc-enable-profile-card-analytics-refactor')) {
34
+ fireAnalyticsWithDurationNext('ui.profilecard.clicked.moreActions', function (duration) {
35
+ return _objectSpread({
36
+ duration: duration,
37
+ numActions: numActions,
38
+ firedAt: Math.round(getPageTime())
39
+ }, PACKAGE_META_DATA);
32
40
  });
33
- });
41
+ } else {
42
+ fireAnalyticsWithDuration(function (duration) {
43
+ return moreActionsClicked('user', {
44
+ duration: duration,
45
+ numActions: numActions
46
+ });
47
+ });
48
+ }
34
49
  }
35
50
  return nextOpen;
36
51
  });
37
- }, [numActions, fireAnalyticsWithDuration]);
52
+ }, [numActions, fireAnalyticsWithDuration, fireAnalyticsWithDurationNext]);
38
53
  return /*#__PURE__*/React.createElement(OverflowActionButtonsWrapper, {
39
54
  testId: "profilecard-actions-overflow"
40
55
  }, /*#__PURE__*/React.createElement(DropdownMenu, {