@atlaskit/profilecard 19.21.0 → 19.22.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 (46) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/client/getTeamFromAGG.js +1 -1
  3. package/dist/cjs/components/Agent/AgentProfileCard.js +10 -5
  4. package/dist/cjs/components/Agent/AgentProfileCardResourced.js +3 -1
  5. package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +2 -1
  6. package/dist/cjs/components/Agent/hooks/useAgentActions.js +1 -1
  7. package/dist/cjs/components/User/ProfileCardTrigger.js +9 -4
  8. package/dist/cjs/components/common/ProfileCardTrigger.js +3 -2
  9. package/dist/cjs/components/common/ProfileCardWrapper.js +18 -0
  10. package/dist/cjs/util/analytics.js +1 -1
  11. package/dist/cjs/util/useProfileInfo.js +1 -1
  12. package/dist/es2019/client/getTeamFromAGG.js +1 -1
  13. package/dist/es2019/components/Agent/AgentProfileCard.js +10 -5
  14. package/dist/es2019/components/Agent/AgentProfileCardResourced.js +3 -1
  15. package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +2 -1
  16. package/dist/es2019/components/Agent/hooks/useAgentActions.js +1 -1
  17. package/dist/es2019/components/User/ProfileCardTrigger.js +9 -4
  18. package/dist/es2019/components/common/ProfileCardTrigger.js +3 -2
  19. package/dist/es2019/components/common/ProfileCardWrapper.js +12 -0
  20. package/dist/es2019/util/analytics.js +1 -1
  21. package/dist/es2019/util/useProfileInfo.js +1 -1
  22. package/dist/esm/client/getTeamFromAGG.js +1 -1
  23. package/dist/esm/components/Agent/AgentProfileCard.js +10 -5
  24. package/dist/esm/components/Agent/AgentProfileCardResourced.js +3 -1
  25. package/dist/esm/components/Agent/AgentProfileCardTrigger.js +2 -1
  26. package/dist/esm/components/Agent/hooks/useAgentActions.js +1 -1
  27. package/dist/esm/components/User/ProfileCardTrigger.js +9 -4
  28. package/dist/esm/components/common/ProfileCardTrigger.js +3 -2
  29. package/dist/esm/components/common/ProfileCardWrapper.js +11 -0
  30. package/dist/esm/util/analytics.js +1 -1
  31. package/dist/esm/util/useProfileInfo.js +1 -1
  32. package/dist/types/components/Agent/AgentProfileCard.d.ts +3 -4
  33. package/dist/types/components/Agent/AgentProfileCardResourced.d.ts +3 -3
  34. package/dist/types/components/Agent/lazyAgentProfileCard.d.ts +2 -3
  35. package/dist/types/components/User/ProfileCardTrigger.d.ts +1 -1
  36. package/dist/types/components/common/PopupTrigger.d.ts +1 -1
  37. package/dist/types/components/common/ProfileCardWrapper.d.ts +4 -0
  38. package/dist/types/types.d.ts +7 -2
  39. package/dist/types-ts4.5/components/Agent/AgentProfileCard.d.ts +3 -4
  40. package/dist/types-ts4.5/components/Agent/AgentProfileCardResourced.d.ts +3 -3
  41. package/dist/types-ts4.5/components/Agent/lazyAgentProfileCard.d.ts +2 -3
  42. package/dist/types-ts4.5/components/User/ProfileCardTrigger.d.ts +1 -1
  43. package/dist/types-ts4.5/components/common/PopupTrigger.d.ts +1 -1
  44. package/dist/types-ts4.5/components/common/ProfileCardWrapper.d.ts +4 -0
  45. package/dist/types-ts4.5/types.d.ts +7 -2
  46. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @atlaskit/profilecard
2
2
 
