@atlaskit/rovo-agent-components 0.1.0 → 0.1.2
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 +18 -0
- package/dist/cjs/common/ui/chat-icon/index.js +52 -0
- package/dist/cjs/common/ui/chat-pill/index.js +64 -0
- package/dist/cjs/index.js +28 -1
- package/dist/cjs/ui/agent-avatar/icons/index.js +1 -0
- package/dist/cjs/ui/agent-avatar/index.js +1 -0
- package/dist/cjs/ui/agent-conversation-starters/index.js +143 -0
- package/dist/cjs/ui/agent-conversation-starters/messages.js +129 -0
- package/dist/cjs/ui/agent-profile-info/index.js +1 -1
- package/dist/es2019/common/ui/chat-icon/index.js +41 -0
- package/dist/es2019/common/ui/chat-pill/index.js +53 -0
- package/dist/es2019/index.js +4 -1
- package/dist/es2019/ui/agent-avatar/icons/index.js +0 -0
- package/dist/es2019/ui/agent-avatar/index.js +0 -0
- package/dist/es2019/ui/agent-conversation-starters/index.js +121 -0
- package/dist/es2019/ui/agent-conversation-starters/messages.js +123 -0
- package/dist/es2019/ui/agent-profile-info/index.js +1 -1
- package/dist/esm/common/ui/chat-icon/index.js +45 -0
- package/dist/esm/common/ui/chat-pill/index.js +57 -0
- package/dist/esm/index.js +4 -1
- package/dist/esm/ui/agent-avatar/icons/index.js +0 -0
- package/dist/esm/ui/agent-avatar/index.js +0 -0
- package/dist/esm/ui/agent-conversation-starters/index.js +133 -0
- package/dist/esm/ui/agent-conversation-starters/messages.js +123 -0
- package/dist/esm/ui/agent-profile-info/index.js +1 -1
- package/dist/types/common/ui/chat-icon/index.d.ts +3 -0
- package/dist/types/common/ui/chat-pill/index.d.ts +8 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/ui/agent-avatar/icons/index.d.ts +0 -0
- package/dist/types/ui/agent-avatar/index.d.ts +0 -0
- package/dist/types/ui/agent-conversation-starters/index.d.ts +31 -0
- package/dist/types/ui/agent-conversation-starters/messages.d.ts +122 -0
- package/dist/types-ts4.5/common/ui/chat-icon/index.d.ts +3 -0
- package/dist/types-ts4.5/common/ui/chat-pill/index.d.ts +8 -0
- package/dist/types-ts4.5/index.d.ts +3 -0
- package/dist/types-ts4.5/ui/agent-avatar/icons/index.d.ts +0 -0
- package/dist/types-ts4.5/ui/agent-avatar/index.d.ts +0 -0
- package/dist/types-ts4.5/ui/agent-conversation-starters/index.d.ts +31 -0
- package/dist/types-ts4.5/ui/agent-conversation-starters/messages.d.ts +122 -0
- package/package.json +15 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/rovo-agent-components
|
|
2
2
|
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#126478](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/126478)
|
|
8
|
+
[`09da97621f790`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/09da97621f790) -
|
|
9
|
+
Moving conversation-starters ans ChatPillIcon to rovo-agent-components, created
|
|
10
|
+
ConversationStarterWithAnalytics to be re-exported for internal atlassian consumption
|
|
11
|
+
|
|
12
|
+
## 0.1.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#125026](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/125026)
|
|
17
|
+
[`6a0fb797d9383`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6a0fb797d9383) -
|
|
18
|
+
Fix not showing loading state if favouriteCount is undefined
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 0.1.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ChatPillIcon = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _icon = _interopRequireDefault(require("@atlaskit/icon"));
|
|
11
|
+
var CustomGlyph = function CustomGlyph(props) {
|
|
12
|
+
return /*#__PURE__*/_react.default.createElement("svg", (0, _extends2.default)({
|
|
13
|
+
width: "20",
|
|
14
|
+
height: "20",
|
|
15
|
+
viewBox: "0 0 20 20",
|
|
16
|
+
fill: "none",
|
|
17
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
18
|
+
}, props), /*#__PURE__*/_react.default.createElement("path", {
|
|
19
|
+
d: "M8.00023 14.25C7.86431 14.25 7.73094 14.287 7.61439 14.3569L3.75024 16.6752V14V4.99998C3.75024 4.30963 4.30988 3.74999 5.00023 3.74998L15.0002 3.74984C15.6906 3.74984 16.2502 4.30948 16.2502 4.99984V12.9999C16.2502 13.6902 15.6906 14.2498 15.0003 14.2499L8.00023 14.25Z",
|
|
20
|
+
stroke: "currentColor",
|
|
21
|
+
strokeWidth: "1.5",
|
|
22
|
+
strokeLinejoin: "round",
|
|
23
|
+
fill: "transparent"
|
|
24
|
+
}), /*#__PURE__*/_react.default.createElement("rect", {
|
|
25
|
+
x: "6",
|
|
26
|
+
y: "8",
|
|
27
|
+
width: "2",
|
|
28
|
+
height: "2",
|
|
29
|
+
rx: "1",
|
|
30
|
+
fill: "currentColor"
|
|
31
|
+
}), /*#__PURE__*/_react.default.createElement("rect", {
|
|
32
|
+
x: "9",
|
|
33
|
+
y: "8",
|
|
34
|
+
width: "2",
|
|
35
|
+
height: "2",
|
|
36
|
+
rx: "1",
|
|
37
|
+
fill: "currentColor"
|
|
38
|
+
}), /*#__PURE__*/_react.default.createElement("rect", {
|
|
39
|
+
x: "12",
|
|
40
|
+
y: "8",
|
|
41
|
+
width: "2",
|
|
42
|
+
height: "2",
|
|
43
|
+
rx: "1",
|
|
44
|
+
fill: "currentColor"
|
|
45
|
+
}));
|
|
46
|
+
};
|
|
47
|
+
var ChatPillIcon = exports.ChatPillIcon = function ChatPillIcon(props) {
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement(_icon.default, (0, _extends2.default)({}, props, {
|
|
49
|
+
glyph: CustomGlyph,
|
|
50
|
+
label: ""
|
|
51
|
+
}));
|
|
52
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ChatPill = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _primitives = require("@atlaskit/primitives");
|
|
12
|
+
var _chatIcon = require("../chat-icon");
|
|
13
|
+
var _excluded = ["children", "whiteSpacePreWrap"];
|
|
14
|
+
var buttonStyles = (0, _primitives.xcss)({
|
|
15
|
+
color: 'color.text',
|
|
16
|
+
padding: 'space.100',
|
|
17
|
+
borderRadius: 'border.radius.200',
|
|
18
|
+
borderBottomRightRadius: "var(--ds-border-radius-050, 2px)",
|
|
19
|
+
lineHeight: '20px',
|
|
20
|
+
fontWeight: '500',
|
|
21
|
+
fontSize: '14px',
|
|
22
|
+
textOverflow: 'ellipsis',
|
|
23
|
+
whiteSpace: 'nowrap',
|
|
24
|
+
flexShrink: 1,
|
|
25
|
+
backgroundColor: 'color.background.neutral',
|
|
26
|
+
':hover': {
|
|
27
|
+
backgroundColor: 'color.background.neutral.hovered'
|
|
28
|
+
},
|
|
29
|
+
':active': {
|
|
30
|
+
backgroundColor: 'color.background.neutral.pressed'
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
var buttonInlineStyles = (0, _primitives.xcss)({
|
|
34
|
+
paddingInline: 'space.025'
|
|
35
|
+
});
|
|
36
|
+
var queryTextStyles = (0, _primitives.xcss)({
|
|
37
|
+
wordBreak: 'break-word',
|
|
38
|
+
textAlign: 'left'
|
|
39
|
+
});
|
|
40
|
+
var whiteSpacePreWrapStyles = (0, _primitives.xcss)({
|
|
41
|
+
whiteSpace: 'pre-wrap'
|
|
42
|
+
});
|
|
43
|
+
var iconWrapper = (0, _primitives.xcss)({
|
|
44
|
+
minWidth: '20px',
|
|
45
|
+
height: '20px'
|
|
46
|
+
});
|
|
47
|
+
var ChatPill = exports.ChatPill = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
48
|
+
var children = _ref.children,
|
|
49
|
+
_ref$whiteSpacePreWra = _ref.whiteSpacePreWrap,
|
|
50
|
+
whiteSpacePreWrap = _ref$whiteSpacePreWra === void 0 ? true : _ref$whiteSpacePreWra,
|
|
51
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement(_primitives.Pressable, (0, _extends2.default)({
|
|
53
|
+
ref: ref
|
|
54
|
+
}, props, {
|
|
55
|
+
xcss: buttonStyles
|
|
56
|
+
}), /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
|
|
57
|
+
space: "space.050",
|
|
58
|
+
xcss: buttonInlineStyles
|
|
59
|
+
}, /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
60
|
+
xcss: iconWrapper
|
|
61
|
+
}, /*#__PURE__*/_react.default.createElement(_chatIcon.ChatPillIcon, null)), /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
62
|
+
xcss: [queryTextStyles, whiteSpacePreWrap && whiteSpacePreWrapStyles]
|
|
63
|
+
}, children)));
|
|
64
|
+
});
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "AgentConversationStarters", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _agentConversationStarters.AgentConversationStarters;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "AgentProfileCreator", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function get() {
|
|
@@ -21,11 +27,32 @@ Object.defineProperty(exports, "AgentStarCount", {
|
|
|
21
27
|
return _agentProfileInfo.AgentStarCount;
|
|
22
28
|
}
|
|
23
29
|
});
|
|
30
|
+
Object.defineProperty(exports, "ChatPill", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _chatPill.ChatPill;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "ChatPillIcon", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _chatIcon.ChatPillIcon;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
24
42
|
Object.defineProperty(exports, "StarIconButton", {
|
|
25
43
|
enumerable: true,
|
|
26
44
|
get: function get() {
|
|
27
45
|
return _starIconButton.StarIconButton;
|
|
28
46
|
}
|
|
29
47
|
});
|
|
48
|
+
Object.defineProperty(exports, "getConversationStarters", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _agentConversationStarters.getConversationStarters;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
30
54
|
var _agentProfileInfo = require("./ui/agent-profile-info");
|
|
31
|
-
var _starIconButton = require("./common/ui/star-icon-button");
|
|
55
|
+
var _starIconButton = require("./common/ui/star-icon-button");
|
|
56
|
+
var _agentConversationStarters = require("./ui/agent-conversation-starters");
|
|
57
|
+
var _chatPill = require("./common/ui/chat-pill");
|
|
58
|
+
var _chatIcon = require("./common/ui/chat-icon");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.usePageContextType = exports.getConversationStarters = exports.PageContextType = exports.AgentConversationStarters = void 0;
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _bindEventListener = require("bind-event-listener");
|
|
14
|
+
var _reactIntlNext = require("react-intl-next");
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
|
+
var _chatPill = require("../../common/ui/chat-pill");
|
|
17
|
+
var _messages = require("./messages");
|
|
18
|
+
var _PAGE_TYPE_CONVERSATI;
|
|
19
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
+
function useWindowLocationChange() {
|
|
22
|
+
var _useState = (0, _react.useState)(window.location.href),
|
|
23
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
24
|
+
location = _useState2[0],
|
|
25
|
+
setLocation = _useState2[1];
|
|
26
|
+
var handleLocationChange = function handleLocationChange() {
|
|
27
|
+
setLocation(window.location.href);
|
|
28
|
+
};
|
|
29
|
+
(0, _react.useEffect)(function () {
|
|
30
|
+
var originalPushState = window.history.pushState;
|
|
31
|
+
var originalReplaceState = window.history.replaceState;
|
|
32
|
+
window.history.pushState = function () {
|
|
33
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
34
|
+
args[_key] = arguments[_key];
|
|
35
|
+
}
|
|
36
|
+
originalPushState.apply(this, args);
|
|
37
|
+
handleLocationChange();
|
|
38
|
+
};
|
|
39
|
+
window.history.replaceState = function () {
|
|
40
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
41
|
+
args[_key2] = arguments[_key2];
|
|
42
|
+
}
|
|
43
|
+
originalReplaceState.apply(this, args);
|
|
44
|
+
handleLocationChange();
|
|
45
|
+
};
|
|
46
|
+
var unbind = (0, _bindEventListener.bindAll)(window, [{
|
|
47
|
+
type: 'popstate',
|
|
48
|
+
listener: handleLocationChange
|
|
49
|
+
}]);
|
|
50
|
+
return function () {
|
|
51
|
+
unbind();
|
|
52
|
+
window.history.pushState = originalPushState;
|
|
53
|
+
window.history.replaceState = originalReplaceState;
|
|
54
|
+
};
|
|
55
|
+
}, []);
|
|
56
|
+
return location;
|
|
57
|
+
}
|
|
58
|
+
var PageContextType = exports.PageContextType = /*#__PURE__*/function (PageContextType) {
|
|
59
|
+
PageContextType["CONFLUENCE_HOME"] = "confluence-home";
|
|
60
|
+
PageContextType["CONFLUENCE_PAGE_VIEW"] = "confluence-page-view";
|
|
61
|
+
PageContextType["CONFLUENCE_PAGE_EDIT"] = "confluence-page-edit";
|
|
62
|
+
PageContextType["JIRA_HOME"] = "jira-home";
|
|
63
|
+
PageContextType["JIRA_ISSUE_VIEW"] = "jira-issue-view";
|
|
64
|
+
PageContextType["JIRA_ISSUE_LIST"] = "jira-issue-list";
|
|
65
|
+
PageContextType["UNKNOWN"] = "unknown";
|
|
66
|
+
return PageContextType;
|
|
67
|
+
}({});
|
|
68
|
+
var PAGE_TYPE_CONVERSATION_STARTERS = (_PAGE_TYPE_CONVERSATI = {}, (0, _defineProperty2.default)(_PAGE_TYPE_CONVERSATI, PageContextType.CONFLUENCE_HOME, [_messages.messages.confluenceHomeSuggestion1, _messages.messages.confluenceHomeSuggestion2, _messages.messages.confluenceHomeSuggestion3]), (0, _defineProperty2.default)(_PAGE_TYPE_CONVERSATI, PageContextType.CONFLUENCE_PAGE_EDIT, [_messages.messages.confluencePageEditSuggestion1, _messages.messages.confluencePageEditSuggestion2, _messages.messages.confluencePageEditSuggestion3]), (0, _defineProperty2.default)(_PAGE_TYPE_CONVERSATI, PageContextType.CONFLUENCE_PAGE_VIEW, [_messages.messages.confluencePageViewSuggestion1, _messages.messages.confluencePageViewSuggestion2, _messages.messages.confluencePageViewSuggestion3]), (0, _defineProperty2.default)(_PAGE_TYPE_CONVERSATI, PageContextType.JIRA_HOME, [_messages.messages.jiraHomeSuggestion1, _messages.messages.jiraHomeSuggestion2, _messages.messages.jiraHomeSuggestion3]), (0, _defineProperty2.default)(_PAGE_TYPE_CONVERSATI, PageContextType.JIRA_ISSUE_VIEW, [_messages.messages.jiraIssueViewSuggestion1, _messages.messages.jiraIssueViewSuggestion2, _messages.messages.jiraIssueViewSuggestion3]), (0, _defineProperty2.default)(_PAGE_TYPE_CONVERSATI, PageContextType.JIRA_ISSUE_LIST, [_messages.messages.jiraIssueListSuggestion1, _messages.messages.jiraIssueListSuggestion2, _messages.messages.jiraIssueListSuggestion3]), (0, _defineProperty2.default)(_PAGE_TYPE_CONVERSATI, PageContextType.UNKNOWN, [_messages.messages.emptyStateSuggestion1, _messages.messages.emptyStateSuggestion2, _messages.messages.emptyStateSuggestion3]), _PAGE_TYPE_CONVERSATI);
|
|
69
|
+
function determinePageType(location) {
|
|
70
|
+
var urlPatterns = [[PageContextType.CONFLUENCE_HOME, /\/wiki\/home$/], [PageContextType.CONFLUENCE_PAGE_EDIT, /\/wiki\/spaces\/[^\/]+\/(?:pages|blog)\/edit-v2\//], [PageContextType.CONFLUENCE_PAGE_VIEW, /\/wiki\/spaces\/[^\/]+\/(?:pages|blog)\//], [PageContextType.JIRA_ISSUE_VIEW, /\/browse\/[^\/]+$/], [PageContextType.JIRA_ISSUE_VIEW, /\/jira\/.+\/projects\/.+\?selectedIssue/], [PageContextType.JIRA_ISSUE_LIST, /\/jira\/.+\/projects\//], [PageContextType.JIRA_HOME, /\/jira\/dashboards\/last-visited$/]];
|
|
71
|
+
for (var _i = 0, _urlPatterns = urlPatterns; _i < _urlPatterns.length; _i++) {
|
|
72
|
+
var _urlPatterns$_i = (0, _slicedToArray2.default)(_urlPatterns[_i], 2),
|
|
73
|
+
type = _urlPatterns$_i[0],
|
|
74
|
+
pattern = _urlPatterns$_i[1];
|
|
75
|
+
if (pattern.test(location)) {
|
|
76
|
+
return type;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return PageContextType.UNKNOWN;
|
|
80
|
+
}
|
|
81
|
+
var usePageContextType = exports.usePageContextType = function usePageContextType() {
|
|
82
|
+
var location = useWindowLocationChange();
|
|
83
|
+
var _useState3 = (0, _react.useState)(determinePageType(location)),
|
|
84
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
85
|
+
pageContextType = _useState4[0],
|
|
86
|
+
setPageContextType = _useState4[1];
|
|
87
|
+
(0, _react.useEffect)(function () {
|
|
88
|
+
setPageContextType(determinePageType(location));
|
|
89
|
+
}, [location]);
|
|
90
|
+
return pageContextType;
|
|
91
|
+
};
|
|
92
|
+
var getConversationStarters = exports.getConversationStarters = function getConversationStarters(_ref) {
|
|
93
|
+
var userDefinedConversationStartersParam = _ref.userDefinedConversationStarters,
|
|
94
|
+
isAgentDefault = _ref.isAgentDefault,
|
|
95
|
+
_ref$pageContextType = _ref.pageContextType,
|
|
96
|
+
pageContextType = _ref$pageContextType === void 0 ? PageContextType.UNKNOWN : _ref$pageContextType;
|
|
97
|
+
var customAgentConversationStarters = [_messages.messages.agentEmptyStateSuggestion1, _messages.messages.agentEmptyStateSuggestion2, _messages.messages.agentEmptyStateSuggestion3];
|
|
98
|
+
var userDefinedConversationStarters = userDefinedConversationStartersParam !== null && userDefinedConversationStartersParam !== void 0 ? userDefinedConversationStartersParam : [];
|
|
99
|
+
var isPageContextConvoStartersEnabled = (0, _platformFeatureFlags.fg)('rovo_chat_page_context_static_convo_starters');
|
|
100
|
+
var defaultAgentConversationStarters = isPageContextConvoStartersEnabled ? PAGE_TYPE_CONVERSATION_STARTERS[pageContextType] : [_messages.messages.emptyStateSuggestion1, _messages.messages.emptyStateSuggestion2, _messages.messages.emptyStateSuggestion3];
|
|
101
|
+
var getCombinedConversationStarters = function getCombinedConversationStarters() {
|
|
102
|
+
if (!isAgentDefault && (0, _platformFeatureFlags.fg)('rovo_chat_new_create_agent')) {
|
|
103
|
+
// Return default suggestions + user defined suggestions with a max of 3 suggestions
|
|
104
|
+
return [].concat((0, _toConsumableArray2.default)(customAgentConversationStarters.slice(0, 3 - userDefinedConversationStarters.length)), (0, _toConsumableArray2.default)(userDefinedConversationStarters));
|
|
105
|
+
}
|
|
106
|
+
return defaultAgentConversationStarters;
|
|
107
|
+
};
|
|
108
|
+
return {
|
|
109
|
+
userDefinedConversationStarters: userDefinedConversationStarters,
|
|
110
|
+
customAgentConversationStarters: customAgentConversationStarters,
|
|
111
|
+
defaultAgentConversationStarters: defaultAgentConversationStarters,
|
|
112
|
+
combinedConversationStarters: getCombinedConversationStarters()
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
var AgentConversationStarters = exports.AgentConversationStarters = function AgentConversationStarters(_ref2) {
|
|
116
|
+
var userDefinedConversationStarters = _ref2.userDefinedConversationStarters,
|
|
117
|
+
isAgentDefault = _ref2.isAgentDefault,
|
|
118
|
+
onConversationStarterClick = _ref2.onConversationStarterClick;
|
|
119
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
120
|
+
formatMessage = _useIntl.formatMessage;
|
|
121
|
+
var pageContextType = usePageContextType();
|
|
122
|
+
var _useMemo = (0, _react.useMemo)(function () {
|
|
123
|
+
return getConversationStarters({
|
|
124
|
+
userDefinedConversationStarters: userDefinedConversationStarters,
|
|
125
|
+
isAgentDefault: isAgentDefault,
|
|
126
|
+
pageContextType: pageContextType
|
|
127
|
+
});
|
|
128
|
+
}, [userDefinedConversationStarters, isAgentDefault, pageContextType]),
|
|
129
|
+
combinedConversationStarters = _useMemo.combinedConversationStarters;
|
|
130
|
+
var _onClick = (0, _react.useCallback)(function (message) {
|
|
131
|
+
onConversationStarterClick(message);
|
|
132
|
+
}, [onConversationStarterClick]);
|
|
133
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, combinedConversationStarters.map(function (starter) {
|
|
134
|
+
var translatedMessage = typeof starter === 'string' ? starter : formatMessage(starter);
|
|
135
|
+
return /*#__PURE__*/_react.default.createElement(_chatPill.ChatPill, {
|
|
136
|
+
testId: "conversation-starter",
|
|
137
|
+
key: translatedMessage,
|
|
138
|
+
onClick: function onClick() {
|
|
139
|
+
return _onClick(translatedMessage);
|
|
140
|
+
}
|
|
141
|
+
}, translatedMessage);
|
|
142
|
+
}));
|
|
143
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.messages = void 0;
|
|
7
|
+
var _reactIntlNext = require("react-intl-next");
|
|
8
|
+
var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
9
|
+
emptyStateSuggestion1: {
|
|
10
|
+
id: 'ai-mate.chat-history.empty-state.suggestion1',
|
|
11
|
+
defaultMessage: 'Are any of my tickets overdue?',
|
|
12
|
+
description: 'The first suggestion displayed in the empty state of the chat history'
|
|
13
|
+
},
|
|
14
|
+
emptyStateSuggestion2: {
|
|
15
|
+
id: 'ai-mate.chat-history.empty-state.suggestion2',
|
|
16
|
+
defaultMessage: 'What should I work on next?',
|
|
17
|
+
description: 'The second suggestion displayed in the empty state of the chat history'
|
|
18
|
+
},
|
|
19
|
+
emptyStateSuggestion3: {
|
|
20
|
+
id: 'ai-mate.chat-history.empty-state.suggestion3',
|
|
21
|
+
defaultMessage: 'Write an update about my week',
|
|
22
|
+
description: 'The third suggestion displayed in the empty state of the chat history'
|
|
23
|
+
},
|
|
24
|
+
agentEmptyStateSuggestion1: {
|
|
25
|
+
id: 'ai-mate.chat-history.empty-state.agent-suggestion1',
|
|
26
|
+
defaultMessage: 'Tell me about yourself',
|
|
27
|
+
description: 'The first suggestion displayed in the empty state when an agent is selected'
|
|
28
|
+
},
|
|
29
|
+
agentEmptyStateSuggestion2: {
|
|
30
|
+
id: 'ai-mate.chat-history.empty-state.agent-suggestion2',
|
|
31
|
+
defaultMessage: 'What can you help me with?',
|
|
32
|
+
description: 'The second suggestion displayed in the empty state when an agent is selected'
|
|
33
|
+
},
|
|
34
|
+
agentEmptyStateSuggestion3: {
|
|
35
|
+
id: 'ai-mate.chat-history.empty-state.agent-suggestion3',
|
|
36
|
+
defaultMessage: "Summarize what I'm looking at",
|
|
37
|
+
description: 'The third suggestion displayed in the empty state when an agent is selected'
|
|
38
|
+
},
|
|
39
|
+
confluenceHomeSuggestion1: {
|
|
40
|
+
id: 'ai-mate.chat-history.empty-state.confluence-home.suggestion1',
|
|
41
|
+
defaultMessage: "Is there any new activity on pages I've written?",
|
|
42
|
+
description: 'The first suggestion displayed in the empty state of the chat history when viewing confluence home.'
|
|
43
|
+
},
|
|
44
|
+
confluenceHomeSuggestion2: {
|
|
45
|
+
id: 'ai-mate.chat-history.empty-state.confluence-home.suggestion2',
|
|
46
|
+
defaultMessage: "What's popular at the moment?",
|
|
47
|
+
description: 'The second suggestion displayed in the empty state of the chat history when viewing confluence home.'
|
|
48
|
+
},
|
|
49
|
+
confluenceHomeSuggestion3: {
|
|
50
|
+
id: 'ai-mate.chat-history.empty-state.confluence-home.suggestion3',
|
|
51
|
+
defaultMessage: 'How can Rovo help me use Confluence?',
|
|
52
|
+
description: 'The third suggestion displayed in the empty state of the chat history when viewing confluence home.'
|
|
53
|
+
},
|
|
54
|
+
confluencePageEditSuggestion1: {
|
|
55
|
+
id: 'ai-mate.chat-history.empty-state.confluence-page-edit.suggestion1',
|
|
56
|
+
defaultMessage: 'Can you improve the writing on this page?',
|
|
57
|
+
description: 'The first suggestion displayed in the empty state of the chat history when editing a confluence page.'
|
|
58
|
+
},
|
|
59
|
+
confluencePageEditSuggestion2: {
|
|
60
|
+
id: 'ai-mate.chat-history.empty-state.confluence-page-edit.suggestion2',
|
|
61
|
+
defaultMessage: 'Write an executive summary for this page.',
|
|
62
|
+
description: 'The second suggestion displayed in the empty state of the chat history when editing a confluence page.'
|
|
63
|
+
},
|
|
64
|
+
confluencePageEditSuggestion3: {
|
|
65
|
+
id: 'ai-mate.chat-history.empty-state.confluence-page-edit.suggestion3',
|
|
66
|
+
defaultMessage: 'Give me links to some other relevant pages.',
|
|
67
|
+
description: 'The third suggestion displayed in the empty state of the chat history when editing a confluence page.'
|
|
68
|
+
},
|
|
69
|
+
confluencePageViewSuggestion1: {
|
|
70
|
+
id: 'ai-mate.chat-history.empty-state.confluence-page-view.suggestion1',
|
|
71
|
+
defaultMessage: 'Summarize what I’m looking at.',
|
|
72
|
+
description: 'The first suggestion displayed in the empty state of the chat history when viewing a confluence page.'
|
|
73
|
+
},
|
|
74
|
+
confluencePageViewSuggestion2: {
|
|
75
|
+
id: 'ai-mate.chat-history.empty-state.confluence-page-view.suggestion2',
|
|
76
|
+
defaultMessage: 'Has anything on this page changed in the last week?',
|
|
77
|
+
description: 'The second suggestion displayed in the empty state of the chat history when viewing a confluence page.'
|
|
78
|
+
},
|
|
79
|
+
confluencePageViewSuggestion3: {
|
|
80
|
+
id: 'ai-mate.chat-history.empty-state.confluence-page-view.suggestion3',
|
|
81
|
+
defaultMessage: 'Summarize the comments on this page.',
|
|
82
|
+
description: 'The third suggestion displayed in the empty state of the chat history when viewing a confluence page.'
|
|
83
|
+
},
|
|
84
|
+
jiraHomeSuggestion1: {
|
|
85
|
+
id: 'ai-mate.chat-history.empty-state.jira-home.suggestion1',
|
|
86
|
+
defaultMessage: 'What’s changed in the past week?',
|
|
87
|
+
description: 'The first suggestion displayed in the empty state of the chat history when viewing jira home.'
|
|
88
|
+
},
|
|
89
|
+
jiraHomeSuggestion2: {
|
|
90
|
+
id: 'ai-mate.chat-history.empty-state.jira-home.suggestion2',
|
|
91
|
+
defaultMessage: 'What issues are the highest priority?',
|
|
92
|
+
description: 'The second suggestion displayed in the empty state of the chat history when viewing jira home.'
|
|
93
|
+
},
|
|
94
|
+
jiraHomeSuggestion3: {
|
|
95
|
+
id: 'ai-mate.chat-history.empty-state.jira-home.suggestion3',
|
|
96
|
+
defaultMessage: 'What issues have comments mentioning me?',
|
|
97
|
+
description: 'The third suggestion displayed in the empty state of the chat history when viewing jira home.'
|
|
98
|
+
},
|
|
99
|
+
jiraIssueViewSuggestion1: {
|
|
100
|
+
id: 'ai-mate.chat-history.empty-state.jira-issue-view.suggestion1',
|
|
101
|
+
defaultMessage: 'Are there any similar issues to this one?',
|
|
102
|
+
description: 'The first suggestion displayed in the empty state of the chat history when viewing a jira issue.'
|
|
103
|
+
},
|
|
104
|
+
jiraIssueViewSuggestion2: {
|
|
105
|
+
id: 'ai-mate.chat-history.empty-state.jira-issue-view.suggestion2',
|
|
106
|
+
defaultMessage: 'What issues aren’t connected to a parent issue?',
|
|
107
|
+
description: 'The second suggestion displayed in the empty state of the chat history when viewing a jira issue.'
|
|
108
|
+
},
|
|
109
|
+
jiraIssueViewSuggestion3: {
|
|
110
|
+
id: 'ai-mate.chat-history.empty-state.jira-issue-view.suggestion3',
|
|
111
|
+
defaultMessage: 'List the issues that are currently “In Progress” and group them by assignee.',
|
|
112
|
+
description: 'The third suggestion displayed in the empty state of the chat history when viewing a jira issue.'
|
|
113
|
+
},
|
|
114
|
+
jiraIssueListSuggestion1: {
|
|
115
|
+
id: 'ai-mate.chat-history.empty-state.jira-issue-list.suggestion1',
|
|
116
|
+
defaultMessage: 'What issues are unassigned?',
|
|
117
|
+
description: 'The first suggestion displayed in the empty state of the chat history when viewing a list of jira issues.'
|
|
118
|
+
},
|
|
119
|
+
jiraIssueListSuggestion2: {
|
|
120
|
+
id: 'ai-mate.chat-history.empty-state.jira-issue-list.suggestion2',
|
|
121
|
+
defaultMessage: 'What issues have been open the longest?',
|
|
122
|
+
description: 'The second suggestion displayed in the empty state of the chat history when viewing a list of jira issues.'
|
|
123
|
+
},
|
|
124
|
+
jiraIssueListSuggestion3: {
|
|
125
|
+
id: 'ai-mate.chat-history.empty-state.jira-issue-list.suggestion3',
|
|
126
|
+
defaultMessage: 'Who has the most tasks?',
|
|
127
|
+
description: 'The third suggestion displayed in the empty state of the chat history when viewing a list of jira issues.'
|
|
128
|
+
}
|
|
129
|
+
});
|
|
@@ -88,7 +88,7 @@ var AgentStarCount = exports.AgentStarCount = function AgentStarCount(_ref2) {
|
|
|
88
88
|
isLoading = _ref2.isLoading;
|
|
89
89
|
var _useIntl2 = (0, _reactIntlNext.useIntl)(),
|
|
90
90
|
formatMessage = _useIntl2.formatMessage;
|
|
91
|
-
if (starCount === null || starCount === undefined) {
|
|
91
|
+
if ((starCount === null || starCount === undefined) && !isLoading) {
|
|
92
92
|
return null;
|
|
93
93
|
}
|
|
94
94
|
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Icon from '@atlaskit/icon';
|
|
4
|
+
const CustomGlyph = props => /*#__PURE__*/React.createElement("svg", _extends({
|
|
5
|
+
width: "20",
|
|
6
|
+
height: "20",
|
|
7
|
+
viewBox: "0 0 20 20",
|
|
8
|
+
fill: "none",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
10
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
11
|
+
d: "M8.00023 14.25C7.86431 14.25 7.73094 14.287 7.61439 14.3569L3.75024 16.6752V14V4.99998C3.75024 4.30963 4.30988 3.74999 5.00023 3.74998L15.0002 3.74984C15.6906 3.74984 16.2502 4.30948 16.2502 4.99984V12.9999C16.2502 13.6902 15.6906 14.2498 15.0003 14.2499L8.00023 14.25Z",
|
|
12
|
+
stroke: "currentColor",
|
|
13
|
+
strokeWidth: "1.5",
|
|
14
|
+
strokeLinejoin: "round",
|
|
15
|
+
fill: "transparent"
|
|
16
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
17
|
+
x: "6",
|
|
18
|
+
y: "8",
|
|
19
|
+
width: "2",
|
|
20
|
+
height: "2",
|
|
21
|
+
rx: "1",
|
|
22
|
+
fill: "currentColor"
|
|
23
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
24
|
+
x: "9",
|
|
25
|
+
y: "8",
|
|
26
|
+
width: "2",
|
|
27
|
+
height: "2",
|
|
28
|
+
rx: "1",
|
|
29
|
+
fill: "currentColor"
|
|
30
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
31
|
+
x: "12",
|
|
32
|
+
y: "8",
|
|
33
|
+
width: "2",
|
|
34
|
+
height: "2",
|
|
35
|
+
rx: "1",
|
|
36
|
+
fill: "currentColor"
|
|
37
|
+
}));
|
|
38
|
+
export const ChatPillIcon = props => /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
39
|
+
glyph: CustomGlyph,
|
|
40
|
+
label: ""
|
|
41
|
+
}));
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Box, Inline, Pressable, xcss } from '@atlaskit/primitives';
|
|
4
|
+
import { ChatPillIcon } from '../chat-icon';
|
|
5
|
+
const buttonStyles = xcss({
|
|
6
|
+
color: 'color.text',
|
|
7
|
+
padding: 'space.100',
|
|
8
|
+
borderRadius: 'border.radius.200',
|
|
9
|
+
borderBottomRightRadius: "var(--ds-border-radius-050, 2px)",
|
|
10
|
+
lineHeight: '20px',
|
|
11
|
+
fontWeight: '500',
|
|
12
|
+
fontSize: '14px',
|
|
13
|
+
textOverflow: 'ellipsis',
|
|
14
|
+
whiteSpace: 'nowrap',
|
|
15
|
+
flexShrink: 1,
|
|
16
|
+
backgroundColor: 'color.background.neutral',
|
|
17
|
+
':hover': {
|
|
18
|
+
backgroundColor: 'color.background.neutral.hovered'
|
|
19
|
+
},
|
|
20
|
+
':active': {
|
|
21
|
+
backgroundColor: 'color.background.neutral.pressed'
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const buttonInlineStyles = xcss({
|
|
25
|
+
paddingInline: 'space.025'
|
|
26
|
+
});
|
|
27
|
+
const queryTextStyles = xcss({
|
|
28
|
+
wordBreak: 'break-word',
|
|
29
|
+
textAlign: 'left'
|
|
30
|
+
});
|
|
31
|
+
const whiteSpacePreWrapStyles = xcss({
|
|
32
|
+
whiteSpace: 'pre-wrap'
|
|
33
|
+
});
|
|
34
|
+
const iconWrapper = xcss({
|
|
35
|
+
minWidth: '20px',
|
|
36
|
+
height: '20px'
|
|
37
|
+
});
|
|
38
|
+
export const ChatPill = /*#__PURE__*/React.forwardRef(({
|
|
39
|
+
children,
|
|
40
|
+
whiteSpacePreWrap = true,
|
|
41
|
+
...props
|
|
42
|
+
}, ref) => /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
43
|
+
ref: ref
|
|
44
|
+
}, props, {
|
|
45
|
+
xcss: buttonStyles
|
|
46
|
+
}), /*#__PURE__*/React.createElement(Inline, {
|
|
47
|
+
space: "space.050",
|
|
48
|
+
xcss: buttonInlineStyles
|
|
49
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
50
|
+
xcss: iconWrapper
|
|
51
|
+
}, /*#__PURE__*/React.createElement(ChatPillIcon, null)), /*#__PURE__*/React.createElement(Box, {
|
|
52
|
+
xcss: [queryTextStyles, whiteSpacePreWrap && whiteSpacePreWrapStyles]
|
|
53
|
+
}, children))));
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export { AgentProfileInfo, AgentProfileCreator, AgentStarCount } from './ui/agent-profile-info';
|
|
2
|
-
export { StarIconButton } from './common/ui/star-icon-button';
|
|
2
|
+
export { StarIconButton } from './common/ui/star-icon-button';
|
|
3
|
+
export { AgentConversationStarters, getConversationStarters } from './ui/agent-conversation-starters';
|
|
4
|
+
export { ChatPill } from './common/ui/chat-pill';
|
|
5
|
+
export { ChatPillIcon } from './common/ui/chat-icon';
|
|
File without changes
|
|
File without changes
|