@atlaskit/profilecard 24.14.0 → 24.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/__tests__/vr-tests/__snapshots__/user-profilecard/error-state--default.png +0 -0
  3. package/__tests__/vr-tests/agent-profilecard.vr.tsx +7 -1
  4. package/__tests__/vr-tests/user-profilecard.vr.tsx +42 -6
  5. package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +1 -1
  6. package/dist/cjs/client/getTeamFromAGG.js +1 -1
  7. package/dist/cjs/components/Agent/Actions.js +5 -2
  8. package/dist/cjs/components/Agent/ActionsCompiled.compiled.css +19 -0
  9. package/dist/cjs/components/Agent/ActionsCompiled.js +140 -0
  10. package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +2 -4
  11. package/dist/cjs/components/Agent/AgentProfileCard.js +5 -1
  12. package/dist/cjs/components/Agent/AgentProfileCardCompiled.compiled.css +8 -0
  13. package/dist/cjs/components/Agent/AgentProfileCardCompiled.js +242 -0
  14. package/dist/cjs/components/Agent/AgentProfileCardWrapper.compiled.css +1 -0
  15. package/dist/cjs/components/Agent/AgentProfileCardWrapper.js +9 -8
  16. package/dist/cjs/components/Agent/ConversationStarters.js +2 -4
  17. package/dist/cjs/components/Error/ErrorMessage.js +3 -3
  18. package/dist/cjs/components/Team/TeamProfileCardTrigger.js +3 -3
  19. package/dist/cjs/components/User/ProfileCardDetails.compiled.css +0 -1
  20. package/dist/cjs/components/User/ProfileCardDetails.js +2 -4
  21. package/dist/cjs/components/User/ReportingLinesDetails.js +4 -1
  22. package/dist/cjs/components/User/ReportingLinesDetailsCompiled.compiled.css +11 -0
  23. package/dist/cjs/components/User/ReportingLinesDetailsCompiled.js +109 -0
  24. package/dist/cjs/components/common/ProfileCardWrapper.compiled.css +1 -0
  25. package/dist/cjs/components/common/ProfileCardWrapper.js +9 -8
  26. package/dist/cjs/components/team-profile-card/team-actions/more-actions/index.js +2 -4
  27. package/dist/cjs/styled/CoverImage.compiled.css +2 -0
  28. package/dist/cjs/styled/CoverImage.js +4 -2
  29. package/dist/cjs/styled/Error.compiled.css +0 -2
  30. package/dist/cjs/styled/Error.js +5 -3
  31. package/dist/cjs/util/analytics.js +2 -2
  32. package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +1 -1
  33. package/dist/es2019/client/getTeamFromAGG.js +1 -1
  34. package/dist/es2019/components/Agent/Actions.js +5 -2
  35. package/dist/es2019/components/Agent/ActionsCompiled.compiled.css +19 -0
  36. package/dist/es2019/components/Agent/ActionsCompiled.js +116 -0
  37. package/dist/es2019/components/Agent/AgentDeleteConfirmationModal.js +1 -2
  38. package/dist/es2019/components/Agent/AgentProfileCard.js +5 -1
  39. package/dist/es2019/components/Agent/AgentProfileCardCompiled.compiled.css +8 -0
  40. package/dist/es2019/components/Agent/AgentProfileCardCompiled.js +186 -0
  41. package/dist/es2019/components/Agent/AgentProfileCardWrapper.compiled.css +1 -0
  42. package/dist/es2019/components/Agent/AgentProfileCardWrapper.js +8 -7
  43. package/dist/es2019/components/Agent/ConversationStarters.js +1 -3
  44. package/dist/es2019/components/Error/ErrorMessage.js +1 -2
  45. package/dist/es2019/components/Team/TeamProfileCardTrigger.js +1 -2
  46. package/dist/es2019/components/User/ProfileCardDetails.compiled.css +0 -1
  47. package/dist/es2019/components/User/ProfileCardDetails.js +1 -4
  48. package/dist/es2019/components/User/ReportingLinesDetails.js +4 -1
  49. package/dist/es2019/components/User/ReportingLinesDetailsCompiled.compiled.css +11 -0
  50. package/dist/es2019/components/User/ReportingLinesDetailsCompiled.js +96 -0
  51. package/dist/es2019/components/common/ProfileCardWrapper.compiled.css +1 -0
  52. package/dist/es2019/components/common/ProfileCardWrapper.js +8 -7
  53. package/dist/es2019/components/team-profile-card/team-actions/more-actions/index.js +1 -2
  54. package/dist/es2019/styled/CoverImage.compiled.css +2 -0
  55. package/dist/es2019/styled/CoverImage.js +4 -2
  56. package/dist/es2019/styled/Error.compiled.css +0 -2
  57. package/dist/es2019/styled/Error.js +6 -4
  58. package/dist/es2019/util/analytics.js +2 -2
  59. package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +1 -1
  60. package/dist/esm/client/getTeamFromAGG.js +1 -1
  61. package/dist/esm/components/Agent/Actions.js +5 -2
  62. package/dist/esm/components/Agent/ActionsCompiled.compiled.css +19 -0
  63. package/dist/esm/components/Agent/ActionsCompiled.js +131 -0
  64. package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +1 -2
  65. package/dist/esm/components/Agent/AgentProfileCard.js +5 -1
  66. package/dist/esm/components/Agent/AgentProfileCardCompiled.compiled.css +8 -0
  67. package/dist/esm/components/Agent/AgentProfileCardCompiled.js +233 -0
  68. package/dist/esm/components/Agent/AgentProfileCardWrapper.compiled.css +1 -0
  69. package/dist/esm/components/Agent/AgentProfileCardWrapper.js +8 -7
  70. package/dist/esm/components/Agent/ConversationStarters.js +1 -3
  71. package/dist/esm/components/Error/ErrorMessage.js +1 -2
  72. package/dist/esm/components/Team/TeamProfileCardTrigger.js +1 -2
  73. package/dist/esm/components/User/ProfileCardDetails.compiled.css +0 -1
  74. package/dist/esm/components/User/ProfileCardDetails.js +1 -4
  75. package/dist/esm/components/User/ReportingLinesDetails.js +4 -1
  76. package/dist/esm/components/User/ReportingLinesDetailsCompiled.compiled.css +11 -0
  77. package/dist/esm/components/User/ReportingLinesDetailsCompiled.js +102 -0
  78. package/dist/esm/components/common/ProfileCardWrapper.compiled.css +1 -0
  79. package/dist/esm/components/common/ProfileCardWrapper.js +8 -7
  80. package/dist/esm/components/team-profile-card/team-actions/more-actions/index.js +1 -2
  81. package/dist/esm/styled/CoverImage.compiled.css +2 -0
  82. package/dist/esm/styled/CoverImage.js +4 -2
  83. package/dist/esm/styled/Error.compiled.css +0 -2
  84. package/dist/esm/styled/Error.js +6 -4
  85. package/dist/esm/util/analytics.js +2 -2
  86. package/dist/types/components/Agent/Actions.d.ts +10 -1
  87. package/dist/types/components/Agent/ActionsCompiled.d.ts +14 -0
  88. package/dist/types/components/Agent/AgentProfileCard.d.ts +13 -3
  89. package/dist/types/components/Agent/AgentProfileCardCompiled.d.ts +4 -0
  90. package/dist/types/components/Agent/lazyAgentProfileCard.d.ts +12 -1
  91. package/dist/types/components/User/ReportingLinesDetails.d.ts +2 -2
  92. package/dist/types/components/User/ReportingLinesDetailsCompiled.d.ts +5 -0
  93. package/dist/types-ts4.5/components/Agent/Actions.d.ts +10 -1
  94. package/dist/types-ts4.5/components/Agent/ActionsCompiled.d.ts +14 -0
  95. package/dist/types-ts4.5/components/Agent/AgentProfileCard.d.ts +13 -3
  96. package/dist/types-ts4.5/components/Agent/AgentProfileCardCompiled.d.ts +4 -0
  97. package/dist/types-ts4.5/components/Agent/lazyAgentProfileCard.d.ts +12 -1
  98. package/dist/types-ts4.5/components/User/ReportingLinesDetails.d.ts +2 -2
  99. package/dist/types-ts4.5/components/User/ReportingLinesDetailsCompiled.d.ts +5 -0
  100. package/package.json +11 -5
