@atlaskit/profilecard 24.37.3 → 24.39.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 (30) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/afm-cc/tsconfig.json +3 -0
  3. package/afm-jira/tsconfig.json +3 -0
  4. package/afm-products/tsconfig.json +3 -0
  5. package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +1 -1
  6. package/dist/cjs/client/getTeamFromAGG.js +1 -1
  7. package/dist/cjs/components/Agent/AgentProfileCardResourced.js +37 -126
  8. package/dist/cjs/components/User/ProfileCard.js +3 -1
  9. package/dist/cjs/components/User/ProfileCardDetails.js +22 -5
  10. package/dist/cjs/components/User/ProfileCardTrigger.js +7 -2
  11. package/dist/cjs/util/analytics.js +2 -2
  12. package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +1 -1
  13. package/dist/es2019/client/getTeamFromAGG.js +1 -1
  14. package/dist/es2019/components/Agent/AgentProfileCardResourced.js +9 -67
  15. package/dist/es2019/components/User/ProfileCard.js +3 -1
  16. package/dist/es2019/components/User/ProfileCardDetails.js +22 -5
  17. package/dist/es2019/components/User/ProfileCardTrigger.js +7 -2
  18. package/dist/es2019/util/analytics.js +2 -2
  19. package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +1 -1
  20. package/dist/esm/client/getTeamFromAGG.js +1 -1
  21. package/dist/esm/components/Agent/AgentProfileCardResourced.js +37 -126
  22. package/dist/esm/components/User/ProfileCard.js +3 -1
  23. package/dist/esm/components/User/ProfileCardDetails.js +22 -5
  24. package/dist/esm/components/User/ProfileCardTrigger.js +7 -2
  25. package/dist/esm/util/analytics.js +2 -2
  26. package/dist/types/components/User/ProfileCardTrigger.d.ts +1 -1
  27. package/dist/types/types.d.ts +14 -0
  28. package/dist/types-ts4.5/components/User/ProfileCardTrigger.d.ts +1 -1
  29. package/dist/types-ts4.5/types.d.ts +14 -0
  30. package/package.json +3 -5
@@ -8,6 +8,7 @@ import { FormattedMessage } from 'react-intl-next';
8
8
  import Lozenge from '@atlaskit/lozenge';
9
9
  import { fg } from '@atlaskit/platform-feature-flags';
10
10
  import { Box, Text } from '@atlaskit/primitives/compiled';
11
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
11
12
  import Tooltip from '@atlaskit/tooltip';
12
13
  import relativeDate from '../../internal/relative-date';
13
14
  import messages from '../../messages';
@@ -24,7 +25,7 @@ const styles = {
24
25
  disabledAccount: "_syazi7uo",
25
26
  activeAccount: "_syaz15cr"
26
27
  };
27
- const renderName = (nickname, fullName, meta, nameRef) => {
28
+ const renderName = (nickname, fullName, meta, nameRef, isRenderedInPortal, isTriggeredUsingKeyboard) => {
28
29
  if (!fullName && !nickname) {
29
30
  return null;
30
31
  }
@@ -47,12 +48,15 @@ const renderName = (nickname, fullName, meta, nameRef) => {
47
48
  as: "h2",
48
49
  xcss: cx(styles.fullNameLabel, styles.activeAccount, meta ? fg('enable_absolute_positioning_profile_card') ? styles.metaLabelWithHighSpecificity : styles.metaLabel : fg('enable_absolute_positioning_profile_card') ? styles.noMetaLabelWithHighSpecificity : styles.noMetaLabel),
49
50
  testId: "profilecard-name",
50
- id: "profilecard-name-label"
51
+ id: "profilecard-name-label",
52
+ tabIndex: isTriggeredUsingKeyboard && isRenderedInPortal && expValEquals('editor_a11y_7152_profile_card_tab_order', 'isEnabled', true) ? -1 : undefined
51
53
  }, displayName)) : /*#__PURE__*/React.createElement(Box, {
54
+ ref: nameRef,
52
55
  as: "h2",
53
56
  xcss: cx(styles.fullNameLabel, styles.activeAccount, meta ? fg('enable_absolute_positioning_profile_card') ? styles.metaLabelWithHighSpecificity : styles.metaLabel : fg('enable_absolute_positioning_profile_card') ? styles.noMetaLabelWithHighSpecificity : styles.noMetaLabel),
54
57
  testId: "profilecard-name",
55
- id: "profilecard-name-label"
58
+ id: "profilecard-name-label",
59
+ tabIndex: isTriggeredUsingKeyboard && isRenderedInPortal && expValEquals('editor_a11y_7152_profile_card_tab_order', 'isEnabled', true) ? -1 : undefined
56
60
  }, displayName);
57
61
  };