3
+ ## 19.22.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#134375](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/134375)
8
+ [`03134c232b4a2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/03134c232b4a2) -
9
+ Pass agent actions overrides
10
+ - [#134349](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/134349)
11
+ [`f66ae41dc74c2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f66ae41dc74c2) -
12
+ Fix wrong copy agent URL
13
+
14
+ ### Patch Changes
15
+
16
+ - [#133158](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/133158)
17
+ [`7cfd5390f596f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7cfd5390f596f) -
18
+ [ux] Pass agent id to AgentBanner and AgentAvatar
19
+
20
+ ## 19.21.1
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies
25
+
3
26
  ## 19.21.0
4
27
 
5
28
  ### Minor Changes
@@ -57,7 +57,7 @@ var addHeaders = exports.addHeaders = function addHeaders(headers) {
57
57
  headers.append('X-ExperimentalApi', 'teams-beta');
58
58
  headers.append('X-ExperimentalApi', 'team-members-beta');
59
59
  headers.append('atl-client-name', "@atlaskit/profilecard");
60
- headers.append('atl-client-version', "19.21.0");
60
+ headers.append('atl-client-version', "19.22.0");
61
61
  return headers;
62
62
  };
63
63
  function getTeamFromAGG(_x, _x2, _x3) {
@@ -43,11 +43,12 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
43
43
  isLoading = _ref.isLoading,
44
44
  isCreatedByViewingUser = _ref.isCreatedByViewingUser,
45
45
  cloudId = _ref.cloudId,
46
- onOpenChat = _ref.onOpenChat,
46
+ _onChatClick = _ref.onChatClick,
47
47
  _ref$product = _ref.product,
48
48
  product = _ref$product === void 0 ? 'rovo' : _ref$product,
49
49
  hasError = _ref.hasError,
50
- errorType = _ref.errorType;
50
+ errorType = _ref.errorType,
51
+ onConversationStartersClick = _ref.onConversationStartersClick;
51
52
  var _useAgentUrlActions = (0, _useAgentActions.useAgentUrlActions)({
52
53
  cloudId: cloudId || ''
53
54
  }),
@@ -117,10 +118,14 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
117
118
  return /*#__PURE__*/_react.default.createElement(_AgentProfileCardWrapper.AgentProfileCardWrapper, null, /*#__PURE__*/_react.default.createElement(_primitives.Box, {
118
119
  xcss: cardContainerStyles
119
120
  }, /*#__PURE__*/_react.default.createElement(_rovoAgentComponents.AgentBanner, {
121
+ agentId: agent.id,
122
+ agentNamedId: agent.named_id,
120
123
  height: 96
121
124
  }), /*#__PURE__*/_react.default.createElement(_primitives.Box, {
122
125
  xcss: avatarStyles
123
126
  }, /*#__PURE__*/_react.default.createElement(_rovoAgentComponents.AgentAvatar, {
127
+ agentId: agent.id,
128
+ agentNamedId: agent.named_id,
124
129
  size: "xlarge"
125
130
  })), /*#__PURE__*/_react.default.createElement(_primitives.Stack, {
126
131
  space: "space.100",
@@ -148,9 +153,9 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
148
153
  isAgentDefault: agent.is_default,
149
154
  userDefinedConversationStarters: agent.user_defined_conversation_starters,
150
155
  onConversationStarterClick: function onConversationStarterClick(conversationStarter) {
151
- onConversationStarter({
156
+ onConversationStartersClick ? onConversationStartersClick(conversationStarter) : onConversationStarter({
152
157
  agentId: agent.id,
153
- prompt: 'conversationStarter'
158
+ prompt: conversationStarter
154
159
  });
155
160
  }
156
161
  })), /*#__PURE__*/_react.default.createElement(_Actions.AgentActions, {
@@ -166,7 +171,7 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
166
171
  },
167
172
  onDeleteAgent: handleOnDelete,
168
173
  onChatClick: function onChatClick() {
169
- return onOpenChat ? onOpenChat(agent.id) : onOpenChatFullScreecn();
174
+ return _onChatClick ? _onChatClick() : onOpenChatFullScreecn();
170
175
  }
171
176
  })));
172
177
  };
@@ -176,7 +176,9 @@ var AgentProfileCardResourced = exports.AgentProfileCardResourced = function Age
176
176
  isLoading: isLoading,
177
177
  hasError: !!error,
178
178
  isCreatedByViewingUser: creatorUserId === props.viewingUserId,
179
- product: props.product
179
+ product: props.product,
180
+ onConversationStartersClick: props.onConversationStartersClick,
181
+ onChatClick: props.onChatClick
180
182
  });
181
183
  }
182
184
  return null;
@@ -140,7 +140,8 @@ var AgentProfileCardTrigger = exports.AgentProfileCardTrigger = function AgentPr
140
140
  cloudId: props.cloudId,
141
141
  product: product,
142
142
  errorType: error,
143
- onOpenChat: props.onOpenChat
143
+ onChatClick: props.onChatClick,
144
+ onConversationStartersClick: props.onConversationStartersClick
144
145
  }));
145
146
  };
146
147
  return /*#__PURE__*/_react.default.createElement(_ProfileCardTrigger.default, (0, _extends2.default)({}, props, {
@@ -39,7 +39,7 @@ var useAgentUrlActions = exports.useAgentUrlActions = function useAgentUrlAction
39
39
  window.open(urlWithParams, '_blank', 'noopener, noreferrer');
40
40
  }, [cloudId]);
41
41
  var onCopyAgent = function onCopyAgent(agentId) {
42
- navigator.clipboard.writeText("/people/agent/".concat(agentId));
42
+ navigator.clipboard.writeText("".concat(window.location.origin, "/people/agent/").concat(agentId));
43
43
  };
44
44
  var onDuplicateAgent = (0, _react.useCallback)(function (agentId) {
45
45
  var baseUrl = "".concat((0, _atlassianContext.getATLContextUrl)('home'), "/chat/agents/new");
@@ -45,7 +45,8 @@ function ProfileCardContent(_ref) {
45
45
  isAgent = _ref.isAgent,
46
46
  profileCardAction = _ref.profileCardAction,
47
47
  hasError = _ref.hasError,
48
- errorType = _ref.errorType;
48
+ errorType = _ref.errorType,
49
+ agentActions = _ref.agentActions;
49
50
  if (isAgent && (0, _platformFeatureFlags.fg)('enable_agent_profile_card')) {
50
51
  return /*#__PURE__*/_react.default.createElement(_AgentProfileCardResourced.AgentProfileCardResourced, {
51
52
  accountId: userId,
@@ -53,7 +54,9 @@ function ProfileCardContent(_ref) {
53
54
  resourceClient: resourceClient,
54
55
  viewingUserId: viewingUserId,
55
56
  trigger: trigger,
56
- product: product
57
+ product: product,
58
+ onChatClick: agentActions === null || agentActions === void 0 ? void 0 : agentActions.onChatClick,
59
+ onConversationStartersClick: agentActions === null || agentActions === void 0 ? void 0 : agentActions.onConversationStartersClick
57
60
  });
58
61
  } else {
59
62
  return /*#__PURE__*/_react.default.createElement(_react.Suspense, {
@@ -88,7 +91,8 @@ function ProfilecardTriggerNext(_ref2) {
88
91
  onVisibilityChange = _ref2.onVisibilityChange,
89
92
  offset = _ref2.offset,
90
93
  viewingUserId = _ref2.viewingUserId,
91
- product = _ref2.product;
94
+ product = _ref2.product,
95
+ agentActions = _ref2.agentActions;
92
96
  var _useAnalyticsEvents = (0, _analyticsNext.useAnalyticsEvents)(),
93
97
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
94
98
  var _useIntl = (0, _reactIntlNext.useIntl)(),
@@ -344,7 +348,8 @@ function ProfilecardTriggerNext(_ref2) {
344
348
  product: product,
345
349
  profileCardAction: filterActions(),
346
350
  errorType: error,
347
- hasError: hasError
351
+ hasError: hasError,
352
+ agentActions: agentActions
348
353
  }));
349
354
  },
350
355
  trigger: function trigger(triggerProps) {
@@ -18,6 +18,7 @@ var _analytics = require("../../util/analytics");
18
18
  var _useProfileInfo2 = require("../../util/useProfileInfo");
19
19
  var _LoadingState = require("./LoadingState");
20
20
  var _PopupTrigger = require("./PopupTrigger");
21
+ var _ProfileCardWrapper = require("./ProfileCardWrapper");
21
22
  var _excluded = ["trigger", "ariaLabelledBy", "children", "renderProfileCard", "fetchProfile", "disabledAriaAttributes", "profileCardType", "fireAnalytics"],
22
23
  _excluded2 = ["aria-expanded", "aria-haspopup"];
23
24
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
@@ -124,10 +125,10 @@ function ProfileCardTrigger(_ref) {
124
125
  onMouseEnter: onMouseEnter,
125
126
  onMouseLeave: hideProfilecard,
126
127
  onFocus: showProfilecard
127
- }, isLoading ? /*#__PURE__*/_react.default.createElement(_LoadingState.LoadingState, {
128
+ }, isLoading ? /*#__PURE__*/_react.default.createElement(_ProfileCardWrapper.ProfileCardWrapper, null, /*#__PURE__*/_react.default.createElement(_LoadingState.LoadingState, {
128
129
  fireAnalytics: fireAnalytics,
129
130
  profileType: profileCardType
130
- }) : renderProfileCard({
131
+ })) : renderProfileCard({
131
132
  profileData: profileData,
132
133
  error: error
133
134
  }));
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ProfileCardWrapper = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _primitives = require("@atlaskit/primitives");
10
+ var styles = (0, _primitives.xcss)({
11
+ width: '360px'
12
+ });
13
+ var ProfileCardWrapper = exports.ProfileCardWrapper = function ProfileCardWrapper(_ref) {
14
+ var children = _ref.children;
15
+ return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
16
+ xcss: styles
17
+ }, children);
18
+ };
@@ -45,7 +45,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
45
45
  actionSubjectId: actionSubjectId,
46
46
  attributes: _objectSpread(_objectSpread({
47
47
  packageName: "@atlaskit/profilecard",
48
- packageVersion: "19.21.0"
48
+ packageVersion: "19.22.0"
49
49
  }, attributes), {}, {
50
50
  firedAt: Math.round((0, _performance.getPageTime)())
51
51
  })
@@ -43,7 +43,7 @@ var useProfileInfo = exports.useProfileInfo = function useProfileInfo(_ref) {
43
43
  _context.prev = 9;
44
44
  _context.t0 = _context["catch"](1);
45
45
  setError(_context.t0);
46
- setIsLoading(true);
46
+ setIsLoading(false);
47
47
  case 13:
48
48
  case "end":
49
49
  return _context.stop();
@@ -67,7 +67,7 @@ export const addHeaders = headers => {
67
67
  headers.append('X-ExperimentalApi', 'teams-beta');
68
68
  headers.append('X-ExperimentalApi', 'team-members-beta');
69
69
  headers.append('atl-client-name', "@atlaskit/profilecard");
70
- headers.append('atl-client-version', "19.21.0");
70
+ headers.append('atl-client-version', "19.22.0");
71
71
  return headers;
72
72
  };
73
73
  export async function getTeamFromAGG(url, teamId, siteId) {
@@ -30,10 +30,11 @@ const AgentProfileCard = ({
30
30
  isLoading,
31
31
  isCreatedByViewingUser,
32
32
  cloudId,
33
- onOpenChat,
33
+ onChatClick,
34
34
  product = 'rovo',
35
35
  hasError,
36
- errorType
36
+ errorType,
37
+ onConversationStartersClick
37
38
  }) => {
38
39
  var _agent$creatorInfo, _agent$creatorInfo2, _agent$creatorInfo3, _agent$creatorInfo4;
39
40
  const {
@@ -93,10 +94,14 @@ const AgentProfileCard = ({
93
94
  return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(Box, {
94
95
  xcss: cardContainerStyles
95
96
  }, /*#__PURE__*/React.createElement(AgentBanner, {
97
+ agentId: agent.id,
98
+ agentNamedId: agent.named_id,
96
99
  height: 96
97
100
  }), /*#__PURE__*/React.createElement(Box, {
98
101
  xcss: avatarStyles
99
102
  }, /*#__PURE__*/React.createElement(AgentAvatar, {
103
+ agentId: agent.id,
104
+ agentNamedId: agent.named_id,
100
105
  size: "xlarge"
101
106
  })), /*#__PURE__*/React.createElement(Stack, {
102
107
  space: "space.100",
@@ -124,9 +129,9 @@ const AgentProfileCard = ({
124
129
  isAgentDefault: agent.is_default,
125
130
  userDefinedConversationStarters: agent.user_defined_conversation_starters,
126
131
  onConversationStarterClick: conversationStarter => {
127
- onConversationStarter({
132
+ onConversationStartersClick ? onConversationStartersClick(conversationStarter) : onConversationStarter({
128
133
  agentId: agent.id,
129
- prompt: 'conversationStarter'
134
+ prompt: conversationStarter
130
135
  });
131
136
  }
132
137
  })), /*#__PURE__*/React.createElement(AgentActions, {
@@ -135,7 +140,7 @@ const AgentProfileCard = ({
135
140
  onCopyAgent: () => onCopyAgent(agent.id),
136
141
  onDuplicateAgent: () => onDuplicateAgent(agent.id),
137
142
  onDeleteAgent: handleOnDelete,
138
- onChatClick: () => onOpenChat ? onOpenChat(agent.id) : onOpenChatFullScreecn()
143
+ onChatClick: () => onChatClick ? onChatClick() : onOpenChatFullScreecn()
139
144
  })));
140
145
  };
141
146
  export default AgentProfileCard;
@@ -94,7 +94,9 @@ export const AgentProfileCardResourced = props => {
94
94
  isLoading: isLoading,
95
95
  hasError: !!error,
96
96
  isCreatedByViewingUser: creatorUserId === props.viewingUserId,
97
- product: props.product
97
+ product: props.product,
98
+ onConversationStartersClick: props.onConversationStartersClick,
99
+ onChatClick: props.onChatClick
98
100
  });
99
101
  }
100
102
  return null;
@@ -83,7 +83,8 @@ export const AgentProfileCardTrigger = ({
83
83
  cloudId: props.cloudId,
84
84
  product: product,
85
85
  errorType: error,
86
- onOpenChat: props.onOpenChat
86
+ onChatClick: props.onChatClick,
87
+ onConversationStartersClick: props.onConversationStartersClick
87
88
  }));
88
89
  };
89
90
  return /*#__PURE__*/React.createElement(ProfileCardTrigger, _extends({}, props, {
@@ -25,7 +25,7 @@ export const useAgentUrlActions = ({
25
25
  window.open(urlWithParams, '_blank', 'noopener, noreferrer');
26
26
  }, [cloudId]);
27
27
  const onCopyAgent = agentId => {
28
- navigator.clipboard.writeText(`/people/agent/${agentId}`);
28
+ navigator.clipboard.writeText(`${window.location.origin}/people/agent/${agentId}`);
29
29
  };
30
30
  const onDuplicateAgent = useCallback(agentId => {
31
31
  const baseUrl = `${getATLContextUrl('home')}/chat/agents/new`;
@@ -25,7 +25,8 @@ function ProfileCardContent({
25
25
  isAgent,
26
26
  profileCardAction,
27
27
  hasError,
28
- errorType
28
+ errorType,
29
+ agentActions
29
30
  }) {
30
31
  if (isAgent && fg('enable_agent_profile_card')) {
31
32
  return /*#__PURE__*/React.createElement(AgentProfileCardResourced, {
@@ -34,7 +35,9 @@ function ProfileCardContent({
34
35
  resourceClient: resourceClient,
35
36
  viewingUserId: viewingUserId,
36
37
  trigger: trigger,
37
- product: product
38
+ product: product,
39
+ onChatClick: agentActions === null || agentActions === void 0 ? void 0 : agentActions.onChatClick,
40
+ onConversationStartersClick: agentActions === null || agentActions === void 0 ? void 0 : agentActions.onConversationStartersClick
38
41
  });
39
42
  } else {
40
43
  return /*#__PURE__*/React.createElement(Suspense, {
@@ -66,7 +69,8 @@ export default function ProfilecardTriggerNext({
66
69
  onVisibilityChange,
67
70
  offset,
68
71
  viewingUserId,
69
- product
72
+ product,
73
+ agentActions
70
74
  }) {
71
75
  const {
72
76
  createAnalyticsEvent
@@ -273,7 +277,8 @@ export default function ProfilecardTriggerNext({
273
277
  product: product,
274
278
  profileCardAction: filterActions(),
275
279
  errorType: error,
276
- hasError: hasError
280
+ hasError: hasError,
281
+ agentActions: agentActions
277
282
  })),
278
283
  trigger: triggerProps => {
279
284
  const {
@@ -6,6 +6,7 @@ import { cardTriggered } from '../../util/analytics';
6
6
  import { useProfileInfo } from '../../util/useProfileInfo';
7
7
  import { LoadingState } from './LoadingState';
8
8
  import { PopupTrigger } from './PopupTrigger';
9
+ import { ProfileCardWrapper } from './ProfileCardWrapper';
9
10
  const DELAY_MS_SHOW = 800;
10
11
  const DELAY_MS_HIDE = 200;
11
12
  function ProfileCardTrigger({
@@ -88,10 +89,10 @@ function ProfileCardTrigger({
88
89
  onMouseEnter: onMouseEnter,
89
90
  onMouseLeave: hideProfilecard,
90
91
  onFocus: showProfilecard
91
- }, isLoading ? /*#__PURE__*/React.createElement(LoadingState, {
92
+ }, isLoading ? /*#__PURE__*/React.createElement(ProfileCardWrapper, null, /*#__PURE__*/React.createElement(LoadingState, {
92
93
  fireAnalytics: fireAnalytics,
93
94
  profileType: profileCardType
94
- }) : renderProfileCard({
95
+ })) : renderProfileCard({
95
96
  profileData,
96
97
  error
97
98
  }))
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { Box, xcss } from '@atlaskit/primitives';
3
+ const styles = xcss({
4
+ width: '360px'
5
+ });
6
+ export const ProfileCardWrapper = ({
7
+ children
8
+ }) => {
9
+ return /*#__PURE__*/React.createElement(Box, {
10
+ xcss: styles
11
+ }, children);
12
+ };
@@ -32,7 +32,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
32
32
  actionSubjectId,
33
33
  attributes: {
34
34
  packageName: "@atlaskit/profilecard",
35
- packageVersion: "19.21.0",
35
+ packageVersion: "19.22.0",
36
36
  ...attributes,
37
37
  firedAt: Math.round(getPageTime())
38
38
  }
@@ -13,7 +13,7 @@ export const useProfileInfo = ({
13
13
  setIsLoading(false);
14
14
  } catch (error) {
15
15
  setError(error);
16
- setIsLoading(true);
16
+ setIsLoading(false);
17
17
  }
18
18
  };
19
19
  return {
@@ -48,7 +48,7 @@ export var addHeaders = function addHeaders(headers) {
48
48
  headers.append('X-ExperimentalApi', 'teams-beta');
49
49
  headers.append('X-ExperimentalApi', 'team-members-beta');
50
50
  headers.append('atl-client-name', "@atlaskit/profilecard");
51
- headers.append('atl-client-version', "19.21.0");
51
+ headers.append('atl-client-version', "19.22.0");
52
52
  return headers;
53
53
  };
54
54
  export function getTeamFromAGG(_x, _x2, _x3) {
@@ -33,11 +33,12 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
33
33
  isLoading = _ref.isLoading,
34
34
  isCreatedByViewingUser = _ref.isCreatedByViewingUser,
35
35
  cloudId = _ref.cloudId,
36
- onOpenChat = _ref.onOpenChat,
36
+ _onChatClick = _ref.onChatClick,
37
37
  _ref$product = _ref.product,
38
38
  product = _ref$product === void 0 ? 'rovo' : _ref$product,
39
39
  hasError = _ref.hasError,
40
- errorType = _ref.errorType;
40
+ errorType = _ref.errorType,
41
+ onConversationStartersClick = _ref.onConversationStartersClick;
41
42
  var _useAgentUrlActions = useAgentUrlActions({
42
43
  cloudId: cloudId || ''
43
44
  }),
@@ -107,10 +108,14 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
107
108
  return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(Box, {
108
109
  xcss: cardContainerStyles
109
110
  }, /*#__PURE__*/React.createElement(AgentBanner, {
111
+ agentId: agent.id,
112
+ agentNamedId: agent.named_id,
110
113
  height: 96
111
114
  }), /*#__PURE__*/React.createElement(Box, {
112
115
  xcss: avatarStyles
113
116
  }, /*#__PURE__*/React.createElement(AgentAvatar, {
117
+ agentId: agent.id,
118
+ agentNamedId: agent.named_id,
114
119
  size: "xlarge"
115
120
  })), /*#__PURE__*/React.createElement(Stack, {
116
121
  space: "space.100",
@@ -138,9 +143,9 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
138
143
  isAgentDefault: agent.is_default,
139
144
  userDefinedConversationStarters: agent.user_defined_conversation_starters,
140
145
  onConversationStarterClick: function onConversationStarterClick(conversationStarter) {
141
- onConversationStarter({
146
+ onConversationStartersClick ? onConversationStartersClick(conversationStarter) : onConversationStarter({
142
147
  agentId: agent.id,
143
- prompt: 'conversationStarter'
148
+ prompt: conversationStarter
144
149
  });
145
150
  }
146
151
  })), /*#__PURE__*/React.createElement(AgentActions, {
@@ -156,7 +161,7 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
156
161
  },
157
162
  onDeleteAgent: handleOnDelete,
158
163
  onChatClick: function onChatClick() {
159
- return onOpenChat ? onOpenChat(agent.id) : onOpenChatFullScreecn();
164
+ return _onChatClick ? _onChatClick() : onOpenChatFullScreecn();
160
165
  }
161
166
  })));
162
167
  };
@@ -166,7 +166,9 @@ export var AgentProfileCardResourced = function AgentProfileCardResourced(props)
166
166
  isLoading: isLoading,
167
167
  hasError: !!error,
168
168
  isCreatedByViewingUser: creatorUserId === props.viewingUserId,
169
- product: props.product
169
+ product: props.product,
170
+ onConversationStartersClick: props.onConversationStartersClick,
171
+ onChatClick: props.onChatClick
170
172
  });
171
173
  }
172
174
  return null;
@@ -130,7 +130,8 @@ export var AgentProfileCardTrigger = function AgentProfileCardTrigger(_ref) {
130
130
  cloudId: props.cloudId,
131
131
  product: product,
132
132
  errorType: error,
133
- onOpenChat: props.onOpenChat
133
+ onChatClick: props.onChatClick,
134
+ onConversationStartersClick: props.onConversationStartersClick
134
135
  }));
135
136
  };
136
137
  return /*#__PURE__*/React.createElement(ProfileCardTrigger, _extends({}, props, {
@@ -32,7 +32,7 @@ export var useAgentUrlActions = function useAgentUrlActions(_ref3) {
32
32
  window.open(urlWithParams, '_blank', 'noopener, noreferrer');
33
33
  }, [cloudId]);
34
34
  var onCopyAgent = function onCopyAgent(agentId) {
35
- navigator.clipboard.writeText("/people/agent/".concat(agentId));
35
+ navigator.clipboard.writeText("".concat(window.location.origin, "/people/agent/").concat(agentId));
36
36
  };
37
37
  var onDuplicateAgent = useCallback(function (agentId) {
38
38
  var baseUrl = "".concat(getATLContextUrl('home'), "/chat/agents/new");
@@ -35,7 +35,8 @@ function ProfileCardContent(_ref) {
35
35
  isAgent = _ref.isAgent,
36
36
  profileCardAction = _ref.profileCardAction,
37
37
  hasError = _ref.hasError,
38
- errorType = _ref.errorType;
38
+ errorType = _ref.errorType,
39
+ agentActions = _ref.agentActions;
39
40
  if (isAgent && fg('enable_agent_profile_card')) {
40
41
  return /*#__PURE__*/React.createElement(AgentProfileCardResourced, {
41
42
  accountId: userId,
@@ -43,7 +44,9 @@ function ProfileCardContent(_ref) {
43
44
  resourceClient: resourceClient,
44
45
  viewingUserId: viewingUserId,
45
46
  trigger: trigger,
46
- product: product
47
+ product: product,
48
+ onChatClick: agentActions === null || agentActions === void 0 ? void 0 : agentActions.onChatClick,
49
+ onConversationStartersClick: agentActions === null || agentActions === void 0 ? void 0 : agentActions.onConversationStartersClick
47
50
  });
48
51
  } else {
49
52
  return /*#__PURE__*/React.createElement(Suspense, {
@@ -78,7 +81,8 @@ export default function ProfilecardTriggerNext(_ref2) {
78
81
  onVisibilityChange = _ref2.onVisibilityChange,
79
82
  offset = _ref2.offset,
80
83
  viewingUserId = _ref2.viewingUserId,
81
- product = _ref2.product;
84
+ product = _ref2.product,
85
+ agentActions = _ref2.agentActions;
82
86
  var _useAnalyticsEvents = useAnalyticsEvents(),
83
87
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
84
88
  var _useIntl = useIntl(),
@@ -334,7 +338,8 @@ export default function ProfilecardTriggerNext(_ref2) {
334
338
  product: product,
335
339
  profileCardAction: filterActions(),
336
340
  errorType: error,
337
- hasError: hasError
341
+ hasError: hasError,
342
+ agentActions: agentActions
338
343
  }));
339
344
  },
340
345
  trigger: function trigger(triggerProps) {
@@ -12,6 +12,7 @@ import { cardTriggered } from '../../util/analytics';
12
12
  import { useProfileInfo } from '../../util/useProfileInfo';
13
13
  import { LoadingState } from './LoadingState';
14
14
  import { PopupTrigger } from './PopupTrigger';
15
+ import { ProfileCardWrapper } from './ProfileCardWrapper';
15
16
  var DELAY_MS_SHOW = 800;
16
17
  var DELAY_MS_HIDE = 200;
17
18
  function ProfileCardTrigger(_ref) {
@@ -114,10 +115,10 @@ function ProfileCardTrigger(_ref) {
114
115
  onMouseEnter: onMouseEnter,
115
116
  onMouseLeave: hideProfilecard,
116
117
  onFocus: showProfilecard
117
- }, isLoading ? /*#__PURE__*/React.createElement(LoadingState, {
118
+ }, isLoading ? /*#__PURE__*/React.createElement(ProfileCardWrapper, null, /*#__PURE__*/React.createElement(LoadingState, {
118
119
  fireAnalytics: fireAnalytics,
119
120
  profileType: profileCardType
120
- }) : renderProfileCard({
121
+ })) : renderProfileCard({
121
122
  profileData: profileData,
122
123
  error: error
123
124
  }));
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { Box, xcss } from '@atlaskit/primitives';
3
+ var styles = xcss({
4
+ width: '360px'
5
+ });
6
+ export var ProfileCardWrapper = function ProfileCardWrapper(_ref) {
7
+ var children = _ref.children;
8
+ return /*#__PURE__*/React.createElement(Box, {
9
+ xcss: styles
10
+ }, children);
11
+ };
@@ -39,7 +39,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
39
39
  actionSubjectId: actionSubjectId,
40
40
  attributes: _objectSpread(_objectSpread({
41
41
  packageName: "@atlaskit/profilecard",
42
- packageVersion: "19.21.0"
42
+ packageVersion: "19.22.0"
43
43
  }, attributes), {}, {
44
44
  firedAt: Math.round(getPageTime())
45
45
  })
@@ -36,7 +36,7 @@ export var useProfileInfo = function useProfileInfo(_ref) {
36
36
  _context.prev = 9;
37
37
  _context.t0 = _context["catch"](1);
38
38
  setError(_context.t0);
39
- setIsLoading(true);
39
+ setIsLoading(false);
40
40
  case 13:
41
41
  case "end":
42
42
  return _context.stop();
@@ -1,14 +1,13 @@
1
1
  /// <reference types="react" />
2
- import { type ProfileCardErrorType, type RovoAgentProfileCardInfo } from '../../types';
2
+ import { type AgentActionsType, type ProfileCardErrorType, type RovoAgentProfileCardInfo } from '../../types';
3
3
  type AgentProfileCardProps = {
4
4
  agent?: RovoAgentProfileCardInfo;
5
5
  isLoading?: boolean;
6
6
  hasError?: boolean;
7
7
  isCreatedByViewingUser?: boolean;
8
8
  cloudId?: string;
9
- onOpenChat?: (agentId: string) => void;
10
9
  product?: string;
11
10
  errorType?: ProfileCardErrorType;
12
- };
13
- declare const AgentProfileCard: ({ agent, isLoading, isCreatedByViewingUser, cloudId, onOpenChat, product, hasError, errorType, }: AgentProfileCardProps) => JSX.Element;
11
+ } & AgentActionsType;
12
+ declare const AgentProfileCard: ({ agent, isLoading, isCreatedByViewingUser, cloudId, onChatClick, product, hasError, errorType, onConversationStartersClick, }: AgentProfileCardProps) => JSX.Element;
14
13
  export default AgentProfileCard;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { type ProfileClient, type TriggerType } from '../../types';
3
- export interface AgentProfileCardResourcedProps {
2
+ import { type AgentActionsType, type ProfileClient, type TriggerType } from '../../types';
3
+ export type AgentProfileCardResourcedProps = {
4
4
  accountId: string;
5
5
  cloudId: string;
6
6
  resourceClient: ProfileClient;
@@ -8,5 +8,5 @@ export interface AgentProfileCardResourcedProps {
8
8
  children?: React.ReactNode;
9
9
  viewingUserId?: string;
10
10
  product?: string;
11
- }
11
+ } & AgentActionsType;
12
12
  export declare const AgentProfileCardResourced: (props: AgentProfileCardResourcedProps) => JSX.Element | null;
@@ -1,11 +1,10 @@
1
1
  /// <reference types="react" />
2
- export declare const AgentProfileCardLazy: import("react").LazyExoticComponent<({ agent, isLoading, isCreatedByViewingUser, cloudId, onOpenChat, product, hasError, errorType, }: {
2
+ export declare const AgentProfileCardLazy: import("react").LazyExoticComponent<({ agent, isLoading, isCreatedByViewingUser, cloudId, onChatClick, product, hasError, errorType, onConversationStartersClick, }: {
3
3
  agent?: import("../../types").RovoAgentProfileCardInfo | undefined;
4
4
  isLoading?: boolean | undefined;
5
5
  hasError?: boolean | undefined;
6
6
  isCreatedByViewingUser?: boolean | undefined;
7
7
  cloudId?: string | undefined;
8
- onOpenChat?: ((agentId: string) => void) | undefined;
9
8
  product?: string | undefined;
10
9
  errorType?: import("../..").ProfileCardErrorType | undefined;
11
- }) => JSX.Element>;
10
+ } & import("../../types").AgentActionsType) => JSX.Element>;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="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, }: ProfileCardTriggerProps): 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, }: ProfileCardTriggerProps): JSX.Element;
@@ -5,4 +5,4 @@ export declare const PopupTrigger: <T>({ children, trigger, forwardRef, showProf
5
5
  showProfilecard: () => void;
6
6
  hideProfilecard: () => void;
7
7
  forwardRef: React.Ref<HTMLSpanElement>;
8
- } & Pick<ProfileCardTriggerProps<T>, "children" | "trigger" | "ariaLabelledBy">) => JSX.Element;
8
+ } & Pick<ProfileCardTriggerProps<T>, "trigger" | "children" | "ariaLabelledBy">) => JSX.Element;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare const ProfileCardWrapper: ({ children }: {
3
+ children: React.ReactNode;
4
+ }) => JSX.Element;
@@ -158,6 +158,7 @@ export interface ProfileCardTriggerProps {
158
158
  offset?: [number, number];
159
159
  product?: string;
160
160
  viewingUserId?: string;
161
+ agentActions?: AgentActionsType;
161
162
  }
162
163
  export interface ProfileCardTriggerState {
163
164
  visible?: boolean;
@@ -292,13 +293,16 @@ export interface TeamProfileCardTriggerProps extends TeamProfilecardCoreProps {
292
293
  */
293
294
  cloudId?: string;
294
295
  }
295
- export interface AgentProfileCardTriggerProps {
296
+ export interface AgentActionsType {
297
+ onChatClick?: () => void;
298
+ onConversationStartersClick?: (starter: string) => void;
299
+ }
300
+ export interface AgentProfileCardTriggerProps extends AgentActionsType {
296
301
  agentId: string;
297
302
  cloudId?: string;
298
303
  autoFocus?: boolean;
299
304
  resourceClient: ProfileClient;
300
305
  actions?: ProfileCardAction[];
301
- onOpenChat?: (agentId: string) => void;
302
306
  position?: ProfilecardTriggerPosition;
303
307
  trigger?: TriggerType;
304
308
  children: React.ReactNode;
@@ -366,6 +370,7 @@ export interface ProfilecardProps {
366
370
  openKudosDrawer?: () => void;
367
371
  isTriggeredUsingKeyboard?: boolean;
368
372
  disabledAriaAttributes?: boolean;
373
+ agentActions?: AgentActionsType;
369
374
  }
370
375
  export type AnalyticsFromDuration = (duration: number) => AnalyticsEventPayload;
371
376
  export type AnalyticsFunction = (generator: AnalyticsFromDuration) => void;
@@ -1,14 +1,13 @@
1
1
  /// <reference types="react" />
2
- import { type ProfileCardErrorType, type RovoAgentProfileCardInfo } from '../../types';
2
+ import { type AgentActionsType, type ProfileCardErrorType, type RovoAgentProfileCardInfo } from '../../types';
3
3
  type AgentProfileCardProps = {
4
4
  agent?: RovoAgentProfileCardInfo;
5
5
  isLoading?: boolean;
6
6
  hasError?: boolean;
7
7
  isCreatedByViewingUser?: boolean;
8
8
  cloudId?: string;
9
- onOpenChat?: (agentId: string) => void;
10
9
  product?: string;
11
10
  errorType?: ProfileCardErrorType;
12
- };
13
- declare const AgentProfileCard: ({ agent, isLoading, isCreatedByViewingUser, cloudId, onOpenChat, product, hasError, errorType, }: AgentProfileCardProps) => JSX.Element;
11
+ } & AgentActionsType;
12
+ declare const AgentProfileCard: ({ agent, isLoading, isCreatedByViewingUser, cloudId, onChatClick, product, hasError, errorType, onConversationStartersClick, }: AgentProfileCardProps) => JSX.Element;
14
13
  export default AgentProfileCard;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { type ProfileClient, type TriggerType } from '../../types';
3
- export interface AgentProfileCardResourcedProps {
2
+ import { type AgentActionsType, type ProfileClient, type TriggerType } from '../../types';
3
+ export type AgentProfileCardResourcedProps = {
4
4
  accountId: string;
5
5
  cloudId: string;
6
6
  resourceClient: ProfileClient;
@@ -8,5 +8,5 @@ export interface AgentProfileCardResourcedProps {
8
8
  children?: React.ReactNode;
9
9
  viewingUserId?: string;
10
10
  product?: string;
11
- }
11
+ } & AgentActionsType;
12
12
  export declare const AgentProfileCardResourced: (props: AgentProfileCardResourcedProps) => JSX.Element | null;
@@ -1,11 +1,10 @@
1
1
  /// <reference types="react" />
2
- export declare const AgentProfileCardLazy: import("react").LazyExoticComponent<({ agent, isLoading, isCreatedByViewingUser, cloudId, onOpenChat, product, hasError, errorType, }: {
2
+ export declare const AgentProfileCardLazy: import("react").LazyExoticComponent<({ agent, isLoading, isCreatedByViewingUser, cloudId, onChatClick, product, hasError, errorType, onConversationStartersClick, }: {
3
3
  agent?: import("../../types").RovoAgentProfileCardInfo | undefined;
4
4
  isLoading?: boolean | undefined;
5
5
  hasError?: boolean | undefined;
6
6
  isCreatedByViewingUser?: boolean | undefined;
7
7
  cloudId?: string | undefined;
8
- onOpenChat?: ((agentId: string) => void) | undefined;
9
8
  product?: string | undefined;
10
9
  errorType?: import("../..").ProfileCardErrorType | undefined;
11
- }) => JSX.Element>;
10
+ } & import("../../types").AgentActionsType) => JSX.Element>;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="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, }: ProfileCardTriggerProps): 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, }: ProfileCardTriggerProps): JSX.Element;
@@ -5,4 +5,4 @@ export declare const PopupTrigger: <T>({ children, trigger, forwardRef, showProf
5
5
  showProfilecard: () => void;
6
6
  hideProfilecard: () => void;
7
7
  forwardRef: React.Ref<HTMLSpanElement>;
8
- } & Pick<ProfileCardTriggerProps<T>, "children" | "trigger" | "ariaLabelledBy">) => JSX.Element;
8
+ } & Pick<ProfileCardTriggerProps<T>, "trigger" | "children" | "ariaLabelledBy">) => JSX.Element;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare const ProfileCardWrapper: ({ children }: {
3
+ children: React.ReactNode;
4
+ }) => JSX.Element;
@@ -161,6 +161,7 @@ export interface ProfileCardTriggerProps {
161
161
  ];
162
162
  product?: string;
163
163
  viewingUserId?: string;
164
+ agentActions?: AgentActionsType;
164
165
  }
165
166
  export interface ProfileCardTriggerState {
166
167
  visible?: boolean;
@@ -295,13 +296,16 @@ export interface TeamProfileCardTriggerProps extends TeamProfilecardCoreProps {
295
296
  */
296
297
  cloudId?: string;
297
298
  }
298
- export interface AgentProfileCardTriggerProps {
299
+ export interface AgentActionsType {
300
+ onChatClick?: () => void;
301
+ onConversationStartersClick?: (starter: string) => void;
302
+ }
303
+ export interface AgentProfileCardTriggerProps extends AgentActionsType {
299
304
  agentId: string;
300
305
  cloudId?: string;
301
306
  autoFocus?: boolean;
302
307
  resourceClient: ProfileClient;
303
308
  actions?: ProfileCardAction[];
304
- onOpenChat?: (agentId: string) => void;
305
309
  position?: ProfilecardTriggerPosition;
306
310
  trigger?: TriggerType;
307
311
  children: React.ReactNode;
@@ -372,6 +376,7 @@ export interface ProfilecardProps {
372
376
  openKudosDrawer?: () => void;
373
377
  isTriggeredUsingKeyboard?: boolean;
374
378
  disabledAriaAttributes?: boolean;
379
+ agentActions?: AgentActionsType;
375
380
  }
376
381
  export type AnalyticsFromDuration = (duration: number) => AnalyticsEventPayload;
377
382
  export type AnalyticsFunction = (generator: AnalyticsFromDuration) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/profilecard",
3
- "version": "19.21.0",
3
+ "version": "19.22.0",
4
4
  "description": "A React component to display a card with user information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -58,7 +58,7 @@
58
58
  "@atlaskit/avatar": "^21.15.0",
59
59
  "@atlaskit/avatar-group": "^9.11.0",
60
60
  "@atlaskit/button": "^20.1.0",
61
- "@atlaskit/dropdown-menu": "^12.17.0",
61
+ "@atlaskit/dropdown-menu": "^12.18.0",
62
62
  "@atlaskit/empty-state": "^7.11.0",
63
63
  "@atlaskit/focus-ring": "^1.6.0",
64
64
  "@atlaskit/give-kudos": "^2.1.1",
@@ -69,7 +69,7 @@
69
69
  "@atlaskit/platform-feature-flags": "^0.3.0",
70
70
  "@atlaskit/popup": "^1.23.0",
71
71
  "@atlaskit/primitives": "^12.0.0",
72
- "@atlaskit/rovo-agent-components": "0.5.0",
72
+ "@atlaskit/rovo-agent-components": "0.6.0",
73
73
  "@atlaskit/spinner": "^16.3.0",
74
74
  "@atlaskit/theme": "^13.0.0",
75
75
  "@atlaskit/tokens": "^1.59.0",