@@ -0,0 +1,131 @@
1
+ /* ActionsCompiled.tsx generated by @compiled/babel-plugin v0.38.1 */
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
+ import "./ActionsCompiled.compiled.css";
6
+ import { ax, ix } from "@compiled/react/runtime";
7
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
+ 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; }
9
+ 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; }
10
+ import React, { useCallback, useState } from 'react';
11
+ import { defineMessages, useIntl } from 'react-intl-next';
12
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
13
+ import Button from '@atlaskit/button/new';
14
+ import { fg } from '@atlaskit/platform-feature-flags';
15
+ import { Box, Inline } from '@atlaskit/primitives/compiled';
16
+ import { AgentDropdownMenu, ChatPillIcon } from '@atlaskit/rovo-agent-components';
17
+ import { fireEvent } from '../../util/analytics';
18
+ import { AgentDeleteConfirmationModal } from './AgentDeleteConfirmationModal';
19
+ var styles = {
20
+ chatToAgentButtonContainer: "_1bsb1osq",
21
+ chatToAgentButtonWrapper: "_1e0c1txw _1bah1h6o _k48p1wq8 _4t3igktf",
22
+ chatPillButtonInlineStyles: "_18zrv77o",
23
+ chatPillTextStyles: "_1nmz1hna _y3gn1e5h _o5721jtm",
24
+ chatPillIconWrapper: "_1ul9gktf _4t3igktf",
25
+ actionsWrapperStyles: "_189ee4h9 _1h6dmuej _15a5nqa1 _ca0qpxbi _u5f3pxbi _n3tdpxbi _19bvpxbi _1pfhpxbi _syaz1fxt"
26
+ };
27
+ export var AgentActions = function AgentActions(_ref) {
28
+ var onEditAgent = _ref.onEditAgent,
29
+ onDeleteAgent = _ref.onDeleteAgent,
30
+ onDuplicateAgent = _ref.onDuplicateAgent,
31
+ onCopyAgent = _ref.onCopyAgent,
32
+ onChatClick = _ref.onChatClick,
33
+ onViewFullProfileClick = _ref.onViewFullProfileClick,
34
+ agent = _ref.agent,
35
+ resourceClient = _ref.resourceClient;
36
+ var _useIntl = useIntl(),
37
+ formatMessage = _useIntl.formatMessage;
38
+ var _useAnalyticsEvents = useAnalyticsEvents(),
39
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
40
+ var _useState = useState(false),
41
+ _useState2 = _slicedToArray(_useState, 2),
42
+ isDeleteModalOpen = _useState2[0],
43
+ setIsDeleteModalOpen = _useState2[1];
44
+ var isForgeAgent = agent.creator_type === 'FORGE' || agent.creator_type === 'THIRD_PARTY';
45
+ var loadAgentPermissions = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
46
+ var _yield$resourceClient, _yield$resourceClient2, AGENT_CREATE, AGENT_UPDATE, AGENT_DEACTIVATE;
47
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
48
+ while (1) switch (_context.prev = _context.next) {
49
+ case 0:
50
+ _context.next = 2;
51
+ return resourceClient.getRovoAgentPermissions(agent.id);
52
+ case 2:
53
+ _yield$resourceClient = _context.sent;
54
+ _yield$resourceClient2 = _yield$resourceClient.permissions;
55
+ AGENT_CREATE = _yield$resourceClient2.AGENT_CREATE;
56
+ AGENT_UPDATE = _yield$resourceClient2.AGENT_UPDATE;
57
+ AGENT_DEACTIVATE = _yield$resourceClient2.AGENT_DEACTIVATE;
58
+ return _context.abrupt("return", _objectSpread(_objectSpread({}, fg('agent_studio_fe_permissions_settings_m1') && {
59
+ isCreateEnabled: AGENT_CREATE.permitted
60
+ }), {}, {
61
+ isEditEnabled: AGENT_UPDATE.permitted,
62
+ isDeleteEnabled: AGENT_DEACTIVATE.permitted
63
+ }));
64
+ case 8:
65
+ case "end":
66
+ return _context.stop();
67
+ }
68
+ }, _callee);
69
+ })), [agent.id, resourceClient]);
70
+ var handleDeleteAgent = useCallback(function () {
71
+ fireEvent(createAnalyticsEvent, {
72
+ action: 'clicked',
73
+ actionSubject: 'button',
74
+ actionSubjectId: 'deleteAgentButton',
75
+ attributes: {
76
+ agentId: agent.id,
77
+ source: 'agentProfileCard'
78
+ }
79
+ });
80
+ setIsDeleteModalOpen(true);
81
+ }, [agent.id, createAnalyticsEvent]);
82
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Inline, {
83
+ space: "space.100",
84
+ xcss: styles.actionsWrapperStyles
85
+ }, /*#__PURE__*/React.createElement(Box, {
86
+ xcss: styles.chatToAgentButtonContainer
87
+ }, /*#__PURE__*/React.createElement(Button, {
88
+ shouldFitContainer: true,
89
+ onClick: function onClick(e) {
90
+ e.stopPropagation();
91
+ onChatClick(e);
92
+ }
93
+ }, /*#__PURE__*/React.createElement(Box, {
94
+ xcss: styles.chatToAgentButtonWrapper
95
+ }, /*#__PURE__*/React.createElement(Inline, {
96
+ space: "space.050",
97
+ xcss: styles.chatPillButtonInlineStyles,
98
+ alignBlock: "center"
99
+ }, /*#__PURE__*/React.createElement(Box, {
100
+ xcss: styles.chatPillIconWrapper
101
+ }, /*#__PURE__*/React.createElement(ChatPillIcon, null)), /*#__PURE__*/React.createElement(Box, {
102
+ xcss: styles.chatPillTextStyles
103
+ }, formatMessage(messages.actionChatToAgent)))))), /*#__PURE__*/React.createElement(AgentDropdownMenu, {
104
+ agentId: agent.id,
105
+ onDeleteAgent: handleDeleteAgent,
106
+ onEditAgent: onEditAgent,
107
+ onDuplicateAgent: onDuplicateAgent,
108
+ onCopyAgent: onCopyAgent,
109
+ isForgeAgent: isForgeAgent,
110
+ loadAgentPermissions: loadAgentPermissions,
111
+ loadPermissionsOnMount: true,
112
+ onViewAgentFullProfileClick: onViewFullProfileClick,
113
+ doesAgentHaveIdentityAccountId: !!agent.identity_account_id,
114
+ shouldTriggerStopPropagation: true
115
+ })), /*#__PURE__*/React.createElement(AgentDeleteConfirmationModal, {
116
+ isOpen: isDeleteModalOpen,
117
+ onClose: function onClose() {
118
+ setIsDeleteModalOpen(false);
119
+ },
120
+ onSubmit: onDeleteAgent,
121
+ agentId: agent.id,
122
+ agentName: agent.name
123
+ }));
124
+ };
125
+ var messages = defineMessages({
126
+ actionChatToAgent: {
127
+ id: 'ptc-directory.agent-profile.action.dropdown.chat-to-agent.nonfinal',
128
+ defaultMessage: 'Chat to Agent',
129
+ description: 'Text for the "chat to agent" action to chat to the agent'
130
+ }
131
+ });
@@ -4,8 +4,7 @@ import React, { useCallback } from 'react';
4
4
  import { defineMessages, useIntl } from 'react-intl-next';
