@atlaskit/rovo-agent-components 0.0.1 → 0.1.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.
Files changed (27) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/common/ui/star-icon-button/index.js +56 -0
  3. package/dist/cjs/common/ui/star-icon-button/messages.js +19 -0
  4. package/dist/cjs/index.js +26 -4
  5. package/dist/cjs/ui/agent-profile-info/index.js +135 -0
  6. package/dist/cjs/ui/agent-profile-info/messages.js +19 -0
  7. package/dist/es2019/common/ui/star-icon-button/index.js +39 -0
  8. package/dist/es2019/common/ui/star-icon-button/messages.js +13 -0
  9. package/dist/es2019/index.js +2 -1
  10. package/dist/es2019/ui/agent-profile-info/index.js +131 -0
  11. package/dist/es2019/ui/agent-profile-info/messages.js +13 -0
  12. package/dist/esm/common/ui/star-icon-button/index.js +46 -0
  13. package/dist/esm/common/ui/star-icon-button/messages.js +13 -0
  14. package/dist/esm/index.js +2 -3
  15. package/dist/esm/ui/agent-profile-info/index.js +128 -0
  16. package/dist/esm/ui/agent-profile-info/messages.js +13 -0
  17. package/dist/types/common/ui/star-icon-button/index.d.ts +6 -0
  18. package/dist/types/common/ui/star-icon-button/messages.d.ts +13 -0
  19. package/dist/types/index.d.ts +2 -2
  20. package/dist/types/ui/agent-profile-info/index.d.ts +21 -0
  21. package/dist/types/ui/agent-profile-info/messages.d.ts +12 -0
  22. package/dist/types-ts4.5/common/ui/star-icon-button/index.d.ts +6 -0
  23. package/dist/types-ts4.5/common/ui/star-icon-button/messages.d.ts +13 -0
  24. package/dist/types-ts4.5/index.d.ts +2 -2
  25. package/dist/types-ts4.5/ui/agent-profile-info/index.d.ts +21 -0
  26. package/dist/types-ts4.5/ui/agent-profile-info/messages.d.ts +12 -0
  27. package/package.json +9 -2