58
62
  const disabledAccountDesc = (statusModifiedDate, disabledAccountMessage, status = 'closed') => {
@@ -122,9 +126,22 @@ const DisabledProfileCardDetails = props => {
122
126
  export const ProfileCardDetails = props => {
123
127
  const {
124
128
  meta,
125
- status
129
+ status,
130
+ isRenderedInPortal,
131
+ isTriggeredUsingKeyboard
126
132
  } = props;
127
133
  const nameRef = useRef(null);
134
+ React.useEffect(() => {
135
+ if (nameRef !== null && nameRef !== void 0 && nameRef.current && isRenderedInPortal && isTriggeredUsingKeyboard && expValEquals('editor_a11y_7152_profile_card_tab_order', 'isEnabled', true)) {
136
+ const rafId = requestAnimationFrame(() => {
137
+ var _nameRef$current;
138
+ (_nameRef$current = nameRef.current) === null || _nameRef$current === void 0 ? void 0 : _nameRef$current.focus();
139
+ });
140
+ return () => {
141
+ cancelAnimationFrame(rafId);
142
+ };
143
+ }
144
+ }, [isRenderedInPortal, isTriggeredUsingKeyboard]);
128
145
  if (props.isServiceAccount) {
129
146
  return /*#__PURE__*/React.createElement(ServiceAccountProfileCardDetails, props);
130
147
  }
@@ -139,7 +156,7 @@ export const ProfileCardDetails = props => {
139
156
  const lozenges = /*#__PURE__*/React.createElement(CustomLozenges, {
140
157
  lozenges: props.customLozenges
141
158
  });
142
- return /*#__PURE__*/React.createElement(DetailsGroup, null, renderName(props.nickname, props.fullName, meta, nameRef), meta && /*#__PURE__*/React.createElement(JobTitleLabel, null, meta), meta && props.customLozenges && props.customLozenges.length > 0 ? /*#__PURE__*/React.createElement(Box, {
159
+ return /*#__PURE__*/React.createElement(DetailsGroup, null, renderName(props.nickname, props.fullName, meta, nameRef, isRenderedInPortal, isTriggeredUsingKeyboard), meta && /*#__PURE__*/React.createElement(JobTitleLabel, null, meta), meta && props.customLozenges && props.customLozenges.length > 0 ? /*#__PURE__*/React.createElement(Box, {
143
160
  paddingBlockStart: "space.150"
144
161
  }, lozenges) : lozenges, /*#__PURE__*/React.createElement(Box, {
145
162
  xcss: styles.detailedListWrapperNext
@@ -6,6 +6,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
6
6
  import Popup from '@atlaskit/popup';
7
7
  import { useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics';
8
8
  import { layers } from '@atlaskit/theme/constants';
9
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
10
  import filterActionsInner from '../../internal/filterActions';
10
11
  import getLabelMessage from '../../internal/getLabelMessage';
11
12
  import { CardWrapper } from '../../styled/UserTrigger';
@@ -26,6 +27,7 @@ function ProfileCardContent({
26
27
  hasError,
27
28
  errorType,
28
29
  agentActions,
30
+ isRenderedInPortal,
29
31
  addFlag,
30
32
  hideAgentMoreActions,
31
33
  hideAiDisclaimer
@@ -46,6 +48,7 @@ function ProfileCardContent({
46
48
  return /*#__PURE__*/React.createElement(Suspense, {
47
49
  fallback: null
48
50
  }, /*#__PURE__*/React.createElement(ProfileCardLazy, _extends({}, profilecardProps, {
51
+ isRenderedInPortal: isRenderedInPortal,
49
52
  actions: profileCardAction,
50
53
  hasError: hasError,
51
54
  errorType: errorType,
@@ -78,6 +81,7 @@ export default function ProfilecardTriggerNext({
78
81
  hideAiDisclaimer,
79
82
  ariaHideProfileTrigger = false,
80
83
  isVisible: propsIsVisible,
84
+ isRenderedInPortal,
81
85
  ssrPlaceholderId,
82
86
  showDelay: customShowDelay,
83
87
  hideDelay: customHideDelay
@@ -324,7 +328,8 @@ export default function ProfilecardTriggerNext({
324
328
  agentActions: agentActions,
325
329
  addFlag: addFlag,
326
330
  hideAgentMoreActions: hideAgentMoreActions,
327
- hideAiDisclaimer: hideAiDisclaimer
331
+ hideAiDisclaimer: hideAiDisclaimer,
332
+ isRenderedInPortal: isRenderedInPortal
328
333
  })),
329
334
  trigger: triggerProps => {
330
335
  const {
@@ -358,7 +363,7 @@ export default function ProfilecardTriggerNext({
358
363
  },
359
364
  zIndex: layers.modal(),
360
365
  shouldUseCaptureOnOutsideClick: true,
361
- autoFocus: autoFocus !== null && autoFocus !== void 0 ? autoFocus : trigger === 'click'
366
+ autoFocus: expValEquals('editor_a11y_7152_profile_card_tab_order', 'isEnabled', true) ? isRenderedInPortal && isTriggeredUsingKeyboard ? false : autoFocus !== null && autoFocus !== void 0 ? autoFocus : trigger === 'click' : autoFocus !== null && autoFocus !== void 0 ? autoFocus : trigger === 'click'
362
367
  // This feature gate is currently enabled only for Jira_Web to avoid UI issues in Confluence_Web.
363
368
  ,
364
369
  shouldRenderToParent: fg('enable_appropriate_reading_order_in_profile_card'),
@@ -4,7 +4,7 @@ import { getPageTime } from './performance';
4
4
  const ANALYTICS_CHANNEL = 'peopleTeams';
5
5
  export const PACKAGE_META_DATA = {
6
6
  packageName: "@atlaskit/profilecard",
7
- packageVersion: "24.37.2"
7
+ packageVersion: "24.38.0"
8
8
  };
9
9
  const runItLater = cb => {
10
10
  const requestIdleCallback = window.requestIdleCallback;
@@ -45,7 +45,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
45
45
  actionSubjectId,
46
46
  attributes: {
47
47
  packageName: "@atlaskit/profilecard",
48
- packageVersion: "24.37.2",
48
+ packageVersion: "24.38.0",
49
49
  ...attributes,
50
50
  firedAt: Math.round(getPageTime())
51
51
  }
@@ -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.37.2");
7
+ headers.append('atl-client-version', "24.38.0");
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.37.2");
62
+ headers.append('atl-client-version', "24.38.0");
63
63
  return headers;
64
64
  };
65
65
  export function getTeamFromAGG(_x, _x2, _x3) {
@@ -39,102 +39,28 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
39
39
  cloudId: props.cloudId
40
40
  }),
41
41
  profileHref = _navigateToTeamsApp.href;
42
-
43
- /**
44
- * @TODO replace with `getAgentCreator` from `@atlassian/rovo-agent-components`
45
- * @deprecated use `getAgentCreator` from `@atlassian/rovo-agent-components`
46
- */
47
- var getCreatorDeprecated = useCallback( /*#__PURE__*/function () {
42
+ var getCreator = useCallback( /*#__PURE__*/function () {
48
43
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
49
- var creator_type, creator, authoringTeam, _authoringTeam$displa, _authoringTeam$profil, creatorInfo;
44
+ var creator_type, creator, authoringTeam, _authoringTeam$displa, _authoringTeam$profil, _userCreatorInfo$full, userCreatorInfo, creatorInfo;
50
45
  return _regeneratorRuntime.wrap(function _callee$(_context) {
51
46
  while (1) switch (_context.prev = _context.next) {
52
47
  case 0:
53
48
  creator_type = _ref.creator_type, creator = _ref.creator, authoringTeam = _ref.authoringTeam;
54
- if (creator) {
55
- _context.next = 3;
56
- break;
57
- }
58
- return _context.abrupt("return", undefined);
59
- case 3:
60
- _context.t0 = creator_type;
61
- _context.next = _context.t0 === 'SYSTEM' ? 6 : _context.t0 === 'THIRD_PARTY' ? 7 : _context.t0 === 'CUSTOMER' ? 8 : 22;
62
- break;
63
- case 6:
64
- return _context.abrupt("return", {
65
- type: 'SYSTEM'
66
- });
67
- case 7:
68
- return _context.abrupt("return", {
69
- type: 'THIRD_PARTY',
70
- name: creator !== null && creator !== void 0 ? creator : ''
71
- });
72
- case 8:
73
- _context.prev = 8;
74
- if (!(!creatorUserId || !props.cloudId)) {
75
- _context.next = 11;
76
- break;
77
- }
78
- return _context.abrupt("return", undefined);
79
- case 11:
80
- if (!authoringTeam) {
81
- _context.next = 13;
82
- break;
83
- }
84
- return _context.abrupt("return", {
85
- type: 'CUSTOMER',
86
- name: (_authoringTeam$displa = authoringTeam.displayName) !== null && _authoringTeam$displa !== void 0 ? _authoringTeam$displa : '',
87
- profileLink: (_authoringTeam$profil = authoringTeam.profileUrl) !== null && _authoringTeam$profil !== void 0 ? _authoringTeam$profil : ''
88
- });
89
- case 13:
90
- _context.next = 15;
91
- return props.resourceClient.getProfile(props.cloudId, creatorUserId, fireEvent);
92
- case 15:
93
- creatorInfo = _context.sent;
94
- return _context.abrupt("return", {
95
- type: 'CUSTOMER',
96
- name: creatorInfo.fullName,
97
- profileLink: fg('platform-adopt-teams-nav-config') ? profileHref : "/people/".concat(creatorUserId),
98
- id: creatorUserId
99
- });
100
- case 19:
101
- _context.prev = 19;
102
- _context.t1 = _context["catch"](8);
103
- return _context.abrupt("return", undefined);
104
- case 22:
105
- return _context.abrupt("return", undefined);
106
- case 23:
107
- case "end":
108
- return _context.stop();
109
- }
110
- }, _callee, null, [[8, 19]]);
111
- }));
112
- return function (_x) {
113
- return _ref2.apply(this, arguments);
114
- };
115
- }(), [creatorUserId, fireEvent, props.cloudId, props.resourceClient, profileHref]);
116
- var getCreator = useCallback( /*#__PURE__*/function () {
117
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
118
- var creator_type, creator, authoringTeam, _authoringTeam$displa2, _authoringTeam$profil2, _userCreatorInfo$full, userCreatorInfo, creatorInfo;
119
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
120
- while (1) switch (_context2.prev = _context2.next) {
121
- case 0:
122
- creator_type = _ref3.creator_type, creator = _ref3.creator, authoringTeam = _ref3.authoringTeam;
123
- _context2.prev = 1;
49
+ _context.prev = 1;
124
50
  if (!(creatorUserId && props.cloudId)) {
125
- _context2.next = 6;
51
+ _context.next = 6;
126
52
  break;
127
53
  }
128
- _context2.next = 5;
54
+ _context.next = 5;
129
55
  return props.resourceClient.getProfile(props.cloudId, creatorUserId, fireEvent);
130
56
  case 5:
131
- userCreatorInfo = _context2.sent;
57
+ userCreatorInfo = _context.sent;
132
58
  case 6:
133
59
  creatorInfo = getAgentCreator({
134
60
  creatorType: creator_type !== null && creator_type !== void 0 ? creator_type : '',
135
61
  authoringTeam: authoringTeam ? {
136
- displayName: (_authoringTeam$displa2 = authoringTeam.displayName) !== null && _authoringTeam$displa2 !== void 0 ? _authoringTeam$displa2 : '',
137
- profileLink: (_authoringTeam$profil2 = authoringTeam.profileUrl) !== null && _authoringTeam$profil2 !== void 0 ? _authoringTeam$profil2 : undefined
62
+ displayName: (_authoringTeam$displa = authoringTeam.displayName) !== null && _authoringTeam$displa !== void 0 ? _authoringTeam$displa : '',
63
+ profileLink: (_authoringTeam$profil = authoringTeam.profileUrl) !== null && _authoringTeam$profil !== void 0 ? _authoringTeam$profil : undefined
138
64
  } : undefined,
139
65
  userCreator: userCreatorInfo ? {
140
66
  name: (_userCreatorInfo$full = userCreatorInfo.fullName) !== null && _userCreatorInfo$full !== void 0 ? _userCreatorInfo$full : '',
@@ -142,79 +68,64 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
142
68
  } : undefined,
143
69
  forgeCreator: creator !== null && creator !== void 0 ? creator : undefined
144
70
  });
145
- return _context2.abrupt("return", creatorInfo);
71
+ return _context.abrupt("return", creatorInfo);
146
72
  case 10:
147
- _context2.prev = 10;
148
- _context2.t0 = _context2["catch"](1);
149
- return _context2.abrupt("return", undefined);
73
+ _context.prev = 10;
74
+ _context.t0 = _context["catch"](1);
75
+ return _context.abrupt("return", undefined);
150
76
  case 13:
151
77
  case "end":
152
- return _context2.stop();
78
+ return _context.stop();
153
79
  }
154
- }, _callee2, null, [[1, 10]]);
80
+ }, _callee, null, [[1, 10]]);
155
81
  }));
156
- return function (_x2) {
157
- return _ref4.apply(this, arguments);
82
+ return function (_x) {
83
+ return _ref2.apply(this, arguments);
158
84
  };
159
85
  }(), [creatorUserId, fireEvent, props.cloudId, props.resourceClient, profileHref]);
160
- var fetchData = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
161
- var _profileResult$aggDat, _profileResult$aggDat2, profileResult, profileData, creatorInfoProps, agentCreatorInfo, agentCreatorInfoDeprecated;
162
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
163
- while (1) switch (_context3.prev = _context3.next) {
86
+ var fetchData = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
87
+ var _profileResult$aggDat, _profileResult$aggDat2, profileResult, profileData, creatorInfoProps, agentCreatorInfo;
88
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
89
+ while (1) switch (_context2.prev = _context2.next) {
164
90
  case 0:
165
91
  setIsLoading(true);
166
- _context3.prev = 1;
167
- _context3.next = 4;
92
+ _context2.prev = 1;
93
+ _context2.next = 4;
168
94
  return props.resourceClient.getRovoAgentProfile({
169
95
  type: 'identity',
170
96
  value: props.accountId
171
97
  }, fireEvent);
172
98
  case 4:
173
- profileResult = _context3.sent;
99
+ profileResult = _context2.sent;
174
100
  profileData = profileResult.restData;
175
101
  creatorInfoProps = {
176
102
  creator_type: profileData === null || profileData === void 0 ? void 0 : profileData.creator_type,
177
103
  creator: (profileData === null || profileData === void 0 ? void 0 : profileData.creator) || undefined,
178
104
  authoringTeam: (_profileResult$aggDat = (_profileResult$aggDat2 = profileResult.aggData) === null || _profileResult$aggDat2 === void 0 ? void 0 : _profileResult$aggDat2.authoringTeam) !== null && _profileResult$aggDat !== void 0 ? _profileResult$aggDat : undefined
179
105
  };
180
- if (!fg('rovo_agent_show_creator_on_profile_card_fix')) {
181
- _context3.next = 14;
182
- break;
183
- }
184
- _context3.next = 10;
106
+ _context2.next = 9;
185
107
  return getCreator(creatorInfoProps);
186
- case 10:
187
- agentCreatorInfo = _context3.sent;
108
+ case 9:
109
+ agentCreatorInfo = _context2.sent;
188
110
  setAgentData(_objectSpread(_objectSpread({}, profileData), {}, {
189
111
  creatorInfo: agentCreatorInfo
190
112
  }));
191
- _context3.next = 18;
113
+ _context2.next = 16;
192
114
  break;
193
- case 14:
194
- _context3.next = 16;
195
- return getCreatorDeprecated(creatorInfoProps);
115
+ case 13:
116
+ _context2.prev = 13;
117
+ _context2.t0 = _context2["catch"](1);
118
+ setError(_context2.t0);
196
119
  case 16:
197
- agentCreatorInfoDeprecated = _context3.sent;
198
- setAgentData(_objectSpread(_objectSpread({}, profileData), {}, {
199
- creatorInfo: agentCreatorInfoDeprecated
200
- }));
201
- case 18:
202
- _context3.next = 23;
203
- break;
204
- case 20:
205
- _context3.prev = 20;
206
- _context3.t0 = _context3["catch"](1);
207
- setError(_context3.t0);
208
- case 23:
209
- _context3.prev = 23;
120
+ _context2.prev = 16;
210
121
  setIsLoading(false);
211
- return _context3.finish(23);
212
- case 26:
122
+ return _context2.finish(16);
123
+ case 19:
213
124
  case "end":
214
- return _context3.stop();
125
+ return _context2.stop();
215
126
  }
216
- }, _callee3, null, [[1, 20, 23, 26]]);
217
- })), [fireEvent, getCreator, props.accountId, props.resourceClient, getCreatorDeprecated]);
127
+ }, _callee2, null, [[1, 13, 16, 19]]);
128
+ })), [fireEvent, getCreator, props.accountId, props.resourceClient]);
218
129
  useEffect(function () {
219
130
  fetchData();
220
131
  }, [fetchData]);
@@ -161,6 +161,7 @@ export var ProfilecardInternal = function ProfilecardInternal(props) {
161
161
  actions: realActions,
162
162
  fireAnalyticsWithDuration: fireAnalyticsWithDuration,
163
163
  isTriggeredUsingKeyboard: props.isTriggeredUsingKeyboard,
164
+ isRenderedInPortal: props.isRenderedInPortal,
164
165
  fireAnalyticsWithDurationNext: fireAnalyticsWithDurationNext
165
166
  }))))));