5
5
  import Button from '@atlaskit/button/new';
6
6
  import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
7
- // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
8
- import { Text } from '@atlaskit/primitives';
7
+ import { Text } from '@atlaskit/primitives/compiled';
9
8
  export var AgentDeleteConfirmationModal = function AgentDeleteConfirmationModal(_ref) {
10
9
  var onClose = _ref.onClose,
11
10
  agentName = _ref.agentName,
@@ -4,6 +4,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import React, { useCallback, useEffect, useState } from 'react';
5
5
  import { useIntl } from 'react-intl-next';
6
6
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
7
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
7
8
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
8
9
  import { Box, Stack, xcss } from '@atlaskit/primitives';
9
10
  import { AgentAvatar, AgentBanner, AgentProfileCreator, AgentProfileInfo, AgentStarCount } from '@atlaskit/rovo-agent-components';
@@ -11,6 +12,7 @@ import { fireEvent, profileCardRendered } from '../../util/analytics';
11
12
  import { LoadingState } from '../common/LoadingState';
12
13
  import { ErrorMessage } from '../Error';
13
14
  import { AgentActions } from './Actions';
15
+ import { default as AgentProfileCardCompiled } from './AgentProfileCardCompiled';
14
16
  import { AgentProfileCardWrapper } from './AgentProfileCardWrapper';
15
17
  import { ConversationStarters } from './ConversationStarters';
16
18
  import { useAgentUrlActions } from './hooks/useAgentActions';
@@ -165,6 +167,7 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
165
167
  errorType: errorType,
166
168
  fireAnalytics: fireAnalytics
167
169
  // TODO: Add fireAnalyticsNext
170
+ // NOTE: Add it to AgentProfileCardCompiled
168
171
  ,
169
172
  fireAnalyticsNext: function fireAnalyticsNext() {}
170
173
  }));
