@atlaskit/profilecard 24.23.1 → 24.24.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.
- package/CHANGELOG.md +7 -0
- package/__tests__/vr-tests/agent-profilecard.vr.tsx +0 -1
- package/__tests__/vr-tests/user-profilecard.vr.tsx +6 -42
- package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/cjs/client/getTeamFromAGG.js +1 -1
- package/dist/cjs/components/Agent/Actions.js +28 -49
- package/dist/cjs/components/Agent/AgentProfileCard.js +39 -41
- package/dist/cjs/components/User/ReportingLinesDetails.compiled.css +5 -0
- package/dist/cjs/components/User/ReportingLinesDetails.js +10 -20
- package/dist/cjs/util/analytics.js +2 -2
- package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/es2019/client/getTeamFromAGG.js +1 -1
- package/dist/es2019/components/Agent/Actions.js +23 -43
- package/dist/es2019/components/Agent/AgentProfileCard.js +37 -40
- package/dist/es2019/components/User/ReportingLinesDetails.compiled.css +5 -0
- package/dist/es2019/components/User/ReportingLinesDetails.js +8 -19
- package/dist/es2019/util/analytics.js +2 -2
- package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/esm/client/getTeamFromAGG.js +1 -1
- package/dist/esm/components/Agent/Actions.js +23 -43
- package/dist/esm/components/Agent/AgentProfileCard.js +35 -38
- package/dist/esm/components/User/ReportingLinesDetails.compiled.css +5 -0
- package/dist/esm/components/User/ReportingLinesDetails.js +8 -19
- package/dist/esm/util/analytics.js +2 -2
- package/dist/types/components/Agent/Actions.d.ts +1 -11
- package/dist/types/components/Agent/AgentProfileCard.d.ts +3 -14
- package/dist/types/components/Agent/lazyAgentProfileCard.d.ts +1 -13
- package/dist/types/components/User/ReportingLinesDetails.d.ts +2 -2
- package/dist/types-ts4.5/components/Agent/Actions.d.ts +1 -11
- package/dist/types-ts4.5/components/Agent/AgentProfileCard.d.ts +3 -14
- package/dist/types-ts4.5/components/Agent/lazyAgentProfileCard.d.ts +1 -13
- package/dist/types-ts4.5/components/User/ReportingLinesDetails.d.ts +2 -2
- package/package.json +3 -6
- package/dist/cjs/components/Agent/ActionsCompiled.js +0 -148
- package/dist/cjs/components/Agent/AgentProfileCardCompiled.js +0 -266
- package/dist/cjs/components/User/ReportingLinesDetailsCompiled.compiled.css +0 -11
- package/dist/cjs/components/User/ReportingLinesDetailsCompiled.js +0 -109
- package/dist/es2019/components/Agent/ActionsCompiled.js +0 -127
- package/dist/es2019/components/Agent/AgentProfileCardCompiled.js +0 -209
- package/dist/es2019/components/User/ReportingLinesDetailsCompiled.compiled.css +0 -11
- package/dist/es2019/components/User/ReportingLinesDetailsCompiled.js +0 -96
- package/dist/esm/components/Agent/ActionsCompiled.js +0 -139
- package/dist/esm/components/Agent/AgentProfileCardCompiled.js +0 -257
- package/dist/esm/components/User/ReportingLinesDetailsCompiled.compiled.css +0 -11
- package/dist/esm/components/User/ReportingLinesDetailsCompiled.js +0 -102
- package/dist/types/components/Agent/ActionsCompiled.d.ts +0 -15
- package/dist/types/components/Agent/AgentProfileCardCompiled.d.ts +0 -4
- package/dist/types/components/User/ReportingLinesDetailsCompiled.d.ts +0 -5
- package/dist/types-ts4.5/components/Agent/ActionsCompiled.d.ts +0 -15
- package/dist/types-ts4.5/components/Agent/AgentProfileCardCompiled.d.ts +0 -4
- package/dist/types-ts4.5/components/User/ReportingLinesDetailsCompiled.d.ts +0 -5
- /package/dist/cjs/components/Agent/{ActionsCompiled.compiled.css → Actions.compiled.css} +0 -0
- /package/dist/cjs/components/Agent/{AgentProfileCardCompiled.compiled.css → AgentProfileCard.compiled.css} +0 -0
- /package/dist/es2019/components/Agent/{ActionsCompiled.compiled.css → Actions.compiled.css} +0 -0
- /package/dist/es2019/components/Agent/{AgentProfileCardCompiled.compiled.css → AgentProfileCard.compiled.css} +0 -0
- /package/dist/esm/components/Agent/{ActionsCompiled.compiled.css → Actions.compiled.css} +0 -0
- /package/dist/esm/components/Agent/{AgentProfileCardCompiled.compiled.css → AgentProfileCard.compiled.css} +0 -0
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
/* AgentProfileCardCompiled.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
|
-
import "./AgentProfileCardCompiled.compiled.css";
|
|
3
|
-
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
5
|
-
import { useIntl } from 'react-intl-next';
|
|
6
|
-
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
-
import { Box, Stack } from '@atlaskit/primitives/compiled';
|
|
9
|
-
import { AgentAvatar, AgentBanner, AgentProfileCreator, AgentProfileInfo, AgentStarCount } from '@atlaskit/rovo-agent-components';
|
|
10
|
-
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
11
|
-
import { fireEvent, PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
|
|
12
|
-
import { getPageTime } from '../../util/performance';
|
|
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
|
-
const styles = {
|
|
21
|
-
detailWrapper: "_18zrpxbi _1q51xy5q",
|
|
22
|
-
detailWrapperRefresh: "_1q511ejb",
|
|
23
|
-
avatarStyles: "_kqswstnw _154i1ejb _1ltvpxbi",
|
|
24
|
-
cardContainerStyles: "_2rko1mok _16qs130s _kqswh2mm",
|
|
25
|
-
agentProfileInfoWrapper: "_18zrpxbi",
|
|
26
|
-
conversationStartersWrapper: "_18zrutpp"
|
|
27
|
-
};
|
|
28
|
-
const AgentProfileCard = ({
|
|
29
|
-
agent,
|
|
30
|
-
isLoading,
|
|
31
|
-
cloudId,
|
|
32
|
-
onChatClick,
|
|
33
|
-
hasError,
|
|
34
|
-
errorType,
|
|
35
|
-
onConversationStartersClick,
|
|
36
|
-
resourceClient,
|
|
37
|
-
addFlag,
|
|
38
|
-
onDeleteAgent,
|
|
39
|
-
hideMoreActions
|
|
40
|
-
}) => {
|
|
41
|
-
var _agent$user_defined_c, _agent$external_confi, _agent$external_confi2, _agent$creatorInfo, _agent$creatorInfo2, _agent$creatorInfo3, _agent$creatorInfo4;
|
|
42
|
-
const {
|
|
43
|
-
onEditAgent,
|
|
44
|
-
onCopyAgent,
|
|
45
|
-
onDuplicateAgent,
|
|
46
|
-
onOpenChat: onOpenChatFullScreen,
|
|
47
|
-
onConversationStarter,
|
|
48
|
-
onViewFullProfile
|
|
49
|
-
} = useAgentUrlActions({
|
|
50
|
-
cloudId: cloudId || '',
|
|
51
|
-
source: 'agentProfileCard'
|
|
52
|
-
});
|
|
53
|
-
const [isStarred, setIsStarred] = useState(false);
|
|
54
|
-
const [starCount, setStarCount] = useState();
|
|
55
|
-
const {
|
|
56
|
-
formatMessage
|
|
57
|
-
} = useIntl();
|
|
58
|
-
const {
|
|
59
|
-
fireEvent: fireAnalyticsNext
|
|
60
|
-
} = useAnalyticsEventsNext();
|
|
61
|
-
const userDefinedConversationStarters = agent === null || agent === void 0 ? 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(starter => {
|
|
62
|
-
return {
|
|
63
|
-
message: starter,
|
|
64
|
-
type: 'user-defined'
|
|
65
|
-
};
|
|
66
|
-
});
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
setIsStarred(!!(agent !== null && agent !== void 0 && agent.favourite));
|
|
69
|
-
setStarCount(agent === null || agent === void 0 ? void 0 : agent.favourite_count);
|
|
70
|
-
}, [agent === null || agent === void 0 ? void 0 : agent.favourite, agent === null || agent === void 0 ? void 0 : agent.favourite_count]);
|
|
71
|
-
const {
|
|
72
|
-
createAnalyticsEvent
|
|
73
|
-
} = useAnalyticsEvents();
|
|
74
|
-
const fireAnalytics = useCallback(payload => {
|
|
75
|
-
if (createAnalyticsEvent) {
|
|
76
|
-
fireEvent(createAnalyticsEvent, payload);
|
|
77
|
-
}
|
|
78
|
-
}, [createAnalyticsEvent]);
|
|
79
|
-
const handleSetFavourite = useCallback(async () => {
|
|
80
|
-
if (agent !== null && agent !== void 0 && agent.id) {
|
|
81
|
-
try {
|
|
82
|
-
await resourceClient.setFavouriteAgent(agent.id, !isStarred, fireAnalytics, fireAnalyticsNext);
|
|
83
|
-
if (isStarred) {
|
|
84
|
-
setStarCount(starCount ? starCount - 1 : 0);
|
|
85
|
-
} else {
|
|
86
|
-
setStarCount((starCount || 0) + 1);
|
|
87
|
-
}
|
|
88
|
-
setIsStarred(!isStarred);
|
|
89
|
-
} catch (error) {}
|
|
90
|
-
}
|
|
91
|
-
}, [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, fireAnalyticsNext, isStarred, resourceClient, starCount]);
|
|
92
|
-
const handleOnDelete = useCallback(async () => {
|
|
93
|
-
if (agent && onDeleteAgent) {
|
|
94
|
-
// Optimistically remove from cache
|
|
95
|
-
const {
|
|
96
|
-
restore
|
|
97
|
-
} = onDeleteAgent(agent.id);
|
|
98
|
-
try {
|
|
99
|
-
await resourceClient.deleteAgent(agent.id, fireAnalytics, fireAnalyticsNext);
|
|
100
|
-
addFlag === null || addFlag === void 0 ? void 0 : addFlag({
|
|
101
|
-
title: formatMessage(messages.agentDeletedSuccessFlagTitle),
|
|
102
|
-
description: formatMessage(messages.agentDeletedSuccessFlagDescription, {
|
|
103
|
-
agentName: agent.name
|
|
104
|
-
}),
|
|
105
|
-
type: 'success',
|
|
106
|
-
id: 'ptc-directory.agent-profile.delete-agent-success'
|
|
107
|
-
});
|
|
108
|
-
} catch (error) {
|
|
109
|
-
// Restore agent to cache on error
|
|
110
|
-
restore();
|
|
111
|
-
addFlag === null || addFlag === void 0 ? void 0 : addFlag({
|
|
112
|
-
title: formatMessage(messages.agentDeletedErrorFlagTitle),
|
|
113
|
-
description: formatMessage(messages.agentDeletedErrorFlagDescription),
|
|
114
|
-
type: 'error',
|
|
115
|
-
id: 'ptc-directory.agent-profile.delete-agent-error'
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}, [addFlag, agent, formatMessage, onDeleteAgent, resourceClient, fireAnalytics, fireAnalyticsNext]);
|
|
120
|
-
useEffect(() => {
|
|
121
|
-
if (!isLoading && agent) {
|
|
122
|
-
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
123
|
-
fireAnalyticsNext(`ui.rovoAgentProfilecard.rendered.content`, {
|
|
124
|
-
...PACKAGE_META_DATA,
|
|
125
|
-
firedAt: Math.round(getPageTime())
|
|
126
|
-
});
|
|
127
|
-
} else {
|
|
128
|
-
fireAnalytics(profileCardRendered('agent', 'content'));
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}, [agent, fireAnalytics, isLoading, fireAnalyticsNext]);
|
|
132
|
-
if (isLoading) {
|
|
133
|
-
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(LoadingState, {
|
|
134
|
-
profileType: "agent",
|
|
135
|
-
fireAnalytics: fireAnalytics,
|
|
136
|
-
fireAnalyticsNext: fireAnalyticsNext
|
|
137
|
-
}));
|
|
138
|
-
}
|
|
139
|
-
if (hasError || !agent) {
|
|
140
|
-
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
141
|
-
fireAnalyticsNext: fireAnalyticsNext,
|
|
142
|
-
errorType: errorType,
|
|
143
|
-
fireAnalytics: fireAnalytics
|
|
144
|
-
}));
|
|
145
|
-
}
|
|
146
|
-
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(Box, {
|
|
147
|
-
xcss: styles.cardContainerStyles
|
|
148
|
-
}, /*#__PURE__*/React.createElement(AgentBanner, {
|
|
149
|
-
agentId: agent.id,
|
|
150
|
-
agentNamedId: (_agent$external_confi = agent.external_config_reference) !== null && _agent$external_confi !== void 0 ? _agent$external_confi : agent.named_id,
|
|
151
|
-
height: fg('rovo_agent_empty_state_refresh') ? 48 : 96,
|
|
152
|
-
agentIdentityAccountId: agent.identity_account_id
|
|
153
|
-
}), /*#__PURE__*/React.createElement(Box, {
|
|
154
|
-
xcss: styles.avatarStyles
|
|
155
|
-
}, /*#__PURE__*/React.createElement(AgentAvatar, {
|
|
156
|
-
agentId: agent.id,
|
|
157
|
-
agentNamedId: (_agent$external_confi2 = agent.external_config_reference) !== null && _agent$external_confi2 !== void 0 ? _agent$external_confi2 : agent.named_id,
|
|
158
|
-
agentIdentityAccountId: agent.identity_account_id,
|
|
159
|
-
size: fg('rovo_agent_empty_state_refresh') ? 'large' : 'xlarge',
|
|
160
|
-
isForgeAgent: agent.creator_type === 'FORGE' || agent.creator_type === 'THIRD_PARTY',
|
|
161
|
-
forgeAgentIconUrl: agent.icon
|
|
162
|
-
})), /*#__PURE__*/React.createElement(Stack, {
|
|
163
|
-
space: "space.100",
|
|
164
|
-
xcss: fg('rovo_agent_empty_state_refresh') ? styles.detailWrapperRefresh : styles.detailWrapper
|
|
165
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
166
|
-
xcss: fg('rovo_agent_empty_state_refresh') ? styles.agentProfileInfoWrapper : null
|
|
167
|
-
}, /*#__PURE__*/React.createElement(AgentProfileInfo, {
|
|
168
|
-
agentName: agent.name,
|
|
169
|
-
isStarred: isStarred,
|
|
170
|
-
onStarToggle: handleSetFavourite,
|
|
171
|
-
isHidden: agent.visibility === 'PRIVATE',
|
|
172
|
-
creatorRender: ((_agent$creatorInfo = agent.creatorInfo) === null || _agent$creatorInfo === void 0 ? void 0 : _agent$creatorInfo.type) && /*#__PURE__*/React.createElement(AgentProfileCreator, {
|
|
173
|
-
creator: {
|
|
174
|
-
type: (_agent$creatorInfo2 = agent.creatorInfo) === null || _agent$creatorInfo2 === void 0 ? void 0 : _agent$creatorInfo2.type,
|
|
175
|
-
name: ((_agent$creatorInfo3 = agent.creatorInfo) === null || _agent$creatorInfo3 === void 0 ? void 0 : _agent$creatorInfo3.name) || '',
|
|
176
|
-
profileLink: ((_agent$creatorInfo4 = agent.creatorInfo) === null || _agent$creatorInfo4 === void 0 ? void 0 : _agent$creatorInfo4.profileLink) || ''
|
|
177
|
-
},
|
|
178
|
-
isLoading: false,
|
|
179
|
-
onCreatorLinkClick: () => {}
|
|
180
|
-
}),
|
|
181
|
-
starCountRender: fg('rovo_agent_empty_state_refresh') ? null : /*#__PURE__*/React.createElement(AgentStarCount, {
|
|
182
|
-
starCount: starCount,
|
|
183
|
-
isLoading: false
|
|
184
|
-
}),
|
|
185
|
-
agentDescription: agent.description
|
|
186
|
-
})), /*#__PURE__*/React.createElement(Box, {
|
|
187
|
-
xcss: fg('rovo_agent_empty_state_refresh') ? styles.conversationStartersWrapper : null
|
|
188
|
-
}, /*#__PURE__*/React.createElement(ConversationStarters, {
|
|
189
|
-
isAgentDefault: agent.is_default,
|
|
190
|
-
userDefinedConversationStarters: userDefinedConversationStarters,
|
|
191
|
-
onConversationStarterClick: conversationStarter => {
|
|
192
|
-
onConversationStartersClick ? onConversationStartersClick(conversationStarter) : onConversationStarter({
|
|
193
|
-
agentId: agent.id,
|
|
194
|
-
prompt: conversationStarter.message
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
}))), /*#__PURE__*/React.createElement(AgentActions, {
|
|
198
|
-
agent: agent,
|
|
199
|
-
onEditAgent: () => onEditAgent(agent.id),
|
|
200
|
-
onCopyAgent: () => onCopyAgent(agent.id),
|
|
201
|
-
onDuplicateAgent: () => onDuplicateAgent(agent.id),
|
|
202
|
-
onDeleteAgent: handleOnDelete,
|
|
203
|
-
onChatClick: onChatClick ? event => onChatClick(event) : () => onOpenChatFullScreen(agent.id, agent.name),
|
|
204
|
-
resourceClient: resourceClient,
|
|
205
|
-
onViewFullProfileClick: () => onViewFullProfile(agent.id),
|
|
206
|
-
hideMoreActions: hideMoreActions
|
|
207
|
-
})));
|
|
208
|
-
};
|
|
209
|
-
export default AgentProfileCard;
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
._syazi7uo{color:var(--ds-text,#292a2e)}
|
|
10
|
-
._u5f3ze3t{padding-right:var(--ds-space-0,0)}
|
|
11
|
-
._irr31dpa:hover{background-color:var(--ds-background-neutral-subtle-hovered,#0515240f)}
|
|
@@ -1,96 +0,0 @@
|
|
|
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
|
-
const styles = {
|
|
17
|
-
reportingLinesButton: "_ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t _bfhksm61 _irr31dpa",
|
|
18
|
-
reportingLinesHeadingDefaultStyles: "_11c81vhk _syazi7uo _k48p1pd9 _otyru2gc",
|
|
19
|
-
reportingLinesHeadingStyles: "_otyrze3t"
|
|
20
|
-
};
|
|
21
|
-
const avatarGroupMaxCount = 5;
|
|
22
|
-
const ReportingLinesDetails = props => {
|
|
23
|
-
var _manager$pii, _manager$pii2;
|
|
24
|
-
const {
|
|
25
|
-
formatMessage
|
|
26
|
-
} = useIntl();
|
|
27
|
-
const {
|
|
28
|
-
fireAnalyticsWithDuration,
|
|
29
|
-
reportingLines = {},
|
|
30
|
-
reportingLinesProfileUrl,
|
|
31
|
-
onReportingLinesClick
|
|
32
|
-
} = props;
|
|
33
|
-
const {
|
|
34
|
-
managers = [],
|
|
35
|
-
reports = []
|
|
36
|
-
} = reportingLines;
|
|
37
|
-
const manager = managers.length >= 1 ? managers[0] : undefined;
|
|
38
|
-
const hasReports = reports.length > 0;
|
|
39
|
-
const getReportingLinesOnClick = (user, userType) => onReportingLinesClick ? () => {
|
|
40
|
-
fireAnalyticsWithDuration(duration => reportingLinesClicked({
|
|
41
|
-
duration,
|
|
42
|
-
userType
|
|
43
|
-
}));
|
|
44
|
-
onReportingLinesClick(user);
|
|
45
|
-
} : undefined;
|
|
46
|
-
const onReportingLinksClick = (user, userType, href) => {
|
|
47
|
-
let shouldPreventDefault = false;
|
|
48
|
-
if (onReportingLinesClick) {
|
|
49
|
-
shouldPreventDefault = onReportingLinesClick(user) === false;
|
|
50
|
-
}
|
|
51
|
-
fireAnalyticsWithDuration(duration => reportingLinesClicked({
|
|
52
|
-
duration,
|
|
53
|
-
userType
|
|
54
|
-
}));
|
|
55
|
-
if (shouldPreventDefault) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (href) {
|
|
59
|
-
window.location.href = href;
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
const showMoreButtonProps = {
|
|
63
|
-
'aria-label': formatMessage(messages.profileCardMoreReportingLinesLabel, {
|
|
64
|
-
count: reports.length - avatarGroupMaxCount + 1
|
|
65
|
-
})
|
|
66
|
-
};
|
|
67
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, manager && /*#__PURE__*/React.createElement(ReportingLinesSection, null, /*#__PURE__*/React.createElement(Box, {
|
|
68
|
-
xcss: cx(styles.reportingLinesHeadingDefaultStyles, styles.reportingLinesHeadingStyles)
|
|
69
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, messages.managerSectionHeading)), /*#__PURE__*/React.createElement(OffsetWrapper, null, /*#__PURE__*/React.createElement(Pressable, {
|
|
70
|
-
onClick: () => onReportingLinksClick(manager, 'manager', getProfileHref(manager.accountIdentifier, reportingLinesProfileUrl)),
|
|
71
|
-
isDisabled: !onReportingLinesClick,
|
|
72
|
-
xcss: styles.reportingLinesButton
|
|
73
|
-
}, /*#__PURE__*/React.createElement(ManagerSection, null, /*#__PURE__*/React.createElement(Avatar, {
|
|
74
|
-
size: "xsmall",
|
|
75
|
-
src: (_manager$pii = manager.pii) === null || _manager$pii === void 0 ? void 0 : _manager$pii.picture
|
|
76
|
-
}), /*#__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, {
|
|
77
|
-
xcss: styles.reportingLinesHeadingDefaultStyles
|
|
78
|
-
}, /*#__PURE__*/React.createElement(FormattedMessage, messages.directReportsSectionHeading)), /*#__PURE__*/React.createElement(AvatarGroup, {
|
|
79
|
-
appearance: "stack",
|
|
80
|
-
size: "small",
|
|
81
|
-
data: reports.map(member => {
|
|
82
|
-
var _member$pii, _member$pii2;
|
|
83
|
-
return {
|
|
84
|
-
key: member.accountIdentifier,
|
|
85
|
-
name: ((_member$pii = member.pii) === null || _member$pii === void 0 ? void 0 : _member$pii.name) || '',
|
|
86
|
-
src: (_member$pii2 = member.pii) === null || _member$pii2 === void 0 ? void 0 : _member$pii2.picture,
|
|
87
|
-
href: getProfileHref(member.accountIdentifier, reportingLinesProfileUrl),
|
|
88
|
-
onClick: getReportingLinesOnClick(member, 'direct-report')
|
|
89
|
-
};
|
|
90
|
-
}),
|
|
91
|
-
maxCount: avatarGroupMaxCount,
|
|
92
|
-
testId: "profilecard-reports-avatar-group",
|
|
93
|
-
showMoreButtonProps: showMoreButtonProps
|
|
94
|
-
})));
|
|
95
|
-
};
|
|
96
|
-
export default ReportingLinesDetails;
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
/* ActionsCompiled.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 "./ActionsCompiled.compiled.css";
|
|
5
|
-
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
-
import React, { useCallback, useState } from 'react';
|
|
8
|
-
import { defineMessages, useIntl } from 'react-intl-next';
|
|
9
|
-
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
|
-
import Button from '@atlaskit/button/new';
|
|
11
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
-
import { Box, Inline } from '@atlaskit/primitives/compiled';
|
|
13
|
-
import { AgentDropdownMenu, ChatPillIcon } from '@atlaskit/rovo-agent-components';
|
|
14
|
-
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
15
|
-
import { fireEvent } from '../../util/analytics';
|
|
16
|
-
import { AgentDeleteConfirmationModal } from './AgentDeleteConfirmationModal';
|
|
17
|
-
var styles = {
|
|
18
|
-
chatToAgentButtonContainer: "_1bsb1osq",
|
|
19
|
-
chatToAgentButtonWrapper: "_1e0c1txw _1bah1h6o _k48p1wq8 _4t3igktf",
|
|
20
|
-
chatPillButtonInlineStyles: "_18zrv77o",
|
|
21
|
-
chatPillTextStyles: "_1nmz1hna _y3gn1e5h _o5721jtm",
|
|
22
|
-
chatPillIconWrapper: "_1ul9gktf _4t3igktf",
|
|
23
|
-
actionsWrapperStyles: "_189ee4h9 _1h6d1l7x _15a5nqa1 _ca0qpxbi _u5f3pxbi _n3tdpxbi _19bvpxbi _1pfhpxbi _syazi7uo",
|
|
24
|
-
actionsWrapperStylesRefresh: "_ca0qutpp _u5f3utpp _n3tdutpp _19bvutpp _syazi7uo"
|
|
25
|
-
};
|
|
26
|
-
export var AgentActions = function AgentActions(_ref) {
|
|
27
|
-
var onEditAgent = _ref.onEditAgent,
|
|
28
|
-
onDeleteAgent = _ref.onDeleteAgent,
|
|
29
|
-
onDuplicateAgent = _ref.onDuplicateAgent,
|
|
30
|
-
onCopyAgent = _ref.onCopyAgent,
|
|
31
|
-
onChatClick = _ref.onChatClick,
|
|
32
|
-
onViewFullProfileClick = _ref.onViewFullProfileClick,
|
|
33
|
-
agent = _ref.agent,
|
|
34
|
-
resourceClient = _ref.resourceClient,
|
|
35
|
-
hideMoreActions = _ref.hideMoreActions;
|
|
36
|
-
var _useIntl = useIntl(),
|
|
37
|
-
formatMessage = _useIntl.formatMessage;
|
|
38
|
-
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
39
|
-
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
|
|
40
|
-
var _useAnalyticsEventsNe = useAnalyticsEventsNext(),
|
|
41
|
-
fireEventNext = _useAnalyticsEventsNe.fireEvent;
|
|
42
|
-
var _useState = useState(false),
|
|
43
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
-
isDeleteModalOpen = _useState2[0],
|
|
45
|
-
setIsDeleteModalOpen = _useState2[1];
|
|
46
|
-
var isForgeAgent = agent.creator_type === 'FORGE' || agent.creator_type === 'THIRD_PARTY';
|
|
47
|
-
var loadAgentPermissions = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
48
|
-
var _yield$resourceClient, _yield$resourceClient2, AGENT_CREATE, AGENT_UPDATE, AGENT_DEACTIVATE;
|
|
49
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
50
|
-
while (1) switch (_context.prev = _context.next) {
|
|
51
|
-
case 0:
|
|
52
|
-
_context.next = 2;
|
|
53
|
-
return resourceClient.getRovoAgentPermissions(agent.id);
|
|
54
|
-
case 2:
|
|
55
|
-
_yield$resourceClient = _context.sent;
|
|
56
|
-
_yield$resourceClient2 = _yield$resourceClient.permissions;
|
|
57
|
-
AGENT_CREATE = _yield$resourceClient2.AGENT_CREATE;
|
|
58
|
-
AGENT_UPDATE = _yield$resourceClient2.AGENT_UPDATE;
|
|
59
|
-
AGENT_DEACTIVATE = _yield$resourceClient2.AGENT_DEACTIVATE;
|
|
60
|
-
return _context.abrupt("return", {
|
|
61
|
-
isCreateEnabled: AGENT_CREATE.permitted,
|
|
62
|
-
isEditEnabled: AGENT_UPDATE.permitted,
|
|
63
|
-
isDeleteEnabled: AGENT_DEACTIVATE.permitted
|
|
64
|
-
});
|
|
65
|
-
case 8:
|
|
66
|
-
case "end":
|
|
67
|
-
return _context.stop();
|
|
68
|
-
}
|
|
69
|
-
}, _callee);
|
|
70
|
-
})), [agent.id, resourceClient]);
|
|
71
|
-
var handleDeleteAgent = useCallback(function () {
|
|
72
|
-
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
73
|
-
fireEventNext('ui.button.clicked.deleteAgentButton', {
|
|
74
|
-
agentId: agent.id,
|
|
75
|
-
source: 'agentProfileCard'
|
|
76
|
-
});
|
|
77
|
-
} else {
|
|
78
|
-
fireEvent(createAnalyticsEvent, {
|
|
79
|
-
action: 'clicked',
|
|
80
|
-
actionSubject: 'button',
|
|
81
|
-
actionSubjectId: 'deleteAgentButton',
|
|
82
|
-
attributes: {
|
|
83
|
-
agentId: agent.id,
|
|
84
|
-
source: 'agentProfileCard'
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
setIsDeleteModalOpen(true);
|
|
89
|
-
}, [agent.id, createAnalyticsEvent, fireEventNext]);
|
|
90
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Inline, {
|
|
91
|
-
space: "space.100",
|
|
92
|
-
xcss: fg('rovo_agent_empty_state_refresh') ? styles.actionsWrapperStylesRefresh : styles.actionsWrapperStyles
|
|
93
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
94
|
-
xcss: styles.chatToAgentButtonContainer
|
|
95
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
96
|
-
shouldFitContainer: true,
|
|
97
|
-
onClick: function onClick(e) {
|
|
98
|
-
e.stopPropagation();
|
|
99
|
-
onChatClick(e);
|
|
100
|
-
}
|
|
101
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
102
|
-
xcss: styles.chatToAgentButtonWrapper
|
|
103
|
-
}, /*#__PURE__*/React.createElement(Inline, {
|
|
104
|
-
space: "space.050",
|
|
105
|
-
xcss: fg('rovo_agent_empty_state_refresh') ? null : styles.chatPillButtonInlineStyles,
|
|
106
|
-
alignBlock: "center"
|
|
107
|
-
}, !fg('rovo_agent_empty_state_refresh') && /*#__PURE__*/React.createElement(Box, {
|
|
108
|
-
xcss: styles.chatPillIconWrapper
|
|
109
|
-
}, /*#__PURE__*/React.createElement(ChatPillIcon, null)), /*#__PURE__*/React.createElement(Box, {
|
|
110
|
-
xcss: styles.chatPillTextStyles
|
|
111
|
-
}, formatMessage(messages.actionChatToAgent)))))), !hideMoreActions && /*#__PURE__*/React.createElement(AgentDropdownMenu, {
|
|
112
|
-
agentId: agent.id,
|
|
113
|
-
onDeleteAgent: handleDeleteAgent,
|
|
114
|
-
onEditAgent: onEditAgent,
|
|
115
|
-
onDuplicateAgent: onDuplicateAgent,
|
|
116
|
-
onCopyAgent: onCopyAgent,
|
|
117
|
-
isForgeAgent: isForgeAgent,
|
|
118
|
-
loadAgentPermissions: loadAgentPermissions,
|
|
119
|
-
loadPermissionsOnMount: true,
|
|
120
|
-
onViewAgentFullProfileClick: onViewFullProfileClick,
|
|
121
|
-
doesAgentHaveIdentityAccountId: !!agent.identity_account_id,
|
|
122
|
-
shouldTriggerStopPropagation: true
|
|
123
|
-
})), /*#__PURE__*/React.createElement(AgentDeleteConfirmationModal, {
|
|
124
|
-
isOpen: isDeleteModalOpen,
|
|
125
|
-
onClose: function onClose() {
|
|
126
|
-
setIsDeleteModalOpen(false);
|
|
127
|
-
},
|
|
128
|
-
onSubmit: onDeleteAgent,
|
|
129
|
-
agentId: agent.id,
|
|
130
|
-
agentName: agent.name
|
|
131
|
-
}));
|
|
132
|
-
};
|
|
133
|
-
var messages = defineMessages({
|
|
134
|
-
actionChatToAgent: {
|
|
135
|
-
id: 'ptc-directory.agent-profile.action.dropdown.chat-with-agent',
|
|
136
|
-
defaultMessage: 'Chat with Agent',
|
|
137
|
-
description: 'Text for the "chat with agent" action to chat to the agent'
|
|
138
|
-
}
|
|
139
|
-
});
|