166
167
  };
@@ -169,6 +170,7 @@ var Actions = function Actions(_ref) {
169
170
  fireAnalyticsWithDuration = _ref.fireAnalyticsWithDuration,
170
171
  fireAnalyticsWithDurationNext = _ref.fireAnalyticsWithDurationNext,
171
172
  isTriggeredUsingKeyboard = _ref.isTriggeredUsingKeyboard,
173
+ isRenderedInPortal = _ref.isRenderedInPortal,
172
174
  fullName = _ref.fullName;
173
175
  var onActionClick = useCallback(function (action, args, event, index) {
174
176
  if (fg('ptc-enable-profile-card-analytics-refactor')) {
@@ -219,7 +221,7 @@ var Actions = function Actions(_ref) {
219
221
  },
220
222
  href: action.link || '',
221
223
  target: action.target,
222
- autoFocus: index === 0 && isTriggeredUsingKeyboard,
224
+ autoFocus: index === 0 && isTriggeredUsingKeyboard && !isRenderedInPortal,
223
225
  id: "action-button-".concat(action.id),
224
226
  "aria-labelledby": fg('enable_userprofilecard_arialabelfix') ? "action-button-".concat(action.id, " profilecard-name-label") : ''
225
227
  }, action.label, isKudos && /*#__PURE__*/React.createElement(AnimationWrapper, null, /*#__PURE__*/React.createElement(KudosBlobAnimation, null)));
@@ -10,6 +10,7 @@ import { FormattedMessage } from 'react-intl-next';
10
10
  import Lozenge from '@atlaskit/lozenge';
11
11
  import { fg } from '@atlaskit/platform-feature-flags';
12
12
  import { Box, Text } from '@atlaskit/primitives/compiled';
13
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
14
  import Tooltip from '@atlaskit/tooltip';
14
15
  import relativeDate from '../../internal/relative-date';
15
16
  import messages from '../../messages';
@@ -26,7 +27,7 @@ var styles = {
26
27
  disabledAccount: "_syazi7uo",
27
28
  activeAccount: "_syaz15cr"
28
29
  };
29
- var renderName = function renderName(nickname, fullName, meta, nameRef) {
30
+ var renderName = function renderName(nickname, fullName, meta, nameRef, isRenderedInPortal, isTriggeredUsingKeyboard) {
30
31
  if (!fullName && !nickname) {
31
32
  return null;
32
33
  }
@@ -49,12 +50,15 @@ var renderName = function renderName(nickname, fullName, meta, nameRef) {
49
50
  as: "h2",
50
51
  xcss: cx(styles.fullNameLabel, styles.activeAccount, meta ? fg('enable_absolute_positioning_profile_card') ? styles.metaLabelWithHighSpecificity : styles.metaLabel : fg('enable_absolute_positioning_profile_card') ? styles.noMetaLabelWithHighSpecificity : styles.noMetaLabel),
51
52
  testId: "profilecard-name",
52
- id: "profilecard-name-label"
53
+ id: "profilecard-name-label",
54
+ tabIndex: isTriggeredUsingKeyboard && isRenderedInPortal && expValEquals('editor_a11y_7152_profile_card_tab_order', 'isEnabled', true) ? -1 : undefined
53
55
  }, displayName)) : /*#__PURE__*/React.createElement(Box, {
56
+ ref: nameRef,
54
57
  as: "h2",
55
58
  xcss: cx(styles.fullNameLabel, styles.activeAccount, meta ? fg('enable_absolute_positioning_profile_card') ? styles.metaLabelWithHighSpecificity : styles.metaLabel : fg('enable_absolute_positioning_profile_card') ? styles.noMetaLabelWithHighSpecificity : styles.noMetaLabel),
56
59
  testId: "profilecard-name",
57
- id: "profilecard-name-label"
60
+ id: "profilecard-name-label",
61
+ tabIndex: isTriggeredUsingKeyboard && isRenderedInPortal && expValEquals('editor_a11y_7152_profile_card_tab_order', 'isEnabled', true) ? -1 : undefined
58
62
  }, displayName);
59
63
  };
60
64
  var disabledAccountDesc = function disabledAccountDesc(statusModifiedDate, disabledAccountMessage) {
@@ -120,8 +124,21 @@ var DisabledProfileCardDetails = function DisabledProfileCardDetails(props) {
120
124
  };
121
125
  export var ProfileCardDetails = function ProfileCardDetails(props) {
122
126
  var meta = props.meta,
123
- status = props.status;
127
+ status = props.status,
128
+ isRenderedInPortal = props.isRenderedInPortal,
129
+ isTriggeredUsingKeyboard = props.isTriggeredUsingKeyboard;
124
130
  var nameRef = useRef(null);
131
+ React.useEffect(function () {
132
+ if (nameRef !== null && nameRef !== void 0 && nameRef.current && isRenderedInPortal && isTriggeredUsingKeyboard && expValEquals('editor_a11y_7152_profile_card_tab_order', 'isEnabled', true)) {
133
+ var rafId = requestAnimationFrame(function () {
134
+ var _nameRef$current;
135
+ (_nameRef$current = nameRef.current) === null || _nameRef$current === void 0 || _nameRef$current.focus();
136
+ });
137
+ return function () {
138
+ cancelAnimationFrame(rafId);
139
+ };
140
+ }
141
+ }, [isRenderedInPortal, isTriggeredUsingKeyboard]);
125
142
  if (props.isServiceAccount) {
126
143
  return /*#__PURE__*/React.createElement(ServiceAccountProfileCardDetails, props);
127
144
  }
@@ -136,7 +153,7 @@ export var ProfileCardDetails = function ProfileCardDetails(props) {
136
153
  var lozenges = /*#__PURE__*/React.createElement(CustomLozenges, {
137
154
  lozenges: props.customLozenges
138
155
  });
139
- return /*#__PURE__*/React.createElement(DetailsGroup, null, renderName(props.nickname, props.fullName, meta, nameRef), meta && /*#__PURE__*/React.createElement(JobTitleLabel, null, meta), meta && props.customLozenges && props.customLozenges.length > 0 ? /*#__PURE__*/React.createElement(Box, {
156
+ return /*#__PURE__*/React.createElement(DetailsGroup, null, renderName(props.nickname, props.fullName, meta, nameRef, isRenderedInPortal, isTriggeredUsingKeyboard), meta && /*#__PURE__*/React.createElement(JobTitleLabel, null, meta), meta && props.customLozenges && props.customLozenges.length > 0 ? /*#__PURE__*/React.createElement(Box, {
140
157
  paddingBlockStart: "space.150"
141
158
  }, lozenges) : lozenges, /*#__PURE__*/React.createElement(Box, {
142
159
  xcss: styles.detailedListWrapperNext
@@ -16,6 +16,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
16
16
  import Popup from '@atlaskit/popup';
17
17
  import { useAnalyticsEvents } from '@atlaskit/teams-app-internal-analytics';
18
18
  import { layers } from '@atlaskit/theme/constants';
19
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
19
20
  import filterActionsInner from '../../internal/filterActions';
20
21
  import getLabelMessage from '../../internal/getLabelMessage';
21
22
  import { CardWrapper } from '../../styled/UserTrigger';
@@ -36,6 +37,7 @@ function ProfileCardContent(_ref) {
36
37
  hasError = _ref.hasError,
37
38
  errorType = _ref.errorType,
38
39
  agentActions = _ref.agentActions,
40
+ isRenderedInPortal = _ref.isRenderedInPortal,
39
41
  addFlag = _ref.addFlag,
40
42
  hideAgentMoreActions = _ref.hideAgentMoreActions,
41
43
  hideAiDisclaimer = _ref.hideAiDisclaimer;
@@ -55,6 +57,7 @@ function ProfileCardContent(_ref) {
55
57
  return /*#__PURE__*/React.createElement(Suspense, {
56
58
  fallback: null
57
59
  }, /*#__PURE__*/React.createElement(ProfileCardLazy, _extends({}, profilecardProps, {
60
+ isRenderedInPortal: isRenderedInPortal,
58
61
  actions: profileCardAction,
59
62
  hasError: hasError,
60
63
  errorType: errorType,
@@ -91,6 +94,7 @@ export default function ProfilecardTriggerNext(_ref2) {
91
94
  _ref2$ariaHideProfile = _ref2.ariaHideProfileTrigger,
92
95
  ariaHideProfileTrigger = _ref2$ariaHideProfile === void 0 ? false : _ref2$ariaHideProfile,
93
96
  propsIsVisible = _ref2.isVisible,
97
+ isRenderedInPortal = _ref2.isRenderedInPortal,
94
98
  ssrPlaceholderId = _ref2.ssrPlaceholderId,
95
99
  customShowDelay = _ref2.showDelay,
96
100
  customHideDelay = _ref2.hideDelay;
@@ -386,7 +390,8 @@ export default function ProfilecardTriggerNext(_ref2) {
386
390
  agentActions: agentActions,
387
391
  addFlag: addFlag,
388
392
  hideAgentMoreActions: hideAgentMoreActions,
389
- hideAiDisclaimer: hideAiDisclaimer
393
+ hideAiDisclaimer: hideAiDisclaimer,
394
+ isRenderedInPortal: isRenderedInPortal
390
395
  }));
391
396
  },
392
397
  trigger: function trigger(triggerProps) {
@@ -417,7 +422,7 @@ export default function ProfilecardTriggerNext(_ref2) {
417
422
  },
418
423
  zIndex: layers.modal(),
419
424
  shouldUseCaptureOnOutsideClick: true,
420
- autoFocus: autoFocus !== null && autoFocus !== void 0 ? autoFocus : trigger === 'click'
425
+ autoFocus: expValEquals('editor_a11y_7152_profile_card_tab_order', 'isEnabled', true) ? isRenderedInPortal && isTriggeredUsingKeyboard ? false : autoFocus !== null && autoFocus !== void 0 ? autoFocus : trigger === 'click' : autoFocus !== null && autoFocus !== void 0 ? autoFocus : trigger === 'click'
421
426
  // This feature gate is currently enabled only for Jira_Web to avoid UI issues in Confluence_Web.
422
427
  ,
423
428
  shouldRenderToParent: fg('enable_appropriate_reading_order_in_profile_card'),
@@ -7,7 +7,7 @@ import { getPageTime } from './performance';
7
7
  var ANALYTICS_CHANNEL = 'peopleTeams';
8
8
  export var PACKAGE_META_DATA = {
9
9
  packageName: "@atlaskit/profilecard",
10
- packageVersion: "24.37.2"
10
+ packageVersion: "24.38.0"
11
11
  };
12
12
  var runItLater = function runItLater(cb) {
13
13
  var requestIdleCallback = window.requestIdleCallback;
@@ -52,7 +52,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
52
52
  actionSubjectId: actionSubjectId,
53
53
  attributes: _objectSpread(_objectSpread({
54
54
  packageName: "@atlaskit/profilecard",
55
- packageVersion: "24.37.2"
55
+ packageVersion: "24.38.0"
56
56
  }, attributes), {}, {
57
57
  firedAt: Math.round(getPageTime())
58
58
  })
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { type ProfileCardTriggerProps } from '../../types';
3
- export default function ProfilecardTriggerNext({ autoFocus, trigger, userId, cloudId, resourceClient, actions, position, children, testId, addFlag, onReportingLinesClick, ariaLabel, ariaLabelledBy, prepopulatedData, disabledAriaAttributes, onVisibilityChange, offset, viewingUserId, product, agentActions, hideAgentMoreActions, hideAiDisclaimer, ariaHideProfileTrigger, isVisible: propsIsVisible, ssrPlaceholderId, showDelay: customShowDelay, hideDelay: customHideDelay, }: ProfileCardTriggerProps): React.JSX.Element;
3
+ export default function ProfilecardTriggerNext({ autoFocus, trigger, userId, cloudId, resourceClient, actions, position, children, testId, addFlag, onReportingLinesClick, ariaLabel, ariaLabelledBy, prepopulatedData, disabledAriaAttributes, onVisibilityChange, offset, viewingUserId, product, agentActions, hideAgentMoreActions, hideAiDisclaimer, ariaHideProfileTrigger, isVisible: propsIsVisible, isRenderedInPortal, ssrPlaceholderId, showDelay: customShowDelay, hideDelay: customHideDelay, }: ProfileCardTriggerProps): React.JSX.Element;
@@ -189,6 +189,13 @@ export interface ProfileCardTriggerProps {
189
189
  disabledAriaAttributes?: boolean;
190
190
  onVisibilityChange?: (isVisible: boolean) => void;
191
191
  isVisible?: boolean;
192
+ /**
193
+ * Indicates whether the profile card is rendered in a portal.
194
+ *
195
+ * If true, the profile card will auto-focus the name element when opened for better accessibility,
196
+ * keeping the user's focus in the tab trap.
197
+ */
198
+ isRenderedInPortal?: boolean;
192
199
  offset?: [number, number];
193
200
  product?: string;
194
201
  viewingUserId?: string;
@@ -437,6 +444,13 @@ export interface ProfilecardProps {
437
444
  teamCentralBaseUrl?: string;
438
445
  addFlag?: (flag: any) => void;
439
446
  cloudId?: string;
447
+ /**
448
+ * Indicates whether the profile card is rendered in a portal.
449
+ *
450
+ * If true, the profile card will auto-focus the name element when opened for better accessibility,
451
+ * keeping the user's focus in the tab trap.
452
+ */
453
+ isRenderedInPortal?: boolean;
440
454
  disabledAccountMessage?: React.ReactNode;
441
455
  hasDisabledAccountLozenge?: boolean;
442
456
  customLozenges?: LozengeProps[];
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { type ProfileCardTriggerProps } from '../../types';
3
- export default function ProfilecardTriggerNext({ autoFocus, trigger, userId, cloudId, resourceClient, actions, position, children, testId, addFlag, onReportingLinesClick, ariaLabel, ariaLabelledBy, prepopulatedData, disabledAriaAttributes, onVisibilityChange, offset, viewingUserId, product, agentActions, hideAgentMoreActions, hideAiDisclaimer, ariaHideProfileTrigger, isVisible: propsIsVisible, ssrPlaceholderId, showDelay: customShowDelay, hideDelay: customHideDelay, }: ProfileCardTriggerProps): React.JSX.Element;
3
+ export default function ProfilecardTriggerNext({ autoFocus, trigger, userId, cloudId, resourceClient, actions, position, children, testId, addFlag, onReportingLinesClick, ariaLabel, ariaLabelledBy, prepopulatedData, disabledAriaAttributes, onVisibilityChange, offset, viewingUserId, product, agentActions, hideAgentMoreActions, hideAiDisclaimer, ariaHideProfileTrigger, isVisible: propsIsVisible, isRenderedInPortal, ssrPlaceholderId, showDelay: customShowDelay, hideDelay: customHideDelay, }: ProfileCardTriggerProps): React.JSX.Element;
@@ -189,6 +189,13 @@ export interface ProfileCardTriggerProps {
189
189
  disabledAriaAttributes?: boolean;
190
190
  onVisibilityChange?: (isVisible: boolean) => void;
191
191
  isVisible?: boolean;
192
+ /**
193
+ * Indicates whether the profile card is rendered in a portal.
194
+ *
195
+ * If true, the profile card will auto-focus the name element when opened for better accessibility,
196
+ * keeping the user's focus in the tab trap.
197
+ */
198
+ isRenderedInPortal?: boolean;
192
199
  offset?: [
193
200
  number,
194
201
  number
@@ -443,6 +450,13 @@ export interface ProfilecardProps {
443
450
  teamCentralBaseUrl?: string;
444
451
  addFlag?: (flag: any) => void;
445
452
  cloudId?: string;
453
+ /**
454
+ * Indicates whether the profile card is rendered in a portal.
455
+ *
456
+ * If true, the profile card will auto-focus the name element when opened for better accessibility,
457
+ * keeping the user's focus in the tab trap.
458
+ */
459
+ isRenderedInPortal?: boolean;
446
460
  disabledAccountMessage?: React.ReactNode;
447
461
  hasDisabledAccountLozenge?: boolean;
448
462
  customLozenges?: LozengeProps[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "24.37.3",
3
+ "version": "24.39.0",
4
4
  "description": "A React component to display a card with user information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -48,7 +48,7 @@
48
48
  "@atlaskit/css": "^0.19.0",
49
49
  "@atlaskit/dropdown-menu": "^16.5.0",
50
50
  "@atlaskit/empty-state": "^10.1.0",
51
- "@atlaskit/give-kudos": "^4.14.0",
51
+ "@atlaskit/give-kudos": "^4.15.0",
52
52
  "@atlaskit/heading": "^5.3.0",
53
53
  "@atlaskit/icon": "^32.0.0",
54
54
  "@atlaskit/link": "3.3.3",
@@ -68,6 +68,7 @@
68
68
  "@atlaskit/teams-avatar": "^2.4.0",
69
69
  "@atlaskit/teams-public": "^0.70.0",
70
70
  "@atlaskit/theme": "^21.0.0",
71
+ "@atlaskit/tmp-editor-statsig": "^32.5.0",
71
72
  "@atlaskit/tokens": "^11.0.0",
72
73
  "@atlaskit/tooltip": "^20.14.0",
73
74
  "@babel/runtime": "^7.0.0",
@@ -175,9 +176,6 @@
175
176
  "rovo_display_ai_disclaimer_on_agent_profile_card": {
176
177
  "type": "boolean"
177
178
  },
178
- "rovo_agent_show_creator_on_profile_card_fix": {
179
- "type": "boolean"
180
- },
181
179
  "new_team_profile_fedramp": {
182
180
  "type": "boolean"
183
181
  },