@@ -239,4 +242,5 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
239
242
  }
240
243
  })));
241
244
  };
242
- export default AgentProfileCard;
245
+ var AgentProfileCardExport = componentWithFG('profilecard_primitives_compiled', AgentProfileCardCompiled, AgentProfileCard);
246
+ export default AgentProfileCardExport;
@@ -0,0 +1,8 @@
1
+
2
+ ._2rko1mok{border-radius:var(--ds-radius-large,8px)}
3
+ ._18zrpxbi{padding-inline:var(--ds-space-200,1pc)}._154i1ejb{top:var(--ds-space-300,24px)}
4
+ ._16qs1cd0{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #091e4226,0 0 1px #091e424f)}
5
+ ._1ltvpxbi{left:var(--ds-space-200,1pc)}
6
+ ._1q51xy5q{padding-block-start:var(--ds-space-400,2pc)}
7
+ ._kqswh2mm{position:relative}
8
+ ._kqswstnw{position:absolute}
@@ -0,0 +1,233 @@
1
+ /* AgentProfileCardCompiled.tsx generated by @compiled/babel-plugin v0.38.1 */
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+ import "./AgentProfileCardCompiled.compiled.css";
5
+ import { ax, ix } from "@compiled/react/runtime";
6
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
7
+ import React, { useCallback, useEffect, useState } from 'react';
8
+ import { useIntl } from 'react-intl-next';
9
+ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
10
+ import { Box, Stack } from '@atlaskit/primitives/compiled';
11
+ import { AgentAvatar, AgentBanner, AgentProfileCreator, AgentProfileInfo, AgentStarCount } from '@atlaskit/rovo-agent-components';
12
+ import { fireEvent, profileCardRendered } from '../../util/analytics';
13
+ import { LoadingState } from '../common/LoadingState';
14
+ import { ErrorMessage } from '../Error';
15
+ import { AgentActions } from './Actions';
16
+ import { AgentProfileCardWrapper } from './AgentProfileCardWrapper';
17
+ import { ConversationStarters } from './ConversationStarters';
18
+ import { useAgentUrlActions } from './hooks/useAgentActions';
19
+ import { messages } from './messages';
20
+ var styles = {
21
+ detailWrapper: "_18zrpxbi _1q51xy5q",
22
+ avatarStyles: "_kqswstnw _154i1ejb _1ltvpxbi",
23
+ cardContainerStyles: "_2rko1mok _16qs1cd0 _kqswh2mm"
24
+ };
25
+ var AgentProfileCard = function AgentProfileCard(_ref) {
26
+ var _agent$user_defined_c, _agent$external_confi, _agent$external_confi2, _agent$creatorInfo, _agent$creatorInfo2, _agent$creatorInfo3, _agent$creatorInfo4;
27
+ var agent = _ref.agent,
28
+ isLoading = _ref.isLoading,
29
+ cloudId = _ref.cloudId,
30
+ onChatClick = _ref.onChatClick,
31
+ hasError = _ref.hasError,
32
+ errorType = _ref.errorType,
33
+ onConversationStartersClick = _ref.onConversationStartersClick,
34
+ resourceClient = _ref.resourceClient,
35
+ addFlag = _ref.addFlag,
36
+ onDeleteAgent = _ref.onDeleteAgent;
37
+ var _useAgentUrlActions = useAgentUrlActions({
38
+ cloudId: cloudId || '',
39
+ source: 'agentProfileCard'
40
+ }),
41
+ _onEditAgent = _useAgentUrlActions.onEditAgent,
42
+ _onCopyAgent = _useAgentUrlActions.onCopyAgent,
43
+ _onDuplicateAgent = _useAgentUrlActions.onDuplicateAgent,
44
+ onOpenChatFullScreen = _useAgentUrlActions.onOpenChat,
45
+ onConversationStarter = _useAgentUrlActions.onConversationStarter,
46
+ onViewFullProfile = _useAgentUrlActions.onViewFullProfile;
47
+ var _useState = useState(false),
48
+ _useState2 = _slicedToArray(_useState, 2),
49
+ isStarred = _useState2[0],
50
+ setIsStarred = _useState2[1];
51
+ var _useState3 = useState(),
52
+ _useState4 = _slicedToArray(_useState3, 2),
53
+ starCount = _useState4[0],
54
+ setStarCount = _useState4[1];
55
+ var _useIntl = useIntl(),
56
+ formatMessage = _useIntl.formatMessage;
57
+ var userDefinedConversationStarters = agent === null || agent === void 0 || (_agent$user_defined_c = agent.user_defined_conversation_starters) === null || _agent$user_defined_c === void 0 ? void 0 : _agent$user_defined_c.map(function (starter) {
58
+ return {
59
+ message: starter,
60
+ type: 'user-defined'
61
+ };
62
+ });
63
+ useEffect(function () {
64
+ setIsStarred(!!(agent !== null && agent !== void 0 && agent.favourite));
65
+ setStarCount(agent === null || agent === void 0 ? void 0 : agent.favourite_count);
66
+ }, [agent === null || agent === void 0 ? void 0 : agent.favourite, agent === null || agent === void 0 ? void 0 : agent.favourite_count]);
67
+ var _useAnalyticsEvents = useAnalyticsEvents(),
68
+ createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
69
+ var fireAnalytics = useCallback(function (payload) {
70
+ if (createAnalyticsEvent) {
71
+ fireEvent(createAnalyticsEvent, payload);
72
+ }
73
+ }, [createAnalyticsEvent]);
74
+ var handleSetFavourite = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
75
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
76
+ while (1) switch (_context.prev = _context.next) {
77
+ case 0:
78
+ if (!(agent !== null && agent !== void 0 && agent.id)) {
79
+ _context.next = 10;
80
+ break;
81
+ }
82
+ _context.prev = 1;
83
+ _context.next = 4;
84
+ return resourceClient.setFavouriteAgent(agent.id, !isStarred, fireAnalytics);
85
+ case 4:
86
+ if (isStarred) {
87
+ setStarCount(starCount ? starCount - 1 : 0);
88
+ } else {
89
+ setStarCount((starCount || 0) + 1);
90
+ }
91
+ setIsStarred(!isStarred);
92
+ _context.next = 10;
93
+ break;
94
+ case 8:
95
+ _context.prev = 8;
96
+ _context.t0 = _context["catch"](1);
97
+ case 10:
98
+ case "end":
99
+ return _context.stop();
100
+ }
101
+ }, _callee, null, [[1, 8]]);
102
+ })), [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, isStarred, resourceClient, starCount]);
103
+ var handleOnDelete = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
104
+ var _onDeleteAgent, restore;
105
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
106
+ while (1) switch (_context2.prev = _context2.next) {
107
+ case 0:
108
+ if (!(agent && onDeleteAgent)) {
109
+ _context2.next = 12;
110
+ break;
111
+ }
112
+ // Optimistically remove from cache
113
+ _onDeleteAgent = onDeleteAgent(agent.id), restore = _onDeleteAgent.restore;
114
+ _context2.prev = 2;
115
+ _context2.next = 5;
116
+ return resourceClient.deleteAgent(agent.id, fireAnalytics);
117
+ case 5:
118
+ addFlag === null || addFlag === void 0 || addFlag({
119
+ title: formatMessage(messages.agentDeletedSuccessFlagTitle),
120
+ description: formatMessage(messages.agentDeletedSuccessFlagDescription, {
121
+ agentName: agent.name
122
+ }),
123
+ type: 'success',
124
+ id: 'ptc-directory.agent-profile.delete-agent-success'
125
+ });
126
+ _context2.next = 12;
127
+ break;
128
+ case 8:
129
+ _context2.prev = 8;
130
+ _context2.t0 = _context2["catch"](2);
131
+ // Restore agent to cache on error
132
+ restore();
133
+ addFlag === null || addFlag === void 0 || addFlag({
134
+ title: formatMessage(messages.agentDeletedErrorFlagTitle),
135
+ description: formatMessage(messages.agentDeletedErrorFlagDescription),
136
+ type: 'error',
137
+ id: 'ptc-directory.agent-profile.delete-agent-error'
138
+ });
139
+ case 12:
140
+ case "end":
141
+ return _context2.stop();
142
+ }
143
+ }, _callee2, null, [[2, 8]]);
144
+ })), [addFlag, agent, formatMessage, onDeleteAgent, resourceClient, fireAnalytics]);
145
+ useEffect(function () {
146
+ if (!isLoading && agent) {
147
+ fireAnalytics(profileCardRendered('agent', 'content'));
148
+ }
149
+ }, [agent, fireAnalytics, isLoading]);
150
+ if (isLoading) {
151
+ return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(LoadingState, {
152
+ profileType: "agent",
153
+ fireAnalytics: fireAnalytics
154
+ }));
155
+ }
156
+ if (hasError || !agent) {
157
+ return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(ErrorMessage, {
158
+ fireAnalyticsNext: function fireAnalyticsNext() {},
159
+ errorType: errorType,
160
+ fireAnalytics: fireAnalytics
161
+ }));
162
+ }
163
+ return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(Box, {
164
+ xcss: styles.cardContainerStyles
165
+ }, /*#__PURE__*/React.createElement(AgentBanner, {
166
+ agentId: agent.id,
167
+ agentNamedId: (_agent$external_confi = agent.external_config_reference) !== null && _agent$external_confi !== void 0 ? _agent$external_confi : agent.named_id,
168
+ height: 96,
169
+ agentIdentityAccountId: agent.identity_account_id
170
+ }), /*#__PURE__*/React.createElement(Box, {
171
+ xcss: styles.avatarStyles
172
+ }, /*#__PURE__*/React.createElement(AgentAvatar, {
173
+ agentId: agent.id,
174
+ agentNamedId: (_agent$external_confi2 = agent.external_config_reference) !== null && _agent$external_confi2 !== void 0 ? _agent$external_confi2 : agent.named_id,
175
+ agentIdentityAccountId: agent.identity_account_id,
176
+ size: "xlarge",
177
+ isForgeAgent: agent.creator_type === 'FORGE' || agent.creator_type === 'THIRD_PARTY',
178
+ forgeAgentIconUrl: agent.icon
179
+ })), /*#__PURE__*/React.createElement(Stack, {
180
+ space: "space.100",
181
+ xcss: styles.detailWrapper
182
+ }, /*#__PURE__*/React.createElement(AgentProfileInfo, {
183
+ agentName: agent.name,
184
+ isStarred: isStarred,
185
+ onStarToggle: handleSetFavourite,
186
+ isHidden: agent.visibility === 'PRIVATE',
187
+ creatorRender: ((_agent$creatorInfo = agent.creatorInfo) === null || _agent$creatorInfo === void 0 ? void 0 : _agent$creatorInfo.type) && /*#__PURE__*/React.createElement(AgentProfileCreator, {
188
+ creator: {
189
+ type: (_agent$creatorInfo2 = agent.creatorInfo) === null || _agent$creatorInfo2 === void 0 ? void 0 : _agent$creatorInfo2.type,
190
+ name: ((_agent$creatorInfo3 = agent.creatorInfo) === null || _agent$creatorInfo3 === void 0 ? void 0 : _agent$creatorInfo3.name) || '',
191
+ profileLink: ((_agent$creatorInfo4 = agent.creatorInfo) === null || _agent$creatorInfo4 === void 0 ? void 0 : _agent$creatorInfo4.profileLink) || ''
192
+ },
193
+ isLoading: false,
194
+ onCreatorLinkClick: function onCreatorLinkClick() {}
195
+ }),
196
+ starCountRender: /*#__PURE__*/React.createElement(AgentStarCount, {
197
+ starCount: starCount,
198
+ isLoading: false
199
+ }),
200
+ agentDescription: agent.description
201
+ }), /*#__PURE__*/React.createElement(ConversationStarters, {
202
+ isAgentDefault: agent.is_default,
203
+ userDefinedConversationStarters: userDefinedConversationStarters,
204
+ onConversationStarterClick: function onConversationStarterClick(conversationStarter) {
205
+ onConversationStartersClick ? onConversationStartersClick(conversationStarter) : onConversationStarter({
206
+ agentId: agent.id,
207
+ prompt: conversationStarter.message
208
+ });
209
+ }
210
+ })), /*#__PURE__*/React.createElement(AgentActions, {
211
+ agent: agent,
212
+ onEditAgent: function onEditAgent() {
213
+ return _onEditAgent(agent.id);
214
+ },
215
+ onCopyAgent: function onCopyAgent() {
216
+ return _onCopyAgent(agent.id);
217
+ },
218
+ onDuplicateAgent: function onDuplicateAgent() {
219
+ return _onDuplicateAgent(agent.id);
220
+ },
221
+ onDeleteAgent: handleOnDelete,
222
+ onChatClick: onChatClick ? function (event) {
223
+ return onChatClick(event);
224
+ } : function () {
225
+ return onOpenChatFullScreen(agent.id, agent.name);
226
+ },
227
+ resourceClient: resourceClient,
228
+ onViewFullProfileClick: function onViewFullProfileClick() {
229
+ return onViewFullProfile(agent.id);
230
+ }
231
+ })));
232
+ };
233
+ export default AgentProfileCard;
@@ -0,0 +1 @@
1
+ ._1bsb1gwv{width:360px}
@@ -1,13 +1,14 @@
1
+ /* AgentProfileCardWrapper.tsx generated by @compiled/babel-plugin v0.38.1 */
2
+ import "./AgentProfileCardWrapper.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
1
4
  import React from 'react';
