@atlaskit/rovo-agent-components 8.11.0 → 8.12.1
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 +23 -0
- package/dist/cjs/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.js +88 -0
- package/dist/cjs/ui/agent-avatar/resolved-agent-avatar/__generated__/ResolvedAgentAvatarQuery.graphql.js +83 -0
- package/dist/es2019/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.js +78 -0
- package/dist/es2019/ui/agent-avatar/resolved-agent-avatar/__generated__/ResolvedAgentAvatarQuery.graphql.js +77 -0
- package/dist/esm/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.js +78 -0
- package/dist/esm/ui/agent-avatar/resolved-agent-avatar/__generated__/ResolvedAgentAvatarQuery.graphql.js +77 -0
- package/dist/types/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.d.ts +18 -0
- package/dist/types/ui/agent-avatar/resolved-agent-avatar/__generated__/ResolvedAgentAvatarQuery.graphql.d.ts +23 -0
- package/package.json +7 -3
- package/ui/agent-avatar/ResolvedAgentAvatar/package.json +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/rovo-agent-components
|
|
2
2
|
|
|
3
|
+
## 8.12.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 8.12.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`441bd218eede9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/441bd218eede9) -
|
|
14
|
+
Fetch the real account picture for the default Rovo agent, the same way any other agent's avatar
|
|
15
|
+
resolves, in the agent-mention nudge, the agent profile card, and the editor streaming
|
|
16
|
+
telepointer. Adds a shared `ResolvedAgentAvatar` to `@atlaskit/rovo-agent-components` (real
|
|
17
|
+
picture with a caller-supplied fallback) and uses it from the telepointer and the profile card
|
|
18
|
+
instead of each carrying its own avatar logic. Falls back to the same specialist avatar or
|
|
19
|
+
generated illustration every other agent gets when there's no picture to fetch, rather than a
|
|
20
|
+
Rovo-specific fallback.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 8.11.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
|
@@ -0,0 +1,88 @@
|
|
|
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.ResolvedAgentAvatar = void 0;
|
|
9
|
+
var _ResolvedAgentAvatarQuery2 = _interopRequireDefault(require("./__generated__/ResolvedAgentAvatarQuery.graphql"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _reactErrorBoundary = require("react-error-boundary");
|
|
12
|
+
var _reactRelay = require("react-relay");
|
|
13
|
+
var _Skeleton = _interopRequireDefault(require("@atlaskit/avatar/Skeleton"));
|
|
14
|
+
var _index = require("../index");
|
|
15
|
+
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); }
|
|
16
|
+
// A relative import, not the package's own public subpath: a package can't resolve its own
|
|
17
|
+
// name from within itself when building its published type declarations in isolation.
|
|
18
|
+
|
|
19
|
+
// The fixed partition/resource-owner/resource-type segments of an identity user ARI — only the
|
|
20
|
+
// account id itself varies. Matched by prefix rather than via `@atlassian/ari` (an internal
|
|
21
|
+
// package this public package can't depend on).
|
|
22
|
+
var IDENTITY_USER_ARI_PREFIX = 'ari:cloud:identity::user/';
|
|
23
|
+
|
|
24
|
+
/** Parses the account id needed for the picture fetch from the identity ARI a caller carries. */
|
|
25
|
+
var parseIdentityAccountId = function parseIdentityAccountId(value) {
|
|
26
|
+
var trimmed = value === null || value === void 0 ? void 0 : value.trim();
|
|
27
|
+
return trimmed !== null && trimmed !== void 0 && trimmed.startsWith(IDENTITY_USER_ARI_PREFIX) ? trimmed.slice(IDENTITY_USER_ARI_PREFIX.length) : undefined;
|
|
28
|
+
};
|
|
29
|
+
var FetchedAgentAvatar = function FetchedAgentAvatar(_ref) {
|
|
30
|
+
var _data$user, _data$user2;
|
|
31
|
+
var accountId = _ref.accountId,
|
|
32
|
+
agentName = _ref.agentName,
|
|
33
|
+
fallback = _ref.fallback,
|
|
34
|
+
showBorder = _ref.showBorder,
|
|
35
|
+
size = _ref.size;
|
|
36
|
+
var data = (0, _reactRelay.useLazyLoadQuery)(_ResolvedAgentAvatarQuery2.default, {
|
|
37
|
+
accountId: accountId
|
|
38
|
+
}, {
|
|
39
|
+
fetchPolicy: 'store-or-network'
|
|
40
|
+
});
|
|
41
|
+
var picture = (_data$user = data.user) === null || _data$user === void 0 || (_data$user = _data$user.picture) === null || _data$user === void 0 ? void 0 : _data$user.trim();
|
|
42
|
+
if (!picture) {
|
|
43
|
+
return fallback;
|
|
44
|
+
}
|
|
45
|
+
var name = ((_data$user2 = data.user) === null || _data$user2 === void 0 || (_data$user2 = _data$user2.name) === null || _data$user2 === void 0 ? void 0 : _data$user2.trim()) || agentName;
|
|
46
|
+
return /*#__PURE__*/_react.default.createElement(_index.AgentAvatar, {
|
|
47
|
+
imageUrl: picture,
|
|
48
|
+
name: name,
|
|
49
|
+
label: name,
|
|
50
|
+
showBorder: showBorder,
|
|
51
|
+
size: size
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The best avatar available for an agent identity: the real account picture when one can be
|
|
57
|
+
* fetched, otherwise the caller-supplied `fallback`. Works for any identity with an
|
|
58
|
+
* `agentIdentityAccountId` — including the default Rovo agent, now that Rovo is provisioned its
|
|
59
|
+
* own identity account. A `Suspense` skeleton bridges the fetch, and an `ErrorBoundary` keeps a
|
|
60
|
+
* failed or unavailable fetch from ever breaking the caller — it just renders `fallback`.
|
|
61
|
+
*/
|
|
62
|
+
var ResolvedAgentAvatar = exports.ResolvedAgentAvatar = function ResolvedAgentAvatar(_ref2) {
|
|
63
|
+
var agentIdentityAccountId = _ref2.agentIdentityAccountId,
|
|
64
|
+
agentName = _ref2.agentName,
|
|
65
|
+
fallback = _ref2.fallback,
|
|
66
|
+
_ref2$showBorder = _ref2.showBorder,
|
|
67
|
+
showBorder = _ref2$showBorder === void 0 ? false : _ref2$showBorder,
|
|
68
|
+
_ref2$size = _ref2.size,
|
|
69
|
+
size = _ref2$size === void 0 ? 'medium' : _ref2$size;
|
|
70
|
+
var accountId = parseIdentityAccountId(agentIdentityAccountId);
|
|
71
|
+
if (!accountId) {
|
|
72
|
+
return fallback;
|
|
73
|
+
}
|
|
74
|
+
return /*#__PURE__*/_react.default.createElement(_reactErrorBoundary.ErrorBoundary, {
|
|
75
|
+
fallback: fallback
|
|
76
|
+
}, /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
77
|
+
fallback: /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
|
|
78
|
+
appearance: "hexagon",
|
|
79
|
+
size: size
|
|
80
|
+
})
|
|
81
|
+
}, /*#__PURE__*/_react.default.createElement(FetchedAgentAvatar, {
|
|
82
|
+
accountId: accountId,
|
|
83
|
+
agentName: agentName,
|
|
84
|
+
fallback: fallback,
|
|
85
|
+
showBorder: showBorder,
|
|
86
|
+
size: size
|
|
87
|
+
})));
|
|
88
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* @generated SignedSource<<765322731b31afdb0584c134ed53e12a>>
|
|
9
|
+
* @relayHash 07c2f9612a7a8401a21c6ad1a0936b2d
|
|
10
|
+
* @lightSyntaxTransform
|
|
11
|
+
* @nogrep
|
|
12
|
+
* @codegen-command: yarn relay
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/* tslint:disable */
|
|
16
|
+
/* eslint-disable */
|
|
17
|
+
// @ts-nocheck
|
|
18
|
+
|
|
19
|
+
// @relayRequestID aa69c7a83a201b1f2a5cdca116d15f149410a79d7ce49e3fafb7ce1e4a4e38d5
|
|
20
|
+
|
|
21
|
+
var node = function () {
|
|
22
|
+
var v0 = [{
|
|
23
|
+
"defaultValue": null,
|
|
24
|
+
"kind": "LocalArgument",
|
|
25
|
+
"name": "accountId"
|
|
26
|
+
}],
|
|
27
|
+
v1 = [{
|
|
28
|
+
"kind": "Variable",
|
|
29
|
+
"name": "accountId",
|
|
30
|
+
"variableName": "accountId"
|
|
31
|
+
}],
|
|
32
|
+
v2 = {
|
|
33
|
+
"kind": "ScalarField",
|
|
34
|
+
"name": "name"
|
|
35
|
+
},
|
|
36
|
+
v3 = {
|
|
37
|
+
"kind": "ScalarField",
|
|
38
|
+
"name": "picture"
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
"fragment": {
|
|
42
|
+
"argumentDefinitions": v0 /*: any*/,
|
|
43
|
+
"kind": "Fragment",
|
|
44
|
+
"name": "ResolvedAgentAvatarQuery",
|
|
45
|
+
"selections": [{
|
|
46
|
+
"args": v1 /*: any*/,
|
|
47
|
+
"kind": "LinkedField",
|
|
48
|
+
"name": "user",
|
|
49
|
+
"plural": false,
|
|
50
|
+
"selections": [v2 /*: any*/, v3 /*: any*/]
|
|
51
|
+
}],
|
|
52
|
+
"type": "Query"
|
|
53
|
+
},
|
|
54
|
+
"kind": "Request",
|
|
55
|
+
"operation": {
|
|
56
|
+
"argumentDefinitions": v0 /*: any*/,
|
|
57
|
+
"kind": "Operation",
|
|
58
|
+
"name": "ResolvedAgentAvatarQuery",
|
|
59
|
+
"selections": [{
|
|
60
|
+
"args": v1 /*: any*/,
|
|
61
|
+
"kind": "LinkedField",
|
|
62
|
+
"name": "user",
|
|
63
|
+
"plural": false,
|
|
64
|
+
"selections": [{
|
|
65
|
+
"kind": "ScalarField",
|
|
66
|
+
"name": "__typename"
|
|
67
|
+
}, v2 /*: any*/, v3 /*: any*/, {
|
|
68
|
+
"kind": "ScalarField",
|
|
69
|
+
"name": "id"
|
|
70
|
+
}]
|
|
71
|
+
}]
|
|
72
|
+
},
|
|
73
|
+
"params": {
|
|
74
|
+
"id": "aa69c7a83a201b1f2a5cdca116d15f149410a79d7ce49e3fafb7ce1e4a4e38d5",
|
|
75
|
+
"metadata": {},
|
|
76
|
+
"name": "ResolvedAgentAvatarQuery",
|
|
77
|
+
"operationKind": "query",
|
|
78
|
+
"text": null
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}();
|
|
82
|
+
node.hash = "a2c97e7ac7feca789629a3b50c6150aa";
|
|
83
|
+
var _default = exports.default = node;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import _ResolvedAgentAvatarQuery from "./__generated__/ResolvedAgentAvatarQuery.graphql";
|
|
2
|
+
import React, { Suspense } from 'react';
|
|
3
|
+
import { ErrorBoundary } from 'react-error-boundary';
|
|
4
|
+
import { graphql, useLazyLoadQuery } from 'react-relay';
|
|
5
|
+
import AvatarSkeleton from '@atlaskit/avatar/Skeleton';
|
|
6
|
+
// A relative import, not the package's own public subpath: a package can't resolve its own
|
|
7
|
+
// name from within itself when building its published type declarations in isolation.
|
|
8
|
+
import { AgentAvatar } from '../index';
|
|
9
|
+
// The fixed partition/resource-owner/resource-type segments of an identity user ARI — only the
|
|
10
|
+
// account id itself varies. Matched by prefix rather than via `@atlassian/ari` (an internal
|
|
11
|
+
// package this public package can't depend on).
|
|
12
|
+
const IDENTITY_USER_ARI_PREFIX = 'ari:cloud:identity::user/';
|
|
13
|
+
|
|
14
|
+
/** Parses the account id needed for the picture fetch from the identity ARI a caller carries. */
|
|
15
|
+
const parseIdentityAccountId = value => {
|
|
16
|
+
const trimmed = value === null || value === void 0 ? void 0 : value.trim();
|
|
17
|
+
return trimmed !== null && trimmed !== void 0 && trimmed.startsWith(IDENTITY_USER_ARI_PREFIX) ? trimmed.slice(IDENTITY_USER_ARI_PREFIX.length) : undefined;
|
|
18
|
+
};
|
|
19
|
+
const FetchedAgentAvatar = ({
|
|
20
|
+
accountId,
|
|
21
|
+
agentName,
|
|
22
|
+
fallback,
|
|
23
|
+
showBorder,
|
|
24
|
+
size
|
|
25
|
+
}) => {
|
|
26
|
+
var _data$user, _data$user$picture, _data$user2, _data$user2$name;
|
|
27
|
+
const data = useLazyLoadQuery(_ResolvedAgentAvatarQuery, {
|
|
28
|
+
accountId
|
|
29
|
+
}, {
|
|
30
|
+
fetchPolicy: 'store-or-network'
|
|
31
|
+
});
|
|
32
|
+
const picture = (_data$user = data.user) === null || _data$user === void 0 ? void 0 : (_data$user$picture = _data$user.picture) === null || _data$user$picture === void 0 ? void 0 : _data$user$picture.trim();
|
|
33
|
+
if (!picture) {
|
|
34
|
+
return fallback;
|
|
35
|
+
}
|
|
36
|
+
const name = ((_data$user2 = data.user) === null || _data$user2 === void 0 ? void 0 : (_data$user2$name = _data$user2.name) === null || _data$user2$name === void 0 ? void 0 : _data$user2$name.trim()) || agentName;
|
|
37
|
+
return /*#__PURE__*/React.createElement(AgentAvatar, {
|
|
38
|
+
imageUrl: picture,
|
|
39
|
+
name: name,
|
|
40
|
+
label: name,
|
|
41
|
+
showBorder: showBorder,
|
|
42
|
+
size: size
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The best avatar available for an agent identity: the real account picture when one can be
|
|
48
|
+
* fetched, otherwise the caller-supplied `fallback`. Works for any identity with an
|
|
49
|
+
* `agentIdentityAccountId` — including the default Rovo agent, now that Rovo is provisioned its
|
|
50
|
+
* own identity account. A `Suspense` skeleton bridges the fetch, and an `ErrorBoundary` keeps a
|
|
51
|
+
* failed or unavailable fetch from ever breaking the caller — it just renders `fallback`.
|
|
52
|
+
*/
|
|
53
|
+
export const ResolvedAgentAvatar = ({
|
|
54
|
+
agentIdentityAccountId,
|
|
55
|
+
agentName,
|
|
56
|
+
fallback,
|
|
57
|
+
showBorder = false,
|
|
58
|
+
size = 'medium'
|
|
59
|
+
}) => {
|
|
60
|
+
const accountId = parseIdentityAccountId(agentIdentityAccountId);
|
|
61
|
+
if (!accountId) {
|
|
62
|
+
return fallback;
|
|
63
|
+
}
|
|
64
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
65
|
+
fallback: fallback
|
|
66
|
+
}, /*#__PURE__*/React.createElement(Suspense, {
|
|
67
|
+
fallback: /*#__PURE__*/React.createElement(AvatarSkeleton, {
|
|
68
|
+
appearance: "hexagon",
|
|
69
|
+
size: size
|
|
70
|
+
})
|
|
71
|
+
}, /*#__PURE__*/React.createElement(FetchedAgentAvatar, {
|
|
72
|
+
accountId: accountId,
|
|
73
|
+
agentName: agentName,
|
|
74
|
+
fallback: fallback,
|
|
75
|
+
showBorder: showBorder,
|
|
76
|
+
size: size
|
|
77
|
+
})));
|
|
78
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated SignedSource<<765322731b31afdb0584c134ed53e12a>>
|
|
3
|
+
* @relayHash 07c2f9612a7a8401a21c6ad1a0936b2d
|
|
4
|
+
* @lightSyntaxTransform
|
|
5
|
+
* @nogrep
|
|
6
|
+
* @codegen-command: yarn relay
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/* tslint:disable */
|
|
10
|
+
/* eslint-disable */
|
|
11
|
+
// @ts-nocheck
|
|
12
|
+
|
|
13
|
+
// @relayRequestID aa69c7a83a201b1f2a5cdca116d15f149410a79d7ce49e3fafb7ce1e4a4e38d5
|
|
14
|
+
|
|
15
|
+
const node = function () {
|
|
16
|
+
var v0 = [{
|
|
17
|
+
"defaultValue": null,
|
|
18
|
+
"kind": "LocalArgument",
|
|
19
|
+
"name": "accountId"
|
|
20
|
+
}],
|
|
21
|
+
v1 = [{
|
|
22
|
+
"kind": "Variable",
|
|
23
|
+
"name": "accountId",
|
|
24
|
+
"variableName": "accountId"
|
|
25
|
+
}],
|
|
26
|
+
v2 = {
|
|
27
|
+
"kind": "ScalarField",
|
|
28
|
+
"name": "name"
|
|
29
|
+
},
|
|
30
|
+
v3 = {
|
|
31
|
+
"kind": "ScalarField",
|
|
32
|
+
"name": "picture"
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
"fragment": {
|
|
36
|
+
"argumentDefinitions": v0 /*: any*/,
|
|
37
|
+
"kind": "Fragment",
|
|
38
|
+
"name": "ResolvedAgentAvatarQuery",
|
|
39
|
+
"selections": [{
|
|
40
|
+
"args": v1 /*: any*/,
|
|
41
|
+
"kind": "LinkedField",
|
|
42
|
+
"name": "user",
|
|
43
|
+
"plural": false,
|
|
44
|
+
"selections": [v2 /*: any*/, v3 /*: any*/]
|
|
45
|
+
}],
|
|
46
|
+
"type": "Query"
|
|
47
|
+
},
|
|
48
|
+
"kind": "Request",
|
|
49
|
+
"operation": {
|
|
50
|
+
"argumentDefinitions": v0 /*: any*/,
|
|
51
|
+
"kind": "Operation",
|
|
52
|
+
"name": "ResolvedAgentAvatarQuery",
|
|
53
|
+
"selections": [{
|
|
54
|
+
"args": v1 /*: any*/,
|
|
55
|
+
"kind": "LinkedField",
|
|
56
|
+
"name": "user",
|
|
57
|
+
"plural": false,
|
|
58
|
+
"selections": [{
|
|
59
|
+
"kind": "ScalarField",
|
|
60
|
+
"name": "__typename"
|
|
61
|
+
}, v2 /*: any*/, v3 /*: any*/, {
|
|
62
|
+
"kind": "ScalarField",
|
|
63
|
+
"name": "id"
|
|
64
|
+
}]
|
|
65
|
+
}]
|
|
66
|
+
},
|
|
67
|
+
"params": {
|
|
68
|
+
"id": "aa69c7a83a201b1f2a5cdca116d15f149410a79d7ce49e3fafb7ce1e4a4e38d5",
|
|
69
|
+
"metadata": {},
|
|
70
|
+
"name": "ResolvedAgentAvatarQuery",
|
|
71
|
+
"operationKind": "query",
|
|
72
|
+
"text": null
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}();
|
|
76
|
+
node.hash = "a2c97e7ac7feca789629a3b50c6150aa";
|
|
77
|
+
export default node;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import _ResolvedAgentAvatarQuery from "./__generated__/ResolvedAgentAvatarQuery.graphql";
|
|
2
|
+
import React, { Suspense } from 'react';
|
|
3
|
+
import { ErrorBoundary } from 'react-error-boundary';
|
|
4
|
+
import { graphql, useLazyLoadQuery } from 'react-relay';
|
|
5
|
+
import AvatarSkeleton from '@atlaskit/avatar/Skeleton';
|
|
6
|
+
// A relative import, not the package's own public subpath: a package can't resolve its own
|
|
7
|
+
// name from within itself when building its published type declarations in isolation.
|
|
8
|
+
import { AgentAvatar } from '../index';
|
|
9
|
+
// The fixed partition/resource-owner/resource-type segments of an identity user ARI — only the
|
|
10
|
+
// account id itself varies. Matched by prefix rather than via `@atlassian/ari` (an internal
|
|
11
|
+
// package this public package can't depend on).
|
|
12
|
+
var IDENTITY_USER_ARI_PREFIX = 'ari:cloud:identity::user/';
|
|
13
|
+
|
|
14
|
+
/** Parses the account id needed for the picture fetch from the identity ARI a caller carries. */
|
|
15
|
+
var parseIdentityAccountId = function parseIdentityAccountId(value) {
|
|
16
|
+
var trimmed = value === null || value === void 0 ? void 0 : value.trim();
|
|
17
|
+
return trimmed !== null && trimmed !== void 0 && trimmed.startsWith(IDENTITY_USER_ARI_PREFIX) ? trimmed.slice(IDENTITY_USER_ARI_PREFIX.length) : undefined;
|
|
18
|
+
};
|
|
19
|
+
var FetchedAgentAvatar = function FetchedAgentAvatar(_ref) {
|
|
20
|
+
var _data$user, _data$user2;
|
|
21
|
+
var accountId = _ref.accountId,
|
|
22
|
+
agentName = _ref.agentName,
|
|
23
|
+
fallback = _ref.fallback,
|
|
24
|
+
showBorder = _ref.showBorder,
|
|
25
|
+
size = _ref.size;
|
|
26
|
+
var data = useLazyLoadQuery(_ResolvedAgentAvatarQuery, {
|
|
27
|
+
accountId: accountId
|
|
28
|
+
}, {
|
|
29
|
+
fetchPolicy: 'store-or-network'
|
|
30
|
+
});
|
|
31
|
+
var picture = (_data$user = data.user) === null || _data$user === void 0 || (_data$user = _data$user.picture) === null || _data$user === void 0 ? void 0 : _data$user.trim();
|
|
32
|
+
if (!picture) {
|
|
33
|
+
return fallback;
|
|
34
|
+
}
|
|
35
|
+
var name = ((_data$user2 = data.user) === null || _data$user2 === void 0 || (_data$user2 = _data$user2.name) === null || _data$user2 === void 0 ? void 0 : _data$user2.trim()) || agentName;
|
|
36
|
+
return /*#__PURE__*/React.createElement(AgentAvatar, {
|
|
37
|
+
imageUrl: picture,
|
|
38
|
+
name: name,
|
|
39
|
+
label: name,
|
|
40
|
+
showBorder: showBorder,
|
|
41
|
+
size: size
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The best avatar available for an agent identity: the real account picture when one can be
|
|
47
|
+
* fetched, otherwise the caller-supplied `fallback`. Works for any identity with an
|
|
48
|
+
* `agentIdentityAccountId` — including the default Rovo agent, now that Rovo is provisioned its
|
|
49
|
+
* own identity account. A `Suspense` skeleton bridges the fetch, and an `ErrorBoundary` keeps a
|
|
50
|
+
* failed or unavailable fetch from ever breaking the caller — it just renders `fallback`.
|
|
51
|
+
*/
|
|
52
|
+
export var ResolvedAgentAvatar = function ResolvedAgentAvatar(_ref2) {
|
|
53
|
+
var agentIdentityAccountId = _ref2.agentIdentityAccountId,
|
|
54
|
+
agentName = _ref2.agentName,
|
|
55
|
+
fallback = _ref2.fallback,
|
|
56
|
+
_ref2$showBorder = _ref2.showBorder,
|
|
57
|
+
showBorder = _ref2$showBorder === void 0 ? false : _ref2$showBorder,
|
|
58
|
+
_ref2$size = _ref2.size,
|
|
59
|
+
size = _ref2$size === void 0 ? 'medium' : _ref2$size;
|
|
60
|
+
var accountId = parseIdentityAccountId(agentIdentityAccountId);
|
|
61
|
+
if (!accountId) {
|
|
62
|
+
return fallback;
|
|
63
|
+
}
|
|
64
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
65
|
+
fallback: fallback
|
|
66
|
+
}, /*#__PURE__*/React.createElement(Suspense, {
|
|
67
|
+
fallback: /*#__PURE__*/React.createElement(AvatarSkeleton, {
|
|
68
|
+
appearance: "hexagon",
|
|
69
|
+
size: size
|
|
70
|
+
})
|
|
71
|
+
}, /*#__PURE__*/React.createElement(FetchedAgentAvatar, {
|
|
72
|
+
accountId: accountId,
|
|
73
|
+
agentName: agentName,
|
|
74
|
+
fallback: fallback,
|
|
75
|
+
showBorder: showBorder,
|
|
76
|
+
size: size
|
|
77
|
+
})));
|
|
78
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated SignedSource<<765322731b31afdb0584c134ed53e12a>>
|
|
3
|
+
* @relayHash 07c2f9612a7a8401a21c6ad1a0936b2d
|
|
4
|
+
* @lightSyntaxTransform
|
|
5
|
+
* @nogrep
|
|
6
|
+
* @codegen-command: yarn relay
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/* tslint:disable */
|
|
10
|
+
/* eslint-disable */
|
|
11
|
+
// @ts-nocheck
|
|
12
|
+
|
|
13
|
+
// @relayRequestID aa69c7a83a201b1f2a5cdca116d15f149410a79d7ce49e3fafb7ce1e4a4e38d5
|
|
14
|
+
|
|
15
|
+
var node = function () {
|
|
16
|
+
var v0 = [{
|
|
17
|
+
"defaultValue": null,
|
|
18
|
+
"kind": "LocalArgument",
|
|
19
|
+
"name": "accountId"
|
|
20
|
+
}],
|
|
21
|
+
v1 = [{
|
|
22
|
+
"kind": "Variable",
|
|
23
|
+
"name": "accountId",
|
|
24
|
+
"variableName": "accountId"
|
|
25
|
+
}],
|
|
26
|
+
v2 = {
|
|
27
|
+
"kind": "ScalarField",
|
|
28
|
+
"name": "name"
|
|
29
|
+
},
|
|
30
|
+
v3 = {
|
|
31
|
+
"kind": "ScalarField",
|
|
32
|
+
"name": "picture"
|
|
33
|
+
};
|
|
34
|
+
return {
|
|
35
|
+
"fragment": {
|
|
36
|
+
"argumentDefinitions": v0 /*: any*/,
|
|
37
|
+
"kind": "Fragment",
|
|
38
|
+
"name": "ResolvedAgentAvatarQuery",
|
|
39
|
+
"selections": [{
|
|
40
|
+
"args": v1 /*: any*/,
|
|
41
|
+
"kind": "LinkedField",
|
|
42
|
+
"name": "user",
|
|
43
|
+
"plural": false,
|
|
44
|
+
"selections": [v2 /*: any*/, v3 /*: any*/]
|
|
45
|
+
}],
|
|
46
|
+
"type": "Query"
|
|
47
|
+
},
|
|
48
|
+
"kind": "Request",
|
|
49
|
+
"operation": {
|
|
50
|
+
"argumentDefinitions": v0 /*: any*/,
|
|
51
|
+
"kind": "Operation",
|
|
52
|
+
"name": "ResolvedAgentAvatarQuery",
|
|
53
|
+
"selections": [{
|
|
54
|
+
"args": v1 /*: any*/,
|
|
55
|
+
"kind": "LinkedField",
|
|
56
|
+
"name": "user",
|
|
57
|
+
"plural": false,
|
|
58
|
+
"selections": [{
|
|
59
|
+
"kind": "ScalarField",
|
|
60
|
+
"name": "__typename"
|
|
61
|
+
}, v2 /*: any*/, v3 /*: any*/, {
|
|
62
|
+
"kind": "ScalarField",
|
|
63
|
+
"name": "id"
|
|
64
|
+
}]
|
|
65
|
+
}]
|
|
66
|
+
},
|
|
67
|
+
"params": {
|
|
68
|
+
"id": "aa69c7a83a201b1f2a5cdca116d15f149410a79d7ce49e3fafb7ce1e4a4e38d5",
|
|
69
|
+
"metadata": {},
|
|
70
|
+
"name": "ResolvedAgentAvatarQuery",
|
|
71
|
+
"operationKind": "query",
|
|
72
|
+
"text": null
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}();
|
|
76
|
+
node.hash = "a2c97e7ac7feca789629a3b50c6150aa";
|
|
77
|
+
export default node;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SizeType } from '@atlaskit/avatar/types';
|
|
3
|
+
/**
|
|
4
|
+
* The best avatar available for an agent identity: the real account picture when one can be
|
|
5
|
+
* fetched, otherwise the caller-supplied `fallback`. Works for any identity with an
|
|
6
|
+
* `agentIdentityAccountId` — including the default Rovo agent, now that Rovo is provisioned its
|
|
7
|
+
* own identity account. A `Suspense` skeleton bridges the fetch, and an `ErrorBoundary` keeps a
|
|
8
|
+
* failed or unavailable fetch from ever breaking the caller — it just renders `fallback`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ResolvedAgentAvatar: ({ agentIdentityAccountId, agentName, fallback, showBorder, size, }: {
|
|
11
|
+
agentIdentityAccountId?: string | null;
|
|
12
|
+
agentName?: string;
|
|
13
|
+
/** Rendered when there's no account id, no picture on file, or the fetch fails. */
|
|
14
|
+
fallback: React.JSX.Element;
|
|
15
|
+
/** Border/background treatment for the fetched picture, matching `AgentAvatar`'s own prop. */
|
|
16
|
+
showBorder?: boolean;
|
|
17
|
+
size?: SizeType;
|
|
18
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated SignedSource<<765322731b31afdb0584c134ed53e12a>>
|
|
3
|
+
* @relayHash 07c2f9612a7a8401a21c6ad1a0936b2d
|
|
4
|
+
* @lightSyntaxTransform
|
|
5
|
+
* @nogrep
|
|
6
|
+
* @codegen-command: yarn relay
|
|
7
|
+
*/
|
|
8
|
+
import type { ConcreteRequest } from 'relay-runtime';
|
|
9
|
+
export type ResolvedAgentAvatarQuery$variables = {
|
|
10
|
+
accountId: string;
|
|
11
|
+
};
|
|
12
|
+
export type ResolvedAgentAvatarQuery$data = {
|
|
13
|
+
readonly user: {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly picture: AGG$URL;
|
|
16
|
+
} | null;
|
|
17
|
+
};
|
|
18
|
+
export type ResolvedAgentAvatarQuery = {
|
|
19
|
+
response: ResolvedAgentAvatarQuery$data;
|
|
20
|
+
variables: ResolvedAgentAvatarQuery$variables;
|
|
21
|
+
};
|
|
22
|
+
declare const node: ConcreteRequest;
|
|
23
|
+
export default node;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/rovo-agent-components",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.12.1",
|
|
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": {
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
},
|
|
14
14
|
"team": "Rovo Agents",
|
|
15
15
|
"website": {
|
|
16
|
+
"tags": [
|
|
17
|
+
"platform-labs"
|
|
18
|
+
],
|
|
16
19
|
"name": "RovoAgentComponents",
|
|
17
20
|
"category": "Components"
|
|
18
21
|
}
|
|
@@ -49,12 +52,13 @@
|
|
|
49
52
|
"@atlaskit/rovo-agent-analytics": "^6.4.0",
|
|
50
53
|
"@atlaskit/skeleton": "^4.4.0",
|
|
51
54
|
"@atlaskit/spinner": "^20.4.0",
|
|
52
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
53
|
-
"@atlaskit/tokens": "^
|
|
55
|
+
"@atlaskit/tmp-editor-statsig": "^199.0.0",
|
|
56
|
+
"@atlaskit/tokens": "^18.0.0",
|
|
54
57
|
"@atlaskit/tooltip": "^24.3.0",
|
|
55
58
|
"@babel/runtime": "^7.0.0",
|
|
56
59
|
"@compiled/react": "^1.0.2",
|
|
57
60
|
"react-dom": "^18.2.0",
|
|
61
|
+
"react-error-boundary": "^3.1.3",
|
|
58
62
|
"react-magnetic-di": "^3.1.4",
|
|
59
63
|
"react-relay": "^20.1.1"
|
|
60
64
|
},
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/rovo-agent-components/ui/agent-avatar/ResolvedAgentAvatar",
|
|
3
|
+
"main": "../../../dist/cjs/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.js",
|
|
4
|
+
"module": "../../../dist/esm/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.js",
|
|
5
|
+
"module:es2019": "../../../dist/es2019/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../../../dist/types/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.d.ts"
|
|
10
|
+
}
|