@atlaskit/rovo-agent-components 4.1.0 → 4.2.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,20 @@
1
1
  # @atlaskit/rovo-agent-components
2
2
 
3
+ ## 4.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`266566c8db777`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/266566c8db777) -
8
+ Duplicate agent via BE mutation when versioning is enabled Changing all duplicate touchpoints to
9
+ do useMutation and then redirect. So this requires chaging all the onDuplicate to return Promise
10
+ and handles the loading state.
11
+
12
+ 3 places where it changes:
13
+ - conversation-assistant-agent useAgentUrlActions - this is browse agent modal, view agent modal,
14
+ agent profile, chat sidebar, studio migration modal
15
+ - atlassian-studio AgentContextMenu - studio `...` buttons in side nav, agent title bar `...`
16
+ - profile-card useAgentUrlActions - Agent profile card (no relay)
17
+
3
18
  ## 4.1.0
4
19
 
5
20
  ### Minor Changes
@@ -21,6 +21,7 @@ var _dropdownMenu = _interopRequireWildcard(require("@atlaskit/dropdown-menu"));
21
21
  var _showMoreHorizontal = _interopRequireDefault(require("@atlaskit/icon/core/show-more-horizontal"));
22
22
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
23
23
  var _compiled = require("@atlaskit/primitives/compiled");
24
+ var _spinner = _interopRequireDefault(require("@atlaskit/spinner"));
24
25
  var _chatIcon = require("../../common/ui/chat-icon");
25
26
  var _agentVerificationDropdownItem = require("../agent-verification-dropdown-item");
26
27
  var _messages = _interopRequireDefault(require("./messages"));