2
-
3
- // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
4
- import { Box, xcss } from '@atlaskit/primitives';
5
- var styles = xcss({
6
- width: '360px'
7
- });
5
+ import { Box } from '@atlaskit/primitives/compiled';
6
+ var styles = {
7
+ wrapper: "_1bsb1gwv"
8
+ };
8
9
  export var AgentProfileCardWrapper = function AgentProfileCardWrapper(_ref) {
9
10
  var children = _ref.children;
10
11
  return /*#__PURE__*/React.createElement(Box, {
11
- xcss: styles
12
+ xcss: styles.wrapper
12
13
  }, children);
13
14
  };
@@ -1,7 +1,5 @@
1
1
  import React from 'react';
2
-
3
- // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
4
- import { Stack } from '@atlaskit/primitives';
2
+ import { Stack } from '@atlaskit/primitives/compiled';
5
3
  import { AgentConversationStarters } from '@atlaskit/rovo-agent-components';
6
4
  export var ConversationStarters = function ConversationStarters(_ref) {
7
5
  var isAgentDefault = _ref.isAgentDefault,
@@ -6,8 +6,7 @@ import Button from '@atlaskit/button/new';
6
6
  import CrossCircleIcon from '@atlaskit/icon/core/cross-circle';
7
7
  import IconError from '@atlaskit/icon/glyph/cross-circle';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
- // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
10
- import { Text } from '@atlaskit/primitives';
9
+ import { Text } from '@atlaskit/primitives/compiled';
11
10
  import { ErrorTitle, ErrorWrapper } from '../../styled/Error';
12
11
  import { PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
13
12
  var ErrorMessage = function ErrorMessage(props) {
@@ -14,8 +14,7 @@ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
14
14
  import { GiveKudosLauncherLazy, KudosType } from '@atlaskit/give-kudos';
15
15
  import { fg } from '@atlaskit/platform-feature-flags';
16
16
  import Popup from '@atlaskit/popup';
17
- // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
18
- import { Box } from '@atlaskit/primitives';
17
+ import { Box } from '@atlaskit/primitives/compiled';
19
18
  import { layers } from '@atlaskit/theme/constants';
20
19
  import _filterActions from '../../internal/filterActions';
21
20
  import messages from '../../messages';
@@ -5,7 +5,6 @@
5
5
  ._18u0ze3t{margin-left:var(--ds-space-0,0)}
6
6
  ._19bvze3t{padding-left:var(--ds-space-0,0)}
7
7
  ._19pkxy5q{margin-top:var(--ds-space-400,2pc)}
8
- ._19pkze3t{margin-top:var(--ds-space-0,0)}
9
8
  ._1bguutpp#profilecard-name-label{margin-bottom:var(--ds-space-150,9pt)}
10
9
  ._1bto1l2s{text-overflow:ellipsis}
11
10
  ._1hpmutpp#profilecard-name-label{margin-top:var(--ds-space-150,9pt)}
@@ -9,16 +9,13 @@ import { cx } from '@compiled/react';
9
9
  import { FormattedMessage } from 'react-intl-next';
10
10
  import Lozenge from '@atlaskit/lozenge';
11
11
  import { fg } from '@atlaskit/platform-feature-flags';
12
- // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
13
- import { Text } from '@atlaskit/primitives';
14
- import { Box } from '@atlaskit/primitives/compiled';
12
+ import { Box, Text } from '@atlaskit/primitives/compiled';
15
13
  import relativeDate from '../../internal/relative-date';
16
14
  import messages from '../../messages';
17
15
  import { AppTitleLabel, CustomLozengeContainer, DetailsGroup, DisabledInfo, JobTitleLabel, LozengeWrapper } from '../../styled/Card';
18
16
  import { IconLabel } from '../Icon';
19
17
  import ReportingLinesDetails from './ReportingLinesDetails';
20
18
  var styles = {
21
- detailedListWrapper: "_19pkze3t _2hwxze3t _otyrze3t _18u0ze3t _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t",
22
19
  detailedListWrapperNext: "_19pkxy5q _2hwxze3t _otyrze3t _18u0ze3t _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t",
23
20
  fullNameLabel: "_1reo15vq _18m915vq _11c81ixg _1bto1l2s _o5721q9c",
24
21
  noMetaLabel: "_2hwxidpf _18u0idpf _rcujxy5q _1l6uutpp",
@@ -9,6 +9,7 @@ import { FormattedMessage, useIntl } from 'react-intl-next';
9
9
  import Avatar from '@atlaskit/avatar';
10
10
  import AvatarGroup from '@atlaskit/avatar-group';
11
11
  import { fg } from '@atlaskit/platform-feature-flags';
12
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
12
13
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
13
14
  import { Box, xcss } from '@atlaskit/primitives';
14
15
  import { Pressable } from '@atlaskit/primitives/compiled';
@@ -16,6 +17,7 @@ import messages from '../../messages';
16
17
  import { ManagerName, ManagerSection, OffsetWrapper, ReportingLinesSection } from '../../styled/ReportingLines';
17
18
  import { PACKAGE_META_DATA, reportingLinesClicked } from '../../util/analytics';
18
19
  import { getPageTime } from '../../util/performance';
20
+ import { default as ReportingLinesDetailsCompiled } from './ReportingLinesDetailsCompiled';
19
21
  function getProfileHref(userId, profileUrl) {
20
22
  return profileUrl ? profileUrl + userId : undefined;
21
23
  }
@@ -133,4 +135,5 @@ var ReportingLinesDetails = function ReportingLinesDetails(props) {
133
135
  showMoreButtonProps: showMoreButtonProps
134
136
  })));
135
137
  };
