@atlaskit/profilecard 20.11.0 → 20.12.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 +13 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +3 -0
- package/afm-post-office/tsconfig.json +3 -0
- package/dist/cjs/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/cjs/client/getTeamFromAGG.js +1 -1
- package/dist/cjs/components/Agent/AgentProfileCard.js +1 -1
- package/dist/cjs/components/Agent/hooks/useAgentActions.js +66 -19
- package/dist/cjs/util/analytics.js +1 -1
- package/dist/es2019/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/es2019/client/getTeamFromAGG.js +1 -1
- package/dist/es2019/components/Agent/AgentProfileCard.js +1 -1
- package/dist/es2019/components/Agent/hooks/useAgentActions.js +67 -19
- package/dist/es2019/util/analytics.js +1 -1
- package/dist/esm/client/getOrgIdForCloudIdFromAGG.js +1 -1
- package/dist/esm/client/getTeamFromAGG.js +1 -1
- package/dist/esm/components/Agent/AgentProfileCard.js +1 -1
- package/dist/esm/components/Agent/hooks/useAgentActions.js +66 -19
- package/dist/esm/util/analytics.js +1 -1
- package/dist/types/components/Agent/hooks/useAgentActions.d.ts +1 -1
- package/dist/types-ts4.5/components/Agent/hooks/useAgentActions.d.ts +1 -1
- package/package.json +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/profilecard
|
|
2
2
|
|
|
3
|
+
## 20.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#162951](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/162951)
|
|
8
|
+
[`17d7f44be2959`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/17d7f44be2959) -
|
|
9
|
+
Agent profile card to use publishWithPostMessage, so `Chat to agent` or conversation starter
|
|
10
|
+
button will open in rovo sidebar if available
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 20.11.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/afm-cc/tsconfig.json
CHANGED
package/afm-jira/tsconfig.json
CHANGED
|
@@ -68,6 +68,9 @@
|
|
|
68
68
|
{
|
|
69
69
|
"path": "../../../ai-mate/rovo-agent-components/afm-post-office/tsconfig.json"
|
|
70
70
|
},
|
|
71
|
+
{
|
|
72
|
+
"path": "../../../ai-mate/rovo-triggers/afm-post-office/tsconfig.json"
|
|
73
|
+
},
|
|
71
74
|
{
|
|
72
75
|
"path": "../../../design-system/spinner/afm-post-office/tsconfig.json"
|
|
73
76
|
},
|
|
@@ -11,7 +11,7 @@ var _graphqlUtils = require("./graphqlUtils");
|
|
|
11
11
|
var ORG_ID_FROM_CLOUD_ID_QUERY = "query OrgIdFromCloudId($cloudId: ID!) {\n\ttenantContexts(cloudIds: [$cloudId]) {\n\t\torgId\n\t}\n}";
|
|
12
12
|
var addHeaders = function addHeaders(headers) {
|
|
13
13
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
14
|
-
headers.append('atl-client-version', "20.
|
|
14
|
+
headers.append('atl-client-version', "20.12.0");
|
|
15
15
|
return headers;
|
|
16
16
|
};
|
|
17
17
|
function getOrgIdForCloudIdFromAGG(_x, _x2) {
|
|
@@ -57,7 +57,7 @@ var addHeaders = exports.addHeaders = function addHeaders(headers) {
|
|
|
57
57
|
headers.append('X-ExperimentalApi', 'teams-beta');
|
|
58
58
|
headers.append('X-ExperimentalApi', 'team-members-beta');
|
|
59
59
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
60
|
-
headers.append('atl-client-version', "20.
|
|
60
|
+
headers.append('atl-client-version', "20.12.0");
|
|
61
61
|
return headers;
|
|
62
62
|
};
|
|
63
63
|
function getTeamFromAGG(_x, _x2, _x3) {
|
|
@@ -232,7 +232,7 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
232
232
|
},
|
|
233
233
|
onDeleteAgent: handleOnDelete,
|
|
234
234
|
onChatClick: function onChatClick() {
|
|
235
|
-
return _onChatClick ? _onChatClick() : onOpenChatFullScreen(agent.id);
|
|
235
|
+
return _onChatClick ? _onChatClick() : onOpenChatFullScreen(agent.id, agent.name);
|
|
236
236
|
},
|
|
237
237
|
resourceClient: resourceClient,
|
|
238
238
|
onViewFullProfileClick: function onViewFullProfileClick() {
|
|
@@ -9,6 +9,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _atlassianContext = require("@atlaskit/atlassian-context");
|
|
12
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
+
var _rovoTriggers = require("@atlaskit/rovo-triggers");
|
|
12
14
|
var _url = require("../../../util/url");
|
|
13
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -28,6 +30,8 @@ var createRovoParams = function createRovoParams(params) {
|
|
|
28
30
|
};
|
|
29
31
|
var useAgentUrlActions = exports.useAgentUrlActions = function useAgentUrlActions(_ref3) {
|
|
30
32
|
var cloudId = _ref3.cloudId;
|
|
33
|
+
var _useRovoPostMessageTo = (0, _rovoTriggers.useRovoPostMessageToPubsub)(),
|
|
34
|
+
publishWithPostMessage = _useRovoPostMessageTo.publishWithPostMessage;
|
|
31
35
|
var onEditAgent = (0, _react.useCallback)(function (agentId) {
|
|
32
36
|
var url = "".concat((0, _atlassianContext.getATLContextUrl)('home'), "/chat/agents/").concat(agentId, "/edit");
|
|
33
37
|
var urlWithParams = (0, _url.encodeParamsToUrl)(url, _objectSpread({
|
|
@@ -54,26 +58,69 @@ var useAgentUrlActions = exports.useAgentUrlActions = function useAgentUrlAction
|
|
|
54
58
|
var onConversationStarter = function onConversationStarter(_ref4) {
|
|
55
59
|
var agentId = _ref4.agentId,
|
|
56
60
|
prompt = _ref4.prompt;
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
var startConversationInNewTab = function startConversationInNewTab() {
|
|
62
|
+
var baseUrl = "".concat((0, _atlassianContext.getATLContextUrl)('home'), "/chat");
|
|
63
|
+
var urlWithParams = (0, _url.encodeParamsToUrl)(baseUrl, _objectSpread({
|
|
64
|
+
cloudId: cloudId
|
|
65
|
+
}, createRovoParams({
|
|
66
|
+
cloudId: cloudId,
|
|
67
|
+
agentId: agentId,
|
|
68
|
+
prompt: prompt,
|
|
69
|
+
pathway: 'chat'
|
|
70
|
+
})));
|
|
71
|
+
window.open(urlWithParams, '_blank', 'noopener, noreferrer');
|
|
72
|
+
};
|
|
73
|
+
if ((0, _platformFeatureFlags.fg)('rovo_profile_card_open_chat_sidebar')) {
|
|
74
|
+
publishWithPostMessage({
|
|
75
|
+
targetWindow: window,
|
|
76
|
+
payload: {
|
|
77
|
+
type: 'chat-new',
|
|
78
|
+
source: 'AgentProfileCard',
|
|
79
|
+
data: {
|
|
80
|
+
name: prompt.slice(0, 50),
|
|
81
|
+
prompt: prompt,
|
|
82
|
+
agentId: agentId,
|
|
83
|
+
dialogues: []
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
onAcknowledgeTimeout: function onAcknowledgeTimeout() {
|
|
87
|
+
startConversationInNewTab();
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
} else {
|
|
91
|
+
startConversationInNewTab();
|
|
92
|
+
}
|
|
67
93
|
};
|
|
68
|
-
var onOpenChat = function onOpenChat(agentId) {
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
94
|
+
var onOpenChat = function onOpenChat(agentId, agentName) {
|
|
95
|
+
var openChatInNewTab = function openChatInNewTab() {
|
|
96
|
+
var baseUrl = "".concat((0, _atlassianContext.getATLContextUrl)('home'), "/chat");
|
|
97
|
+
var urlWithParams = (0, _url.encodeParamsToUrl)(baseUrl, _objectSpread({
|
|
98
|
+
cloudId: cloudId
|
|
99
|
+
}, createRovoParams({
|
|
100
|
+
cloudId: cloudId,
|
|
101
|
+
agentId: agentId
|
|
102
|
+
})));
|
|
103
|
+
window.open(urlWithParams, '_blank', 'noopener, noreferrer');
|
|
104
|
+
};
|
|
105
|
+
if ((0, _platformFeatureFlags.fg)('rovo_profile_card_open_chat_sidebar')) {
|
|
106
|
+
publishWithPostMessage({
|
|
107
|
+
targetWindow: window,
|
|
108
|
+
payload: {
|
|
109
|
+
type: 'chat-new',
|
|
110
|
+
source: 'AgentProfileCard',
|
|
111
|
+
data: {
|
|
112
|
+
agentId: agentId,
|
|
113
|
+
dialogues: [],
|
|
114
|
+
name: "Chat with ".concat(agentName)
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
onAcknowledgeTimeout: function onAcknowledgeTimeout() {
|
|
118
|
+
openChatInNewTab();
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
} else {
|
|
122
|
+
openChatInNewTab();
|
|
123
|
+
}
|
|
77
124
|
};
|
|
78
125
|
var onViewFullProfile = function onViewFullProfile(agentId) {
|
|
79
126
|
window.open("".concat(window.location.origin, "/people/agent/").concat(agentId), '_blank', 'noopener, noreferrer');
|
|
@@ -45,7 +45,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
|
|
|
45
45
|
actionSubjectId: actionSubjectId,
|
|
46
46
|
attributes: _objectSpread(_objectSpread({
|
|
47
47
|
packageName: "@atlaskit/profilecard",
|
|
48
|
-
packageVersion: "20.
|
|
48
|
+
packageVersion: "20.12.0"
|
|
49
49
|
}, attributes), {}, {
|
|
50
50
|
firedAt: Math.round((0, _performance.getPageTime)())
|
|
51
51
|
})
|
|
@@ -6,7 +6,7 @@ const ORG_ID_FROM_CLOUD_ID_QUERY = `query OrgIdFromCloudId($cloudId: ID!) {
|
|
|
6
6
|
}`;
|
|
7
7
|
const addHeaders = headers => {
|
|
8
8
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
9
|
-
headers.append('atl-client-version', "20.
|
|
9
|
+
headers.append('atl-client-version', "20.12.0");
|
|
10
10
|
return headers;
|
|
11
11
|
};
|
|
12
12
|
export async function getOrgIdForCloudIdFromAGG(url, cloudId) {
|
|
@@ -67,7 +67,7 @@ export const addHeaders = headers => {
|
|
|
67
67
|
headers.append('X-ExperimentalApi', 'teams-beta');
|
|
68
68
|
headers.append('X-ExperimentalApi', 'team-members-beta');
|
|
69
69
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
70
|
-
headers.append('atl-client-version', "20.
|
|
70
|
+
headers.append('atl-client-version', "20.12.0");
|
|
71
71
|
return headers;
|
|
72
72
|
};
|
|
73
73
|
export async function getTeamFromAGG(url, teamId, siteId) {
|
|
@@ -178,7 +178,7 @@ const AgentProfileCard = ({
|
|
|
178
178
|
onCopyAgent: () => onCopyAgent(agent.id),
|
|
179
179
|
onDuplicateAgent: () => onDuplicateAgent(agent.id),
|
|
180
180
|
onDeleteAgent: handleOnDelete,
|
|
181
|
-
onChatClick: () => onChatClick ? onChatClick() : onOpenChatFullScreen(agent.id),
|
|
181
|
+
onChatClick: () => onChatClick ? onChatClick() : onOpenChatFullScreen(agent.id, agent.name),
|
|
182
182
|
resourceClient: resourceClient,
|
|
183
183
|
onViewFullProfileClick: () => onViewFullProfile(agent.id)
|
|
184
184
|
})));
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
2
|
import { getATLContextUrl } from '@atlaskit/atlassian-context';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { useRovoPostMessageToPubsub } from '@atlaskit/rovo-triggers';
|
|
3
5
|
import { encodeParamsToUrl } from '../../../util/url';
|
|
4
6
|
export const firstCharUpper = str => str.charAt(0).toUpperCase() + str.slice(1);
|
|
5
7
|
const ROVO_PARAM_PREFIX = 'rovoChat';
|
|
@@ -13,6 +15,9 @@ const createRovoParams = params => {
|
|
|
13
15
|
export const useAgentUrlActions = ({
|
|
14
16
|
cloudId
|
|
15
17
|
}) => {
|
|
18
|
+
const {
|
|
19
|
+
publishWithPostMessage
|
|
20
|
+
} = useRovoPostMessageToPubsub();
|
|
16
21
|
const onEditAgent = useCallback(agentId => {
|
|
17
22
|
const url = `${getATLContextUrl('home')}/chat/agents/${agentId}/edit`;
|
|
18
23
|
const urlWithParams = encodeParamsToUrl(url, {
|
|
@@ -42,28 +47,71 @@ export const useAgentUrlActions = ({
|
|
|
42
47
|
agentId,
|
|
43
48
|
prompt
|
|
44
49
|
}) => {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
...createRovoParams({
|
|
50
|
+
const startConversationInNewTab = () => {
|
|
51
|
+
const baseUrl = `${getATLContextUrl('home')}/chat`;
|
|
52
|
+
const urlWithParams = encodeParamsToUrl(baseUrl, {
|
|
49
53
|
cloudId,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
...createRovoParams({
|
|
55
|
+
cloudId,
|
|
56
|
+
agentId,
|
|
57
|
+
prompt,
|
|
58
|
+
pathway: 'chat'
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
window.open(urlWithParams, '_blank', 'noopener, noreferrer');
|
|
62
|
+
};
|
|
63
|
+
if (fg('rovo_profile_card_open_chat_sidebar')) {
|
|
64
|
+
publishWithPostMessage({
|
|
65
|
+
targetWindow: window,
|
|
66
|
+
payload: {
|
|
67
|
+
type: 'chat-new',
|
|
68
|
+
source: 'AgentProfileCard',
|
|
69
|
+
data: {
|
|
70
|
+
name: prompt.slice(0, 50),
|
|
71
|
+
prompt,
|
|
72
|
+
agentId,
|
|
73
|
+
dialogues: []
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
onAcknowledgeTimeout: () => {
|
|
77
|
+
startConversationInNewTab();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
} else {
|
|
81
|
+
startConversationInNewTab();
|
|
82
|
+
}
|
|
56
83
|
};
|
|
57
|
-
const onOpenChat = agentId => {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
...createRovoParams({
|
|
84
|
+
const onOpenChat = (agentId, agentName) => {
|
|
85
|
+
const openChatInNewTab = () => {
|
|
86
|
+
const baseUrl = `${getATLContextUrl('home')}/chat`;
|
|
87
|
+
const urlWithParams = encodeParamsToUrl(baseUrl, {
|
|
62
88
|
cloudId,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
89
|
+
...createRovoParams({
|
|
90
|
+
cloudId,
|
|
91
|
+
agentId
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
window.open(urlWithParams, '_blank', 'noopener, noreferrer');
|
|
95
|
+
};
|
|
96
|
+
if (fg('rovo_profile_card_open_chat_sidebar')) {
|
|
97
|
+
publishWithPostMessage({
|
|
98
|
+
targetWindow: window,
|
|
99
|
+
payload: {
|
|
100
|
+
type: 'chat-new',
|
|
101
|
+
source: 'AgentProfileCard',
|
|
102
|
+
data: {
|
|
103
|
+
agentId,
|
|
104
|
+
dialogues: [],
|
|
105
|
+
name: `Chat with ${agentName}`
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
onAcknowledgeTimeout: () => {
|
|
109
|
+
openChatInNewTab();
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
} else {
|
|
113
|
+
openChatInNewTab();
|
|
114
|
+
}
|
|
67
115
|
};
|
|
68
116
|
const onViewFullProfile = agentId => {
|
|
69
117
|
window.open(`${window.location.origin}/people/agent/${agentId}`, '_blank', 'noopener, noreferrer');
|
|
@@ -32,7 +32,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
|
|
|
32
32
|
actionSubjectId,
|
|
33
33
|
attributes: {
|
|
34
34
|
packageName: "@atlaskit/profilecard",
|
|
35
|
-
packageVersion: "20.
|
|
35
|
+
packageVersion: "20.12.0",
|
|
36
36
|
...attributes,
|
|
37
37
|
firedAt: Math.round(getPageTime())
|
|
38
38
|
}
|
|
@@ -4,7 +4,7 @@ import { AGGQuery } from './graphqlUtils';
|
|
|
4
4
|
var ORG_ID_FROM_CLOUD_ID_QUERY = "query OrgIdFromCloudId($cloudId: ID!) {\n\ttenantContexts(cloudIds: [$cloudId]) {\n\t\torgId\n\t}\n}";
|
|
5
5
|
var addHeaders = function addHeaders(headers) {
|
|
6
6
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
7
|
-
headers.append('atl-client-version', "20.
|
|
7
|
+
headers.append('atl-client-version', "20.12.0");
|
|
8
8
|
return headers;
|
|
9
9
|
};
|
|
10
10
|
export function getOrgIdForCloudIdFromAGG(_x, _x2) {
|
|
@@ -48,7 +48,7 @@ export var addHeaders = function addHeaders(headers) {
|
|
|
48
48
|
headers.append('X-ExperimentalApi', 'teams-beta');
|
|
49
49
|
headers.append('X-ExperimentalApi', 'team-members-beta');
|
|
50
50
|
headers.append('atl-client-name', "@atlaskit/profilecard");
|
|
51
|
-
headers.append('atl-client-version', "20.
|
|
51
|
+
headers.append('atl-client-version', "20.12.0");
|
|
52
52
|
return headers;
|
|
53
53
|
};
|
|
54
54
|
export function getTeamFromAGG(_x, _x2, _x3) {
|
|
@@ -222,7 +222,7 @@ var AgentProfileCard = function AgentProfileCard(_ref) {
|
|
|
222
222
|
},
|
|
223
223
|
onDeleteAgent: handleOnDelete,
|
|
224
224
|
onChatClick: function onChatClick() {
|
|
225
|
-
return _onChatClick ? _onChatClick() : onOpenChatFullScreen(agent.id);
|
|
225
|
+
return _onChatClick ? _onChatClick() : onOpenChatFullScreen(agent.id, agent.name);
|
|
226
226
|
},
|
|
227
227
|
resourceClient: resourceClient,
|
|
228
228
|
onViewFullProfileClick: function onViewFullProfileClick() {
|
|
@@ -4,6 +4,8 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
5
|
import { useCallback } from 'react';
|
|
6
6
|
import { getATLContextUrl } from '@atlaskit/atlassian-context';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
import { useRovoPostMessageToPubsub } from '@atlaskit/rovo-triggers';
|
|
7
9
|
import { encodeParamsToUrl } from '../../../util/url';
|
|
8
10
|
export var firstCharUpper = function firstCharUpper(str) {
|
|
9
11
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
@@ -21,6 +23,8 @@ var createRovoParams = function createRovoParams(params) {
|
|
|
21
23
|
};
|
|
22
24
|
export var useAgentUrlActions = function useAgentUrlActions(_ref3) {
|
|
23
25
|
var cloudId = _ref3.cloudId;
|
|
26
|
+
var _useRovoPostMessageTo = useRovoPostMessageToPubsub(),
|
|
27
|
+
publishWithPostMessage = _useRovoPostMessageTo.publishWithPostMessage;
|
|
24
28
|
var onEditAgent = useCallback(function (agentId) {
|
|
25
29
|
var url = "".concat(getATLContextUrl('home'), "/chat/agents/").concat(agentId, "/edit");
|
|
26
30
|
var urlWithParams = encodeParamsToUrl(url, _objectSpread({
|
|
@@ -47,26 +51,69 @@ export var useAgentUrlActions = function useAgentUrlActions(_ref3) {
|
|
|
47
51
|
var onConversationStarter = function onConversationStarter(_ref4) {
|
|
48
52
|
var agentId = _ref4.agentId,
|
|
49
53
|
prompt = _ref4.prompt;
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
var startConversationInNewTab = function startConversationInNewTab() {
|
|
55
|
+
var baseUrl = "".concat(getATLContextUrl('home'), "/chat");
|
|
56
|
+
var urlWithParams = encodeParamsToUrl(baseUrl, _objectSpread({
|
|
57
|
+
cloudId: cloudId
|
|
58
|
+
}, createRovoParams({
|
|
59
|
+
cloudId: cloudId,
|
|
60
|
+
agentId: agentId,
|
|
61
|
+
prompt: prompt,
|
|
62
|
+
pathway: 'chat'
|
|
63
|
+
})));
|
|
64
|
+
window.open(urlWithParams, '_blank', 'noopener, noreferrer');
|
|
65
|
+
};
|
|
66
|
+
if (fg('rovo_profile_card_open_chat_sidebar')) {
|
|
67
|
+
publishWithPostMessage({
|
|
68
|
+
targetWindow: window,
|
|
69
|
+
payload: {
|
|
70
|
+
type: 'chat-new',
|
|
71
|
+
source: 'AgentProfileCard',
|
|
72
|
+
data: {
|
|
73
|
+
name: prompt.slice(0, 50),
|
|
74
|
+
prompt: prompt,
|
|
75
|
+
agentId: agentId,
|
|
76
|
+
dialogues: []
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
onAcknowledgeTimeout: function onAcknowledgeTimeout() {
|
|
80
|
+
startConversationInNewTab();
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
} else {
|
|
84
|
+
startConversationInNewTab();
|
|
85
|
+
}
|
|
60
86
|
};
|
|
61
|
-
var onOpenChat = function onOpenChat(agentId) {
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
87
|
+
var onOpenChat = function onOpenChat(agentId, agentName) {
|
|
88
|
+
var openChatInNewTab = function openChatInNewTab() {
|
|
89
|
+
var baseUrl = "".concat(getATLContextUrl('home'), "/chat");
|
|
90
|
+
var urlWithParams = encodeParamsToUrl(baseUrl, _objectSpread({
|
|
91
|
+
cloudId: cloudId
|
|
92
|
+
}, createRovoParams({
|
|
93
|
+
cloudId: cloudId,
|
|
94
|
+
agentId: agentId
|
|
95
|
+
})));
|
|
96
|
+
window.open(urlWithParams, '_blank', 'noopener, noreferrer');
|
|
97
|
+
};
|
|
98
|
+
if (fg('rovo_profile_card_open_chat_sidebar')) {
|
|
99
|
+
publishWithPostMessage({
|
|
100
|
+
targetWindow: window,
|
|
101
|
+
payload: {
|
|
102
|
+
type: 'chat-new',
|
|
103
|
+
source: 'AgentProfileCard',
|
|
104
|
+
data: {
|
|
105
|
+
agentId: agentId,
|
|
106
|
+
dialogues: [],
|
|
107
|
+
name: "Chat with ".concat(agentName)
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
onAcknowledgeTimeout: function onAcknowledgeTimeout() {
|
|
111
|
+
openChatInNewTab();
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
} else {
|
|
115
|
+
openChatInNewTab();
|
|
116
|
+
}
|
|
70
117
|
};
|
|
71
118
|
var onViewFullProfile = function onViewFullProfile(agentId) {
|
|
72
119
|
window.open("".concat(window.location.origin, "/people/agent/").concat(agentId), '_blank', 'noopener, noreferrer');
|
|
@@ -39,7 +39,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
|
|
|
39
39
|
actionSubjectId: actionSubjectId,
|
|
40
40
|
attributes: _objectSpread(_objectSpread({
|
|
41
41
|
packageName: "@atlaskit/profilecard",
|
|
42
|
-
packageVersion: "20.
|
|
42
|
+
packageVersion: "20.12.0"
|
|
43
43
|
}, attributes), {}, {
|
|
44
44
|
firedAt: Math.round(getPageTime())
|
|
45
45
|
})
|
|
@@ -5,7 +5,7 @@ export declare const useAgentUrlActions: ({ cloudId }: {
|
|
|
5
5
|
onEditAgent: (agentId: string) => void;
|
|
6
6
|
onCopyAgent: (agentId: string) => void;
|
|
7
7
|
onDuplicateAgent: (agentId: string) => void;
|
|
8
|
-
onOpenChat: (agentId: string) => void;
|
|
8
|
+
onOpenChat: (agentId: string, agentName: string) => void;
|
|
9
9
|
onConversationStarter: ({ agentId, prompt }: {
|
|
10
10
|
agentId: string;
|
|
11
11
|
prompt: string;
|
|
@@ -5,7 +5,7 @@ export declare const useAgentUrlActions: ({ cloudId }: {
|
|
|
5
5
|
onEditAgent: (agentId: string) => void;
|
|
6
6
|
onCopyAgent: (agentId: string) => void;
|
|
7
7
|
onDuplicateAgent: (agentId: string) => void;
|
|
8
|
-
onOpenChat: (agentId: string) => void;
|
|
8
|
+
onOpenChat: (agentId: string, agentName: string) => void;
|
|
9
9
|
onConversationStarter: ({ agentId, prompt }: {
|
|
10
10
|
agentId: string;
|
|
11
11
|
prompt: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/profilecard",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.12.0",
|
|
4
4
|
"description": "A React component to display a card with user information.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -65,8 +65,9 @@
|
|
|
65
65
|
"@atlaskit/modal-dialog": "^12.17.0",
|
|
66
66
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
67
67
|
"@atlaskit/popup": "^1.29.0",
|
|
68
|
-
"@atlaskit/primitives": "^13.
|
|
68
|
+
"@atlaskit/primitives": "^13.2.0",
|
|
69
69
|
"@atlaskit/rovo-agent-components": "^1.12.0",
|
|
70
|
+
"@atlaskit/rovo-triggers": "^1.3.0",
|
|
70
71
|
"@atlaskit/spinner": "^16.3.0",
|
|
71
72
|
"@atlaskit/theme": "^14.0.0",
|
|
72
73
|
"@atlaskit/tokens": "^2.2.0",
|
|
@@ -90,6 +91,7 @@
|
|
|
90
91
|
"@atlassian/feature-flags-test-utils": "*",
|
|
91
92
|
"@atlassian/ptc-test-utils": "^0.8.0",
|
|
92
93
|
"@testing-library/react": "^12.1.5",
|
|
94
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
93
95
|
"@testing-library/user-event": "^14.4.3",
|
|
94
96
|
"enzyme": "^3.10.0",
|
|
95
97
|
"es6-promise": "^4.0.5",
|
|
@@ -130,6 +132,9 @@
|
|
|
130
132
|
},
|
|
131
133
|
"platform_profile_card_css_refactor": {
|
|
132
134
|
"type": "boolean"
|
|
135
|
+
},
|
|
136
|
+
"rovo_profile_card_open_chat_sidebar": {
|
|
137
|
+
"type": "boolean"
|
|
133
138
|
}
|
|
134
139
|
}
|
|
135
140
|
}
|