@atlaskit/rovo-agent-components 0.0.2 → 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/rovo-agent-components
2
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
+
3
12
  ## 0.0.2
4
13
 
5
14
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "AgentProfileInfo", {
15
15
  return _agentProfileInfo.AgentProfileInfo;
16
16
  }
17
17
  });
18
+ Object.defineProperty(exports, "AgentStarCount", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _agentProfileInfo.AgentStarCount;
22
+ }
23
+ });
18
24
  Object.defineProperty(exports, "StarIconButton", {
19
25
  enumerable: true,
20
26
  get: function get() {
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.AgentProfileInfo = exports.AgentProfileCreator = void 0;
7
+ exports.AgentStarCount = exports.AgentProfileInfo = exports.AgentProfileCreator = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _reactIntlNext = require("react-intl-next");
10
10
  var _heading = _interopRequireDefault(require("@atlaskit/heading"));
@@ -83,17 +83,42 @@ var AgentProfileCreator = exports.AgentProfileCreator = function AgentProfileCre
83
83
  size: "small"
84
84
  }), creatorRender) : null;
85
85
  };
86
- var AgentProfileInfo = exports.AgentProfileInfo = function AgentProfileInfo(_ref2) {
87
- var agentName = _ref2.agentName,
88
- agentDescription = _ref2.agentDescription,
89
- creatorRender = _ref2.creatorRender,
90
- starCount = _ref2.starCount,
91
- isStarred = _ref2.isStarred,
92
- onStarToggle = _ref2.onStarToggle;
86
+ var AgentStarCount = exports.AgentStarCount = function AgentStarCount(_ref2) {
87
+ var starCount = _ref2.starCount,
88
+ isLoading = _ref2.isLoading;
93
89
  var _useIntl2 = (0, _reactIntlNext.useIntl)(),
94
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;
95
119
  return /*#__PURE__*/_react.default.createElement(_primitives.Stack, {
96
- space: "space.100"
120
+ space: "space.100",
121
+ xcss: wrapperStyles
97
122
  }, /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
98
123
  xcss: nameStyles,
99
124
  space: "space.100",
@@ -106,12 +131,5 @@ var AgentProfileInfo = exports.AgentProfileInfo = function AgentProfileInfo(_ref
106
131
  })), creatorRender, !!agentDescription && /*#__PURE__*/_react.default.createElement(_primitives.Box, {
107
132
  xcss: descriptionStyles,
108
133
  as: "p"
109
- }, agentDescription), starCount !== 0 && /*#__PURE__*/_react.default.createElement(_primitives.Box, {
110
- xcss: countStyles
111
- }, /*#__PURE__*/_react.default.createElement(_star.default, {
112
- label: "",
113
- size: "small"
114
- }), formatMessage(_messages.messages.starredCount, {
115
- count: starCount
116
- })));
134
+ }, agentDescription), starCountRender);
117
135
  };
@@ -1,2 +1,2 @@
1
- export { AgentProfileInfo, AgentProfileCreator } from './ui/agent-profile-info';
1
+ export { AgentProfileInfo, AgentProfileCreator, AgentStarCount } from './ui/agent-profile-info';
2
2
  export { StarIconButton } from './common/ui/star-icon-button';
@@ -76,19 +76,45 @@ export const AgentProfileCreator = ({
76
76
  size: "small"
77
77
  }), creatorRender) : null;
78
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
+ });
79
107
  export const AgentProfileInfo = ({
80
108
  agentName,
81
109
  agentDescription,
82
110
  creatorRender,
83
- starCount,
111
+ starCountRender,
84
112
  isStarred,
85
113
  onStarToggle
86
114
  }) => {
87
- const {
88
- formatMessage
89
- } = useIntl();
90
115
  return /*#__PURE__*/React.createElement(Stack, {
91
- space: "space.100"
116
+ space: "space.100",
117
+ xcss: wrapperStyles
92
118
  }, /*#__PURE__*/React.createElement(Inline, {
93
119
  xcss: nameStyles,
94
120
  space: "space.100",
@@ -101,12 +127,5 @@ export const AgentProfileInfo = ({
101
127
  })), creatorRender, !!agentDescription && /*#__PURE__*/React.createElement(Box, {
102
128
  xcss: descriptionStyles,
103
129
  as: "p"
104
- }, agentDescription), starCount !== 0 && /*#__PURE__*/React.createElement(Box, {
105
- xcss: countStyles
106
- }, /*#__PURE__*/React.createElement(StarIcon, {
107
- label: "",
108
- size: "small"
109
- }), formatMessage(messages.starredCount, {
110
- count: starCount
111
- })));
130
+ }, agentDescription), starCountRender);
112
131
  };
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { AgentProfileInfo, AgentProfileCreator } from './ui/agent-profile-info';
1
+ export { AgentProfileInfo, AgentProfileCreator, AgentStarCount } from './ui/agent-profile-info';
2
2
  export { StarIconButton } from './common/ui/star-icon-button';
