@atlaskit/rovo-agent-components 3.21.0 → 3.23.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 +19 -0
- package/agent-verification-dropdown-item/package.json +17 -0
- package/dist/cjs/index.js +8 -1
- package/dist/cjs/ui/agent-avatar/generated-avatars/index.js +14 -0
- package/dist/cjs/ui/agent-avatar/index.js +2 -0
- package/dist/cjs/ui/agent-profile-info/agent-profile-info.stories.js +35 -0
- package/dist/cjs/ui/agent-profile-info/index.js +9 -3
- package/dist/cjs/ui/agent-verification-dropdown-item/__generated__/agentVerificationDropdownItem_AtlaskitRovoAgentComponents_agentRef.graphql.js +29 -0
- package/dist/cjs/ui/agent-verification-dropdown-item/__generated__/agentVerificationDropdownItem_AtlaskitRovoAgentComponents_updateAgentVerificationMutation.graphql.js +122 -0
- package/dist/cjs/ui/agent-verification-dropdown-item/__generated__/agentVerificationDropdownItem_AtlaskitRovoAgentComponents_userPermissionsRef.graphql.js +29 -0
- package/dist/cjs/ui/agent-verification-dropdown-item/__generated__/testAgentVerificationDropdownItemQuery.graphql.js +186 -0
- package/dist/cjs/ui/agent-verification-dropdown-item/index.js +112 -0
- package/dist/cjs/ui/agent-verification-dropdown-item/messages.js +44 -0
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/ui/agent-avatar/generated-avatars/index.js +14 -0
- package/dist/es2019/ui/agent-avatar/index.js +2 -0
- package/dist/es2019/ui/agent-profile-info/agent-profile-info.stories.js +24 -0
- package/dist/es2019/ui/agent-profile-info/index.js +8 -3
- package/dist/es2019/ui/agent-verification-dropdown-item/__generated__/agentVerificationDropdownItem_AtlaskitRovoAgentComponents_agentRef.graphql.js +23 -0
- package/dist/es2019/ui/agent-verification-dropdown-item/__generated__/agentVerificationDropdownItem_AtlaskitRovoAgentComponents_updateAgentVerificationMutation.graphql.js +116 -0
- package/dist/es2019/ui/agent-verification-dropdown-item/__generated__/agentVerificationDropdownItem_AtlaskitRovoAgentComponents_userPermissionsRef.graphql.js +23 -0
- package/dist/es2019/ui/agent-verification-dropdown-item/__generated__/testAgentVerificationDropdownItemQuery.graphql.js +180 -0
- package/dist/es2019/ui/agent-verification-dropdown-item/index.js +102 -0
- package/dist/es2019/ui/agent-verification-dropdown-item/messages.js +38 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/ui/agent-avatar/generated-avatars/index.js +14 -0
- package/dist/esm/ui/agent-avatar/index.js +2 -0
- package/dist/esm/ui/agent-profile-info/agent-profile-info.stories.js +28 -0
- package/dist/esm/ui/agent-profile-info/index.js +9 -3
- package/dist/esm/ui/agent-verification-dropdown-item/__generated__/agentVerificationDropdownItem_AtlaskitRovoAgentComponents_agentRef.graphql.js +23 -0
- package/dist/esm/ui/agent-verification-dropdown-item/__generated__/agentVerificationDropdownItem_AtlaskitRovoAgentComponents_updateAgentVerificationMutation.graphql.js +116 -0
- package/dist/esm/ui/agent-verification-dropdown-item/__generated__/agentVerificationDropdownItem_AtlaskitRovoAgentComponents_userPermissionsRef.graphql.js +23 -0
- package/dist/esm/ui/agent-verification-dropdown-item/__generated__/testAgentVerificationDropdownItemQuery.graphql.js +180 -0
- package/dist/esm/ui/agent-verification-dropdown-item/index.js +103 -0
- package/dist/esm/ui/agent-verification-dropdown-item/messages.js +38 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/ui/agent-avatar/generated-avatars/index.d.ts +2 -1
- package/dist/types/ui/agent-avatar/index.d.ts +2 -1
- package/dist/types/ui/agent-profile-info/index.d.ts +3 -1
- package/dist/types/ui/agent-verification-dropdown-item/__generated__/agentVerificationDropdownItem_AtlaskitRovoAgentComponents_agentRef.graphql.d.ts +18 -0
- package/dist/types/ui/agent-verification-dropdown-item/__generated__/agentVerificationDropdownItem_AtlaskitRovoAgentComponents_updateAgentVerificationMutation.graphql.d.ts +30 -0
- package/dist/types/ui/agent-verification-dropdown-item/__generated__/agentVerificationDropdownItem_AtlaskitRovoAgentComponents_userPermissionsRef.graphql.d.ts +18 -0
- package/dist/types/ui/agent-verification-dropdown-item/__generated__/testAgentVerificationDropdownItemQuery.graphql.d.ts +26 -0
- package/dist/types/ui/agent-verification-dropdown-item/index.d.ts +22 -0
- package/dist/types/ui/agent-verification-dropdown-item/messages.d.ts +38 -0
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/ui/agent-avatar/generated-avatars/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/agent-avatar/index.d.ts +2 -1
- package/dist/types-ts4.5/ui/agent-profile-info/index.d.ts +3 -1
- package/dist/types-ts4.5/ui/agent-verification-dropdown-item/__generated__/agentVerificationDropdownItem_AtlaskitRovoAgentComponents_agentRef.graphql.d.ts +18 -0
- package/dist/types-ts4.5/ui/agent-verification-dropdown-item/__generated__/agentVerificationDropdownItem_AtlaskitRovoAgentComponents_updateAgentVerificationMutation.graphql.d.ts +30 -0
- package/dist/types-ts4.5/ui/agent-verification-dropdown-item/__generated__/agentVerificationDropdownItem_AtlaskitRovoAgentComponents_userPermissionsRef.graphql.d.ts +18 -0
- package/dist/types-ts4.5/ui/agent-verification-dropdown-item/__generated__/testAgentVerificationDropdownItemQuery.graphql.d.ts +26 -0
- package/dist/types-ts4.5/ui/agent-verification-dropdown-item/index.d.ts +22 -0
- package/dist/types-ts4.5/ui/agent-verification-dropdown-item/messages.d.ts +38 -0
- package/package.json +9 -2
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
verifyAgentLabel: {
|
|
10
|
+
id: 'rovo-agent-components.agent-verification-dropdown-item.verify-agent',
|
|
11
|
+
defaultMessage: 'Verify agent',
|
|
12
|
+
description: 'Label for verify agent dropdown menu item'
|
|
13
|
+
},
|
|
14
|
+
unverifyAgentLabel: {
|
|
15
|
+
id: 'rovo-agent-components.agent-verification-dropdown-item.unverify-agent',
|
|
16
|
+
defaultMessage: 'Unverify agent',
|
|
17
|
+
description: 'Label for unverify agent dropdown menu item'
|
|
18
|
+
},
|
|
19
|
+
verifySuccessTitle: {
|
|
20
|
+
id: 'rovo-agent-components.agent-verification-dropdown-item.verify-success-title',
|
|
21
|
+
defaultMessage: 'Agent verified',
|
|
22
|
+
description: 'Title for success flag when agent is verified'
|
|
23
|
+
},
|
|
24
|
+
unverifySuccessTitle: {
|
|
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'
|
|
28
|
+
},
|
|
29
|
+
verifyErrorTitle: {
|
|
30
|
+
id: 'rovo-agent-components.agent-verification-dropdown-item.verify-error-title',
|
|
31
|
+
defaultMessage: 'Failed to verify agent',
|
|
32
|
+
description: 'Title for error flag when verifying agent fails'
|
|
33
|
+
},
|
|
34
|
+
unverifyErrorTitle: {
|
|
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'
|
|
38
|
+
},
|
|
39
|
+
errorDescription: {
|
|
40
|
+
id: 'rovo-agent-components.agent-verification-dropdown-item.error-description',
|
|
41
|
+
defaultMessage: 'An error occurred while updating agent verification status: {errorMessage}',
|
|
42
|
+
description: 'Description for error flag showing the error message'
|
|
43
|
+
}
|
|
44
|
+
});
|
package/dist/es2019/index.js
CHANGED
|
@@ -12,4 +12,5 @@ export { HiddenIcon } from './common/ui/hidden-icon';
|
|
|
12
12
|
export { AgentAvatar } from './ui/agent-avatar';
|
|
13
13
|
export { AgentBanner, GeneratedAvatar } from './ui/agent-avatar/generated-avatars';
|
|
14
14
|
export { AgentDropdownMenu } from './ui/agent-dropdown-menu';
|
|
15
|
-
export { AgentMenuItemSkeleton } from './ui/agent-menu-item-skeleton';
|
|
15
|
+
export { AgentMenuItemSkeleton } from './ui/agent-menu-item-skeleton';
|
|
16
|
+
export { AgentVerificationDropdownItem } from './ui/agent-verification-dropdown-item';
|
|
@@ -234,8 +234,20 @@ const getAvatarRender = ({
|
|
|
234
234
|
agentNamedId,
|
|
235
235
|
agentId,
|
|
236
236
|
agentIdentityAccountId,
|
|
237
|
+
isRovoDev,
|
|
237
238
|
size
|
|
238
239
|
}) => {
|
|
240
|
+
if (isRovoDev && fg('rovo_dev_themed_identity_card')) {
|
|
241
|
+
return {
|
|
242
|
+
render: /*#__PURE__*/React.createElement(RovoDevAvatar, {
|
|
243
|
+
size: AVATAR_SIZES[size],
|
|
244
|
+
primaryColor: "",
|
|
245
|
+
secondaryColor: ""
|
|
246
|
+
}),
|
|
247
|
+
color: greenColor
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
|
|
239
251
|
//@TODO CRCS-3129: Remove Rovo Dev hardcoded icon after TeamEU demos
|
|
240
252
|
// Handle Rovo Dev agent avatar for TeamEU Demo
|
|
241
253
|
if (agentId === ROVO_DEV_AGENT_ID && fg('jira_ai_force_rovo_dev_avatar')) {
|
|
@@ -293,6 +305,7 @@ export const AgentBanner = ({
|
|
|
293
305
|
agentNamedId,
|
|
294
306
|
agentId,
|
|
295
307
|
agentIdentityAccountId,
|
|
308
|
+
isRovoDev,
|
|
296
309
|
height,
|
|
297
310
|
fillSpace
|
|
298
311
|
}) => {
|
|
@@ -302,6 +315,7 @@ export const AgentBanner = ({
|
|
|
302
315
|
agentNamedId,
|
|
303
316
|
agentId,
|
|
304
317
|
agentIdentityAccountId,
|
|
318
|
+
isRovoDev,
|
|
305
319
|
size: 'medium'
|
|
306
320
|
});
|
|
307
321
|
return /*#__PURE__*/React.createElement(Box, {
|
|
@@ -33,6 +33,7 @@ export const AgentAvatar = ({
|
|
|
33
33
|
agentIdentityAccountId,
|
|
34
34
|
agentNamedId,
|
|
35
35
|
showBorder = true,
|
|
36
|
+
isRovoDev,
|
|
36
37
|
isForgeAgent,
|
|
37
38
|
forgeAgentIconUrl
|
|
38
39
|
}) => {
|
|
@@ -73,6 +74,7 @@ export const AgentAvatar = ({
|
|
|
73
74
|
agentId: agentId,
|
|
74
75
|
agentNamedId: agentNamedId,
|
|
75
76
|
agentIdentityAccountId: agentIdentityAccountId,
|
|
77
|
+
isRovoDev: isRovoDev,
|
|
76
78
|
size: size
|
|
77
79
|
}))));
|
|
78
80
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { injectable } from 'react-magnetic-di';
|
|
3
|
+
import { useFragment } from 'react-relay';
|
|
4
|
+
import { withDi, withUseIntl } from '@atlassian/agent-studio-test-utils/storybook-decorators';
|
|
5
|
+
import { AgentProfileInfo } from './index';
|
|
6
|
+
const commonDeps = [injectable(useFragment, () => ({
|
|
7
|
+
isVerified: true
|
|
8
|
+
}))];
|
|
9
|
+
const meta = {
|
|
10
|
+
decorators: [withUseIntl(), withDi(commonDeps)]
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
export const Default = {
|
|
14
|
+
render: () => /*#__PURE__*/React.createElement(AgentProfileInfo, {
|
|
15
|
+
agentName: "Code Documentation Writer",
|
|
16
|
+
agentDescription: "Create or modify documentation files in your codebase to ensure that they are up to date",
|
|
17
|
+
creatorRender: /*#__PURE__*/React.createElement("div", null, "Creator Render"),
|
|
18
|
+
starCountRender: /*#__PURE__*/React.createElement("div", null, "Star Count Render"),
|
|
19
|
+
headingRender: /*#__PURE__*/React.createElement("div", null, "Heading Render"),
|
|
20
|
+
isStarred: true,
|
|
21
|
+
isHidden: false,
|
|
22
|
+
onStarToggle: () => {}
|
|
23
|
+
})
|
|
24
|
+
};
|
|
@@ -20,7 +20,8 @@ const styles = {
|
|
|
20
20
|
descriptionRefresh: "_1mouze3t _1i4qfg65 _1nmz1hna",
|
|
21
21
|
wrapper: "_otyru2gc",
|
|
22
22
|
tooltipWrapper: "_195gu2gc _1e0c116y _kqswh2mm _94n5v77o",
|
|
23
|
-
headingWrapper: "_kqswh2mm"
|
|
23
|
+
headingWrapper: "_kqswh2mm",
|
|
24
|
+
headingContentWrapper: "_195gu2gc"
|
|
24
25
|
};
|
|
25
26
|
export const getAgentCreator = ({
|
|
26
27
|
creatorType,
|
|
@@ -140,9 +141,11 @@ export const AgentProfileInfo = ({
|
|
|
140
141
|
agentDescription,
|
|
141
142
|
creatorRender,
|
|
142
143
|
starCountRender,
|
|
144
|
+
headingRender,
|
|
143
145
|
isStarred,
|
|
144
146
|
isHidden,
|
|
145
|
-
onStarToggle
|
|
147
|
+
onStarToggle,
|
|
148
|
+
showStarButton = true
|
|
146
149
|
}) => {
|
|
147
150
|
const {
|
|
148
151
|
formatMessage
|
|
@@ -167,7 +170,9 @@ export const AgentProfileInfo = ({
|
|
|
167
170
|
position: "top"
|
|
168
171
|
}, /*#__PURE__*/React.createElement(HiddenIcon, {
|
|
169
172
|
label: formatMessage(messages.hiddenIcon)
|
|
170
|
-
})))
|
|
173
|
+
}))), headingRender && /*#__PURE__*/React.createElement(Box, {
|
|
174
|
+
xcss: styles.headingContentWrapper
|
|
175
|
+
}, headingRender)), showStarButton && /*#__PURE__*/React.createElement(StarIconButton, {
|
|
171
176
|
isStarred: isStarred,
|
|
172
177
|
handleToggle: onStarToggle
|
|
173
178
|
})), creatorRender, !!agentDescription && /*#__PURE__*/React.createElement(Box, {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated SignedSource<<9817b3677a18810cda2656cb77948845>>
|
|
3
|
+
* @lightSyntaxTransform
|
|
4
|
+
* @nogrep
|
|
5
|
+
* @codegen-command: yarn relay
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/* tslint:disable */
|
|
9
|
+
/* eslint-disable */
|
|
10
|
+
// @ts-nocheck
|
|
11
|
+
|
|
12
|
+
const node = {
|
|
13
|
+
"argumentDefinitions": [],
|
|
14
|
+
"kind": "Fragment",
|
|
15
|
+
"name": "agentVerificationDropdownItem_AtlaskitRovoAgentComponents_agentRef",
|
|
16
|
+
"selections": [{
|
|
17
|
+
"kind": "ScalarField",
|
|
18
|
+
"name": "isVerified"
|
|
19
|
+
}],
|
|
20
|
+
"type": "AgentStudioAssistant"
|
|
21
|
+
};
|
|
22
|
+
node.hash = "1635a55a6ff272864bba57326c99a315";
|
|
23
|
+
export default node;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated SignedSource<<e119306497999ac48bfef5821a96f2eb>>
|
|
3
|
+
* @relayHash 426410e11638597e4a12069dd5a8be16
|
|
4
|
+
* @lightSyntaxTransform
|
|
5
|
+
* @nogrep
|
|
6
|
+
* @codegen-command: yarn relay
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/* tslint:disable */
|
|
10
|
+
/* eslint-disable */
|
|
11
|
+
// @ts-nocheck
|
|
12
|
+
|
|
13
|
+
// @relayRequestID e3ee432c0fc33e7c2f8bfeac0ba4eaedbab44694541de64c5219ab207398f3c0
|
|
14
|
+
|
|
15
|
+
const node = function () {
|
|
16
|
+
var v0 = [{
|
|
17
|
+
"defaultValue": null,
|
|
18
|
+
"kind": "LocalArgument",
|
|
19
|
+
"name": "id"
|
|
20
|
+
}, {
|
|
21
|
+
"defaultValue": null,
|
|
22
|
+
"kind": "LocalArgument",
|
|
23
|
+
"name": "verified"
|
|
24
|
+
}],
|
|
25
|
+
v1 = [{
|
|
26
|
+
"kind": "Variable",
|
|
27
|
+
"name": "id",
|
|
28
|
+
"variableName": "id"
|
|
29
|
+
}, {
|
|
30
|
+
"kind": "Variable",
|
|
31
|
+
"name": "verified",
|
|
32
|
+
"variableName": "verified"
|
|
33
|
+
}],
|
|
34
|
+
v2 = {
|
|
35
|
+
"kind": "ScalarField",
|
|
36
|
+
"name": "success"
|
|
37
|
+
},
|
|
38
|
+
v3 = {
|
|
39
|
+
"concreteType": "MutationError",
|
|
40
|
+
"kind": "LinkedField",
|
|
41
|
+
"name": "errors",
|
|
42
|
+
"plural": true,
|
|
43
|
+
"selections": [{
|
|
44
|
+
"kind": "ScalarField",
|
|
45
|
+
"name": "message"
|
|
46
|
+
}]
|
|
47
|
+
},
|
|
48
|
+
v4 = {
|
|
49
|
+
"kind": "ScalarField",
|
|
50
|
+
"name": "id"
|
|
51
|
+
},
|
|
52
|
+
v5 = {
|
|
53
|
+
"kind": "ScalarField",
|
|
54
|
+
"name": "isVerified"
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
"fragment": {
|
|
58
|
+
"argumentDefinitions": v0 /*: any*/,
|
|
59
|
+
"kind": "Fragment",
|
|
60
|
+
"name": "agentVerificationDropdownItem_AtlaskitRovoAgentComponents_updateAgentVerificationMutation",
|
|
61
|
+
"selections": [{
|
|
62
|
+
"args": v1 /*: any*/,
|
|
63
|
+
"concreteType": "AgentStudioUpdateAgentVerificationPayload",
|
|
64
|
+
"kind": "LinkedField",
|
|
65
|
+
"name": "agentStudio_updateAgentVerification",
|
|
66
|
+
"plural": false,
|
|
67
|
+
"selections": [v2 /*: any*/, v3 /*: any*/, {
|
|
68
|
+
"kind": "LinkedField",
|
|
69
|
+
"name": "agent",
|
|
70
|
+
"plural": false,
|
|
71
|
+
"selections": [{
|
|
72
|
+
"kind": "InlineFragment",
|
|
73
|
+
"selections": [v4 /*: any*/, v5 /*: any*/],
|
|
74
|
+
"type": "AgentStudioAssistant"
|
|
75
|
+
}]
|
|
76
|
+
}]
|
|
77
|
+
}],
|
|
78
|
+
"type": "Mutation"
|
|
79
|
+
},
|
|
80
|
+
"kind": "Request",
|
|
81
|
+
"operation": {
|
|
82
|
+
"argumentDefinitions": v0 /*: any*/,
|
|
83
|
+
"kind": "Operation",
|
|
84
|
+
"name": "agentVerificationDropdownItem_AtlaskitRovoAgentComponents_updateAgentVerificationMutation",
|
|
85
|
+
"selections": [{
|
|
86
|
+
"args": v1 /*: any*/,
|
|
87
|
+
"concreteType": "AgentStudioUpdateAgentVerificationPayload",
|
|
88
|
+
"kind": "LinkedField",
|
|
89
|
+
"name": "agentStudio_updateAgentVerification",
|
|
90
|
+
"plural": false,
|
|
91
|
+
"selections": [v2 /*: any*/, v3 /*: any*/, {
|
|
92
|
+
"kind": "LinkedField",
|
|
93
|
+
"name": "agent",
|
|
94
|
+
"plural": false,
|
|
95
|
+
"selections": [{
|
|
96
|
+
"kind": "ScalarField",
|
|
97
|
+
"name": "__typename"
|
|
98
|
+
}, v4 /*: any*/, {
|
|
99
|
+
"kind": "InlineFragment",
|
|
100
|
+
"selections": [v5 /*: any*/],
|
|
101
|
+
"type": "AgentStudioAssistant"
|
|
102
|
+
}]
|
|
103
|
+
}]
|
|
104
|
+
}]
|
|
105
|
+
},
|
|
106
|
+
"params": {
|
|
107
|
+
"id": "e3ee432c0fc33e7c2f8bfeac0ba4eaedbab44694541de64c5219ab207398f3c0",
|
|
108
|
+
"metadata": {},
|
|
109
|
+
"name": "agentVerificationDropdownItem_AtlaskitRovoAgentComponents_updateAgentVerificationMutation",
|
|
110
|
+
"operationKind": "mutation",
|
|
111
|
+
"text": null
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}();
|
|
115
|
+
node.hash = "215d57ba82c69595cbed5235ec1fec93";
|
|
116
|
+
export default node;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated SignedSource<<3ba8bcbc18cbb9766a1547794c6c98af>>
|
|
3
|
+
* @lightSyntaxTransform
|
|
4
|
+
* @nogrep
|
|
5
|
+
* @codegen-command: yarn relay
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/* tslint:disable */
|
|
9
|
+
/* eslint-disable */
|
|
10
|
+
// @ts-nocheck
|
|
11
|
+
|
|
12
|
+
const node = {
|
|
13
|
+
"argumentDefinitions": [],
|
|
14
|
+
"kind": "Fragment",
|
|
15
|
+
"name": "agentVerificationDropdownItem_AtlaskitRovoAgentComponents_userPermissionsRef",
|
|
16
|
+
"selections": [{
|
|
17
|
+
"kind": "ScalarField",
|
|
18
|
+
"name": "isAbleToGovernAgents"
|
|
19
|
+
}],
|
|
20
|
+
"type": "AtlassianStudioUserProductPermissions"
|
|
21
|
+
};
|
|
22
|
+
node.hash = "5addff9015092fd6e1870a9f51056493";
|
|
23
|
+
export default node;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated SignedSource<<251e7c171e33da0a0b2e0e8041d77493>>
|
|
3
|
+
* @relayHash 79a628a32ef254ccf6142a38adf8ecca
|
|
4
|
+
* @lightSyntaxTransform
|
|
5
|
+
* @nogrep
|
|
6
|
+
* @codegen-command: yarn relay
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/* tslint:disable */
|
|
10
|
+
/* eslint-disable */
|
|
11
|
+
// @ts-nocheck
|
|
12
|
+
|
|
13
|
+
// @relayRequestID 790e12806b8a31f23c8834d4c00327ae778a10fab62bf682c07e39e2b2349465
|
|
14
|
+
|
|
15
|
+
const node = function () {
|
|
16
|
+
var v0 = [{
|
|
17
|
+
"kind": "Literal",
|
|
18
|
+
"name": "id",
|
|
19
|
+
"value": "test-agent-id"
|
|
20
|
+
}],
|
|
21
|
+
v1 = [{
|
|
22
|
+
"kind": "Literal",
|
|
23
|
+
"name": "cloudId",
|
|
24
|
+
"value": "test-cloud-id"
|
|
25
|
+
}],
|
|
26
|
+
v2 = {
|
|
27
|
+
"kind": "ScalarField",
|
|
28
|
+
"name": "__typename"
|
|
29
|
+
},
|
|
30
|
+
v3 = {
|
|
31
|
+
"enumValues": null,
|
|
32
|
+
"nullable": false,
|
|
33
|
+
"plural": false,
|
|
34
|
+
"type": "String"
|
|
35
|
+
},
|
|
36
|
+
v4 = {
|
|
37
|
+
"enumValues": null,
|
|
38
|
+
"nullable": true,
|
|
39
|
+
"plural": false,
|
|
40
|
+
"type": "Boolean"
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
"fragment": {
|
|
44
|
+
"argumentDefinitions": [],
|
|
45
|
+
"kind": "Fragment",
|
|
46
|
+
"name": "testAgentVerificationDropdownItemQuery",
|
|
47
|
+
"selections": [{
|
|
48
|
+
"kind": "RequiredField",
|
|
49
|
+
"field": {
|
|
50
|
+
"args": v0 /*: any*/,
|
|
51
|
+
"kind": "LinkedField",
|
|
52
|
+
"name": "agentStudio_agentById",
|
|
53
|
+
"plural": false,
|
|
54
|
+
"selections": [{
|
|
55
|
+
"kind": "InlineFragment",
|
|
56
|
+
"selections": [{
|
|
57
|
+
"kind": "FragmentSpread",
|
|
58
|
+
"name": "agentVerificationDropdownItem_AtlaskitRovoAgentComponents_agentRef"
|
|
59
|
+
}],
|
|
60
|
+
"type": "AgentStudioAssistant"
|
|
61
|
+
}],
|
|
62
|
+
"storageKey": "agentStudio_agentById(id:\"test-agent-id\")"
|
|
63
|
+
},
|
|
64
|
+
"action": "THROW",
|
|
65
|
+
"path": "agentStudio_agentById"
|
|
66
|
+
}, {
|
|
67
|
+
"args": v1 /*: any*/,
|
|
68
|
+
"kind": "LinkedField",
|
|
69
|
+
"name": "atlassianStudio_userSiteContext",
|
|
70
|
+
"plural": false,
|
|
71
|
+
"selections": [{
|
|
72
|
+
"kind": "InlineFragment",
|
|
73
|
+
"selections": [{
|
|
74
|
+
"concreteType": "AtlassianStudioUserProductPermissions",
|
|
75
|
+
"kind": "LinkedField",
|
|
76
|
+
"name": "userPermissions",
|
|
77
|
+
"plural": false,
|
|
78
|
+
"selections": [{
|
|
79
|
+
"kind": "FragmentSpread",
|
|
80
|
+
"name": "agentVerificationDropdownItem_AtlaskitRovoAgentComponents_userPermissionsRef"
|
|
81
|
+
}]
|
|
82
|
+
}],
|
|
83
|
+
"type": "AtlassianStudioUserSiteContextOutput"
|
|
84
|
+
}],
|
|
85
|
+
"storageKey": "atlassianStudio_userSiteContext(cloudId:\"test-cloud-id\")"
|
|
86
|
+
}],
|
|
87
|
+
"type": "Query"
|
|
88
|
+
},
|
|
89
|
+
"kind": "Request",
|
|
90
|
+
"operation": {
|
|
91
|
+
"argumentDefinitions": [],
|
|
92
|
+
"kind": "Operation",
|
|
93
|
+
"name": "testAgentVerificationDropdownItemQuery",
|
|
94
|
+
"selections": [{
|
|
95
|
+
"args": v0 /*: any*/,
|
|
96
|
+
"kind": "LinkedField",
|
|
97
|
+
"name": "agentStudio_agentById",
|
|
98
|
+
"plural": false,
|
|
99
|
+
"selections": [v2 /*: any*/, {
|
|
100
|
+
"kind": "InlineFragment",
|
|
101
|
+
"selections": [{
|
|
102
|
+
"kind": "ScalarField",
|
|
103
|
+
"name": "isVerified"
|
|
104
|
+
}],
|
|
105
|
+
"type": "AgentStudioAssistant"
|
|
106
|
+
}, {
|
|
107
|
+
"kind": "InlineFragment",
|
|
108
|
+
"selections": [{
|
|
109
|
+
"kind": "ScalarField",
|
|
110
|
+
"name": "id"
|
|
111
|
+
}],
|
|
112
|
+
"type": "Node",
|
|
113
|
+
"abstractKey": "__isNode"
|
|
114
|
+
}],
|
|
115
|
+
"storageKey": "agentStudio_agentById(id:\"test-agent-id\")"
|
|
116
|
+
}, {
|
|
117
|
+
"args": v1 /*: any*/,
|
|
118
|
+
"kind": "LinkedField",
|
|
119
|
+
"name": "atlassianStudio_userSiteContext",
|
|
120
|
+
"plural": false,
|
|
121
|
+
"selections": [v2 /*: any*/, {
|
|
122
|
+
"kind": "InlineFragment",
|
|
123
|
+
"selections": [{
|
|
124
|
+
"concreteType": "AtlassianStudioUserProductPermissions",
|
|
125
|
+
"kind": "LinkedField",
|
|
126
|
+
"name": "userPermissions",
|
|
127
|
+
"plural": false,
|
|
128
|
+
"selections": [{
|
|
129
|
+
"kind": "ScalarField",
|
|
130
|
+
"name": "isAbleToGovernAgents"
|
|
131
|
+
}]
|
|
132
|
+
}],
|
|
133
|
+
"type": "AtlassianStudioUserSiteContextOutput"
|
|
134
|
+
}],
|
|
135
|
+
"storageKey": "atlassianStudio_userSiteContext(cloudId:\"test-cloud-id\")"
|
|
136
|
+
}]
|
|
137
|
+
},
|
|
138
|
+
"params": {
|
|
139
|
+
"id": "790e12806b8a31f23c8834d4c00327ae778a10fab62bf682c07e39e2b2349465",
|
|
140
|
+
"metadata": {
|
|
141
|
+
"relayTestingSelectionTypeInfo": {
|
|
142
|
+
"agentStudio_agentById": {
|
|
143
|
+
"enumValues": null,
|
|
144
|
+
"nullable": true,
|
|
145
|
+
"plural": false,
|
|
146
|
+
"type": "AgentStudioAgentResult"
|
|
147
|
+
},
|
|
148
|
+
"agentStudio_agentById.__isNode": v3 /*: any*/,
|
|
149
|
+
"agentStudio_agentById.__typename": v3 /*: any*/,
|
|
150
|
+
"agentStudio_agentById.id": {
|
|
151
|
+
"enumValues": null,
|
|
152
|
+
"nullable": false,
|
|
153
|
+
"plural": false,
|
|
154
|
+
"type": "ID"
|
|
155
|
+
},
|
|
156
|
+
"agentStudio_agentById.isVerified": v4 /*: any*/,
|
|
157
|
+
"atlassianStudio_userSiteContext": {
|
|
158
|
+
"enumValues": null,
|
|
159
|
+
"nullable": true,
|
|
160
|
+
"plural": false,
|
|
161
|
+
"type": "AtlassianStudioUserSiteContextResult"
|
|
162
|
+
},
|
|
163
|
+
"atlassianStudio_userSiteContext.__typename": v3 /*: any*/,
|
|
164
|
+
"atlassianStudio_userSiteContext.userPermissions": {
|
|
165
|
+
"enumValues": null,
|
|
166
|
+
"nullable": true,
|
|
167
|
+
"plural": false,
|
|
168
|
+
"type": "AtlassianStudioUserProductPermissions"
|
|
169
|
+
},
|
|
170
|
+
"atlassianStudio_userSiteContext.userPermissions.isAbleToGovernAgents": v4 /*: any*/
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"name": "testAgentVerificationDropdownItemQuery",
|
|
174
|
+
"operationKind": "query",
|
|
175
|
+
"text": null
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
}();
|
|
179
|
+
node.hash = "19dfd01b36565c5a9ddf6cfed9c3594f";
|
|
180
|
+
export default node;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import _agentVerificationDropdownItem_AtlaskitRovoAgentComponents_updateAgentVerificationMutation from "./__generated__/agentVerificationDropdownItem_AtlaskitRovoAgentComponents_updateAgentVerificationMutation.graphql";
|
|
2
|
+
import _agentVerificationDropdownItem_AtlaskitRovoAgentComponents_userPermissionsRef from "./__generated__/agentVerificationDropdownItem_AtlaskitRovoAgentComponents_userPermissionsRef.graphql";
|
|
3
|
+
import _agentVerificationDropdownItem_AtlaskitRovoAgentComponents_agentRef from "./__generated__/agentVerificationDropdownItem_AtlaskitRovoAgentComponents_agentRef.graphql";
|
|
4
|
+
import React, { useCallback } from 'react';
|
|
5
|
+
import { useIntl } from 'react-intl-next';
|
|
6
|
+
import { graphql, useFragment, useMutation } from 'react-relay';
|
|
7
|
+
import { DropdownItem } from '@atlaskit/dropdown-menu';
|
|
8
|
+
import { useFlags } from '@atlaskit/flag';
|
|
9
|
+
import ErrorIcon from '@atlaskit/icon/core/status-error';
|
|
10
|
+
import SuccessIcon from '@atlaskit/icon/core/status-success';
|
|
11
|
+
import { AgentActions, useRovoAgentActionAnalytics } from '@atlaskit/rovo-agent-analytics/actions';
|
|
12
|
+
import messages from './messages';
|
|
13
|
+
/**
|
|
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.
|
|
16
|
+
* Returns null if the user doesn't have permission to govern agents or the feature flag is off.
|
|
17
|
+
*/
|
|
18
|
+
export const AgentVerificationDropdownItem = ({
|
|
19
|
+
agentId,
|
|
20
|
+
agentRef,
|
|
21
|
+
userPermissionsRef,
|
|
22
|
+
onClick,
|
|
23
|
+
testId
|
|
24
|
+
}) => {
|
|
25
|
+
var _userPermissions$isAb, _agentData$isVerified;
|
|
26
|
+
const {
|
|
27
|
+
formatMessage
|
|
28
|
+
} = useIntl();
|
|
29
|
+
const {
|
|
30
|
+
showFlag
|
|
31
|
+
} = useFlags();
|
|
32
|
+
const agentData = useFragment(_agentVerificationDropdownItem_AtlaskitRovoAgentComponents_agentRef, agentRef);
|
|
33
|
+
const userPermissions = useFragment(_agentVerificationDropdownItem_AtlaskitRovoAgentComponents_userPermissionsRef, userPermissionsRef);
|
|
34
|
+
const isAbleToGovernAgents = (_userPermissions$isAb = userPermissions === null || userPermissions === void 0 ? void 0 : userPermissions.isAbleToGovernAgents) !== null && _userPermissions$isAb !== void 0 ? _userPermissions$isAb : false;
|
|
35
|
+
const isVerified = (_agentData$isVerified = agentData === null || agentData === void 0 ? void 0 : agentData.isVerified) !== null && _agentData$isVerified !== void 0 ? _agentData$isVerified : false;
|
|
36
|
+
const {
|
|
37
|
+
trackAgentAction,
|
|
38
|
+
trackAgentActionError
|
|
39
|
+
} = useRovoAgentActionAnalytics({
|
|
40
|
+
touchPoint: 'agent-verification-dropdown-item',
|
|
41
|
+
agentId,
|
|
42
|
+
isAbleToGovernAgents
|
|
43
|
+
});
|
|
44
|
+
const [commitUpdateVerification] = useMutation(_agentVerificationDropdownItem_AtlaskitRovoAgentComponents_updateAgentVerificationMutation);
|
|
45
|
+
const handleError = useCallback((verified, errorMessage) => {
|
|
46
|
+
showFlag({
|
|
47
|
+
title: formatMessage(verified ? messages.verifyErrorTitle : messages.unverifyErrorTitle),
|
|
48
|
+
description: formatMessage(messages.errorDescription, {
|
|
49
|
+
errorMessage
|
|
50
|
+
}),
|
|
51
|
+
appearance: 'error',
|
|
52
|
+
icon: /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
53
|
+
spacing: "spacious",
|
|
54
|
+
label: ""
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}, [formatMessage, showFlag]);
|
|
58
|
+
const handleUpdateVerification = useCallback(verified => {
|
|
59
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
60
|
+
commitUpdateVerification({
|
|
61
|
+
variables: {
|
|
62
|
+
id: agentId,
|
|
63
|
+
verified
|
|
64
|
+
},
|
|
65
|
+
onCompleted: (_, errors) => {
|
|
66
|
+
if (errors && errors.length > 0) {
|
|
67
|
+
const errorMessage = errors[0].message;
|
|
68
|
+
trackAgentActionError(verified ? AgentActions.VERIFY : AgentActions.UNVERIFY, new Error(errorMessage), {
|
|
69
|
+
agentId
|
|
70
|
+
});
|
|
71
|
+
handleError(verified, errorMessage);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
trackAgentAction(verified ? AgentActions.VERIFY : AgentActions.UNVERIFY, {});
|
|
75
|
+
showFlag({
|
|
76
|
+
title: formatMessage(verified ? messages.verifySuccessTitle : messages.unverifySuccessTitle),
|
|
77
|
+
appearance: 'success',
|
|
78
|
+
isAutoDismiss: true,
|
|
79
|
+
icon: /*#__PURE__*/React.createElement(SuccessIcon, {
|
|
80
|
+
spacing: "spacious",
|
|
81
|
+
label: ""
|
|
82
|
+
})
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
onError: error => {
|
|
86
|
+
trackAgentActionError(verified ? AgentActions.VERIFY : AgentActions.UNVERIFY, error, {
|
|
87
|
+
agentId
|
|
88
|
+
});
|
|
89
|
+
handleError(verified, error.message);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}, [agentId, commitUpdateVerification, formatMessage, handleError, onClick, showFlag, trackAgentAction, trackAgentActionError]);
|
|
93
|
+
|
|
94
|
+
// Don't render if user doesn't have permission
|
|
95
|
+
if (!isAbleToGovernAgents) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
return /*#__PURE__*/React.createElement(DropdownItem, {
|
|
99
|
+
testId: testId,
|
|
100
|
+
onClick: () => handleUpdateVerification(!isVerified)
|
|
101
|
+
}, formatMessage(isVerified ? messages.unverifyAgentLabel : messages.verifyAgentLabel));
|
|
102
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl-next';
|
|
2
|
+
export default defineMessages({
|
|
3
|
+
verifyAgentLabel: {
|
|
4
|
+
id: 'rovo-agent-components.agent-verification-dropdown-item.verify-agent',
|
|
5
|
+
defaultMessage: 'Verify agent',
|
|
6
|
+
description: 'Label for verify agent dropdown menu item'
|
|
7
|
+
},
|
|
8
|
+
unverifyAgentLabel: {
|
|
9
|
+
id: 'rovo-agent-components.agent-verification-dropdown-item.unverify-agent',
|
|
10
|
+
defaultMessage: 'Unverify agent',
|
|
11
|
+
description: 'Label for unverify agent dropdown menu item'
|
|
12
|
+
},
|
|
13
|
+
verifySuccessTitle: {
|
|
14
|
+
id: 'rovo-agent-components.agent-verification-dropdown-item.verify-success-title',
|
|
15
|
+
defaultMessage: 'Agent verified',
|
|
16
|
+
description: 'Title for success flag when agent is verified'
|
|
17
|
+
},
|
|
18
|
+
unverifySuccessTitle: {
|
|
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'
|
|
22
|
+
},
|
|
23
|
+
verifyErrorTitle: {
|
|
24
|
+
id: 'rovo-agent-components.agent-verification-dropdown-item.verify-error-title',
|
|
25
|
+
defaultMessage: 'Failed to verify agent',
|
|
26
|
+
description: 'Title for error flag when verifying agent fails'
|
|
27
|
+
},
|
|
28
|
+
unverifyErrorTitle: {
|
|
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'
|
|
32
|
+
},
|
|
33
|
+
errorDescription: {
|
|
34
|
+
id: 'rovo-agent-components.agent-verification-dropdown-item.error-description',
|
|
35
|
+
defaultMessage: 'An error occurred while updating agent verification status: {errorMessage}',
|
|
36
|
+
description: 'Description for error flag showing the error message'
|
|
37
|
+
}
|
|
38
|
+
});
|
package/dist/esm/index.js
CHANGED
|
@@ -12,4 +12,5 @@ export { HiddenIcon } from './common/ui/hidden-icon';
|
|
|
12
12
|
export { AgentAvatar } from './ui/agent-avatar';
|
|
13
13
|
export { AgentBanner, GeneratedAvatar } from './ui/agent-avatar/generated-avatars';
|
|
14
14
|
export { AgentDropdownMenu } from './ui/agent-dropdown-menu';
|
|
15
|
-
export { AgentMenuItemSkeleton } from './ui/agent-menu-item-skeleton';
|
|
15
|
+
export { AgentMenuItemSkeleton } from './ui/agent-menu-item-skeleton';
|
|
16
|
+
export { AgentVerificationDropdownItem } from './ui/agent-verification-dropdown-item';
|