@atlaskit/profilecard 24.14.1 → 24.16.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 +22 -0
- package/__tests__/vr-tests/agent-profilecard.vr.tsx +5 -5
- package/__tests__/vr-tests/user-profilecard.vr.tsx +30 -30
- 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/components/Agent/Actions.js +20 -9
- package/dist/cjs/components/Agent/ActionsCompiled.js +18 -8
- package/dist/cjs/components/Agent/AgentDeleteConfirmationModal.js +3 -1
- package/dist/cjs/components/Agent/AgentProfileCard.js +24 -14
- package/dist/cjs/components/Agent/AgentProfileCardCompiled.js +23 -8
- package/dist/cjs/components/Agent/AgentProfileCardResourced.js +8 -5
- package/dist/cjs/components/Agent/AgentProfileCardTrigger.js +6 -2
- package/dist/cjs/components/Agent/hooks/useAgentActions.js +61 -30
- 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 +104 -33
- package/dist/cjs/components/common/ProfileCardTrigger.js +3 -1
- package/dist/cjs/components/team-profile-card/main.js +18 -9
- package/dist/cjs/components/team-profile-card/team-connections/main.js +36 -17
- package/dist/cjs/util/analytics.js +55 -0
- 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/components/Agent/Actions.js +21 -9
- package/dist/es2019/components/Agent/ActionsCompiled.js +19 -8
- package/dist/es2019/components/Agent/AgentDeleteConfirmationModal.js +3 -1
- package/dist/es2019/components/Agent/AgentProfileCard.js +24 -13
- package/dist/es2019/components/Agent/AgentProfileCardCompiled.js +23 -9
- package/dist/es2019/components/Agent/AgentProfileCardResourced.js +9 -5
- package/dist/es2019/components/Agent/AgentProfileCardTrigger.js +7 -2
- package/dist/es2019/components/Agent/hooks/useAgentActions.js +62 -30
- 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 +74 -10
- package/dist/es2019/components/common/ProfileCardTrigger.js +3 -1
- package/dist/es2019/components/team-profile-card/main.js +19 -9
- package/dist/es2019/components/team-profile-card/team-connections/main.js +38 -17
- package/dist/es2019/util/analytics.js +55 -0
- 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/components/Agent/Actions.js +20 -9
- package/dist/esm/components/Agent/ActionsCompiled.js +18 -8
- package/dist/esm/components/Agent/AgentDeleteConfirmationModal.js +3 -1
- package/dist/esm/components/Agent/AgentProfileCard.js +25 -13
- package/dist/esm/components/Agent/AgentProfileCardCompiled.js +24 -9
- package/dist/esm/components/Agent/AgentProfileCardResourced.js +8 -5
- package/dist/esm/components/Agent/AgentProfileCardTrigger.js +6 -2
- package/dist/esm/components/Agent/hooks/useAgentActions.js +61 -30
- 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 +105 -34
- package/dist/esm/components/common/ProfileCardTrigger.js +3 -1
- package/dist/esm/components/team-profile-card/main.js +18 -9
- package/dist/esm/components/team-profile-card/team-connections/main.js +36 -17
- package/dist/esm/util/analytics.js +55 -0
- 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/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/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/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/types.d.ts +2 -0
- package/dist/types-ts4.5/util/analytics.d.ts +46 -2
- package/package.json +8 -8
|
@@ -8,6 +8,7 @@ import Button from '@atlaskit/button/new';
|
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { Box, Inline } from '@atlaskit/primitives/compiled';
|
|
10
10
|
import { AgentDropdownMenu, ChatPillIcon } from '@atlaskit/rovo-agent-components';
|
|
11
|
+
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
11
12
|
import { fireEvent } from '../../util/analytics';
|
|
12
13
|
import { AgentDeleteConfirmationModal } from './AgentDeleteConfirmationModal';
|
|
13
14
|
const styles = {
|
|
@@ -34,6 +35,9 @@ export const AgentActions = ({
|
|
|
34
35
|
const {
|
|
35
36
|
createAnalyticsEvent
|
|
36
37
|
} = useAnalyticsEvents();
|
|
38
|
+
const {
|
|
39
|
+
fireEvent: fireEventNext
|
|
40
|
+
} = useAnalyticsEventsNext();
|
|
37
41
|
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
|
|
38
42
|
const isForgeAgent = agent.creator_type === 'FORGE' || agent.creator_type === 'THIRD_PARTY';
|
|
39
43
|
const loadAgentPermissions = useCallback(async () => {
|
|
@@ -53,17 +57,24 @@ export const AgentActions = ({
|
|
|
53
57
|
};
|
|
54
58
|
}, [agent.id, resourceClient]);
|
|
55
59
|
const handleDeleteAgent = useCallback(() => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
actionSubject: 'button',
|
|
59
|
-
actionSubjectId: 'deleteAgentButton',
|
|
60
|
-
attributes: {
|
|
60
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
61
|
+
fireEventNext('ui.button.clicked.deleteAgentButton', {
|
|
61
62
|
agentId: agent.id,
|
|
62
63
|
source: 'agentProfileCard'
|
|
63
|
-
}
|
|
64
|
-
}
|
|
64
|
+
});
|
|
65
|
+
} else {
|
|
66
|
+
fireEvent(createAnalyticsEvent, {
|
|
67
|
+
action: 'clicked',
|
|
68
|
+
actionSubject: 'button',
|
|
69
|
+
actionSubjectId: 'deleteAgentButton',
|
|
70
|
+
attributes: {
|
|
71
|
+
agentId: agent.id,
|
|
72
|
+
source: 'agentProfileCard'
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
65
76
|
setIsDeleteModalOpen(true);
|
|
66
|
-
}, [agent.id, createAnalyticsEvent]);
|
|
77
|
+
}, [agent.id, createAnalyticsEvent, fireEventNext]);
|
|
67
78
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Inline, {
|
|
68
79
|
space: "space.100",
|
|
69
80
|
xcss: styles.actionsWrapperStyles
|
|
@@ -21,7 +21,9 @@ export const AgentDeleteConfirmationModal = ({
|
|
|
21
21
|
}, [agentId, onClose, onSubmit]);
|
|
22
22
|
return /*#__PURE__*/React.createElement(ModalTransition, null, isOpen && /*#__PURE__*/React.createElement(Modal, {
|
|
23
23
|
width: "small"
|
|
24
|
-
}, /*#__PURE__*/React.createElement(ModalHeader,
|
|
24
|
+
}, /*#__PURE__*/React.createElement(ModalHeader, {
|
|
25
|
+
hasCloseButton: true
|
|
26
|
+
}, /*#__PURE__*/React.createElement(ModalTitle, null, formatMessage(messages.title, {
|
|
25
27
|
agentName
|
|
26
28
|
}))), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(Text, {
|
|
27
29
|
as: "p"
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
3
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
5
6
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
6
7
|
import { Box, Stack, xcss } from '@atlaskit/primitives';
|
|
7
8
|
import { AgentAvatar, AgentBanner, AgentProfileCreator, AgentProfileInfo, AgentStarCount } from '@atlaskit/rovo-agent-components';
|
|
8
|
-
import {
|
|
9
|
+
import { useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/teams-app-internal-analytics';
|
|
10
|
+
import { fireEvent, PACKAGE_META_DATA, profileCardRendered } from '../../util/analytics';
|
|
11
|
+
import { getPageTime } from '../../util/performance';
|
|
9
12
|
import { LoadingState } from '../common/LoadingState';
|
|
10
13
|
import { ErrorMessage } from '../Error';
|
|
11
14
|
import { AgentActions } from './Actions';
|
|
@@ -57,6 +60,9 @@ const AgentProfileCard = ({
|
|
|
57
60
|
const {
|
|
58
61
|
formatMessage
|
|
59
62
|
} = useIntl();
|
|
63
|
+
const {
|
|
64
|
+
fireEvent: fireEventNext
|
|
65
|
+
} = useAnalyticsEventsNext();
|
|
60
66
|
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 => {
|
|
61
67
|
return {
|
|
62
68
|
message: starter,
|
|
@@ -78,7 +84,7 @@ const AgentProfileCard = ({
|
|
|
78
84
|
const handleSetFavourite = useCallback(async () => {
|
|
79
85
|
if (agent !== null && agent !== void 0 && agent.id) {
|
|
80
86
|
try {
|
|
81
|
-
await resourceClient.setFavouriteAgent(agent.id, !isStarred, fireAnalytics);
|
|
87
|
+
await resourceClient.setFavouriteAgent(agent.id, !isStarred, fireAnalytics, fireEventNext);
|
|
82
88
|
if (isStarred) {
|
|
83
89
|
setStarCount(starCount ? starCount - 1 : 0);
|
|
84
90
|
} else {
|
|
@@ -87,7 +93,7 @@ const AgentProfileCard = ({
|
|
|
87
93
|
setIsStarred(!isStarred);
|
|
88
94
|
} catch (error) {}
|
|
89
95
|
}
|
|
90
|
-
}, [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, isStarred, resourceClient, starCount]);
|
|
96
|
+
}, [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, fireEventNext, isStarred, resourceClient, starCount]);
|
|
91
97
|
const handleOnDelete = useCallback(async () => {
|
|
92
98
|
if (agent && onDeleteAgent) {
|
|
93
99
|
// Optimistically remove from cache
|
|
@@ -95,7 +101,7 @@ const AgentProfileCard = ({
|
|
|
95
101
|
restore
|
|
96
102
|
} = onDeleteAgent(agent.id);
|
|
97
103
|
try {
|
|
98
|
-
await resourceClient.deleteAgent(agent.id, fireAnalytics);
|
|
104
|
+
await resourceClient.deleteAgent(agent.id, fireAnalytics, fireEventNext);
|
|
99
105
|
addFlag === null || addFlag === void 0 ? void 0 : addFlag({
|
|
100
106
|
title: formatMessage(messages.agentDeletedSuccessFlagTitle),
|
|
101
107
|
description: formatMessage(messages.agentDeletedSuccessFlagDescription, {
|
|
@@ -115,26 +121,31 @@ const AgentProfileCard = ({
|
|
|
115
121
|
});
|
|
116
122
|
}
|
|
117
123
|
}
|
|
118
|
-
}, [addFlag, agent, formatMessage, onDeleteAgent, resourceClient, fireAnalytics]);
|
|
124
|
+
}, [addFlag, agent, formatMessage, onDeleteAgent, resourceClient, fireAnalytics, fireEventNext]);
|
|
119
125
|
useEffect(() => {
|
|
120
126
|
if (!isLoading && agent) {
|
|
121
|
-
|
|
127
|
+
if (fg('ptc-enable-profile-card-analytics-refactor')) {
|
|
128
|
+
fireEventNext(`ui.rovoAgentProfilecard.rendered.content`, {
|
|
129
|
+
...PACKAGE_META_DATA,
|
|
130
|
+
firedAt: Math.round(getPageTime())
|
|
131
|
+
});
|
|
132
|
+
} else {
|
|
133
|
+
fireAnalytics(profileCardRendered('agent', 'content'));
|
|
134
|
+
}
|
|
122
135
|
}
|
|
123
|
-
}, [agent, fireAnalytics, isLoading]);
|
|
136
|
+
}, [agent, fireAnalytics, fireEventNext, isLoading]);
|
|
124
137
|
if (isLoading) {
|
|
125
138
|
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(LoadingState, {
|
|
126
139
|
profileType: "agent",
|
|
127
|
-
fireAnalytics: fireAnalytics
|
|
140
|
+
fireAnalytics: fireAnalytics,
|
|
141
|
+
fireAnalyticsNext: fireEventNext
|
|
128
142
|
}));
|
|
129
143
|
}
|
|
130
144
|
if (hasError || !agent) {
|
|
131
145
|
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
132
146
|
errorType: errorType,
|
|
133
|
-
fireAnalytics: fireAnalytics
|
|
134
|
-
|
|
135
|
-
// NOTE: Add it to AgentProfileCardCompiled
|
|
136
|
-
,
|
|
137
|
-
fireAnalyticsNext: () => {}
|
|
147
|
+
fireAnalytics: fireAnalytics,
|
|
148
|
+
fireAnalyticsNext: fireEventNext
|
|
138
149
|
}));
|
|
139
150
|
}
|
|
140
151
|
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(Box, {
|
|
@@ -4,9 +4,12 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
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 { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { Box, Stack } from '@atlaskit/primitives/compiled';
|
|
8
9
|
import { AgentAvatar, AgentBanner, AgentProfileCreator, AgentProfileInfo, AgentStarCount } from '@atlaskit/rovo-agent-components';
|
|
9
|
-
import {
|
|
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';
|
|
10
13
|
import { LoadingState } from '../common/LoadingState';
|
|
11
14
|
import { ErrorMessage } from '../Error';
|
|
12
15
|
import { AgentActions } from './Actions';
|
|
@@ -48,6 +51,9 @@ const AgentProfileCard = ({
|
|
|
48
51
|
const {
|
|
49
52
|
formatMessage
|
|
50
53
|
} = useIntl();
|
|
54
|
+
const {
|
|
55
|
+
fireEvent: fireAnalyticsNext
|
|
56
|
+
} = useAnalyticsEventsNext();
|
|
51
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 => {
|
|
52
58
|
return {
|
|
53
59
|
message: starter,
|
|
@@ -69,7 +75,7 @@ const AgentProfileCard = ({
|
|
|
69
75
|
const handleSetFavourite = useCallback(async () => {
|
|
70
76
|
if (agent !== null && agent !== void 0 && agent.id) {
|
|
71
77
|
try {
|
|
72
|
-
await resourceClient.setFavouriteAgent(agent.id, !isStarred, fireAnalytics);
|
|
78
|
+
await resourceClient.setFavouriteAgent(agent.id, !isStarred, fireAnalytics, fireAnalyticsNext);
|
|
73
79
|
if (isStarred) {
|
|
74
80
|
setStarCount(starCount ? starCount - 1 : 0);
|
|
75
81
|
} else {
|
|
@@ -78,7 +84,7 @@ const AgentProfileCard = ({
|
|
|
78
84
|
setIsStarred(!isStarred);
|
|
79
85
|
} catch (error) {}
|
|
80
86
|
}
|
|
81
|
-
}, [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, isStarred, resourceClient, starCount]);
|
|
87
|
+
}, [agent === null || agent === void 0 ? void 0 : agent.id, fireAnalytics, fireAnalyticsNext, isStarred, resourceClient, starCount]);
|
|
82
88
|
const handleOnDelete = useCallback(async () => {
|
|
83
89
|
if (agent && onDeleteAgent) {
|
|
84
90
|
// Optimistically remove from cache
|
|
@@ -86,7 +92,7 @@ const AgentProfileCard = ({
|
|
|
86
92
|
restore
|
|
87
93
|
} = onDeleteAgent(agent.id);
|
|
88
94
|
try {
|
|
89
|
-
await resourceClient.deleteAgent(agent.id, fireAnalytics);
|
|
95
|
+
await resourceClient.deleteAgent(agent.id, fireAnalytics, fireAnalyticsNext);
|
|
90
96
|
addFlag === null || addFlag === void 0 ? void 0 : addFlag({
|
|
91
97
|
title: formatMessage(messages.agentDeletedSuccessFlagTitle),
|
|
92
98
|
description: formatMessage(messages.agentDeletedSuccessFlagDescription, {
|
|
@@ -106,21 +112,29 @@ const AgentProfileCard = ({
|
|
|
106
112
|
});
|
|
107
113
|
}
|
|
108
114
|
}
|
|
109
|
-
}, [addFlag, agent, formatMessage, onDeleteAgent, resourceClient, fireAnalytics]);
|
|
115
|
+
}, [addFlag, agent, formatMessage, onDeleteAgent, resourceClient, fireAnalytics, fireAnalyticsNext]);
|
|
110
116
|
useEffect(() => {
|
|
111
117
|
if (!isLoading && agent) {
|
|
112
|
-
|
|
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
|
+
}
|
|
113
126
|
}
|
|
114
|
-
}, [agent, fireAnalytics, isLoading]);
|
|
127
|
+
}, [agent, fireAnalytics, isLoading, fireAnalyticsNext]);
|
|
115
128
|
if (isLoading) {
|
|
116
129
|
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(LoadingState, {
|
|
117
130
|
profileType: "agent",
|
|
118
|
-
fireAnalytics: fireAnalytics
|
|
131
|
+
fireAnalytics: fireAnalytics,
|
|
132
|
+
fireAnalyticsNext: fireAnalyticsNext
|
|
119
133
|
}));
|
|
120
134
|
}
|
|
121
135
|
if (hasError || !agent) {
|
|
122
136
|
return /*#__PURE__*/React.createElement(AgentProfileCardWrapper, null, /*#__PURE__*/React.createElement(ErrorMessage, {
|
|
123
|
-
fireAnalyticsNext:
|
|
137
|
+
fireAnalyticsNext: fireAnalyticsNext,
|
|
124
138
|
errorType: errorType,
|
|
125
139
|
fireAnalytics: fireAnalytics
|
|
126
140
|
}));
|
|
@@ -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
|
});
|
|
@@ -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,
|
|
@@ -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, {
|