@@ -76,17 +76,42 @@ export var AgentProfileCreator = function AgentProfileCreator(_ref) {
76
76
  size: "small"
77
77
  }), creatorRender) : null;
78
78
  };
79
- export var AgentProfileInfo = function AgentProfileInfo(_ref2) {
80
- var agentName = _ref2.agentName,
81
- agentDescription = _ref2.agentDescription,
82
- creatorRender = _ref2.creatorRender,
83
- starCount = _ref2.starCount,
84
- isStarred = _ref2.isStarred,
85
- onStarToggle = _ref2.onStarToggle;
79
+ export var AgentStarCount = function AgentStarCount(_ref2) {
80
+ var starCount = _ref2.starCount,
81
+ isLoading = _ref2.isLoading;
86
82
  var _useIntl2 = useIntl(),
87
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;
88
112
  return /*#__PURE__*/React.createElement(Stack, {
89
- space: "space.100"
113
+ space: "space.100",
114
+ xcss: wrapperStyles
90
115
  }, /*#__PURE__*/React.createElement(Inline, {
91
116
  xcss: nameStyles,
92
117
  space: "space.100",
@@ -99,12 +124,5 @@ export var AgentProfileInfo = function AgentProfileInfo(_ref2) {
99
124
  })), creatorRender, !!agentDescription && /*#__PURE__*/React.createElement(Box, {
100
125
  xcss: descriptionStyles,
101
126
  as: "p"
102
- }, agentDescription), starCount !== 0 && /*#__PURE__*/React.createElement(Box, {
103
- xcss: countStyles
104
- }, /*#__PURE__*/React.createElement(StarIcon, {
105
- label: "",
106
- size: "small"
107
- }), formatMessage(messages.starredCount, {
108
- count: starCount
109
- })));
127
+ }, agentDescription), starCountRender);
110
128
  };
@@ -1,2 +1,2 @@
1
- export { AgentProfileInfo, AgentProfileCreator } from './ui/agent-profile-info';
1
+ export { AgentProfileInfo, AgentProfileCreator, AgentStarCount } from './ui/agent-profile-info';
2
2
  export { StarIconButton } from './common/ui/star-icon-button';
@@ -7,11 +7,15 @@ export declare const AgentProfileCreator: ({ creator, onCreatorLinkClick, isLoad
7
7
  isLoading: boolean;
8
8
  onCreatorLinkClick: () => void;
9
9
  }) => JSX.Element | null;
10
- export declare const AgentProfileInfo: ({ agentName, agentDescription, creatorRender, starCount, isStarred, onStarToggle, }: {
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, }: {
11
15
  agentName: string;
12
16
  agentDescription?: string | null | undefined;
13
17
  creatorRender: React.ReactNode;
14
- starCount: number;
18
+ starCountRender: React.ReactNode;
15
19
  isStarred: boolean;
16
20
  onStarToggle: () => void;
17
21
  }) => JSX.Element;
@@ -1,2 +1,2 @@
1
- export { AgentProfileInfo, AgentProfileCreator } from './ui/agent-profile-info';
1
+ export { AgentProfileInfo, AgentProfileCreator, AgentStarCount } from './ui/agent-profile-info';
2
2
  export { StarIconButton } from './common/ui/star-icon-button';
@@ -7,11 +7,15 @@ export declare const AgentProfileCreator: ({ creator, onCreatorLinkClick, isLoad
7
7
  isLoading: boolean;
8
8
  onCreatorLinkClick: () => void;
9
9
  }) => JSX.Element | null;
10
- export declare const AgentProfileInfo: ({ agentName, agentDescription, creatorRender, starCount, isStarred, onStarToggle, }: {
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, }: {
11
15
  agentName: string;
12
16
  agentDescription?: string | null | undefined;
13
17
  creatorRender: React.ReactNode;
14
- starCount: number;
18
+ starCountRender: React.ReactNode;
15
19
  isStarred: boolean;
16
20
  onStarToggle: () => void;
17
21
  }) => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/rovo-agent-components",
3
- "version": "0.0.2",
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",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@atlaskit/heading": "^2.4.3",
40
- "@atlaskit/icon": "^22.7.0",
40
+ "@atlaskit/icon": "^22.8.0",
41
41
  "@atlaskit/logo": "^14.1.0",
42
42
  "@atlaskit/primitives": "^11.1.0",
43
43
  "@atlaskit/skeleton": "^0.4.0",