136
- export default ReportingLinesDetails;
138
+ var ReportingLinesDetailsExport = componentWithFG('profilecard_primitives_compiled', ReportingLinesDetailsCompiled, ReportingLinesDetails);
139
+ export default ReportingLinesDetailsExport;
@@ -0,0 +1,11 @@
1
+ ._11c81vhk{font:var(--ds-font-heading-xxsmall,normal 600 9pt/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
2
+ ._19bvze3t{padding-left:var(--ds-space-0,0)}
3
+ ._bfhksm61{background-color:var(--ds-background-neutral-subtle,#00000000)}
4
+ ._ca0qze3t{padding-top:var(--ds-space-0,0)}
5
+ ._k48p1pd9{font-weight:var(--ds-font-weight-semibold,600)}
6
+ ._n3tdze3t{padding-bottom:var(--ds-space-0,0)}
7
+ ._otyru2gc{margin-bottom:var(--ds-space-100,8px)}
8
+ ._otyrze3t{margin-bottom:var(--ds-space-0,0)}
9
+ ._syaz1fxt{color:var(--ds-text,#172b4d)}
10
+ ._u5f3ze3t{padding-right:var(--ds-space-0,0)}
11
+ ._irr3166n:hover{background-color:var(--ds-background-neutral-subtle-hovered,#091e420f)}
@@ -0,0 +1,102 @@
1
+ /* ReportingLinesDetailsCompiled.tsx generated by @compiled/babel-plugin v0.38.1 */
2
+ import "./ReportingLinesDetailsCompiled.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import React from 'react';
5
+ import { FormattedMessage, useIntl } from 'react-intl-next';
6
+ import Avatar from '@atlaskit/avatar';
7
+ import AvatarGroup from '@atlaskit/avatar-group';
8
+ import { cx } from '@atlaskit/css';
9
+ import { Box, Pressable } from '@atlaskit/primitives/compiled';
10
+ import messages from '../../messages';
11
+ import { ManagerName, ManagerSection, OffsetWrapper, ReportingLinesSection } from '../../styled/ReportingLines';
12
+ import { reportingLinesClicked } from '../../util/analytics';
13
+ function getProfileHref(userId, profileUrl) {
14
+ return profileUrl ? profileUrl + userId : undefined;
15
+ }
16
+ var styles = {
17
+ reportingLinesButton: "_ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t _bfhksm61 _irr3166n",
18
+ reportingLinesHeadingDefaultStyles: "_11c81vhk _syaz1fxt _k48p1pd9 _otyru2gc",
19
+ reportingLinesHeadingStyles: "_otyrze3t"
20
+ };
21
+ var avatarGroupMaxCount = 5;
22
+ var ReportingLinesDetails = function ReportingLinesDetails(props) {
23
+ var _manager$pii, _manager$pii2;
24
+ var _useIntl = useIntl(),
25
+ formatMessage = _useIntl.formatMessage;
26
+ var fireAnalyticsWithDuration = props.fireAnalyticsWithDuration,
27
+ _props$reportingLines = props.reportingLines,
28
+ reportingLines = _props$reportingLines === void 0 ? {} : _props$reportingLines,
29
+ reportingLinesProfileUrl = props.reportingLinesProfileUrl,
30
+ onReportingLinesClick = props.onReportingLinesClick;
31
+ var _reportingLines$manag = reportingLines.managers,
32
+ managers = _reportingLines$manag === void 0 ? [] : _reportingLines$manag,
33
+ _reportingLines$repor = reportingLines.reports,
34
+ reports = _reportingLines$repor === void 0 ? [] : _reportingLines$repor;
35
+ var manager = managers.length >= 1 ? managers[0] : undefined;
36
+ var hasReports = reports.length > 0;
37
+ var getReportingLinesOnClick = function getReportingLinesOnClick(user, userType) {
38
+ return onReportingLinesClick ? function () {
39
+ fireAnalyticsWithDuration(function (duration) {
40
+ return reportingLinesClicked({
41
+ duration: duration,
42
+ userType: userType
43
+ });
44
+ });
45
+ onReportingLinesClick(user);
46
+ } : undefined;
47
+ };
48
+ var onReportingLinksClick = function onReportingLinksClick(user, userType, href) {
49
+ var shouldPreventDefault = false;
50
+ if (onReportingLinesClick) {
51
+ shouldPreventDefault = onReportingLinesClick(user) === false;
52
+ }
53
+ fireAnalyticsWithDuration(function (duration) {
54
+ return reportingLinesClicked({
55
+ duration: duration,
56
+ userType: userType
57
+ });
58
+ });
59
+ if (shouldPreventDefault) {
60
+ return;
61
+ }
62
+ if (href) {
63
+ window.location.href = href;
64
+ }
65
+ };
66
+ var showMoreButtonProps = {
67
+ 'aria-label': formatMessage(messages.profileCardMoreReportingLinesLabel, {
68
+ count: reports.length - avatarGroupMaxCount + 1
69
+ })
70
+ };
71
+ return /*#__PURE__*/React.createElement(React.Fragment, null, manager && /*#__PURE__*/React.createElement(ReportingLinesSection, null, /*#__PURE__*/React.createElement(Box, {
72
+ xcss: cx(styles.reportingLinesHeadingDefaultStyles, styles.reportingLinesHeadingStyles)
73
+ }, /*#__PURE__*/React.createElement(FormattedMessage, messages.managerSectionHeading)), /*#__PURE__*/React.createElement(OffsetWrapper, null, /*#__PURE__*/React.createElement(Pressable, {
74
+ onClick: function onClick() {
75
+ return onReportingLinksClick(manager, 'manager', getProfileHref(manager.accountIdentifier, reportingLinesProfileUrl));
76
+ },
77
+ isDisabled: !onReportingLinesClick,
78
+ xcss: styles.reportingLinesButton
79
+ }, /*#__PURE__*/React.createElement(ManagerSection, null, /*#__PURE__*/React.createElement(Avatar, {
80
+ size: "xsmall",
81
+ src: (_manager$pii = manager.pii) === null || _manager$pii === void 0 ? void 0 : _manager$pii.picture
82
+ }), /*#__PURE__*/React.createElement(ManagerName, null, (_manager$pii2 = manager.pii) === null || _manager$pii2 === void 0 ? void 0 : _manager$pii2.name))))), hasReports && /*#__PURE__*/React.createElement(ReportingLinesSection, null, /*#__PURE__*/React.createElement(Box, {
83
+ xcss: styles.reportingLinesHeadingDefaultStyles
84
+ }, /*#__PURE__*/React.createElement(FormattedMessage, messages.directReportsSectionHeading)), /*#__PURE__*/React.createElement(AvatarGroup, {
85
+ appearance: "stack",
86
+ size: "small",
87
+ data: reports.map(function (member) {
88
+ var _member$pii, _member$pii2;
89
+ return {
90
+ key: member.accountIdentifier,
91
+ name: ((_member$pii = member.pii) === null || _member$pii === void 0 ? void 0 : _member$pii.name) || '',
92
+ src: (_member$pii2 = member.pii) === null || _member$pii2 === void 0 ? void 0 : _member$pii2.picture,
93
+ href: getProfileHref(member.accountIdentifier, reportingLinesProfileUrl),
94
+ onClick: getReportingLinesOnClick(member, 'direct-report')
95
+ };
96
+ }),
97
+ maxCount: avatarGroupMaxCount,
98
+ testId: "profilecard-reports-avatar-group",
99
+ showMoreButtonProps: showMoreButtonProps
100
+ })));
101
+ };
102
+ export default ReportingLinesDetails;
@@ -0,0 +1 @@
1
+ ._1bsb1gwv{width:360px}