@atlaskit/rovo-agent-components 1.6.3 → 1.7.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 +12 -0
- package/dist/cjs/ui/agent-conversation-starters/index.js +31 -6
- package/dist/es2019/ui/agent-conversation-starters/index.js +31 -6
- package/dist/esm/ui/agent-conversation-starters/index.js +31 -6
- package/dist/types/index.d.ts +1 -1
- package/dist/types/ui/agent-conversation-starters/index.d.ts +16 -7
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/agent-conversation-starters/index.d.ts +16 -7
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/rovo-agent-components
|
|
2
2
|
|
|
3
|
+
## 1.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#154365](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154365)
|
|
8
|
+
[`6daa73332cbc2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6daa73332cbc2) -
|
|
9
|
+
Added type to conversation starters
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 1.6.3
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -22,9 +22,28 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
22
22
|
var getConversationStarters = exports.getConversationStarters = function getConversationStarters(_ref) {
|
|
23
23
|
var userDefinedConversationStartersParam = _ref.userDefinedConversationStarters,
|
|
24
24
|
isAgentDefault = _ref.isAgentDefault;
|
|
25
|
-
var
|
|
25
|
+
var type = 'static';
|
|
26
|
+
var customAgentConversationStarters = [{
|
|
27
|
+
message: _messages.messages.agentEmptyStateSuggestion1,
|
|
28
|
+
type: type
|
|
29
|
+
}, {
|
|
30
|
+
message: _messages.messages.agentEmptyStateSuggestion2,
|
|
31
|
+
type: type
|
|
32
|
+
}, {
|
|
33
|
+
message: _messages.messages.agentEmptyStateSuggestion3,
|
|
34
|
+
type: type
|
|
35
|
+
}];
|
|
26
36
|
var userDefinedConversationStarters = userDefinedConversationStartersParam !== null && userDefinedConversationStartersParam !== void 0 ? userDefinedConversationStartersParam : [];
|
|
27
|
-
var defaultAgentConversationStarters = [
|
|
37
|
+
var defaultAgentConversationStarters = [{
|
|
38
|
+
message: _messages.messages.emptyStateSuggestion1,
|
|
39
|
+
type: type
|
|
40
|
+
}, {
|
|
41
|
+
message: _messages.messages.emptyStateSuggestion2,
|
|
42
|
+
type: type
|
|
43
|
+
}, {
|
|
44
|
+
message: _messages.messages.emptyStateSuggestion3,
|
|
45
|
+
type: type
|
|
46
|
+
}];
|
|
28
47
|
var getCombinedConversationStarters = function getCombinedConversationStarters() {
|
|
29
48
|
var shouldCombine = !isAgentDefault;
|
|
30
49
|
if (shouldCombine) {
|
|
@@ -55,7 +74,13 @@ var AgentConversationStarters = exports.AgentConversationStarters = function Age
|
|
|
55
74
|
combinedConversationStarters = _useMemo.combinedConversationStarters;
|
|
56
75
|
var starters = (0, _react.useMemo)(function () {
|
|
57
76
|
return combinedConversationStarters.map(function (starter) {
|
|
58
|
-
return typeof starter === 'string' ?
|
|
77
|
+
return typeof starter.message === 'string' ? {
|
|
78
|
+
message: starter.message,
|
|
79
|
+
type: starter.type
|
|
80
|
+
} : {
|
|
81
|
+
message: formatMessage(starter.message),
|
|
82
|
+
type: starter.type
|
|
83
|
+
};
|
|
59
84
|
});
|
|
60
85
|
}, [combinedConversationStarters, formatMessage]);
|
|
61
86
|
return /*#__PURE__*/_react.default.createElement(ConversationStarters, (0, _extends2.default)({
|
|
@@ -74,16 +99,16 @@ var ConversationStarters = exports.ConversationStarters = function ConversationS
|
|
|
74
99
|
var isLastStarter = index === starters.length - 1;
|
|
75
100
|
var chatPill = /*#__PURE__*/_react.default.createElement(_chatPill.ChatPill, {
|
|
76
101
|
testId: "conversation-starter",
|
|
77
|
-
key: starter,
|
|
102
|
+
key: starter.message,
|
|
78
103
|
onClick: function onClick() {
|
|
79
104
|
return onConversationStarterClick(starter);
|
|
80
105
|
}
|
|
81
|
-
}, starter);
|
|
106
|
+
}, starter.message);
|
|
82
107
|
return isLastStarter && showReloadButton ? /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
|
|
83
108
|
space: "space.050",
|
|
84
109
|
grow: "fill",
|
|
85
110
|
alignInline: "end",
|
|
86
|
-
key: starter
|
|
111
|
+
key: starter.message
|
|
87
112
|
}, chatPill, /*#__PURE__*/_react.default.createElement(_new.IconButton, {
|
|
88
113
|
icon: _retry.default,
|
|
89
114
|
onClick: onReloadButtonClick,
|
|
@@ -10,9 +10,28 @@ export const getConversationStarters = ({
|
|
|
10
10
|
userDefinedConversationStarters: userDefinedConversationStartersParam,
|
|
11
11
|
isAgentDefault
|
|
12
12
|
}) => {
|
|
13
|
-
const
|
|
13
|
+
const type = 'static';
|
|
14
|
+
const customAgentConversationStarters = [{
|
|
15
|
+
message: messages.agentEmptyStateSuggestion1,
|
|
16
|
+
type
|
|
17
|
+
}, {
|
|
18
|
+
message: messages.agentEmptyStateSuggestion2,
|
|
19
|
+
type
|
|
20
|
+
}, {
|
|
21
|
+
message: messages.agentEmptyStateSuggestion3,
|
|
22
|
+
type
|
|
23
|
+
}];
|
|
14
24
|
const userDefinedConversationStarters = userDefinedConversationStartersParam !== null && userDefinedConversationStartersParam !== void 0 ? userDefinedConversationStartersParam : [];
|
|
15
|
-
const defaultAgentConversationStarters = [
|
|
25
|
+
const defaultAgentConversationStarters = [{
|
|
26
|
+
message: messages.emptyStateSuggestion1,
|
|
27
|
+
type
|
|
28
|
+
}, {
|
|
29
|
+
message: messages.emptyStateSuggestion2,
|
|
30
|
+
type
|
|
31
|
+
}, {
|
|
32
|
+
message: messages.emptyStateSuggestion3,
|
|
33
|
+
type
|
|
34
|
+
}];
|
|
16
35
|
const getCombinedConversationStarters = () => {
|
|
17
36
|
const shouldCombine = !isAgentDefault;
|
|
18
37
|
if (shouldCombine) {
|
|
@@ -42,7 +61,13 @@ export const AgentConversationStarters = ({
|
|
|
42
61
|
userDefinedConversationStarters,
|
|
43
62
|
isAgentDefault
|
|
44
63
|
}), [userDefinedConversationStarters, isAgentDefault]);
|
|
45
|
-
const starters = useMemo(() => combinedConversationStarters.map(starter => typeof starter === 'string' ?
|
|
64
|
+
const starters = useMemo(() => combinedConversationStarters.map(starter => typeof starter.message === 'string' ? {
|
|
65
|
+
message: starter.message,
|
|
66
|
+
type: starter.type
|
|
67
|
+
} : {
|
|
68
|
+
message: formatMessage(starter.message),
|
|
69
|
+
type: starter.type
|
|
70
|
+
}), [combinedConversationStarters, formatMessage]);
|
|
46
71
|
return /*#__PURE__*/React.createElement(ConversationStarters, _extends({
|
|
47
72
|
starters: starters
|
|
48
73
|
}, props));
|
|
@@ -58,14 +83,14 @@ export const ConversationStarters = ({
|
|
|
58
83
|
const isLastStarter = index === starters.length - 1;
|
|
59
84
|
const chatPill = /*#__PURE__*/React.createElement(ChatPill, {
|
|
60
85
|
testId: "conversation-starter",
|
|
61
|
-
key: starter,
|
|
86
|
+
key: starter.message,
|
|
62
87
|
onClick: () => onConversationStarterClick(starter)
|
|
63
|
-
}, starter);
|
|
88
|
+
}, starter.message);
|
|
64
89
|
return isLastStarter && showReloadButton ? /*#__PURE__*/React.createElement(Inline, {
|
|
65
90
|
space: "space.050",
|
|
66
91
|
grow: "fill",
|
|
67
92
|
alignInline: "end",
|
|
68
|
-
key: starter
|
|
93
|
+
key: starter.message
|
|
69
94
|
}, chatPill, /*#__PURE__*/React.createElement(IconButton, {
|
|
70
95
|
icon: RetryIcon,
|
|
71
96
|
onClick: onReloadButtonClick,
|
|
@@ -12,9 +12,28 @@ import { messages } from './messages';
|
|
|
12
12
|
export var getConversationStarters = function getConversationStarters(_ref) {
|
|
13
13
|
var userDefinedConversationStartersParam = _ref.userDefinedConversationStarters,
|
|
14
14
|
isAgentDefault = _ref.isAgentDefault;
|
|
15
|
-
var
|
|
15
|
+
var type = 'static';
|
|
16
|
+
var customAgentConversationStarters = [{
|
|
17
|
+
message: messages.agentEmptyStateSuggestion1,
|
|
18
|
+
type: type
|
|
19
|
+
}, {
|
|
20
|
+
message: messages.agentEmptyStateSuggestion2,
|
|
21
|
+
type: type
|
|
22
|
+
}, {
|
|
23
|
+
message: messages.agentEmptyStateSuggestion3,
|
|
24
|
+
type: type
|
|
25
|
+
}];
|
|
16
26
|
var userDefinedConversationStarters = userDefinedConversationStartersParam !== null && userDefinedConversationStartersParam !== void 0 ? userDefinedConversationStartersParam : [];
|
|
17
|
-
var defaultAgentConversationStarters = [
|
|
27
|
+
var defaultAgentConversationStarters = [{
|
|
28
|
+
message: messages.emptyStateSuggestion1,
|
|
29
|
+
type: type
|
|
30
|
+
}, {
|
|
31
|
+
message: messages.emptyStateSuggestion2,
|
|
32
|
+
type: type
|
|
33
|
+
}, {
|
|
34
|
+
message: messages.emptyStateSuggestion3,
|
|
35
|
+
type: type
|
|
36
|
+
}];
|
|
18
37
|
var getCombinedConversationStarters = function getCombinedConversationStarters() {
|
|
19
38
|
var shouldCombine = !isAgentDefault;
|
|
20
39
|
if (shouldCombine) {
|
|
@@ -45,7 +64,13 @@ export var AgentConversationStarters = function AgentConversationStarters(_ref2)
|
|
|
45
64
|
combinedConversationStarters = _useMemo.combinedConversationStarters;
|
|
46
65
|
var starters = useMemo(function () {
|
|
47
66
|
return combinedConversationStarters.map(function (starter) {
|
|
48
|
-
return typeof starter === 'string' ?
|
|
67
|
+
return typeof starter.message === 'string' ? {
|
|
68
|
+
message: starter.message,
|
|
69
|
+
type: starter.type
|
|
70
|
+
} : {
|
|
71
|
+
message: formatMessage(starter.message),
|
|
72
|
+
type: starter.type
|
|
73
|
+
};
|
|
49
74
|
});
|
|
50
75
|
}, [combinedConversationStarters, formatMessage]);
|
|
51
76
|
return /*#__PURE__*/React.createElement(ConversationStarters, _extends({
|
|
@@ -64,16 +89,16 @@ export var ConversationStarters = function ConversationStarters(_ref3) {
|
|
|
64
89
|
var isLastStarter = index === starters.length - 1;
|
|
65
90
|
var chatPill = /*#__PURE__*/React.createElement(ChatPill, {
|
|
66
91
|
testId: "conversation-starter",
|
|
67
|
-
key: starter,
|
|
92
|
+
key: starter.message,
|
|
68
93
|
onClick: function onClick() {
|
|
69
94
|
return onConversationStarterClick(starter);
|
|
70
95
|
}
|
|
71
|
-
}, starter);
|
|
96
|
+
}, starter.message);
|
|
72
97
|
return isLastStarter && showReloadButton ? /*#__PURE__*/React.createElement(Inline, {
|
|
73
98
|
space: "space.050",
|
|
74
99
|
grow: "fill",
|
|
75
100
|
alignInline: "end",
|
|
76
|
-
key: starter
|
|
101
|
+
key: starter.message
|
|
77
102
|
}, chatPill, /*#__PURE__*/React.createElement(IconButton, {
|
|
78
103
|
icon: RetryIcon,
|
|
79
104
|
onClick: onReloadButtonClick,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { AgentProfileInfo, AgentProfileCreator, AgentStarCount } from './ui/agent-profile-info';
|
|
2
2
|
export { StarIconButton } from './common/ui/star-icon-button';
|
|
3
|
-
export { AgentConversationStarters, ConversationStarters, type AgentConversationStartersProps, type ConversationStartersProps, getConversationStarters, } from './ui/agent-conversation-starters';
|
|
3
|
+
export { AgentConversationStarters, ConversationStarters, type AgentConversationStartersProps, type ConversationStarter, type StaticAgentConversationStarter, type ConversationStartersProps, getConversationStarters, } from './ui/agent-conversation-starters';
|
|
4
4
|
export { ChatPill, type ChatPillProps, BrowseAgentsPill } from './common/ui/chat-pill';
|
|
5
5
|
export type { BrowseAgentsPillProps } from './common/ui/chat-pill';
|
|
6
6
|
export { ChatPillIcon } from './common/ui/chat-icon';
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type MessageDescriptor } from 'react-intl-next';
|
|
3
|
+
export type ConversationStarter = {
|
|
4
|
+
message: string;
|
|
5
|
+
type: ConversationStarterType;
|
|
6
|
+
};
|
|
7
|
+
type ConversationStarterType = 'static' | 'user-defined' | 'llm-generated';
|
|
3
8
|
type GetConversationStartersParams = {
|
|
4
|
-
userDefinedConversationStarters?:
|
|
9
|
+
userDefinedConversationStarters?: ConversationStarter[] | null | undefined;
|
|
5
10
|
isAgentDefault: boolean;
|
|
6
11
|
};
|
|
12
|
+
export type StaticAgentConversationStarter = {
|
|
13
|
+
message: MessageDescriptor;
|
|
14
|
+
type: ConversationStarterType;
|
|
15
|
+
};
|
|
7
16
|
type ConversationStarters = {
|
|
8
|
-
userDefinedConversationStarters:
|
|
9
|
-
customAgentConversationStarters:
|
|
10
|
-
defaultAgentConversationStarters:
|
|
11
|
-
combinedConversationStarters: Array<
|
|
17
|
+
userDefinedConversationStarters: ConversationStarter[];
|
|
18
|
+
customAgentConversationStarters: StaticAgentConversationStarter[];
|
|
19
|
+
defaultAgentConversationStarters: StaticAgentConversationStarter[];
|
|
20
|
+
combinedConversationStarters: Array<ConversationStarter | StaticAgentConversationStarter>;
|
|
12
21
|
};
|
|
13
22
|
export declare const getConversationStarters: ({ userDefinedConversationStarters: userDefinedConversationStartersParam, isAgentDefault, }: GetConversationStartersParams) => ConversationStarters;
|
|
14
23
|
export type AgentConversationStartersProps = {
|
|
@@ -17,8 +26,8 @@ export type AgentConversationStartersProps = {
|
|
|
17
26
|
} & Omit<ConversationStartersProps, 'starters'>;
|
|
18
27
|
export declare const AgentConversationStarters: ({ userDefinedConversationStarters, isAgentDefault, ...props }: AgentConversationStartersProps) => JSX.Element;
|
|
19
28
|
export type ConversationStartersProps = {
|
|
20
|
-
starters:
|
|
21
|
-
onConversationStarterClick: (conversationStarter:
|
|
29
|
+
starters: ConversationStarter[];
|
|
30
|
+
onConversationStarterClick: (conversationStarter: ConversationStarter) => void;
|
|
22
31
|
showReloadButton?: boolean;
|
|
23
32
|
onReloadButtonClick?: () => void;
|
|
24
33
|
onBrowseAgentsClick?: () => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { AgentProfileInfo, AgentProfileCreator, AgentStarCount } from './ui/agent-profile-info';
|
|
2
2
|
export { StarIconButton } from './common/ui/star-icon-button';
|
|
3
|
-
export { AgentConversationStarters, ConversationStarters, type AgentConversationStartersProps, type ConversationStartersProps, getConversationStarters, } from './ui/agent-conversation-starters';
|
|
3
|
+
export { AgentConversationStarters, ConversationStarters, type AgentConversationStartersProps, type ConversationStarter, type StaticAgentConversationStarter, type ConversationStartersProps, getConversationStarters, } from './ui/agent-conversation-starters';
|
|
4
4
|
export { ChatPill, type ChatPillProps, BrowseAgentsPill } from './common/ui/chat-pill';
|
|
5
5
|
export type { BrowseAgentsPillProps } from './common/ui/chat-pill';
|
|
6
6
|
export { ChatPillIcon } from './common/ui/chat-icon';
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type MessageDescriptor } from 'react-intl-next';
|
|
3
|
+
export type ConversationStarter = {
|
|
4
|
+
message: string;
|
|
5
|
+
type: ConversationStarterType;
|
|
6
|
+
};
|
|
7
|
+
type ConversationStarterType = 'static' | 'user-defined' | 'llm-generated';
|
|
3
8
|
type GetConversationStartersParams = {
|
|
4
|
-
userDefinedConversationStarters?:
|
|
9
|
+
userDefinedConversationStarters?: ConversationStarter[] | null | undefined;
|
|
5
10
|
isAgentDefault: boolean;
|
|
6
11
|
};
|
|
12
|
+
export type StaticAgentConversationStarter = {
|
|
13
|
+
message: MessageDescriptor;
|
|
14
|
+
type: ConversationStarterType;
|
|
15
|
+
};
|
|
7
16
|
type ConversationStarters = {
|
|
8
|
-
userDefinedConversationStarters:
|
|
9
|
-
customAgentConversationStarters:
|
|
10
|
-
defaultAgentConversationStarters:
|
|
11
|
-
combinedConversationStarters: Array<
|
|
17
|
+
userDefinedConversationStarters: ConversationStarter[];
|
|
18
|
+
customAgentConversationStarters: StaticAgentConversationStarter[];
|
|
19
|
+
defaultAgentConversationStarters: StaticAgentConversationStarter[];
|
|
20
|
+
combinedConversationStarters: Array<ConversationStarter | StaticAgentConversationStarter>;
|
|
12
21
|
};
|
|
13
22
|
export declare const getConversationStarters: ({ userDefinedConversationStarters: userDefinedConversationStartersParam, isAgentDefault, }: GetConversationStartersParams) => ConversationStarters;
|
|
14
23
|
export type AgentConversationStartersProps = {
|
|
@@ -17,8 +26,8 @@ export type AgentConversationStartersProps = {
|
|
|
17
26
|
} & Omit<ConversationStartersProps, 'starters'>;
|
|
18
27
|
export declare const AgentConversationStarters: ({ userDefinedConversationStarters, isAgentDefault, ...props }: AgentConversationStartersProps) => JSX.Element;
|
|
19
28
|
export type ConversationStartersProps = {
|
|
20
|
-
starters:
|
|
21
|
-
onConversationStarterClick: (conversationStarter:
|
|
29
|
+
starters: ConversationStarter[];
|
|
30
|
+
onConversationStarterClick: (conversationStarter: ConversationStarter) => void;
|
|
22
31
|
showReloadButton?: boolean;
|
|
23
32
|
onReloadButtonClick?: () => void;
|
|
24
33
|
onBrowseAgentsClick?: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/rovo-agent-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "This package host public components related to rovo agents, the components here are needed for other public atlaskit packages",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
".": "./src/index.ts"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@atlaskit/avatar": "^21.
|
|
39
|
-
"@atlaskit/button": "^20.
|
|
38
|
+
"@atlaskit/avatar": "^21.16.0",
|
|
39
|
+
"@atlaskit/button": "^20.3.0",
|
|
40
40
|
"@atlaskit/heading": "^2.4.3",
|
|
41
|
-
"@atlaskit/icon": "^22.
|
|
41
|
+
"@atlaskit/icon": "^22.24.0",
|
|
42
42
|
"@atlaskit/logo": "^14.3.0",
|
|
43
43
|
"@atlaskit/primitives": "^12.2.0",
|
|
44
44
|
"@atlaskit/skeleton": "^0.5.0",
|