@atlaskit/profilecard 24.14.0 → 24.15.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 +21 -0
- package/__tests__/vr-tests/__snapshots__/user-profilecard/error-state--default.png +0 -0
- package/__tests__/vr-tests/agent-profilecard.vr.tsx +7 -1
- package/__tests__/vr-tests/user-profilecard.vr.tsx +42 -6
- package/dist/cjs/client/ProfileCardClient.js +10 -10
- package/dist/cjs/client/RovoAgentCardClient.js +172 -56
- package/dist/cjs/client/TeamProfileCardClient.js +44 -14
- package/dist/cjs/client/UserProfileCardClient.js +2 -9
- package/dist/cjs/client/errorUtils.js +83 -5
- package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/cjs/client/getTeamFromAGG.js +1 -1
- package/dist/cjs/components/Agent/Actions.js +25 -11
- package/dist/cjs/components/Agent/ActionsCompiled.compiled.css +19 -0
- package/dist/cjs/components/Agent/ActionsCompiled.js +150 -0
- package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +2 -4
- package/dist/cjs/components/Agent/AgentProfileCard.js +28 -14
- package/dist/cjs/components/Agent/AgentProfileCardCompiled.compiled.css +8 -0
- package/dist/cjs/components/Agent/AgentProfileCardCompiled.js +257 -0
- package/dist/cjs/components/Agent/AgentProfileCardResourced.js +8 -5
- package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +6 -2
- package/dist/cjs/components/Agent/AgentProfileCardWrapper.compiled.css +1 -0
- package/dist/cjs/components/Agent/AgentProfileCardWrapper.js +9 -8
- package/dist/cjs/components/Agent/ConversationStarters.js +2 -4
- package/dist/cjs/components/Agent/hooks/useAgentActions.js +61 -30
- package/dist/cjs/components/Error/ErrorMessage.js +3 -3
- package/dist/cjs/components/Team/TeamForbiddenErrorState.js +21 -6
- package/dist/cjs/components/Team/TeamLoadingState.js +21 -6
- package/dist/cjs/components/Team/TeamProfileCard.js +155 -60
- package/dist/cjs/components/Team/TeamProfileCardTrigger.js +107 -36
- package/dist/cjs/components/User/ProfileCardDetails.compiled.css +0 -1
- package/dist/cjs/components/User/ProfileCardDetails.js +2 -4
- package/dist/cjs/components/User/ReportingLinesDetails.js +4 -1
- package/dist/cjs/components/User/ReportingLinesDetailsCompiled.compiled.css +11 -0
- package/dist/cjs/components/User/ReportingLinesDetailsCompiled.js +109 -0
- package/dist/cjs/components/common/ProfileCardWrapper.compiled.css +1 -0
- package/dist/cjs/components/common/ProfileCardWrapper.js +9 -8
- package/dist/cjs/components/team-profile-card/main.js +18 -9
- package/dist/cjs/components/team-profile-card/team-actions/more-actions/index.js +2 -4
- package/dist/cjs/components/team-profile-card/team-connections/main.js +36 -17
- package/dist/cjs/styled/CoverImage.compiled.css +2 -0
- package/dist/cjs/styled/CoverImage.js +4 -2
- package/dist/cjs/styled/Error.compiled.css +0 -2
- package/dist/cjs/styled/Error.js +5 -3
- package/dist/cjs/util/analytics.js +57 -2
- package/dist/es2019/client/ProfileCardClient.js +10 -10
- package/dist/es2019/client/RovoAgentCardClient.js +186 -58
- package/dist/es2019/client/TeamProfileCardClient.js +49 -16
- package/dist/es2019/client/UserProfileCardClient.js +3 -10
- package/dist/es2019/client/errorUtils.js +84 -3
- package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/es2019/client/getTeamFromAGG.js +1 -1
- package/dist/es2019/components/Agent/Actions.js +26 -11
- package/dist/es2019/components/Agent/ActionsCompiled.compiled.css +19 -0
- package/dist/es2019/components/Agent/ActionsCompiled.js +127 -0
- package/dist/es2019/components/Agent/AgentDeleteConfirmationModal.js +1 -2
- package/dist/es2019/components/Agent/AgentProfileCard.js +28 -13
- package/dist/es2019/components/Agent/AgentProfileCardCompiled.compiled.css +8 -0
- package/dist/es2019/components/Agent/AgentProfileCardCompiled.js +200 -0
- package/dist/es2019/components/Agent/AgentProfileCardResourced.js +9 -5
- package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +7 -2
- package/dist/es2019/components/Agent/AgentProfileCardWrapper.compiled.css +1 -0
- package/dist/es2019/components/Agent/AgentProfileCardWrapper.js +8 -7
- package/dist/es2019/components/Agent/ConversationStarters.js +1 -3
- package/dist/es2019/components/Agent/hooks/useAgentActions.js +62 -30
- package/dist/es2019/components/Error/ErrorMessage.js +1 -2
- package/dist/es2019/components/Team/TeamForbiddenErrorState.js +17 -6
- package/dist/es2019/components/Team/TeamLoadingState.js +17 -6
- package/dist/es2019/components/Team/TeamProfileCard.js +144 -54
- package/dist/es2019/components/Team/TeamProfileCardTrigger.js +75 -12
- package/dist/es2019/components/User/ProfileCardDetails.compiled.css +0 -1
- package/dist/es2019/components/User/ProfileCardDetails.js +1 -4
- package/dist/es2019/components/User/ReportingLinesDetails.js +4 -1
- package/dist/es2019/components/User/ReportingLinesDetailsCompiled.compiled.css +11 -0
- package/dist/es2019/components/User/ReportingLinesDetailsCompiled.js +96 -0
- package/dist/es2019/components/common/ProfileCardWrapper.compiled.css +1 -0
- package/dist/es2019/components/common/ProfileCardWrapper.js +8 -7
- package/dist/es2019/components/team-profile-card/main.js +19 -9
- package/dist/es2019/components/team-profile-card/team-actions/more-actions/index.js +1 -2
- package/dist/es2019/components/team-profile-card/team-connections/main.js +38 -17
- package/dist/es2019/styled/CoverImage.compiled.css +2 -0
- package/dist/es2019/styled/CoverImage.js +4 -2
- package/dist/es2019/styled/Error.compiled.css +0 -2
- package/dist/es2019/styled/Error.js +6 -4
- package/dist/es2019/util/analytics.js +57 -2
- package/dist/esm/client/ProfileCardClient.js +10 -10
- package/dist/esm/client/RovoAgentCardClient.js +174 -58
- package/dist/esm/client/TeamProfileCardClient.js +46 -16
- package/dist/esm/client/UserProfileCardClient.js +3 -10
- package/dist/esm/client/errorUtils.js +82 -4
- package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/esm/client/getTeamFromAGG.js +1 -1
- package/dist/esm/components/Agent/Actions.js +25 -11
- package/dist/esm/components/Agent/ActionsCompiled.compiled.css +19 -0
- package/dist/esm/components/Agent/ActionsCompiled.js +141 -0
- package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +1 -2
- package/dist/esm/components/Agent/AgentProfileCard.js +29 -13
- package/dist/esm/components/Agent/AgentProfileCardCompiled.compiled.css +8 -0
- package/dist/esm/components/Agent/AgentProfileCardCompiled.js +248 -0
- package/dist/esm/components/Agent/AgentProfileCardResourced.js +8 -5
- package/dist/esm/components/Agent/AgentProfileCardTrigger.js +6 -2
- package/dist/esm/components/Agent/AgentProfileCardWrapper.compiled.css +1 -0
- package/dist/esm/components/Agent/AgentProfileCardWrapper.js +8 -7
- package/dist/esm/components/Agent/ConversationStarters.js +1 -3
- package/dist/esm/components/Agent/hooks/useAgentActions.js +61 -30
- package/dist/esm/components/Error/ErrorMessage.js +1 -2
- package/dist/esm/components/Team/TeamForbiddenErrorState.js +22 -7
- package/dist/esm/components/Team/TeamLoadingState.js +22 -7
- package/dist/esm/components/Team/TeamProfileCard.js +156 -61
- package/dist/esm/components/Team/TeamProfileCardTrigger.js +106 -36
- package/dist/esm/components/User/ProfileCardDetails.compiled.css +0 -1
- package/dist/esm/components/User/ProfileCardDetails.js +1 -4
- package/dist/esm/components/User/ReportingLinesDetails.js +4 -1
- package/dist/esm/components/User/ReportingLinesDetailsCompiled.compiled.css +11 -0
- package/dist/esm/components/User/ReportingLinesDetailsCompiled.js +102 -0
- package/dist/esm/components/common/ProfileCardWrapper.compiled.css +1 -0
- package/dist/esm/components/common/ProfileCardWrapper.js +8 -7
- package/dist/esm/components/team-profile-card/main.js +18 -9
- package/dist/esm/components/team-profile-card/team-actions/more-actions/index.js +1 -2
- package/dist/esm/components/team-profile-card/team-connections/main.js +36 -17
- package/dist/esm/styled/CoverImage.compiled.css +2 -0
- package/dist/esm/styled/CoverImage.js +4 -2
- package/dist/esm/styled/Error.compiled.css +0 -2
- package/dist/esm/styled/Error.js +6 -4
- package/dist/esm/util/analytics.js +57 -2
- package/dist/types/client/ProfileCardClient.d.ts +5 -5
- package/dist/types/client/RovoAgentCardClient.d.ts +5 -4
- package/dist/types/client/TeamProfileCardClient.d.ts +2 -1
- package/dist/types/client/errorUtils.d.ts +2 -1
- package/dist/types/client/types.d.ts +14 -2
- package/dist/types/components/Agent/Actions.d.ts +10 -1
- package/dist/types/components/Agent/ActionsCompiled.d.ts +14 -0
- package/dist/types/components/Agent/AgentProfileCard.d.ts +13 -3
- package/dist/types/components/Agent/AgentProfileCardCompiled.d.ts +4 -0
- package/dist/types/components/Agent/lazyAgentProfileCard.d.ts +12 -1
- package/dist/types/components/Team/TeamForbiddenErrorState.d.ts +2 -1
- package/dist/types/components/Team/TeamLoadingState.d.ts +2 -1
- package/dist/types/components/Team/TeamProfileCardTrigger.d.ts +7 -2
- package/dist/types/components/User/ReportingLinesDetails.d.ts +2 -2
- package/dist/types/components/User/ReportingLinesDetailsCompiled.d.ts +5 -0
- package/dist/types/types.d.ts +2 -0
- package/dist/types/util/analytics.d.ts +46 -2
- package/dist/types-ts4.5/client/ProfileCardClient.d.ts +5 -5
- package/dist/types-ts4.5/client/RovoAgentCardClient.d.ts +5 -4
- package/dist/types-ts4.5/client/TeamProfileCardClient.d.ts +2 -1
- package/dist/types-ts4.5/client/errorUtils.d.ts +2 -1
- package/dist/types-ts4.5/client/types.d.ts +14 -2
- package/dist/types-ts4.5/components/Agent/Actions.d.ts +10 -1
- package/dist/types-ts4.5/components/Agent/ActionsCompiled.d.ts +14 -0
- package/dist/types-ts4.5/components/Agent/AgentProfileCard.d.ts +13 -3
- package/dist/types-ts4.5/components/Agent/AgentProfileCardCompiled.d.ts +4 -0
- package/dist/types-ts4.5/components/Agent/lazyAgentProfileCard.d.ts +12 -1
- package/dist/types-ts4.5/components/Team/TeamForbiddenErrorState.d.ts +2 -1
- package/dist/types-ts4.5/components/Team/TeamLoadingState.d.ts +2 -1
- package/dist/types-ts4.5/components/Team/TeamProfileCardTrigger.d.ts +7 -2
- package/dist/types-ts4.5/components/User/ReportingLinesDetails.d.ts +2 -2
- package/dist/types-ts4.5/components/User/ReportingLinesDetailsCompiled.d.ts +5 -0
- package/dist/types-ts4.5/types.d.ts +2 -0
- package/dist/types-ts4.5/util/analytics.d.ts +46 -2
- package/package.json +15 -9
|
@@ -0,0 +1,200 @@
|
|
|
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
|
+
avatarStyles: "_kqswstnw _154i1ejb _1ltvpxbi",
|
|
23
|
+
cardContainerStyles: "_2rko1mok _16qs1cd0 _kqswh2mm"
|
|
24
|
+
};
|
|
25
|
+
const AgentProfileCard = ({
|
|
26
|
+
agent,
|
|
27
|
+
isLoading,
|
|
28
|
+
cloudId,
|
|
29
|
+
onChatClick,
|
|
30
|
+
hasError,
|
|
31
|
+
errorType,
|
|
32
|
+
onConversationStartersClick,
|
|
33
|
+
resourceClient,
|
|
34
|
+
addFlag,
|
|
35
|
+
onDeleteAgent
|
|
36
|
+
}) => {
|
|
37
|
+
var _agent$user_defined_c, _agent$external_confi, _agent$external_confi2, _agent$creatorInfo, _agent$creatorInfo2, _agent$creatorInfo3, _agent$creatorInfo4;
|
|
38
|
+
const {
|
|
39
|
+
onEditAgent,
|
|
40
|
+
onCopyAgent,
|
|
41
|
+
onDuplicateAgent,
|
|
42
|
+
onOpenChat: onOpenChatFullScreen,
|
|
43
|
+
onConversationStarter,
|
|
44
|
+
onViewFullProfile
|
|
45
|
+
} = useAgentUrlActions({
|
|
46
|
+
cloudId: cloudId || '',
|
|
47
|
+
source: 'agentProfileCard'
|
|
48
|
+
});
|
|
49
|
+
const [isStarred, setIsStarred] = useState(false);
|
|
50
|
+
const [starCount, setStarCount] = useState();
|
|
51
|
+
const {
|
|
52
|
+
formatMessage
|
|
53
|
+
} = useIntl();
|
|
54
|
+
const {
|
|
55
|
+
fireEvent: fireAnalyticsNext
|
|
56
|
+
} = useAnalyticsEventsNext();
|
|
57
|
+
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 => {
|
|
58
|
+
return {
|
|
59
|
+
message: starter,
|
|
60
|
+
type: 'user-defined'
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
useEffect(() => {
|
|
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
|
+
const {
|
|
68
|
+
createAnalyticsEvent
|
|
69
|
+
} = useAnalyticsEvents();
|
|
70
|
+
const fireAnalytics = useCallback(payload => {
|
|
71
|
+
if (createAnalyticsEvent) {
|
|
72
|
+
fireEvent(createAnalyticsEvent, payload);
|
|
73
|
+
}
|
|
74
|
+
}, [createAnalyticsEvent]);
|
|
75
|
+
const handleSetFavourite = useCallback(async () => {
|
|
76
|
+
if (agent !== null && agent !== void 0 && agent.id) {
|
|
77
|
+
try {
|
|
78
|
+
await resourceClient.setFavouriteAgent(agent.id, !isStarred, fireAnalytics, fireAnalyticsNext);
|
|
79
|
+
if (isStarred) {
|
|
80
|
+
setStarCount(starCount ? starCount - 1 : 0);
|
|
81
|
+
} else {
|
|
82
|
+
setStarCount((starCount || 0) + 1);
|
|
83
|
+
}
|
|
84
|
+
setIsStarred(!isStarred);
|
|
85
|
+
} catch (error) {}
|
|
86
|
+
}
|
|
87
|
+
}, [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, fireAnalyticsNext, isStarred, resourceClient, starCount]);
|
|
88
|
+
const handleOnDelete = useCallback(async () => {
|
|
89
|
+
if (agent && onDeleteAgent) {
|
|
90
|
+
// Optimistically remove from cache
|
|
91
|
+
const {
|
|
92
|
+
restore
|
|
93
|
+
} = onDeleteAgent(agent.id);
|
|
94
|
+
try {
|
|
95
|
+
await resourceClient.deleteAgent(agent.id, fireAnalytics, fireAnalyticsNext);
|
|
96
|
+
addFlag === null || addFlag === void 0 ? void 0 : addFlag({
|
|
97
|
+
title: formatMessage(messages.agentDeletedSuccessFlagTitle),
|
|
98
|
+
description: formatMessage(messages.agentDeletedSuccessFlagDescription, {
|
|
99
|
+
agentName: agent.name
|
|
100
|
+
}),
|
|
101
|
+
type: 'success',
|
|
102
|
+
id: 'ptc-directory.agent-profile.delete-agent-success'
|
|
103
|
+
});
|
|
104
|
+
} catch (error) {
|
|
105
|
+
// Restore agent to cache on error
|
|
106
|
+
restore();
|
|
107
|
+
addFlag === null || addFlag === void 0 ? void 0 : addFlag({
|
|
108
|
+
title: formatMessage(messages.agentDeletedErrorFlagTitle),
|
|
109
|
+
description: formatMessage(messages.agentDeletedErrorFlagDescription),
|
|
110
|
+
type: 'error',
|
|
111
|
+
id: 'ptc-directory.agent-profile.delete-agent-error'
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}, [addFlag, agent, formatMessage, onDeleteAgent, resourceClient, fireAnalytics, fireAnalyticsNext]);
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (!isLoading && agent) {
|
|
118
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
119
|
+
fireAnalyticsNext(`ui.rovoAgentProfilecard.rendered.content`, {
|
|
120
|
+
...PACKAGE_META_DATA,
|
|
121
|
+
firedAt: Math.round(getPageTime())
|
|
122
|
+
});
|
|
123
|
+
} else {
|
|
124
|
+
fireAnalytics(profileCardRendered('agent', 'content'));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}, [agent, fireAnalytics, isLoading, fireAnalyticsNext]);
|
|
128
|
+
if (isLoading) {
|
|
129
|
+
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(LoadingState, {
|
|
130
|
+
profileType: "agent",
|
|
131
|
+
fireAnalytics: fireAnalytics,
|
|
132
|
+
fireAnalyticsNext: fireAnalyticsNext
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
if (hasError || !agent) {
|
|
136
|
+
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
137
|
+
fireAnalyticsNext: fireAnalyticsNext,
|
|
138
|
+
errorType: errorType,
|
|
139
|
+
fireAnalytics: fireAnalytics
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(Box, {
|
|
143
|
+
xcss: styles.cardContainerStyles
|
|
144
|
+
}, /*#__PURE__*/React.createElement(AgentBanner, {
|
|
145
|
+
agentId: agent.id,
|
|
146
|
+
agentNamedId: (_agent$external_confi = agent.external_config_reference) !== null && _agent$external_confi !== void 0 ? _agent$external_confi : agent.named_id,
|
|
147
|
+
height: 96,
|
|
148
|
+
agentIdentityAccountId: agent.identity_account_id
|
|
149
|
+
}), /*#__PURE__*/React.createElement(Box, {
|
|
150
|
+
xcss: styles.avatarStyles
|
|
151
|
+
}, /*#__PURE__*/React.createElement(AgentAvatar, {
|
|
152
|
+
agentId: agent.id,
|
|
153
|
+
agentNamedId: (_agent$external_confi2 = agent.external_config_reference) !== null && _agent$external_confi2 !== void 0 ? _agent$external_confi2 : agent.named_id,
|
|
154
|
+
agentIdentityAccountId: agent.identity_account_id,
|
|
155
|
+
size: "xlarge",
|
|
156
|
+
isForgeAgent: agent.creator_type === 'FORGE' || agent.creator_type === 'THIRD_PARTY',
|
|
157
|
+
forgeAgentIconUrl: agent.icon
|
|
158
|
+
})), /*#__PURE__*/React.createElement(Stack, {
|
|
159
|
+
space: "space.100",
|
|
160
|
+
xcss: styles.detailWrapper
|
|
161
|
+
}, /*#__PURE__*/React.createElement(AgentProfileInfo, {
|
|
162
|
+
agentName: agent.name,
|
|
163
|
+
isStarred: isStarred,
|
|
164
|
+
onStarToggle: handleSetFavourite,
|
|
165
|
+
isHidden: agent.visibility === 'PRIVATE',
|
|
166
|
+
creatorRender: ((_agent$creatorInfo = agent.creatorInfo) === null || _agent$creatorInfo === void 0 ? void 0 : _agent$creatorInfo.type) && /*#__PURE__*/React.createElement(AgentProfileCreator, {
|
|
167
|
+
creator: {
|
|
168
|
+
type: (_agent$creatorInfo2 = agent.creatorInfo) === null || _agent$creatorInfo2 === void 0 ? void 0 : _agent$creatorInfo2.type,
|
|
169
|
+
name: ((_agent$creatorInfo3 = agent.creatorInfo) === null || _agent$creatorInfo3 === void 0 ? void 0 : _agent$creatorInfo3.name) || '',
|
|
170
|
+
profileLink: ((_agent$creatorInfo4 = agent.creatorInfo) === null || _agent$creatorInfo4 === void 0 ? void 0 : _agent$creatorInfo4.profileLink) || ''
|
|
171
|
+
},
|
|
172
|
+
isLoading: false,
|
|
173
|
+
onCreatorLinkClick: () => {}
|
|
174
|
+
}),
|
|
175
|
+
starCountRender: /*#__PURE__*/React.createElement(AgentStarCount, {
|
|
176
|
+
starCount: starCount,
|
|
177
|
+
isLoading: false
|
|
178
|
+
}),
|
|
179
|
+
agentDescription: agent.description
|
|
180
|
+
}), /*#__PURE__*/React.createElement(ConversationStarters, {
|
|
181
|
+
isAgentDefault: agent.is_default,
|
|
182
|
+
userDefinedConversationStarters: userDefinedConversationStarters,
|
|
183
|
+
onConversationStarterClick: conversationStarter => {
|
|
184
|
+
onConversationStartersClick ? onConversationStartersClick(conversationStarter) : onConversationStarter({
|
|
185
|
+
agentId: agent.id,
|
|
186
|
+
prompt: conversationStarter.message
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
})), /*#__PURE__*/React.createElement(AgentActions, {
|
|
190
|
+
agent: agent,
|
|
191
|
+
onEditAgent: () => onEditAgent(agent.id),
|
|
192
|
+
onCopyAgent: () => onCopyAgent(agent.id),
|
|
193
|
+
onDuplicateAgent: () => onDuplicateAgent(agent.id),
|
|
194
|
+
onDeleteAgent: handleOnDelete,
|
|
195
|
+
onChatClick: onChatClick ? event => onChatClick(event) : () => onOpenChatFullScreen(agent.id, agent.name),
|
|
196
|
+
resourceClient: resourceClient,
|
|
197
|
+
onViewFullProfileClick: () => onViewFullProfile(agent.id)
|
|
198
|
+
})));
|
|
199
|
+
};
|
|
200
|
+
export default AgentProfileCard;
|
|
@@ -2,6 +2,7 @@ import React, { Suspense, useCallback, useEffect, useMemo, useState } from 'reac
|
|
|
2
2
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import { navigateToTeamsApp } from '@atlaskit/teams-app-config/navigation';
|
|
5
|
+
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
5
6
|
import { fireEvent } from '../../util/analytics';
|
|
6
7
|
import { getAAIDFromARI } from '../../util/rovoAgentUtils';
|
|
7
8
|
import ErrorMessage from '../Error/ErrorMessage';
|
|
@@ -14,6 +15,9 @@ export const AgentProfileCardResourced = props => {
|
|
|
14
15
|
const {
|
|
15
16
|
createAnalyticsEvent
|
|
16
17
|
} = useAnalyticsEvents();
|
|
18
|
+
const {
|
|
19
|
+
fireEvent: fireEventNext
|
|
20
|
+
} = useAnalyticsEventsNext();
|
|
17
21
|
const fireAnalytics = useCallback(payload => {
|
|
18
22
|
if (createAnalyticsEvent) {
|
|
19
23
|
fireEvent(createAnalyticsEvent, payload);
|
|
@@ -48,7 +52,7 @@ export const AgentProfileCardResourced = props => {
|
|
|
48
52
|
if (!creatorUserId || !props.cloudId) {
|
|
49
53
|
return undefined;
|
|
50
54
|
}
|
|
51
|
-
const creatorInfo = await props.resourceClient.getProfile(creatorUserId, props.cloudId, fireAnalytics);
|
|
55
|
+
const creatorInfo = await props.resourceClient.getProfile(creatorUserId, props.cloudId, fireAnalytics, fireEventNext);
|
|
52
56
|
return {
|
|
53
57
|
type: 'CUSTOMER',
|
|
54
58
|
name: creatorInfo.fullName,
|
|
@@ -61,14 +65,14 @@ export const AgentProfileCardResourced = props => {
|
|
|
61
65
|
default:
|
|
62
66
|
return undefined;
|
|
63
67
|
}
|
|
64
|
-
}, [creatorUserId, fireAnalytics, props.cloudId, props.resourceClient, profileHref]);
|
|
68
|
+
}, [creatorUserId, fireAnalytics, fireEventNext, props.cloudId, props.resourceClient, profileHref]);
|
|
65
69
|
const fetchData = useCallback(async () => {
|
|
66
70
|
setIsLoading(true);
|
|
67
71
|
try {
|
|
68
72
|
const profileData = await props.resourceClient.getRovoAgentProfile({
|
|
69
73
|
type: 'identity',
|
|
70
74
|
value: props.accountId
|
|
71
|
-
}, fireAnalytics);
|
|
75
|
+
}, fireAnalytics, fireEventNext);
|
|
72
76
|
const agentCreatorInfo = await getCreator(profileData === null || profileData === void 0 ? void 0 : profileData.creator_type, (profileData === null || profileData === void 0 ? void 0 : profileData.creator) || undefined);
|
|
73
77
|
setAgentData({
|
|
74
78
|
...profileData,
|
|
@@ -79,7 +83,7 @@ export const AgentProfileCardResourced = props => {
|
|
|
79
83
|
} finally {
|
|
80
84
|
setIsLoading(false);
|
|
81
85
|
}
|
|
82
|
-
}, [fireAnalytics, getCreator, props.accountId, props.resourceClient]);
|
|
86
|
+
}, [fireAnalytics, fireEventNext, getCreator, props.accountId, props.resourceClient]);
|
|
83
87
|
useEffect(() => {
|
|
84
88
|
fetchData();
|
|
85
89
|
}, [fetchData]);
|
|
@@ -90,7 +94,7 @@ export const AgentProfileCardResourced = props => {
|
|
|
90
94
|
},
|
|
91
95
|
errorType: error || null,
|
|
92
96
|
fireAnalytics: () => {},
|
|
93
|
-
fireAnalyticsNext:
|
|
97
|
+
fireAnalyticsNext: fireEventNext
|
|
94
98
|
}));
|
|
95
99
|
}
|
|
96
100
|
return /*#__PURE__*/React.createElement(Suspense, {
|
|
@@ -3,6 +3,7 @@ import React, { forwardRef, Suspense, useCallback } from 'react';
|
|
|
3
3
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
import { navigateToTeamsApp } from '@atlaskit/teams-app-config/navigation';
|
|
6
|
+
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
6
7
|
import { fireEvent } from '../../util/analytics';
|
|
7
8
|
import { getAAIDFromARI } from '../../util/rovoAgentUtils';
|
|
8
9
|
import ProfileCardTrigger from '../common/ProfileCardTrigger';
|
|
@@ -21,6 +22,9 @@ export const AgentProfileCardTrigger = /*#__PURE__*/forwardRef(({
|
|
|
21
22
|
const {
|
|
22
23
|
createAnalyticsEvent
|
|
23
24
|
} = useAnalyticsEvents();
|
|
25
|
+
const {
|
|
26
|
+
fireEvent: fireEventNext
|
|
27
|
+
} = useAnalyticsEventsNext();
|
|
24
28
|
const fireAnalytics = useCallback(payload => {
|
|
25
29
|
if (createAnalyticsEvent) {
|
|
26
30
|
fireEvent(createAnalyticsEvent, payload);
|
|
@@ -60,7 +64,7 @@ export const AgentProfileCardTrigger = /*#__PURE__*/forwardRef(({
|
|
|
60
64
|
},
|
|
61
65
|
cloudId
|
|
62
66
|
});
|
|
63
|
-
const creatorInfo = await props.resourceClient.getProfile(cloudId, userId, fireAnalytics);
|
|
67
|
+
const creatorInfo = await props.resourceClient.getProfile(cloudId, userId, fireAnalytics, fireEventNext);
|
|
64
68
|
return {
|
|
65
69
|
type: 'CUSTOMER',
|
|
66
70
|
name: creatorInfo.fullName,
|
|
@@ -78,7 +82,7 @@ export const AgentProfileCardTrigger = /*#__PURE__*/forwardRef(({
|
|
|
78
82
|
const agentInfo = await resourceClient.getRovoAgentProfile({
|
|
79
83
|
type: 'agent',
|
|
80
84
|
value: userId
|
|
81
|
-
}, fireAnalytics);
|
|
85
|
+
}, fireAnalytics, fireEventNext);
|
|
82
86
|
const agentCreatorInfo = await getCreator(agentInfo.creator_type, agentInfo.creator || undefined);
|
|
83
87
|
return {
|
|
84
88
|
...agentInfo,
|
|
@@ -109,6 +113,7 @@ export const AgentProfileCardTrigger = /*#__PURE__*/forwardRef(({
|
|
|
109
113
|
renderProfileCard: renderProfileCard,
|
|
110
114
|
fetchProfile: fetchAgentProfile,
|
|
111
115
|
fireAnalytics: fireAnalytics,
|
|
116
|
+
fireAnalyticsNext: fireEventNext,
|
|
112
117
|
profileCardType: "agent"
|
|
113
118
|
}));
|
|
114
119
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._1bsb1gwv{width:360px}
|
|
@@ -1,14 +1,15 @@
|
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
width: '360px'
|
|
7
|
-
});
|
|
5
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
6
|
+
const styles = {
|
|
7
|
+
wrapper: "_1bsb1gwv"
|
|
8
|
+
};
|
|
8
9
|
export const AgentProfileCardWrapper = ({
|
|
9
10
|
children
|
|
10
11
|
}) => {
|
|
11
12
|
return /*#__PURE__*/React.createElement(Box, {
|
|
12
|
-
xcss: styles
|
|
13
|
+
xcss: styles.wrapper
|
|
13
14
|
}, children);
|
|
14
15
|
};
|
|
@@ -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 const ConversationStarters = ({
|
|
7
5
|
isAgentDefault,
|
|
@@ -4,6 +4,7 @@ import { getATLContextUrl } from '@atlaskit/atlassian-context';
|
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
import { useRovoPostMessageToPubsub } from '@atlaskit/rovo-triggers';
|
|
6
6
|
import { navigateToTeamsApp } from '@atlaskit/teams-app-config/navigation';
|
|
7
|
+
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
7
8
|
import { fireEvent } from '../../../util/analytics';
|
|
8
9
|
import { encodeParamsToUrl } from '../../../util/url';
|
|
9
10
|
export const firstCharUpper = str => str.charAt(0).toUpperCase() + str.slice(1);
|
|
@@ -25,6 +26,9 @@ export const useAgentUrlActions = ({
|
|
|
25
26
|
const {
|
|
26
27
|
createAnalyticsEvent
|
|
27
28
|
} = useAnalyticsEvents();
|
|
29
|
+
const {
|
|
30
|
+
fireEvent: fireEventNext
|
|
31
|
+
} = useAnalyticsEventsNext();
|
|
28
32
|
const onEditAgent = useCallback(agentId => {
|
|
29
33
|
const url = `${getATLContextUrl('home')}/chat/agents/${agentId}/edit`;
|
|
30
34
|
const urlWithParams = encodeParamsToUrl(url, {
|
|
@@ -34,27 +38,41 @@ export const useAgentUrlActions = ({
|
|
|
34
38
|
})
|
|
35
39
|
});
|
|
36
40
|
window.open(urlWithParams, '_blank', 'noopener, noreferrer');
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
actionSubject: 'button',
|
|
40
|
-
actionSubjectId: 'editAgentButton',
|
|
41
|
-
attributes: {
|
|
41
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
42
|
+
fireEventNext('ui.button.clicked.editAgentButton', {
|
|
42
43
|
agentId,
|
|
43
44
|
source
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
fireEvent(createAnalyticsEvent, {
|
|
48
|
+
action: 'clicked',
|
|
49
|
+
actionSubject: 'button',
|
|
50
|
+
actionSubjectId: 'editAgentButton',
|
|
51
|
+
attributes: {
|
|
52
|
+
agentId,
|
|
53
|
+
source
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}, [cloudId, createAnalyticsEvent, fireEventNext, source]);
|
|
47
58
|
const onCopyAgent = agentId => {
|
|
48
59
|
navigator.clipboard.writeText(`${window.location.origin}/people/agent/${agentId}`);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
actionSubject: 'button',
|
|
52
|
-
actionSubjectId: 'copyAgentLinkButton',
|
|
53
|
-
attributes: {
|
|
60
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
61
|
+
fireEventNext('ui.button.clicked.copyAgentLinkButton', {
|
|
54
62
|
agentId,
|
|
55
63
|
source
|
|
56
|
-
}
|
|
57
|
-
}
|
|
64
|
+
});
|
|
65
|
+
} else {
|
|
66
|
+
fireEvent(createAnalyticsEvent, {
|
|
67
|
+
action: 'clicked',
|
|
68
|
+
actionSubject: 'button',
|
|
69
|
+
actionSubjectId: 'copyAgentLinkButton',
|
|
70
|
+
attributes: {
|
|
71
|
+
agentId,
|
|
72
|
+
source
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
58
76
|
};
|
|
59
77
|
const onDuplicateAgent = useCallback(agentId => {
|
|
60
78
|
const baseUrl = `${getATLContextUrl('home')}/chat/agents/new`;
|
|
@@ -67,16 +85,23 @@ export const useAgentUrlActions = ({
|
|
|
67
85
|
})
|
|
68
86
|
});
|
|
69
87
|
window.open(urlWithParams, '_blank', 'noopener, noreferrer');
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
actionSubject: 'button',
|
|
73
|
-
actionSubjectId: 'duplicateAgentButton',
|
|
74
|
-
attributes: {
|
|
88
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
89
|
+
fireEventNext('ui.button.clicked.duplicateAgentButton', {
|
|
75
90
|
agentId,
|
|
76
91
|
source
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
92
|
+
});
|
|
93
|
+
} else {
|
|
94
|
+
fireEvent(createAnalyticsEvent, {
|
|
95
|
+
action: 'clicked',
|
|
96
|
+
actionSubject: 'button',
|
|
97
|
+
actionSubjectId: 'duplicateAgentButton',
|
|
98
|
+
attributes: {
|
|
99
|
+
agentId,
|
|
100
|
+
source
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}, [cloudId, createAnalyticsEvent, fireEventNext, source]);
|
|
80
105
|
const onConversationStarter = ({
|
|
81
106
|
agentId,
|
|
82
107
|
prompt
|
|
@@ -155,15 +180,22 @@ export const useAgentUrlActions = ({
|
|
|
155
180
|
} else {
|
|
156
181
|
window.open(`${window.location.origin}/people/agent/${agentId}`, '_blank', 'noopener, noreferrer');
|
|
157
182
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
actionSubject: 'button',
|
|
161
|
-
actionSubjectId: 'viewAgentFullProfileButton',
|
|
162
|
-
attributes: {
|
|
183
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
184
|
+
fireEventNext('ui.button.clicked.viewAgentFullProfileButton', {
|
|
163
185
|
agentId,
|
|
164
186
|
source
|
|
165
|
-
}
|
|
166
|
-
}
|
|
187
|
+
});
|
|
188
|
+
} else {
|
|
189
|
+
fireEvent(createAnalyticsEvent, {
|
|
190
|
+
action: 'clicked',
|
|
191
|
+
actionSubject: 'button',
|
|
192
|
+
actionSubjectId: 'viewAgentFullProfileButton',
|
|
193
|
+
attributes: {
|
|
194
|
+
agentId,
|
|
195
|
+
source
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|
|
167
199
|
};
|
|
168
200
|
return {
|
|
169
201
|
onEditAgent,
|
|
@@ -3,8 +3,7 @@ import Button from '@atlaskit/button/new';
|
|
|
3
3
|
import CrossCircleIcon from '@atlaskit/icon/core/cross-circle';
|
|
4
4
|
import IconError from '@atlaskit/icon/glyph/cross-circle';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
-
|
|
7
|
-
import { Text } from '@atlaskit/primitives';
|
|
6
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
8
7
|
import { ErrorTitle, ErrorWrapper } from '../../styled/Error';
|
|
9
8
|
import { PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
|
|
10
9
|
const ErrorMessage = props => {
|
|
@@ -1,20 +1,31 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import EmptyState from '@atlaskit/empty-state';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import messages from '../../messages';
|
|
5
6
|
import { AccessLockSVGWrapper, TeamForbiddenErrorStateWrapper } from '../../styled/TeamCard';
|
|
6
|
-
import { profileCardRendered } from '../../util/analytics';
|
|
7
|
+
import { PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
|
|
8
|
+
import { getPageTime } from '../../util/performance';
|
|
7
9
|
import AccessLockSVG from '../Error/AccessLockSVG';
|
|
8
10
|
export default (props => {
|
|
9
11
|
const {
|
|
10
|
-
analytics
|
|
12
|
+
analytics,
|
|
13
|
+
analyticsNext
|
|
11
14
|
} = props;
|
|
12
15
|
const intl = useIntl();
|
|
13
16
|
useEffect(() => {
|
|
14
|
-
|
|
15
|
-
duration
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
18
|
+
analyticsNext('ui.teamProfileCard.rendered.error', duration => ({
|
|
19
|
+
duration,
|
|
20
|
+
firedAt: Math.round(getPageTime()),
|
|
21
|
+
...PACKAGE_META_DATA
|
|
22
|
+
}));
|
|
23
|
+
} else {
|
|
24
|
+
analytics(duration => profileCardRendered('team', 'error', {
|
|
25
|
+
duration
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
}, [analytics, analyticsNext]);
|
|
18
29
|
return /*#__PURE__*/React.createElement(TeamForbiddenErrorStateWrapper, {
|
|
19
30
|
testId: "team-profilecard-forbidden-error-state"
|
|
20
31
|
}, /*#__PURE__*/React.createElement(EmptyState, {
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import Spinner from '@atlaskit/spinner';
|
|
3
4
|
import { CardContent, CardHeader, CardWrapper, LoadingWrapper } from '../../styled/TeamTrigger';
|
|
4
|
-
import { profileCardRendered } from '../../util/analytics';
|
|
5
|
+
import { PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
|
|
6
|
+
import { getPageTime } from '../../util/performance';
|
|
5
7
|
export default (props => {
|
|
6
8
|
const {
|
|
7
|
-
analytics
|
|
9
|
+
analytics,
|
|
10
|
+
analyticsNext
|
|
8
11
|
} = props;
|
|
9
12
|
useEffect(() => {
|
|
10
|
-
|
|
11
|
-
duration
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
14
|
+
analyticsNext('ui.teamProfileCard.rendered.spinner', duration => ({
|
|
15
|
+
duration,
|
|
16
|
+
firedAt: Math.round(getPageTime()),
|
|
17
|
+
...PACKAGE_META_DATA
|
|
18
|
+
}));
|
|
19
|
+
} else {
|
|
20
|
+
analytics(duration => profileCardRendered('team', 'spinner', {
|
|
21
|
+
duration
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
}, [analytics, analyticsNext]);
|
|
14
25
|
return /*#__PURE__*/React.createElement(CardWrapper, {
|
|
15
26
|
testId: "team-profilecard"
|
|
16
27
|
}, /*#__PURE__*/React.createElement(CardHeader, {
|