@atlaskit/rovo-agent-components 3.30.0 → 3.32.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,19 @@
1
1
  # @atlaskit/rovo-agent-components
2
2
 
3
+ ## 3.32.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`32fb2d5d28925`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/32fb2d5d28925) -
8
+ Added 'Verify / Unverify agent' dropdown to rovo chat trigger
9
+
10
+ ## 3.31.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`8f3aaeeed50ec`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8f3aaeeed50ec) -
15
+ Change copy from 'Unverify agent' to 'Remove verification'
16
+
3
17
  ## 3.30.0
4
18
 
5
19
  ### Minor Changes
@@ -60,15 +60,5 @@ var _default = exports.default = (0, _reactIntlNext.defineMessages)({
60
60
  id: 'rovo-chat.view-agents.use-template-button',
61
61
  defaultMessage: 'Use template',
62
62
  description: 'Button to copy and use a template'
63
- },
64
- verifyAgent: {
65
- id: 'rovo-chat.view-agents.verify-agent',
66
- defaultMessage: 'Verify agent',
67
- description: 'Button to verify an agent'
68
- },
69
- unverifyAgent: {
70
- id: 'rovo-chat.view-agents.unverify-agent',
71
- defaultMessage: 'Unverify agent',
72
- description: 'Button to unverify an agent'
73
63
  }
74
64
  });
@@ -22,7 +22,7 @@ var _messages = _interopRequireDefault(require("./messages"));
22
22
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
23
23
  /**
24
24
  * A dropdown item for verifying or unverifying an agent.
25
- * Renders "Verify agent" if the agent is not verified, or "Unverify agent" if it is.
25
+ * Renders "Verify agent" if the agent is not verified, or "Remove verification" if it is.
26
26
  * Returns null if the user doesn't have permission to govern agents or the feature flag is off.
27
27
  */
28
28
  var AgentVerificationDropdownItem = exports.AgentVerificationDropdownItem = function AgentVerificationDropdownItem(_ref) {
@@ -31,7 +31,8 @@ var AgentVerificationDropdownItem = exports.AgentVerificationDropdownItem = func
31
31
  userPermissionsRef = _ref.userPermissionsRef,
32
32
  onClick = _ref.onClick,
33
33
  onVerificationSuccess = _ref.onVerificationSuccess,
34
- testId = _ref.testId;
34
+ testId = _ref.testId,
35
+ renderItem = _ref.renderItem;
35
36
  var _useIntl = (0, _reactIntlNext.useIntl)(),
36
37
  formatMessage = _useIntl.formatMessage;
37
38
  var _useFlags = (0, _flag.useFlags)(),
@@ -49,8 +50,9 @@ var AgentVerificationDropdownItem = exports.AgentVerificationDropdownItem = func
49
50
  trackAgentAction = _useRovoAgentActionAn.trackAgentAction,
50
51
  trackAgentActionError = _useRovoAgentActionAn.trackAgentActionError;
51
52
  var _useMutation = (0, _reactRelay.useMutation)(_agentVerificationDropdownItem_AtlaskitRovoAgentComponents_updateAgentVerificationMutation2.default),
52
- _useMutation2 = (0, _slicedToArray2.default)(_useMutation, 1),
53
- commitUpdateVerification = _useMutation2[0];
53
+ _useMutation2 = (0, _slicedToArray2.default)(_useMutation, 2),
54
+ commitUpdateVerification = _useMutation2[0],
55
+ isPending = _useMutation2[1];
54
56
  var handleError = (0, _react.useCallback)(function (verified, errorMessage) {
55
57
  showFlag({
56
58
  title: formatMessage(verified ? _messages.default.verifyErrorTitle : _messages.default.unverifyErrorTitle),
@@ -107,6 +109,10 @@ var AgentVerificationDropdownItem = exports.AgentVerificationDropdownItem = func
107
109
  }
108
110
  });
109
111
  }, [agentId, commitUpdateVerification, formatMessage, handleError, onClick, onVerificationSuccess, showFlag, trackAgentAction, trackAgentActionError]);