package/CHANGELOG.md CHANGED
@@ -1 +1,17 @@
1
1
  # @atlaskit/rovo-agent-components
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#125357](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/125357)
8
+ [`b94215c8c2301`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b94215c8c2301) -
9
+ Adding data fetcher and controller for single agent endpoint, added favourites count in view agent
10
+ modal
11
+
12
+ ## 0.0.2
13
+
14
+ ### Patch Changes
15
+
16
+ - [`b52fe103ff593`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/b52fe103ff593) -
17
+ Extracting AgentProfileInfo to atlaskit component and fixing ARI utils
@@ -0,0 +1,56 @@
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.StarIconButton = void 0;
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var _reactIntlNext = require("react-intl-next");
12
+ var _star = _interopRequireDefault(require("@atlaskit/icon/glyph/star"));
13
+ var _starFilled = _interopRequireDefault(require("@atlaskit/icon/glyph/star-filled"));
14
+ var _primitives = require("@atlaskit/primitives");
15
+ var _messages = _interopRequireDefault(require("./messages"));
16
+ 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); }
17
+ 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; }
18
+ var pressableStarIconStyles = (0, _primitives.xcss)({
19
+ background: 'transparent',
20
+ padding: 'space.0',
21
+ height: '32px',
22
+ width: '32px'
23
+ });
24
+ var hiddenStyles = (0, _primitives.xcss)({
25
+ opacity: 0
26
+ });
27
+ var StarIconButton = exports.StarIconButton = function StarIconButton(_ref) {
28
+ var isStarred = _ref.isStarred,
29
+ handleToggle = _ref.handleToggle,
30
+ _ref$visible = _ref.visible,
31
+ visible = _ref$visible === void 0 ? true : _ref$visible;
32
+ var _useIntl = (0, _reactIntlNext.useIntl)(),
33
+ formatMessage = _useIntl.formatMessage;
34
+ var _useState = (0, _react.useState)(false),
35
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
36
+ isHovered = _useState2[0],
37
+ setIsHovered = _useState2[1];
38
+ return /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
39
+ xcss: [pressableStarIconStyles, !visible && hiddenStyles],
40
+ onClick: handleToggle,
41
+ onMouseEnter: function onMouseEnter() {
42
+ return setIsHovered(true);
43
+ },
44
+ onMouseLeave: function onMouseLeave() {
45
+ return setIsHovered(false);
46
+ }
47
+ }, isStarred || isHovered ? /*#__PURE__*/_react.default.createElement(_starFilled.default, {
48
+ size: "medium",
49
+ label: formatMessage(_messages.default.removeFromFavouritesLabel),
50
+ primaryColor: "var(--ds-background-accent-yellow-subtler-pressed, #E2B203)"
51
+ }) : /*#__PURE__*/_react.default.createElement(_star.default, {
52
+ size: "medium",
53
+ label: formatMessage(_messages.default.clickToFavouriteLabel),
54
+ primaryColor: "var(--ds-background-accent-gray-bolder-hovered, #44546F)"
55
+ }));
56
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _reactIntlNext = require("react-intl-next");
8
+ var _default = exports.default = (0, _reactIntlNext.defineMessages)({
9
+ removeFromFavouritesLabel: {
10
+ id: 'rovo-chat.browse-agents.remove-from-favourites-label',
11
+ defaultMessage: 'Remove from favourites',
12
+ description: 'Remove from favourites label'
13
+ },
14
+ clickToFavouriteLabel: {
15
+ id: 'rovo-chat.browse-agents.click-to-favourite-label',
16
+ defaultMessage: 'Not favourited, click to favourite',
17
+ description: 'Click to favourite agent label'
18
+ }
19
+ });
package/dist/cjs/index.js CHANGED
@@ -3,7 +3,29 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
7
- var _default = exports.default = function _default() {
8
- return 'Test';
9
- };
6
+ Object.defineProperty(exports, "AgentProfileCreator", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _agentProfileInfo.AgentProfileCreator;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "AgentProfileInfo", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _agentProfileInfo.AgentProfileInfo;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "AgentStarCount", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _agentProfileInfo.AgentStarCount;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "StarIconButton", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _starIconButton.StarIconButton;
28
+ }
29
+ });
30
+ var _agentProfileInfo = require("./ui/agent-profile-info");
31
+ var _starIconButton = require("./common/ui/star-icon-button");
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.AgentStarCount = exports.AgentProfileInfo = exports.AgentProfileCreator = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactIntlNext = require("react-intl-next");
10
+ var _heading = _interopRequireDefault(require("@atlaskit/heading"));
11
+ var _star = _interopRequireDefault(require("@atlaskit/icon/glyph/star"));
12
+ var _logo = require("@atlaskit/logo");
13
+ var _primitives = require("@atlaskit/primitives");
14
+ var _skeleton = _interopRequireDefault(require("@atlaskit/skeleton"));
15
+ var _starIconButton = require("../../common/ui/star-icon-button");
16
+ var _messages = require("./messages");
17
+ var clickableItemStyles = (0, _primitives.xcss)({
18
+ display: 'flex',
19
+ alignItems: 'center',
20
+ gap: 'space.050'
21
+ });
22
+ var countStyles = (0, _primitives.xcss)({
23
+ fontSize: '11px',
24
+ display: 'flex',
25
+ alignItems: 'center',
26
+ gap: 'space.025'
27
+ });
28
+ var nameStyles = (0, _primitives.xcss)({
29
+ justifyContent: 'space-between',
30
+ alignItems: 'flex-start'
31
+ });
32
+ var descriptionStyles = (0, _primitives.xcss)({
33
+ marginTop: 'space.0',
34
+ marginBottom: 'space.100'
35
+ });
36
+ var AgentProfileCreator = exports.AgentProfileCreator = function AgentProfileCreator(_ref) {
37
+ var creator = _ref.creator,
38
+ onCreatorLinkClick = _ref.onCreatorLinkClick,
39
+ isLoading = _ref.isLoading;
40
+ var _useIntl = (0, _reactIntlNext.useIntl)(),
41
+ formatMessage = _useIntl.formatMessage;
42
+ var getCreatorRender = function getCreatorRender() {
43
+ if (isLoading) {
44
+ return formatMessage(_messages.messages.agentCreatedBy, {
45
+ creatorNameWithLink: /*#__PURE__*/_react.default.createElement(_skeleton.default, {
46
+ testId: "agent-profile-creator-skeleton",
47
+ isShimmering: true,
48
+ height: 18,
49
+ width: 100,
50
+ borderRadius: 3
51
+ })
52
+ });
53
+ }
54
+ if (!creator) {
55
+ return null;
56
+ }
57
+ if (creator === 'SYSTEM') {
58
+ return formatMessage(_messages.messages.agentCreatedBy, {
59
+ creatorNameWithLink: /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
60
+ alignBlock: "center",
61
+ testId: "atlassian-icon"
62
+ }, /*#__PURE__*/_react.default.createElement(_logo.AtlassianIcon, {
63
+ size: "small",
64
+ appearance: "brand"
65
+ }), /*#__PURE__*/_react.default.createElement(_primitives.Box, null, "Atlassian"))
66
+ });
67
+ }
68
+ return formatMessage(_messages.messages.agentCreatedBy, {
69
+ creatorNameWithLink: /*#__PURE__*/_react.default.createElement("a", {
70
+ href: creator.profileLink,
71
+ onClick: function onClick() {
72
+ return onCreatorLinkClick();
73
+ },
74
+ target: "_blank"
75
+ }, creator.name)
76
+ });
77
+ };
78
+ var creatorRender = getCreatorRender();
79
+ return creatorRender ? /*#__PURE__*/_react.default.createElement(_primitives.Box, {
80
+ xcss: clickableItemStyles
81
+ }, /*#__PURE__*/_react.default.createElement(_logo.RovoIcon, {
82
+ appearance: "brand",
83
+ size: "small"
84
+ }), creatorRender) : null;
85
+ };
86
+ var AgentStarCount = exports.AgentStarCount = function AgentStarCount(_ref2) {
87
+ var starCount = _ref2.starCount,
88
+ isLoading = _ref2.isLoading;
89
+ var _useIntl2 = (0, _reactIntlNext.useIntl)(),
90
+ formatMessage = _useIntl2.formatMessage;
91
+ if (starCount === null || starCount === undefined) {
92
+ return null;
93
+ }
94
+ return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
95
+ xcss: countStyles
96
+ }, /*#__PURE__*/_react.default.createElement(_star.default, {
97
+ label: "",
98
+ size: "small"
99
+ }), isLoading ? /*#__PURE__*/_react.default.createElement(_skeleton.default, {
100
+ testId: "agent-profile-info-star-count-skeleton",
101
+ isShimmering: true,
102
+ height: 16,
103
+ width: 75,
104
+ borderRadius: 3
105
+ }) : formatMessage(_messages.messages.starredCount, {
106
+ count: starCount
107
+ }));
108
+ };
109
+ var wrapperStyles = (0, _primitives.xcss)({
110
+ marginBottom: 'space.100'
111
+ });
112
+ var AgentProfileInfo = exports.AgentProfileInfo = function AgentProfileInfo(_ref3) {
113
+ var agentName = _ref3.agentName,
114
+ agentDescription = _ref3.agentDescription,
115
+ creatorRender = _ref3.creatorRender,
116
+ starCountRender = _ref3.starCountRender,
117
+ isStarred = _ref3.isStarred,
118
+ onStarToggle = _ref3.onStarToggle;
119
+ return /*#__PURE__*/_react.default.createElement(_primitives.Stack, {
120
+ space: "space.100",
121
+ xcss: wrapperStyles
122
+ }, /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
123
+ xcss: nameStyles,
124
+ space: "space.100",
125
+ alignBlock: "center"
126
+ }, /*#__PURE__*/_react.default.createElement(_heading.default, {
127
+ size: "xlarge"
128
+ }, agentName), /*#__PURE__*/_react.default.createElement(_starIconButton.StarIconButton, {
129
+ isStarred: isStarred,
130
+ handleToggle: onStarToggle
131
+ })), creatorRender, !!agentDescription && /*#__PURE__*/_react.default.createElement(_primitives.Box, {
132
+ xcss: descriptionStyles,
133
+ as: "p"
134
+ }, agentDescription), starCountRender);
135
+ };
@@ -0,0 +1,19 @@
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
+ agentCreatedBy: {
10
+ id: 'ai-mate.agent-profile-info.created-by',
11
+ defaultMessage: 'Rovo agent by {creatorNameWithLink}',
12
+ description: 'Message to show who created this Rovo agent'
13
+ },
14
+ starredCount: {
15
+ id: 'ai-mate.agent-profile-info.starred-count',
16
+ defaultMessage: '{count} starred',
17
+ description: 'Message to show how many times this agent has been starred by users'
18
+ }
19
+ });
@@ -0,0 +1,39 @@
1
+ import React, { useState } from 'react';
2
+ import { useIntl } from 'react-intl-next';
3
+ import StarIcon from '@atlaskit/icon/glyph/star';
4
+ import StarFilledIcon from '@atlaskit/icon/glyph/star-filled';
5
+ import { Pressable, xcss } from '@atlaskit/primitives';
6
+ import messages from './messages';
7
+ const pressableStarIconStyles = xcss({
8
+ background: 'transparent',
9
+ padding: 'space.0',
10
+ height: '32px',
11
+ width: '32px'
12
+ });
13
+ const hiddenStyles = xcss({
14
+ opacity: 0
15
+ });
16
+ export const StarIconButton = ({
17
+ isStarred,
18
+ handleToggle,
19
+ visible = true
20
+ }) => {
21
+ const {
22
+ formatMessage
23
+ } = useIntl();
24
+ const [isHovered, setIsHovered] = useState(false);
25
+ return /*#__PURE__*/React.createElement(Pressable, {
26
+ xcss: [pressableStarIconStyles, !visible && hiddenStyles],
27
+ onClick: handleToggle,
28
+ onMouseEnter: () => setIsHovered(true),
29
+ onMouseLeave: () => setIsHovered(false)
30
+ }, isStarred || isHovered ? /*#__PURE__*/React.createElement(StarFilledIcon, {
31
+ size: "medium",
32
+ label: formatMessage(messages.removeFromFavouritesLabel),
33
+ primaryColor: "var(--ds-background-accent-yellow-subtler-pressed, #E2B203)"
34
+ }) : /*#__PURE__*/React.createElement(StarIcon, {
35
+ size: "medium",
36
+ label: formatMessage(messages.clickToFavouriteLabel),
37
+ primaryColor: "var(--ds-background-accent-gray-bolder-hovered, #44546F)"
38
+ }));
39
+ };
@@ -0,0 +1,13 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export default defineMessages({
3
+ removeFromFavouritesLabel: {
4
+ id: 'rovo-chat.browse-agents.remove-from-favourites-label',
5
+ defaultMessage: 'Remove from favourites',
6
+ description: 'Remove from favourites label'
7
+ },
8
+ clickToFavouriteLabel: {
9
+ id: 'rovo-chat.browse-agents.click-to-favourite-label',
10
+ defaultMessage: 'Not favourited, click to favourite',
11
+ description: 'Click to favourite agent label'
12
+ }
13
+ });
@@ -1 +1,2 @@
1
- export default (() => 'Test');
1
+ export { AgentProfileInfo, AgentProfileCreator, AgentStarCount } from './ui/agent-profile-info';
2
+ export { StarIconButton } from './common/ui/star-icon-button';
@@ -0,0 +1,131 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl-next';
3
+ import Heading from '@atlaskit/heading';
4
+ import StarIcon from '@atlaskit/icon/glyph/star';
5
+ import { AtlassianIcon, RovoIcon } from '@atlaskit/logo';
6
+ import { Box, Inline, Stack, xcss } from '@atlaskit/primitives';
7
+ import Skeleton from '@atlaskit/skeleton';
8
+ import { StarIconButton } from '../../common/ui/star-icon-button';
9
+ import { messages } from './messages';
10
+ const clickableItemStyles = xcss({
11
+ display: 'flex',
12
+ alignItems: 'center',
13
+ gap: 'space.050'
14
+ });
15
+ const countStyles = xcss({
16
+ fontSize: '11px',
17
+ display: 'flex',
18
+ alignItems: 'center',
19
+ gap: 'space.025'
20
+ });
21
+ const nameStyles = xcss({
22
+ justifyContent: 'space-between',
23
+ alignItems: 'flex-start'
24
+ });
25
+ const descriptionStyles = xcss({
26
+ marginTop: 'space.0',
27
+ marginBottom: 'space.100'
28
+ });
29
+ export const AgentProfileCreator = ({
30
+ creator,
31
+ onCreatorLinkClick,
32
+ isLoading: isLoading
33
+ }) => {
34
+ const {
35
+ formatMessage
36
+ } = useIntl();
37
+ const getCreatorRender = () => {
38
+ if (isLoading) {
39
+ return formatMessage(messages.agentCreatedBy, {
40
+ creatorNameWithLink: /*#__PURE__*/React.createElement(Skeleton, {
41
+ testId: "agent-profile-creator-skeleton",
42
+ isShimmering: true,
43
+ height: 18,
44
+ width: 100,
45
+ borderRadius: 3
46
+ })
47
+ });
48
+ }
49
+ if (!creator) {
50
+ return null;
51
+ }
52
+ if (creator === 'SYSTEM') {
53
+ return formatMessage(messages.agentCreatedBy, {
54
+ creatorNameWithLink: /*#__PURE__*/React.createElement(Inline, {
55
+ alignBlock: "center",
56
+ testId: "atlassian-icon"
57
+ }, /*#__PURE__*/React.createElement(AtlassianIcon, {
58
+ size: "small",
59
+ appearance: "brand"
60
+ }), /*#__PURE__*/React.createElement(Box, null, "Atlassian"))
61
+ });
62
+ }
63
+ return formatMessage(messages.agentCreatedBy, {
64
+ creatorNameWithLink: /*#__PURE__*/React.createElement("a", {
65
+ href: creator.profileLink,
66
+ onClick: () => onCreatorLinkClick(),
67
+ target: "_blank"
68
+ }, creator.name)
69
+ });
70
+ };
71
+ const creatorRender = getCreatorRender();
72
+ return creatorRender ? /*#__PURE__*/React.createElement(Box, {
73
+ xcss: clickableItemStyles
74
+ }, /*#__PURE__*/React.createElement(RovoIcon, {
75
+ appearance: "brand",
76
+ size: "small"
77
+ }), creatorRender) : null;
78
+ };
79
+ export const AgentStarCount = ({
80
+ starCount,
81
+ isLoading
82
+ }) => {
83
+ const {
84
+ formatMessage
85
+ } = useIntl();
86
+ if (starCount === null || starCount === undefined) {
87
+ return null;
88
+ }
89
+ return /*#__PURE__*/React.createElement(Box, {
90
+ xcss: countStyles
91
+ }, /*#__PURE__*/React.createElement(StarIcon, {
92
+ label: "",
93
+ size: "small"
94
+ }), isLoading ? /*#__PURE__*/React.createElement(Skeleton, {
95
+ testId: "agent-profile-info-star-count-skeleton",
96
+ isShimmering: true,
97
+ height: 16,
98
+ width: 75,
99
+ borderRadius: 3
100
+ }) : formatMessage(messages.starredCount, {
101
+ count: starCount
102
+ }));
103
+ };
104
+ const wrapperStyles = xcss({
105
+ marginBottom: 'space.100'
106
+ });
107
+ export const AgentProfileInfo = ({
108
+ agentName,
109
+ agentDescription,
110
+ creatorRender,
111
+ starCountRender,
112
+ isStarred,
113
+ onStarToggle
114
+ }) => {
115
+ return /*#__PURE__*/React.createElement(Stack, {
116
+ space: "space.100",
117
+ xcss: wrapperStyles
118
+ }, /*#__PURE__*/React.createElement(Inline, {
119
+ xcss: nameStyles,
120
+ space: "space.100",
121
+ alignBlock: "center"
122
+ }, /*#__PURE__*/React.createElement(Heading, {
123
+ size: "xlarge"
124
+ }, agentName), /*#__PURE__*/React.createElement(StarIconButton, {
125
+ isStarred: isStarred,
126
+ handleToggle: onStarToggle
127
+ })), creatorRender, !!agentDescription && /*#__PURE__*/React.createElement(Box, {
128
+ xcss: descriptionStyles,
129
+ as: "p"
130
+ }, agentDescription), starCountRender);
131
+ };
@@ -0,0 +1,13 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export const messages = defineMessages({
3
+ agentCreatedBy: {
4
+ id: 'ai-mate.agent-profile-info.created-by',
5
+ defaultMessage: 'Rovo agent by {creatorNameWithLink}',
6
+ description: 'Message to show who created this Rovo agent'
7
+ },
8
+ starredCount: {
9
+ id: 'ai-mate.agent-profile-info.starred-count',
10
+ defaultMessage: '{count} starred',
11
+ description: 'Message to show how many times this agent has been starred by users'
12
+ }
13
+ });
@@ -0,0 +1,46 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import React, { useState } from 'react';
3
+ import { useIntl } from 'react-intl-next';
4
+ import StarIcon from '@atlaskit/icon/glyph/star';
5
+ import StarFilledIcon from '@atlaskit/icon/glyph/star-filled';
6
+ import { Pressable, xcss } from '@atlaskit/primitives';
7
+ import messages from './messages';
8
+ var pressableStarIconStyles = xcss({
9
+ background: 'transparent',
10
+ padding: 'space.0',
11
+ height: '32px',
12
+ width: '32px'
13
+ });
14
+ var hiddenStyles = xcss({
15
+ opacity: 0
16
+ });
17
+ export var StarIconButton = function StarIconButton(_ref) {
18
+ var isStarred = _ref.isStarred,
19
+ handleToggle = _ref.handleToggle,
20
+ _ref$visible = _ref.visible,
21
+ visible = _ref$visible === void 0 ? true : _ref$visible;
22
+ var _useIntl = useIntl(),
23
+ formatMessage = _useIntl.formatMessage;
24
+ var _useState = useState(false),
25
+ _useState2 = _slicedToArray(_useState, 2),
26
+ isHovered = _useState2[0],
27
+ setIsHovered = _useState2[1];
28
+ return /*#__PURE__*/React.createElement(Pressable, {
29
+ xcss: [pressableStarIconStyles, !visible && hiddenStyles],
30
+ onClick: handleToggle,
31
+ onMouseEnter: function onMouseEnter() {
32
+ return setIsHovered(true);
33
+ },
34
+ onMouseLeave: function onMouseLeave() {
35
+ return setIsHovered(false);
36
+ }
37
+ }, isStarred || isHovered ? /*#__PURE__*/React.createElement(StarFilledIcon, {
38
+ size: "medium",
39
+ label: formatMessage(messages.removeFromFavouritesLabel),
40
+ primaryColor: "var(--ds-background-accent-yellow-subtler-pressed, #E2B203)"
41
+ }) : /*#__PURE__*/React.createElement(StarIcon, {
42
+ size: "medium",
43
+ label: formatMessage(messages.clickToFavouriteLabel),
44
+ primaryColor: "var(--ds-background-accent-gray-bolder-hovered, #44546F)"
45
+ }));
46
+ };
@@ -0,0 +1,13 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export default defineMessages({
3
+ removeFromFavouritesLabel: {
4
+ id: 'rovo-chat.browse-agents.remove-from-favourites-label',
5
+ defaultMessage: 'Remove from favourites',
6
+ description: 'Remove from favourites label'
7
+ },
8
+ clickToFavouriteLabel: {
9
+ id: 'rovo-chat.browse-agents.click-to-favourite-label',
10
+ defaultMessage: 'Not favourited, click to favourite',
11
+ description: 'Click to favourite agent label'
12
+ }
13
+ });
package/dist/esm/index.js CHANGED
@@ -1,3 +1,2 @@
1
- export default (function () {
2
- return 'Test';
3
- });
1
+ export { AgentProfileInfo, AgentProfileCreator, AgentStarCount } from './ui/agent-profile-info';
2
+ export { StarIconButton } from './common/ui/star-icon-button';
@@ -0,0 +1,128 @@
1
+ import React from 'react';
2
+ import { useIntl } from 'react-intl-next';
3
+ import Heading from '@atlaskit/heading';
4
+ import StarIcon from '@atlaskit/icon/glyph/star';
5
+ import { AtlassianIcon, RovoIcon } from '@atlaskit/logo';
6
+ import { Box, Inline, Stack, xcss } from '@atlaskit/primitives';
7
+ import Skeleton from '@atlaskit/skeleton';
8
+ import { StarIconButton } from '../../common/ui/star-icon-button';
9
+ import { messages } from './messages';
10
+ var clickableItemStyles = xcss({
11
+ display: 'flex',
12
+ alignItems: 'center',
13
+ gap: 'space.050'
14
+ });
15
+ var countStyles = xcss({
16
+ fontSize: '11px',
17
+ display: 'flex',
18
+ alignItems: 'center',
19
+ gap: 'space.025'
20
+ });
21
+ var nameStyles = xcss({
22
+ justifyContent: 'space-between',
23
+ alignItems: 'flex-start'
24
+ });
25
+ var descriptionStyles = xcss({
26
+ marginTop: 'space.0',
27
+ marginBottom: 'space.100'
28
+ });
29
+ export var AgentProfileCreator = function AgentProfileCreator(_ref) {
30
+ var creator = _ref.creator,
31
+ onCreatorLinkClick = _ref.onCreatorLinkClick,
32
+ isLoading = _ref.isLoading;
33
+ var _useIntl = useIntl(),
34
+ formatMessage = _useIntl.formatMessage;
35
+ var getCreatorRender = function getCreatorRender() {
36
+ if (isLoading) {
37
+ return formatMessage(messages.agentCreatedBy, {
38
+ creatorNameWithLink: /*#__PURE__*/React.createElement(Skeleton, {
39
+ testId: "agent-profile-creator-skeleton",
40
+ isShimmering: true,
41
+ height: 18,
42
+ width: 100,
43
+ borderRadius: 3
44
+ })
45
+ });
46
+ }
47
+ if (!creator) {
48
+ return null;
49
+ }
50
+ if (creator === 'SYSTEM') {
51
+ return formatMessage(messages.agentCreatedBy, {
52
+ creatorNameWithLink: /*#__PURE__*/React.createElement(Inline, {
53
+ alignBlock: "center",
54
+ testId: "atlassian-icon"
55
+ }, /*#__PURE__*/React.createElement(AtlassianIcon, {
56
+ size: "small",
57
+ appearance: "brand"
58
+ }), /*#__PURE__*/React.createElement(Box, null, "Atlassian"))
59
+ });
60
+ }
61
+ return formatMessage(messages.agentCreatedBy, {
62
+ creatorNameWithLink: /*#__PURE__*/React.createElement("a", {
63
+ href: creator.profileLink,
64
+ onClick: function onClick() {
65
+ return onCreatorLinkClick();
66
+ },
67
+ target: "_blank"
68
+ }, creator.name)
69
+ });
70
+ };
71
+ var creatorRender = getCreatorRender();
72
+ return creatorRender ? /*#__PURE__*/React.createElement(Box, {
73
+ xcss: clickableItemStyles
74
+ }, /*#__PURE__*/React.createElement(RovoIcon, {
75
+ appearance: "brand",
76
+ size: "small"
77
+ }), creatorRender) : null;
78
+ };
79
+ export var AgentStarCount = function AgentStarCount(_ref2) {
80
+ var starCount = _ref2.starCount,
81
+ isLoading = _ref2.isLoading;
82
+ var _useIntl2 = useIntl(),
83
+ formatMessage = _useIntl2.formatMessage;
84
+ if (starCount === null || starCount === undefined) {
85
+ return null;
86
+ }
87
+ return /*#__PURE__*/React.createElement(Box, {
88
+ xcss: countStyles
89
+ }, /*#__PURE__*/React.createElement(StarIcon, {
90
+ label: "",
91
+ size: "small"
92
+ }), isLoading ? /*#__PURE__*/React.createElement(Skeleton, {
93
+ testId: "agent-profile-info-star-count-skeleton",
94
+ isShimmering: true,
95
+ height: 16,
96
+ width: 75,
97
+ borderRadius: 3
98
+ }) : formatMessage(messages.starredCount, {
99
+ count: starCount
100
+ }));
101
+ };
102
+ var wrapperStyles = xcss({
103
+ marginBottom: 'space.100'
104
+ });
105
+ export var AgentProfileInfo = function AgentProfileInfo(_ref3) {
106
+ var agentName = _ref3.agentName,
107
+ agentDescription = _ref3.agentDescription,
108
+ creatorRender = _ref3.creatorRender,
109
+ starCountRender = _ref3.starCountRender,
110
+ isStarred = _ref3.isStarred,
111
+ onStarToggle = _ref3.onStarToggle;
112
+ return /*#__PURE__*/React.createElement(Stack, {
113
+ space: "space.100",
114
+ xcss: wrapperStyles
115
+ }, /*#__PURE__*/React.createElement(Inline, {
116
+ xcss: nameStyles,
117
+ space: "space.100",
118
+ alignBlock: "center"
119
+ }, /*#__PURE__*/React.createElement(Heading, {
120
+ size: "xlarge"
121
+ }, agentName), /*#__PURE__*/React.createElement(StarIconButton, {
122
+ isStarred: isStarred,
123
+ handleToggle: onStarToggle
124
+ })), creatorRender, !!agentDescription && /*#__PURE__*/React.createElement(Box, {
125
+ xcss: descriptionStyles,
126
+ as: "p"
127
+ }, agentDescription), starCountRender);
128
+ };
@@ -0,0 +1,13 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export var messages = defineMessages({
3
+ agentCreatedBy: {
4
+ id: 'ai-mate.agent-profile-info.created-by',
5
+ defaultMessage: 'Rovo agent by {creatorNameWithLink}',
6
+ description: 'Message to show who created this Rovo agent'
7
+ },
8
+ starredCount: {
9
+ id: 'ai-mate.agent-profile-info.starred-count',
10
+ defaultMessage: '{count} starred',
11
+ description: 'Message to show how many times this agent has been starred by users'
12
+ }
13
+ });
@@ -0,0 +1,6 @@
1
+ import { type KeyboardEvent, type MouseEvent } from 'react';
2
+ export declare const StarIconButton: ({ isStarred, handleToggle, visible, }: {
3
+ isStarred: boolean;
4
+ handleToggle: (e: MouseEvent<Element, globalThis.MouseEvent> | KeyboardEvent<Element>) => void;
5
+ visible?: boolean | undefined;
6
+ }) => JSX.Element;
@@ -0,0 +1,13 @@
1
+ declare const _default: {
2
+ removeFromFavouritesLabel: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ clickToFavouriteLabel: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ };
13
+ export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: () => string;
2
- export default _default;
1
+ export { AgentProfileInfo, AgentProfileCreator, AgentStarCount } from './ui/agent-profile-info';
2
+ export { StarIconButton } from './common/ui/star-icon-button';
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ export declare const AgentProfileCreator: ({ creator, onCreatorLinkClick, isLoading: isLoading, }: {
3
+ creator?: {
4
+ name: string;
5
+ profileLink: string;
6
+ } | "SYSTEM" | undefined;
7
+ isLoading: boolean;
8
+ onCreatorLinkClick: () => void;
9
+ }) => JSX.Element | null;
10
+ export declare const AgentStarCount: ({ starCount, isLoading, }: {
11
+ starCount: number | null | undefined;
12
+ isLoading: boolean;
13
+ }) => JSX.Element | null;
14
+ export declare const AgentProfileInfo: ({ agentName, agentDescription, creatorRender, starCountRender, isStarred, onStarToggle, }: {
15
+ agentName: string;
16
+ agentDescription?: string | null | undefined;
17
+ creatorRender: React.ReactNode;
18
+ starCountRender: React.ReactNode;
19
+ isStarred: boolean;
20
+ onStarToggle: () => void;
21
+ }) => JSX.Element;
@@ -0,0 +1,12 @@
1
+ export declare const messages: {
2
+ agentCreatedBy: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ starredCount: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ };
@@ -0,0 +1,6 @@
1
+ import { type KeyboardEvent, type MouseEvent } from 'react';
2
+ export declare const StarIconButton: ({ isStarred, handleToggle, visible, }: {
3
+ isStarred: boolean;
4
+ handleToggle: (e: MouseEvent<Element, globalThis.MouseEvent> | KeyboardEvent<Element>) => void;
5
+ visible?: boolean | undefined;
6
+ }) => JSX.Element;
@@ -0,0 +1,13 @@
1
+ declare const _default: {
2
+ removeFromFavouritesLabel: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ clickToFavouriteLabel: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ };
13
+ export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: () => string;
2
- export default _default;
1
+ export { AgentProfileInfo, AgentProfileCreator, AgentStarCount } from './ui/agent-profile-info';
2
+ export { StarIconButton } from './common/ui/star-icon-button';
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ export declare const AgentProfileCreator: ({ creator, onCreatorLinkClick, isLoading: isLoading, }: {
3
+ creator?: {
4
+ name: string;
5
+ profileLink: string;
6
+ } | "SYSTEM" | undefined;
7
+ isLoading: boolean;
8
+ onCreatorLinkClick: () => void;
9
+ }) => JSX.Element | null;
10
+ export declare const AgentStarCount: ({ starCount, isLoading, }: {
11
+ starCount: number | null | undefined;
12
+ isLoading: boolean;
13
+ }) => JSX.Element | null;
14
+ export declare const AgentProfileInfo: ({ agentName, agentDescription, creatorRender, starCountRender, isStarred, onStarToggle, }: {
15
+ agentName: string;
16
+ agentDescription?: string | null | undefined;
17
+ creatorRender: React.ReactNode;
18
+ starCountRender: React.ReactNode;
19
+ isStarred: boolean;
20
+ onStarToggle: () => void;
21
+ }) => JSX.Element;
@@ -0,0 +1,12 @@
1
+ export declare const messages: {
2
+ agentCreatedBy: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ starredCount: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/rovo-agent-components",
3
- "version": "0.0.1",
3
+ "version": "0.1.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",
@@ -36,7 +36,14 @@
36
36
  ".": "./src/index.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@babel/runtime": "^7.0.0"
39
+ "@atlaskit/heading": "^2.4.3",
40
+ "@atlaskit/icon": "^22.8.0",
41
+ "@atlaskit/logo": "^14.1.0",
42
+ "@atlaskit/primitives": "^11.1.0",
43
+ "@atlaskit/skeleton": "^0.4.0",
44
+ "@atlaskit/tokens": "^1.56.0",
45
+ "@babel/runtime": "^7.0.0",
46
+ "react-intl-next": "npm:react-intl@^5.18.1"
40
47
  },
41
48
  "peerDependencies": {
42
49
  "react": "^16.8.0"