@@ -83,20 +84,24 @@ var AgentDropdownMenu = exports.AgentDropdownMenu = function AgentDropdownMenu(_
83
84
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
84
85
  isLoading = _useState2[0],
85
86
  setIsLoading = _useState2[1];
86
- var _useIntl2 = (0, _reactIntl.useIntl)(),
87
- formatMessage = _useIntl2.formatMessage;
88
87
  var _useState3 = (0, _react.useState)(false),
89
88
  _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
90
- hasBeenCopied = _useState4[0],
91
- setHasBeenCopied = _useState4[1];
89
+ isDuplicating = _useState4[0],
90
+ setIsDuplicating = _useState4[1];
91
+ var _useIntl2 = (0, _reactIntl.useIntl)(),
92
+ formatMessage = _useIntl2.formatMessage;
92
93
  var _useState5 = (0, _react.useState)(false),
93
94
  _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
94
- isOpen = _useState6[0],
95
- setIsOpen = _useState6[1];
96
- var _useState7 = (0, _react.useState)(),
95
+ hasBeenCopied = _useState6[0],
96
+ setHasBeenCopied = _useState6[1];
97
+ var _useState7 = (0, _react.useState)(false),
97
98
  _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
98
- permissions = _useState8[0],
99
- setPermissions = _useState8[1];
99
+ isOpen = _useState8[0],
100
+ setIsOpen = _useState8[1];
101
+ var _useState9 = (0, _react.useState)(),
102
+ _useState0 = (0, _slicedToArray2.default)(_useState9, 2),
103
+ permissions = _useState0[0],
104
+ setPermissions = _useState0[1];
100
105
  (0, _react.useEffect)(function () {
101
106
  var fetchData = /*#__PURE__*/function () {
102
107
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
@@ -196,8 +201,38 @@ var AgentDropdownMenu = exports.AgentDropdownMenu = function AgentDropdownMenu(_
196
201
  }, formatMessage(_messages.default.viewAgent)), doesAgentHaveIdentityAccountId && onViewAgentFullProfileClick && /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
197
202
  onClick: onViewAgentFullProfileClick
198
203
  }, formatMessage(_messages.default.viewAgentFullProfile)), !isForgeAgent && isCreateAgentsEnabled && /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
199
- onClick: onDuplicateAgent
200
- }, isAutodevTemplateAgent ? formatMessage(_messages.default.useTemplateButton) : formatMessage(_messages.default.duplicateAgent)), /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
204
+ onClick: ( /*#__PURE__*/function () {
205
+ var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(e) {
206
+ return _regenerator.default.wrap(function _callee2$(_context2) {
207
+ while (1) switch (_context2.prev = _context2.next) {
208
+ case 0:
209
+ if ((0, _platformFeatureFlags.fg)('rovo_agent_versioning_enabled')) {
210
+ e.stopPropagation();
211
+ }
212
+ setIsDuplicating(true);
213
+ _context2.prev = 2;
214
+ _context2.next = 5;
215
+ return onDuplicateAgent === null || onDuplicateAgent === void 0 ? void 0 : onDuplicateAgent(e);
216
+ case 5:
217
+ _context2.prev = 5;
218
+ setIsDuplicating(false);
219
+ return _context2.finish(5);
220
+ case 8:
221
+ case "end":
222
+ return _context2.stop();
223
+ }
224
+ }, _callee2, null, [[2,, 5, 8]]);
225
+ }));
226
+ return function (_x) {
227
+ return _ref5.apply(this, arguments);
228
+ };
229
+ }()),
230
+ isDisabled: isDuplicating
231
+ }, /*#__PURE__*/_react.default.createElement(_compiled.Inline, {
232
+ space: "space.050"
233
+ }, isDuplicating && /*#__PURE__*/_react.default.createElement(_spinner.default, {
234
+ size: "small"
235
+ }), isAutodevTemplateAgent ? formatMessage(_messages.default.useTemplateButton) : formatMessage(_messages.default.duplicateAgent))), /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
201
236
  onClick: function onClick(e) {
202
237
  e.stopPropagation();
203
238
  setHasBeenCopied(true);
@@ -9,6 +9,7 @@ import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdow
9
9
  import MoreIcon from '@atlaskit/icon/core/show-more-horizontal';
10
10
  import { fg } from '@atlaskit/platform-feature-flags';
11
11
  import { Box, Inline } from '@atlaskit/primitives/compiled';
12
+ import Spinner from '@atlaskit/spinner';
12
13
  import { ChatPillIcon } from '../../common/ui/chat-icon';
13
14
  import { AgentVerificationDropdownItem } from '../agent-verification-dropdown-item';
14
15
  import messages from './messages';
@@ -68,6 +69,7 @@ export const AgentDropdownMenu = ({
68
69
  customDropdownOptions
69
70
  }) => {
70
71
  const [isLoading, setIsLoading] = useState(false);
72
+ const [isDuplicating, setIsDuplicating] = useState(false);
71
73
  const {
72
74
  formatMessage
73
75
  } = useIntl();
@@ -154,8 +156,23 @@ export const AgentDropdownMenu = ({
154
156
  }, formatMessage(messages.viewAgent)), doesAgentHaveIdentityAccountId && onViewAgentFullProfileClick && /*#__PURE__*/React.createElement(DropdownItem, {
155
157
  onClick: onViewAgentFullProfileClick
156
158
  }, formatMessage(messages.viewAgentFullProfile)), !isForgeAgent && isCreateAgentsEnabled && /*#__PURE__*/React.createElement(DropdownItem, {
157
- onClick: onDuplicateAgent
158
- }, isAutodevTemplateAgent ? formatMessage(messages.useTemplateButton) : formatMessage(messages.duplicateAgent)), /*#__PURE__*/React.createElement(DropdownItem, {
159
+ onClick: async e => {
160
+ if (fg('rovo_agent_versioning_enabled')) {
161
+ e.stopPropagation();
162
+ }
163
+ setIsDuplicating(true);
164
+ try {
165
+ await (onDuplicateAgent === null || onDuplicateAgent === void 0 ? void 0 : onDuplicateAgent(e));
166
+ } finally {
167
+ setIsDuplicating(false);
168
+ }
169
+ },
170
+ isDisabled: isDuplicating
171
+ }, /*#__PURE__*/React.createElement(Inline, {
172
+ space: "space.050"
173
+ }, isDuplicating && /*#__PURE__*/React.createElement(Spinner, {
174
+ size: "small"
175
+ }), isAutodevTemplateAgent ? formatMessage(messages.useTemplateButton) : formatMessage(messages.duplicateAgent))), /*#__PURE__*/React.createElement(DropdownItem, {
159
176
  onClick: e => {
160
177
  e.stopPropagation();
161
178
  setHasBeenCopied(true);
@@ -14,6 +14,7 @@ import DropdownMenu, { DropdownItem, DropdownItemGroup } from '@atlaskit/dropdow
14
14
  import MoreIcon from '@atlaskit/icon/core/show-more-horizontal';
15
15
  import { fg } from '@atlaskit/platform-feature-flags';
16
16
  import { Box, Inline } from '@atlaskit/primitives/compiled';
17
+ import Spinner from '@atlaskit/spinner';
17
18
  import { ChatPillIcon } from '../../common/ui/chat-icon';
18
19
  import { AgentVerificationDropdownItem } from '../agent-verification-dropdown-item';
19
20
  import messages from './messages';
@@ -74,20 +75,24 @@ export var AgentDropdownMenu = function AgentDropdownMenu(_ref2) {
74
75
  _useState2 = _slicedToArray(_useState, 2),
75
76
  isLoading = _useState2[0],
76
77
  setIsLoading = _useState2[1];
77
- var _useIntl2 = useIntl(),
78
- formatMessage = _useIntl2.formatMessage;
79
78
  var _useState3 = useState(false),
80
79
  _useState4 = _slicedToArray(_useState3, 2),
81
- hasBeenCopied = _useState4[0],
82
- setHasBeenCopied = _useState4[1];
80
+ isDuplicating = _useState4[0],
81
+ setIsDuplicating = _useState4[1];
82
+ var _useIntl2 = useIntl(),
83
+ formatMessage = _useIntl2.formatMessage;
83
84
  var _useState5 = useState(false),
84
85
  _useState6 = _slicedToArray(_useState5, 2),
85
- isOpen = _useState6[0],
86
- setIsOpen = _useState6[1];
87
- var _useState7 = useState(),
86
+ hasBeenCopied = _useState6[0],
87
+ setHasBeenCopied = _useState6[1];
88
+ var _useState7 = useState(false),
88
89
  _useState8 = _slicedToArray(_useState7, 2),
89
- permissions = _useState8[0],
90
- setPermissions = _useState8[1];
90
+ isOpen = _useState8[0],
91
+ setIsOpen = _useState8[1];
92
+ var _useState9 = useState(),
93
+ _useState0 = _slicedToArray(_useState9, 2),
94
+ permissions = _useState0[0],
95
+ setPermissions = _useState0[1];
91
96
  useEffect(function () {
92
97
  var fetchData = /*#__PURE__*/function () {
93
98
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
@@ -187,8 +192,38 @@ export var AgentDropdownMenu = function AgentDropdownMenu(_ref2) {
187
192
  }, formatMessage(messages.viewAgent)), doesAgentHaveIdentityAccountId && onViewAgentFullProfileClick && /*#__PURE__*/React.createElement(DropdownItem, {
188
193
  onClick: onViewAgentFullProfileClick
189
194
  }, formatMessage(messages.viewAgentFullProfile)), !isForgeAgent && isCreateAgentsEnabled && /*#__PURE__*/React.createElement(DropdownItem, {
190
- onClick: onDuplicateAgent
191
- }, isAutodevTemplateAgent ? formatMessage(messages.useTemplateButton) : formatMessage(messages.duplicateAgent)), /*#__PURE__*/React.createElement(DropdownItem, {
195
+ onClick: ( /*#__PURE__*/function () {
196
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(e) {
197
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
198
+ while (1) switch (_context2.prev = _context2.next) {
199
+ case 0:
200
+ if (fg('rovo_agent_versioning_enabled')) {
201
+ e.stopPropagation();
202
+ }
203
+ setIsDuplicating(true);
204
+ _context2.prev = 2;
205
+ _context2.next = 5;
206
+ return onDuplicateAgent === null || onDuplicateAgent === void 0 ? void 0 : onDuplicateAgent(e);
207
+ case 5:
208
+ _context2.prev = 5;
209
+ setIsDuplicating(false);
210
+ return _context2.finish(5);
211
+ case 8:
212
+ case "end":
213
+ return _context2.stop();
214
+ }
215
+ }, _callee2, null, [[2,, 5, 8]]);
216
+ }));
217
+ return function (_x) {
218
+ return _ref5.apply(this, arguments);
219
+ };
220
+ }()),
221
+ isDisabled: isDuplicating
222
+ }, /*#__PURE__*/React.createElement(Inline, {
223
+ space: "space.050"
224
+ }, isDuplicating && /*#__PURE__*/React.createElement(Spinner, {
225
+ size: "small"
226
+ }), isAutodevTemplateAgent ? formatMessage(messages.useTemplateButton) : formatMessage(messages.duplicateAgent))), /*#__PURE__*/React.createElement(DropdownItem, {
192
227
  onClick: function onClick(e) {
193
228
  e.stopPropagation();
194
229
  setHasBeenCopied(true);
@@ -36,7 +36,7 @@ type AgentDropdownMenuProps = {
36
36
  agentName?: string;
37
37
  onEditAgent?: React.ComponentProps<typeof DropdownItem>['onClick'];
38
38
  onCopyAgent?: React.ComponentProps<typeof DropdownItem>['onClick'];
39
- onDuplicateAgent?: React.ComponentProps<typeof DropdownItem>['onClick'];
39
+ onDuplicateAgent?: (e: React.MouseEvent<Element, MouseEvent> | React.KeyboardEvent<Element>) => Promise<void>;
40
40
  onDeleteAgent?: React.ComponentProps<typeof DropdownItem>['onClick'];
41
41
  isForgeAgent: boolean;
42
42
  onDropdownTriggerClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>, analyticsEvent: UIAnalyticsEvent) => void;
@@ -36,7 +36,7 @@ type AgentDropdownMenuProps = {
36
36
  agentName?: string;
37
37
  onEditAgent?: React.ComponentProps<typeof DropdownItem>['onClick'];
38
38
  onCopyAgent?: React.ComponentProps<typeof DropdownItem>['onClick'];
39
- onDuplicateAgent?: React.ComponentProps<typeof DropdownItem>['onClick'];
39
+ onDuplicateAgent?: (e: React.MouseEvent<Element, MouseEvent> | React.KeyboardEvent<Element>) => Promise<void>;
40
40
  onDeleteAgent?: React.ComponentProps<typeof DropdownItem>['onClick'];
41
41
  isForgeAgent: boolean;
42
42
  onDropdownTriggerClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>, analyticsEvent: UIAnalyticsEvent) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/rovo-agent-components",
3
- "version": "4.1.0",
3
+ "version": "4.2.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
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend-monorepo",
6
6
  "atlassian": {
@@ -47,13 +47,14 @@
47
47
  "@atlaskit/dropdown-menu": "^16.8.0",
48
48
  "@atlaskit/flag": "^17.9.0",
49
49
  "@atlaskit/heading": "^5.4.0",
50
- "@atlaskit/icon": "^34.1.0",
50
+ "@atlaskit/icon": "^34.2.0",
51
51
  "@atlaskit/link": "^3.4.0",
52
52
  "@atlaskit/logo": "^20.0.0",
53
53
  "@atlaskit/platform-feature-flags": "^1.1.0",
54
54
  "@atlaskit/primitives": "^19.0.0",
55
- "@atlaskit/rovo-agent-analytics": "^1.1.0",
55
+ "@atlaskit/rovo-agent-analytics": "^1.2.0",
56
56
  "@atlaskit/skeleton": "^2.1.0",
57
+ "@atlaskit/spinner": "^19.1.0",
57
58
  "@atlaskit/tokens": "^13.0.0",
58
59
  "@atlaskit/tooltip": "^21.1.0",
59
60
  "@babel/runtime": "^7.0.0",
@@ -123,6 +124,9 @@
123
124
  "should-render-to-parent-should-be-true-ai-mate": {
124
125
  "type": "boolean"
125
126
  },
127
+ "rovo_agent_versioning_enabled": {
128
+ "type": "boolean"
129
+ },
126
130
  "jira_ai_force_rovo_dev_avatar": {
127
131
  "type": "boolean"
128
132
  },