112
+ var labelText = formatMessage(isVerified ? _messages.default.unverifyAgentLabel : _messages.default.verifyAgentLabel);
113
+ var handleOnClick = function handleOnClick() {
114
+ return handleUpdateVerification(!isVerified);
115
+ };
110
116
  if (
111
117
  // Don't render if agent ID is not available
112
118
  !agentId ||
@@ -114,10 +120,18 @@ var AgentVerificationDropdownItem = exports.AgentVerificationDropdownItem = func
114
120
  !isAbleToGovernAgents) {
115
121
  return null;
116
122
  }
123
+
124
+ // Use custom render or default to DropdownItem
125
+ if (renderItem) {
126
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, renderItem({
127
+ isPending: isPending,
128
+ isVerified: isVerified,
129
+ labelText: labelText,
130
+ onClick: handleOnClick
131
+ }));
132
+ }
117
133
  return /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
118
134
  testId: testId,
119
- onClick: function onClick() {
120
- return handleUpdateVerification(!isVerified);
121
- }
122
- }, formatMessage(isVerified ? _messages.default.unverifyAgentLabel : _messages.default.verifyAgentLabel));
135
+ onClick: handleOnClick
136
+ }, labelText);
123
137
  };
@@ -13,8 +13,8 @@ var _default = exports.default = (0, _reactIntlNext.defineMessages)({
13
13
  },
14
14
  unverifyAgentLabel: {
15
15
  id: 'rovo-agent-components.agent-verification-dropdown-item.unverify-agent',
16
- defaultMessage: 'Unverify agent',
17
- description: 'Label for unverify agent dropdown menu item'
16
+ defaultMessage: 'Remove verification',
17
+ description: 'Label for remove verification dropdown menu item'
18
18
  },
19
19
  verifySuccessTitle: {
20
20
  id: 'rovo-agent-components.agent-verification-dropdown-item.verify-success-title',
@@ -23,8 +23,8 @@ var _default = exports.default = (0, _reactIntlNext.defineMessages)({
23
23
  },
24
24
  unverifySuccessTitle: {
25
25
  id: 'rovo-agent-components.agent-verification-dropdown-item.unverify-success-title',
26
- defaultMessage: 'Agent unverified',
27
- description: 'Title for success flag when agent is unverified'
26
+ defaultMessage: 'Verification removed',
27
+ description: 'Title for success flag when agent verification is removed'
28
28
  },
29
29
  verifyErrorTitle: {
30
30
  id: 'rovo-agent-components.agent-verification-dropdown-item.verify-error-title',
@@ -33,8 +33,8 @@ var _default = exports.default = (0, _reactIntlNext.defineMessages)({
33
33
  },
34
34
  unverifyErrorTitle: {
35
35
  id: 'rovo-agent-components.agent-verification-dropdown-item.unverify-error-title',
36
- defaultMessage: 'Failed to unverify agent',
37
- description: 'Title for error flag when unverifying agent fails'
36
+ defaultMessage: 'Failed to remove verification',
37
+ description: 'Title for error flag when removing agent verification fails'
38
38
  },
39
39
  errorDescription: {
40
40
  id: 'rovo-agent-components.agent-verification-dropdown-item.error-description',
@@ -54,15 +54,5 @@ export default defineMessages({
54
54
  id: 'rovo-chat.view-agents.use-template-button',
55
55
  defaultMessage: 'Use template',
56
56
  description: 'Button to copy and use a template'
57
- },
58
- verifyAgent: {
59
- id: 'rovo-chat.view-agents.verify-agent',
60
- defaultMessage: 'Verify agent',
61
- description: 'Button to verify an agent'
62
- },
63
- unverifyAgent: {
64
- id: 'rovo-chat.view-agents.unverify-agent',
65
- defaultMessage: 'Unverify agent',
66
- description: 'Button to unverify an agent'
67
57
  }
68
58
  });
@@ -12,7 +12,7 @@ import { AgentActions, useRovoAgentActionAnalytics } from '@atlaskit/rovo-agent-
12
12
  import messages from './messages';
13
13
  /**
14
14
  * A dropdown item for verifying or unverifying an agent.
15
- * Renders "Verify agent" if the agent is not verified, or "Unverify agent" if it is.
15
+ * Renders "Verify agent" if the agent is not verified, or "Remove verification" if it is.
16
16
  * Returns null if the user doesn't have permission to govern agents or the feature flag is off.
17
17
  */
18
18
  export const AgentVerificationDropdownItem = ({
@@ -20,7 +20,8 @@ export const AgentVerificationDropdownItem = ({
20
20
  userPermissionsRef,
21
21
  onClick,
22
22
  onVerificationSuccess,
23
- testId
23
+ testId,
24
+ renderItem
24
25
  }) => {
25
26
  var _userPermissions$isAb, _agentData$isVerified;
26
27
  const {
@@ -42,7 +43,7 @@ export const AgentVerificationDropdownItem = ({
42
43
  agentId,
43
44
  isAbleToGovernAgents
44
45
  });
45
- const [commitUpdateVerification] = useMutation(_agentVerificationDropdownItem_AtlaskitRovoAgentComponents_updateAgentVerificationMutation);
46
+ const [commitUpdateVerification, isPending] = useMutation(_agentVerificationDropdownItem_AtlaskitRovoAgentComponents_updateAgentVerificationMutation);
46
47
  const handleError = useCallback((verified, errorMessage) => {
47
48
  showFlag({
48
49
  title: formatMessage(verified ? messages.verifyErrorTitle : messages.unverifyErrorTitle),
@@ -99,6 +100,8 @@ export const AgentVerificationDropdownItem = ({
99
100
  }
100
101
  });
101
102
  }, [agentId, commitUpdateVerification, formatMessage, handleError, onClick, onVerificationSuccess, showFlag, trackAgentAction, trackAgentActionError]);
103
+ const labelText = formatMessage(isVerified ? messages.unverifyAgentLabel : messages.verifyAgentLabel);
104
+ const handleOnClick = () => handleUpdateVerification(!isVerified);
102
105
  if (
103
106
  // Don't render if agent ID is not available
104
107
  !agentId ||
@@ -106,8 +109,18 @@ export const AgentVerificationDropdownItem = ({
106
109
  !isAbleToGovernAgents) {
107
110
  return null;
108
111
  }
112
+
113
+ // Use custom render or default to DropdownItem
114
+ if (renderItem) {
115
+ return /*#__PURE__*/React.createElement(React.Fragment, null, renderItem({
116
+ isPending,
117
+ isVerified,
118
+ labelText,
119
+ onClick: handleOnClick
120
+ }));
121
+ }
109
122
  return /*#__PURE__*/React.createElement(DropdownItem, {
110
123
  testId: testId,
111
- onClick: () => handleUpdateVerification(!isVerified)
112
- }, formatMessage(isVerified ? messages.unverifyAgentLabel : messages.verifyAgentLabel));
124
+ onClick: handleOnClick
125
+ }, labelText);
113
126
  };
@@ -7,8 +7,8 @@ export default defineMessages({
7
7
  },
8
8
  unverifyAgentLabel: {
9
9
  id: 'rovo-agent-components.agent-verification-dropdown-item.unverify-agent',
10
- defaultMessage: 'Unverify agent',
11
- description: 'Label for unverify agent dropdown menu item'
10
+ defaultMessage: 'Remove verification',
11
+ description: 'Label for remove verification dropdown menu item'
12
12
  },
13
13
  verifySuccessTitle: {
14
14
  id: 'rovo-agent-components.agent-verification-dropdown-item.verify-success-title',
@@ -17,8 +17,8 @@ export default defineMessages({
17
17
  },
18
18
  unverifySuccessTitle: {
19
19
  id: 'rovo-agent-components.agent-verification-dropdown-item.unverify-success-title',
20
- defaultMessage: 'Agent unverified',
21
- description: 'Title for success flag when agent is unverified'
20
+ defaultMessage: 'Verification removed',
21
+ description: 'Title for success flag when agent verification is removed'
22
22
  },
23
23
  verifyErrorTitle: {
24
24
  id: 'rovo-agent-components.agent-verification-dropdown-item.verify-error-title',
@@ -27,8 +27,8 @@ export default defineMessages({
27
27
  },
28
28
  unverifyErrorTitle: {
29
29
  id: 'rovo-agent-components.agent-verification-dropdown-item.unverify-error-title',
30
- defaultMessage: 'Failed to unverify agent',
31
- description: 'Title for error flag when unverifying agent fails'
30
+ defaultMessage: 'Failed to remove verification',
31
+ description: 'Title for error flag when removing agent verification fails'
32
32
  },
33
33
  errorDescription: {
34
34
  id: 'rovo-agent-components.agent-verification-dropdown-item.error-description',
@@ -54,15 +54,5 @@ export default defineMessages({
54
54
  id: 'rovo-chat.view-agents.use-template-button',
55
55
  defaultMessage: 'Use template',
56
56
  description: 'Button to copy and use a template'
57
- },
58
- verifyAgent: {
59
- id: 'rovo-chat.view-agents.verify-agent',
60
- defaultMessage: 'Verify agent',
61
- description: 'Button to verify an agent'
62
- },
63
- unverifyAgent: {
64
- id: 'rovo-chat.view-agents.unverify-agent',
65
- defaultMessage: 'Unverify agent',
66
- description: 'Button to unverify an agent'
67
57
  }
68
58
  });
@@ -13,7 +13,7 @@ import { AgentActions, useRovoAgentActionAnalytics } from '@atlaskit/rovo-agent-
13
13
  import messages from './messages';
14
14
  /**
15
15
  * A dropdown item for verifying or unverifying an agent.
16
- * Renders "Verify agent" if the agent is not verified, or "Unverify agent" if it is.
16
+ * Renders "Verify agent" if the agent is not verified, or "Remove verification" if it is.
17
17
  * Returns null if the user doesn't have permission to govern agents or the feature flag is off.
18
18
  */
19
19
  export var AgentVerificationDropdownItem = function AgentVerificationDropdownItem(_ref) {
@@ -22,7 +22,8 @@ export var AgentVerificationDropdownItem = function AgentVerificationDropdownIte
22
22
  userPermissionsRef = _ref.userPermissionsRef,
23
23
  onClick = _ref.onClick,
24
24
  onVerificationSuccess = _ref.onVerificationSuccess,
25
- testId = _ref.testId;
25
+ testId = _ref.testId,
26
+ renderItem = _ref.renderItem;
26
27
  var _useIntl = useIntl(),
27
28
  formatMessage = _useIntl.formatMessage;
28
29
  var _useFlags = useFlags(),
@@ -40,8 +41,9 @@ export var AgentVerificationDropdownItem = function AgentVerificationDropdownIte
40
41
  trackAgentAction = _useRovoAgentActionAn.trackAgentAction,
41
42
  trackAgentActionError = _useRovoAgentActionAn.trackAgentActionError;
42
43
  var _useMutation = useMutation(_agentVerificationDropdownItem_AtlaskitRovoAgentComponents_updateAgentVerificationMutation),
43
- _useMutation2 = _slicedToArray(_useMutation, 1),
44
- commitUpdateVerification = _useMutation2[0];
44
+ _useMutation2 = _slicedToArray(_useMutation, 2),
45
+ commitUpdateVerification = _useMutation2[0],
46
+ isPending = _useMutation2[1];
45
47
  var handleError = useCallback(function (verified, errorMessage) {
46
48
  showFlag({
47
49
  title: formatMessage(verified ? messages.verifyErrorTitle : messages.unverifyErrorTitle),
@@ -98,6 +100,10 @@ export var AgentVerificationDropdownItem = function AgentVerificationDropdownIte
98
100
  }
99
101
  });
100
102
  }, [agentId, commitUpdateVerification, formatMessage, handleError, onClick, onVerificationSuccess, showFlag, trackAgentAction, trackAgentActionError]);
103
+ var labelText = formatMessage(isVerified ? messages.unverifyAgentLabel : messages.verifyAgentLabel);
104
+ var handleOnClick = function handleOnClick() {
105
+ return handleUpdateVerification(!isVerified);
106
+ };
101
107
  if (
102
108
  // Don't render if agent ID is not available
103
109
  !agentId ||
@@ -105,10 +111,18 @@ export var AgentVerificationDropdownItem = function AgentVerificationDropdownIte
105
111
  !isAbleToGovernAgents) {
106
112
  return null;
107
113
  }
114
+
115
+ // Use custom render or default to DropdownItem
116
+ if (renderItem) {
117
+ return /*#__PURE__*/React.createElement(React.Fragment, null, renderItem({
118
+ isPending: isPending,
119
+ isVerified: isVerified,
120
+ labelText: labelText,
121
+ onClick: handleOnClick
122
+ }));
123
+ }
108
124
  return /*#__PURE__*/React.createElement(DropdownItem, {
109
125
  testId: testId,
110
- onClick: function onClick() {
111
- return handleUpdateVerification(!isVerified);
112
- }
113
- }, formatMessage(isVerified ? messages.unverifyAgentLabel : messages.verifyAgentLabel));
126
+ onClick: handleOnClick
127
+ }, labelText);
114
128
  };
@@ -7,8 +7,8 @@ export default defineMessages({
7
7
  },
8
8
  unverifyAgentLabel: {
9
9
  id: 'rovo-agent-components.agent-verification-dropdown-item.unverify-agent',
10
- defaultMessage: 'Unverify agent',
11
- description: 'Label for unverify agent dropdown menu item'
10
+ defaultMessage: 'Remove verification',
11
+ description: 'Label for remove verification dropdown menu item'
12
12
  },
13
13
  verifySuccessTitle: {
14
14
  id: 'rovo-agent-components.agent-verification-dropdown-item.verify-success-title',
@@ -17,8 +17,8 @@ export default defineMessages({
17
17
  },
18
18
  unverifySuccessTitle: {
19
19
  id: 'rovo-agent-components.agent-verification-dropdown-item.unverify-success-title',
20
- defaultMessage: 'Agent unverified',
21
- description: 'Title for success flag when agent is unverified'
20
+ defaultMessage: 'Verification removed',
21
+ description: 'Title for success flag when agent verification is removed'
22
22
  },
23
23
  verifyErrorTitle: {
24
24
  id: 'rovo-agent-components.agent-verification-dropdown-item.verify-error-title',
@@ -27,8 +27,8 @@ export default defineMessages({
27
27
  },
28
28
  unverifyErrorTitle: {
29
29
  id: 'rovo-agent-components.agent-verification-dropdown-item.unverify-error-title',
30
- defaultMessage: 'Failed to unverify agent',
31
- description: 'Title for error flag when unverifying agent fails'
30
+ defaultMessage: 'Failed to remove verification',
31
+ description: 'Title for error flag when removing agent verification fails'
32
32
  },
33
33
  errorDescription: {
34
34
  id: 'rovo-agent-components.agent-verification-dropdown-item.error-description',
@@ -54,15 +54,5 @@ declare const _default: {
54
54
  readonly defaultMessage: "Use template";
55
55
  readonly description: "Button to copy and use a template";
56
56
  };
57
- readonly verifyAgent: {
58
- readonly id: "rovo-chat.view-agents.verify-agent";
59
- readonly defaultMessage: "Verify agent";
60
- readonly description: "Button to verify an agent";
61
- };
62
- readonly unverifyAgent: {
63
- readonly id: "rovo-chat.view-agents.unverify-agent";
64
- readonly defaultMessage: "Unverify agent";
65
- readonly description: "Button to unverify an agent";
66
- };
67
57
  };
68
58
  export default _default;
@@ -17,10 +17,20 @@ export type AgentVerificationDropdownItemProps = {
17
17
  * Test ID for the dropdown item.
18
18
  */
19
19
  testId?: string;
20
+ /**
21
+ * Render function for custom dropdown component.
22
+ * If not provided, defaults to DropdownItem.
23
+ */
24
+ renderItem?: (props: {
25
+ isPending: boolean;
26
+ isVerified: boolean;
27
+ labelText: string;
28
+ onClick: () => void;
29
+ }) => React.ReactNode;
20
30
  };
21
31
  /**
22
32
  * A dropdown item for verifying or unverifying an agent.
23
- * Renders "Verify agent" if the agent is not verified, or "Unverify agent" if it is.
33
+ * Renders "Verify agent" if the agent is not verified, or "Remove verification" if it is.
24
34
  * Returns null if the user doesn't have permission to govern agents or the feature flag is off.
25
35
  */
26
- export declare const AgentVerificationDropdownItem: ({ agentRef, userPermissionsRef, onClick, onVerificationSuccess, testId, }: AgentVerificationDropdownItemProps) => React.JSX.Element | null;
36
+ export declare const AgentVerificationDropdownItem: ({ agentRef, userPermissionsRef, onClick, onVerificationSuccess, testId, renderItem, }: AgentVerificationDropdownItemProps) => React.JSX.Element | null;
@@ -54,15 +54,5 @@ declare const _default: {
54
54
  readonly defaultMessage: "Use template";
55
55
  readonly description: "Button to copy and use a template";
56
56
  };
57
- readonly verifyAgent: {
58
- readonly id: "rovo-chat.view-agents.verify-agent";
59
- readonly defaultMessage: "Verify agent";
60
- readonly description: "Button to verify an agent";
61
- };
62
- readonly unverifyAgent: {
63
- readonly id: "rovo-chat.view-agents.unverify-agent";
64
- readonly defaultMessage: "Unverify agent";
65
- readonly description: "Button to unverify an agent";
66
- };
67
57
  };
68
58
  export default _default;
@@ -17,10 +17,20 @@ export type AgentVerificationDropdownItemProps = {
17
17
  * Test ID for the dropdown item.
18
18
  */
19
19
  testId?: string;
20
+ /**
21
+ * Render function for custom dropdown component.
22
+ * If not provided, defaults to DropdownItem.
23
+ */
24
+ renderItem?: (props: {
25
+ isPending: boolean;
26
+ isVerified: boolean;
27
+ labelText: string;
28
+ onClick: () => void;
29
+ }) => React.ReactNode;
20
30
  };
21
31
  /**
22
32
  * A dropdown item for verifying or unverifying an agent.
23
- * Renders "Verify agent" if the agent is not verified, or "Unverify agent" if it is.
33
+ * Renders "Verify agent" if the agent is not verified, or "Remove verification" if it is.
24
34
  * Returns null if the user doesn't have permission to govern agents or the feature flag is off.
25
35
  */
26
- export declare const AgentVerificationDropdownItem: ({ agentRef, userPermissionsRef, onClick, onVerificationSuccess, testId, }: AgentVerificationDropdownItemProps) => React.JSX.Element | null;
36
+ export declare const AgentVerificationDropdownItem: ({ agentRef, userPermissionsRef, onClick, onVerificationSuccess, testId, renderItem, }: AgentVerificationDropdownItemProps) => React.JSX.Element | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/rovo-agent-components",
3
- "version": "3.30.0",
3
+ "version": "3.32.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",