@atlaskit/rovo-agent-components 8.12.3 → 8.13.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 +11 -0
- package/dist/cjs/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.compiled.css +4 -0
- package/dist/cjs/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.js +52 -16
- package/dist/es2019/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.compiled.css +4 -0
- package/dist/es2019/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.js +53 -16
- package/dist/esm/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.compiled.css +4 -0
- package/dist/esm/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.js +53 -16
- package/dist/types/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.d.ts +12 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/rovo-agent-components
|
|
2
2
|
|
|
3
|
+
## 8.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`241e671db5235`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/241e671db5235) -
|
|
8
|
+
`ResolvedAgentAvatar` now accepts either a bare account id or a full identity ARI for
|
|
9
|
+
`agentIdentityAccountId`, so callers that already have the bare id don't need to wrap it first.
|
|
10
|
+
`fallback` is now optional, defaulting to a generic hexagon `Avatar` built from `agentName` when a
|
|
11
|
+
caller has nothing more specific to show. The fetched picture now renders through `Avatar`
|
|
12
|
+
directly instead of the deprecated `AgentAvatar`.
|
|
13
|
+
|
|
3
14
|
## 8.12.3
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* ResolvedAgentAvatar.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -6,25 +7,37 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
7
|
value: true
|
|
7
8
|
});
|
|
8
9
|
exports.ResolvedAgentAvatar = void 0;
|
|
10
|
+
require("./ResolvedAgentAvatar.compiled.css");
|
|
11
|
+
var _runtime = require("@compiled/react/runtime");
|
|
9
12
|
var _ResolvedAgentAvatarQuery2 = _interopRequireDefault(require("./__generated__/ResolvedAgentAvatarQuery.graphql"));
|
|
10
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
14
|
var _reactErrorBoundary = require("react-error-boundary");
|
|
12
15
|
var _reactRelay = require("react-relay");
|
|
16
|
+
var _avatar = _interopRequireDefault(require("@atlaskit/avatar/avatar"));
|
|
17
|
+
var _avatarSizes = require("@atlaskit/avatar/avatar-sizes");
|
|
13
18
|
var _Skeleton = _interopRequireDefault(require("@atlaskit/avatar/Skeleton"));
|
|
14
|
-
var
|
|
19
|
+
var _box = require("@atlaskit/primitives/compiled/box");
|
|
15
20
|
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
|
-
|
|
17
|
-
|
|
21
|
+
var styles = {
|
|
22
|
+
showBorder: "_1e0c1txw _4cvr1h6o _1bah1h6o _bfhkvuon"
|
|
23
|
+
};
|
|
18
24
|
|
|
19
25
|
// The fixed partition/resource-owner/resource-type segments of an identity user ARI — only the
|
|
20
26
|
// account id itself varies. Matched by prefix rather than via `@atlassian/ari` (an internal
|
|
21
27
|
// package this public package can't depend on).
|
|
22
28
|
var IDENTITY_USER_ARI_PREFIX = 'ari:cloud:identity::user/';
|
|
23
29
|
|
|
24
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Parses the account id needed for the picture fetch from whatever identity a caller carries —
|
|
32
|
+
* either the bare account id, or the full identity ARI (callers that already have one on hand
|
|
33
|
+
* don't need to strip it first).
|
|
34
|
+
*/
|
|
25
35
|
var parseIdentityAccountId = function parseIdentityAccountId(value) {
|
|
26
36
|
var trimmed = value === null || value === void 0 ? void 0 : value.trim();
|
|
27
|
-
|
|
37
|
+
if (!trimmed) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
return trimmed.startsWith(IDENTITY_USER_ARI_PREFIX) ? trimmed.slice(IDENTITY_USER_ARI_PREFIX.length) : trimmed;
|
|
28
41
|
};
|
|
29
42
|
var FetchedAgentAvatar = function FetchedAgentAvatar(_ref) {
|
|
30
43
|
var _data$user, _data$user2;
|
|
@@ -43,21 +56,39 @@ var FetchedAgentAvatar = function FetchedAgentAvatar(_ref) {
|
|
|
43
56
|
return fallback;
|
|
44
57
|
}
|
|
45
58
|
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
|
-
|
|
47
|
-
|
|
59
|
+
if (!showBorder) {
|
|
60
|
+
return /*#__PURE__*/_react.default.createElement(_avatar.default, {
|
|
61
|
+
appearance: "hexagon",
|
|
62
|
+
src: picture,
|
|
63
|
+
name: name,
|
|
64
|
+
label: name,
|
|
65
|
+
size: size
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
69
|
+
testId: "resolved-agent-avatar-border",
|
|
70
|
+
xcss: styles.showBorder,
|
|
71
|
+
style: {
|
|
72
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
73
|
+
height: _avatarSizes.AVATAR_SIZES[size],
|
|
74
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
75
|
+
width: _avatarSizes.AVATAR_SIZES[size]
|
|
76
|
+
}
|
|
77
|
+
}, /*#__PURE__*/_react.default.createElement(_avatar.default, {
|
|
78
|
+
appearance: "hexagon",
|
|
79
|
+
src: picture,
|
|
48
80
|
name: name,
|
|
49
81
|
label: name,
|
|
50
|
-
showBorder: showBorder,
|
|
51
82
|
size: size
|
|
52
|
-
});
|
|
83
|
+
}));
|
|
53
84
|
};
|
|
54
85
|
|
|
55
86
|
/**
|
|
56
87
|
* The best avatar available for an agent identity: the real account picture when one can be
|
|
57
|
-
* fetched, otherwise
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
88
|
+
* fetched, otherwise `fallback`. Works for any identity with an `agentIdentityAccountId` —
|
|
89
|
+
* including the default Rovo agent, now that Rovo is provisioned its own identity account. A
|
|
90
|
+
* `Suspense` skeleton bridges the fetch, and an `ErrorBoundary` keeps a failed or unavailable
|
|
91
|
+
* fetch from ever breaking the caller — it just renders `fallback`.
|
|
61
92
|
*/
|
|
62
93
|
var ResolvedAgentAvatar = exports.ResolvedAgentAvatar = function ResolvedAgentAvatar(_ref2) {
|
|
63
94
|
var agentIdentityAccountId = _ref2.agentIdentityAccountId,
|
|
@@ -67,12 +98,17 @@ var ResolvedAgentAvatar = exports.ResolvedAgentAvatar = function ResolvedAgentAv
|
|
|
67
98
|
showBorder = _ref2$showBorder === void 0 ? false : _ref2$showBorder,
|
|
68
99
|
_ref2$size = _ref2.size,
|
|
69
100
|
size = _ref2$size === void 0 ? 'medium' : _ref2$size;
|
|
101
|
+
var resolvedFallback = fallback !== null && fallback !== void 0 ? fallback : /*#__PURE__*/_react.default.createElement(_avatar.default, {
|
|
102
|
+
appearance: "hexagon",
|
|
103
|
+
name: agentName,
|
|
104
|
+
size: size
|
|
105
|
+
});
|
|
70
106
|
var accountId = parseIdentityAccountId(agentIdentityAccountId);
|
|
71
107
|
if (!accountId) {
|
|
72
|
-
return
|
|
108
|
+
return resolvedFallback;
|
|
73
109
|
}
|
|
74
110
|
return /*#__PURE__*/_react.default.createElement(_reactErrorBoundary.ErrorBoundary, {
|
|
75
|
-
fallback:
|
|
111
|
+
fallback: resolvedFallback
|
|
76
112
|
}, /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
77
113
|
fallback: /*#__PURE__*/_react.default.createElement(_Skeleton.default, {
|
|
78
114
|
appearance: "hexagon",
|
|
@@ -81,7 +117,7 @@ var ResolvedAgentAvatar = exports.ResolvedAgentAvatar = function ResolvedAgentAv
|
|
|
81
117
|
}, /*#__PURE__*/_react.default.createElement(FetchedAgentAvatar, {
|
|
82
118
|
accountId: accountId,
|
|
83
119
|
agentName: agentName,
|
|
84
|
-
fallback:
|
|
120
|
+
fallback: resolvedFallback,
|
|
85
121
|
showBorder: showBorder,
|
|
86
122
|
size: size
|
|
87
123
|
})));
|
|
@@ -1,20 +1,34 @@
|
|
|
1
|
+
/* ResolvedAgentAvatar.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
import "./ResolvedAgentAvatar.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
1
4
|
import _ResolvedAgentAvatarQuery from "./__generated__/ResolvedAgentAvatarQuery.graphql";
|
|
2
5
|
import React, { Suspense } from 'react';
|
|
3
6
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
4
7
|
import { graphql, useLazyLoadQuery } from 'react-relay';
|
|
8
|
+
import Avatar from '@atlaskit/avatar/avatar';
|
|
9
|
+
import { AVATAR_SIZES } from '@atlaskit/avatar/avatar-sizes';
|
|
5
10
|
import AvatarSkeleton from '@atlaskit/avatar/Skeleton';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
import { Box } from '@atlaskit/primitives/compiled/box';
|
|
12
|
+
const styles = {
|
|
13
|
+
showBorder: "_1e0c1txw _4cvr1h6o _1bah1h6o _bfhkvuon"
|
|
14
|
+
};
|
|
15
|
+
|
|
9
16
|
// The fixed partition/resource-owner/resource-type segments of an identity user ARI — only the
|
|
10
17
|
// account id itself varies. Matched by prefix rather than via `@atlassian/ari` (an internal
|
|
11
18
|
// package this public package can't depend on).
|
|
12
19
|
const IDENTITY_USER_ARI_PREFIX = 'ari:cloud:identity::user/';
|
|
13
20
|
|
|
14
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Parses the account id needed for the picture fetch from whatever identity a caller carries —
|
|
23
|
+
* either the bare account id, or the full identity ARI (callers that already have one on hand
|
|
24
|
+
* don't need to strip it first).
|
|
25
|
+
*/
|
|
15
26
|
const parseIdentityAccountId = value => {
|
|
16
27
|
const trimmed = value === null || value === void 0 ? void 0 : value.trim();
|
|
17
|
-
|
|
28
|
+
if (!trimmed) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
return trimmed.startsWith(IDENTITY_USER_ARI_PREFIX) ? trimmed.slice(IDENTITY_USER_ARI_PREFIX.length) : trimmed;
|
|
18
32
|
};
|
|
19
33
|
const FetchedAgentAvatar = ({
|
|
20
34
|
accountId,
|
|
@@ -34,21 +48,39 @@ const FetchedAgentAvatar = ({
|
|
|
34
48
|
return fallback;
|
|
35
49
|
}
|
|
36
50
|
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
|
-
|
|
38
|
-
|
|
51
|
+
if (!showBorder) {
|
|
52
|
+
return /*#__PURE__*/React.createElement(Avatar, {
|
|
53
|
+
appearance: "hexagon",
|
|
54
|
+
src: picture,
|
|
55
|
+
name: name,
|
|
56
|
+
label: name,
|
|
57
|
+
size: size
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
61
|
+
testId: "resolved-agent-avatar-border",
|
|
62
|
+
xcss: styles.showBorder,
|
|
63
|
+
style: {
|
|
64
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
65
|
+
height: AVATAR_SIZES[size],
|
|
66
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
67
|
+
width: AVATAR_SIZES[size]
|
|
68
|
+
}
|
|
69
|
+
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
70
|
+
appearance: "hexagon",
|
|
71
|
+
src: picture,
|
|
39
72
|
name: name,
|
|
40
73
|
label: name,
|
|
41
|
-
showBorder: showBorder,
|
|
42
74
|
size: size
|
|
43
|
-
});
|
|
75
|
+
}));
|
|
44
76
|
};
|
|
45
77
|
|
|
46
78
|
/**
|
|
47
79
|
* The best avatar available for an agent identity: the real account picture when one can be
|
|
48
|
-
* fetched, otherwise
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
80
|
+
* fetched, otherwise `fallback`. Works for any identity with an `agentIdentityAccountId` —
|
|
81
|
+
* including the default Rovo agent, now that Rovo is provisioned its own identity account. A
|
|
82
|
+
* `Suspense` skeleton bridges the fetch, and an `ErrorBoundary` keeps a failed or unavailable
|
|
83
|
+
* fetch from ever breaking the caller — it just renders `fallback`.
|
|
52
84
|
*/
|
|
53
85
|
export const ResolvedAgentAvatar = ({
|
|
54
86
|
agentIdentityAccountId,
|
|
@@ -57,12 +89,17 @@ export const ResolvedAgentAvatar = ({
|
|
|
57
89
|
showBorder = false,
|
|
58
90
|
size = 'medium'
|
|
59
91
|
}) => {
|
|
92
|
+
const resolvedFallback = fallback !== null && fallback !== void 0 ? fallback : /*#__PURE__*/React.createElement(Avatar, {
|
|
93
|
+
appearance: "hexagon",
|
|
94
|
+
name: agentName,
|
|
95
|
+
size: size
|
|
96
|
+
});
|
|
60
97
|
const accountId = parseIdentityAccountId(agentIdentityAccountId);
|
|
61
98
|
if (!accountId) {
|
|
62
|
-
return
|
|
99
|
+
return resolvedFallback;
|
|
63
100
|
}
|
|
64
101
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
65
|
-
fallback:
|
|
102
|
+
fallback: resolvedFallback
|
|
66
103
|
}, /*#__PURE__*/React.createElement(Suspense, {
|
|
67
104
|
fallback: /*#__PURE__*/React.createElement(AvatarSkeleton, {
|
|
68
105
|
appearance: "hexagon",
|
|
@@ -71,7 +108,7 @@ export const ResolvedAgentAvatar = ({
|
|
|
71
108
|
}, /*#__PURE__*/React.createElement(FetchedAgentAvatar, {
|
|
72
109
|
accountId: accountId,
|
|
73
110
|
agentName: agentName,
|
|
74
|
-
fallback:
|
|
111
|
+
fallback: resolvedFallback,
|
|
75
112
|
showBorder: showBorder,
|
|
76
113
|
size: size
|
|
77
114
|
})));
|
|
@@ -1,20 +1,34 @@
|
|
|
1
|
+
/* ResolvedAgentAvatar.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
import "./ResolvedAgentAvatar.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
1
4
|
import _ResolvedAgentAvatarQuery from "./__generated__/ResolvedAgentAvatarQuery.graphql";
|
|
2
5
|
import React, { Suspense } from 'react';
|
|
3
6
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
4
7
|
import { graphql, useLazyLoadQuery } from 'react-relay';
|
|
8
|
+
import Avatar from '@atlaskit/avatar/avatar';
|
|
9
|
+
import { AVATAR_SIZES } from '@atlaskit/avatar/avatar-sizes';
|
|
5
10
|
import AvatarSkeleton from '@atlaskit/avatar/Skeleton';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
import { Box } from '@atlaskit/primitives/compiled/box';
|
|
12
|
+
var styles = {
|
|
13
|
+
showBorder: "_1e0c1txw _4cvr1h6o _1bah1h6o _bfhkvuon"
|
|
14
|
+
};
|
|
15
|
+
|
|
9
16
|
// The fixed partition/resource-owner/resource-type segments of an identity user ARI — only the
|
|
10
17
|
// account id itself varies. Matched by prefix rather than via `@atlassian/ari` (an internal
|
|
11
18
|
// package this public package can't depend on).
|
|
12
19
|
var IDENTITY_USER_ARI_PREFIX = 'ari:cloud:identity::user/';
|
|
13
20
|
|
|
14
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Parses the account id needed for the picture fetch from whatever identity a caller carries —
|
|
23
|
+
* either the bare account id, or the full identity ARI (callers that already have one on hand
|
|
24
|
+
* don't need to strip it first).
|
|
25
|
+
*/
|
|
15
26
|
var parseIdentityAccountId = function parseIdentityAccountId(value) {
|
|
16
27
|
var trimmed = value === null || value === void 0 ? void 0 : value.trim();
|
|
17
|
-
|
|
28
|
+
if (!trimmed) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
return trimmed.startsWith(IDENTITY_USER_ARI_PREFIX) ? trimmed.slice(IDENTITY_USER_ARI_PREFIX.length) : trimmed;
|
|
18
32
|
};
|
|
19
33
|
var FetchedAgentAvatar = function FetchedAgentAvatar(_ref) {
|
|
20
34
|
var _data$user, _data$user2;
|
|
@@ -33,21 +47,39 @@ var FetchedAgentAvatar = function FetchedAgentAvatar(_ref) {
|
|
|
33
47
|
return fallback;
|
|
34
48
|
}
|
|
35
49
|
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
|
-
|
|
37
|
-
|
|
50
|
+
if (!showBorder) {
|
|
51
|
+
return /*#__PURE__*/React.createElement(Avatar, {
|
|
52
|
+
appearance: "hexagon",
|
|
53
|
+
src: picture,
|
|
54
|
+
name: name,
|
|
55
|
+
label: name,
|
|
56
|
+
size: size
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
60
|
+
testId: "resolved-agent-avatar-border",
|
|
61
|
+
xcss: styles.showBorder,
|
|
62
|
+
style: {
|
|
63
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
64
|
+
height: AVATAR_SIZES[size],
|
|
65
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values
|
|
66
|
+
width: AVATAR_SIZES[size]
|
|
67
|
+
}
|
|
68
|
+
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
69
|
+
appearance: "hexagon",
|
|
70
|
+
src: picture,
|
|
38
71
|
name: name,
|
|
39
72
|
label: name,
|
|
40
|
-
showBorder: showBorder,
|
|
41
73
|
size: size
|
|
42
|
-
});
|
|
74
|
+
}));
|
|
43
75
|
};
|
|
44
76
|
|
|
45
77
|
/**
|
|
46
78
|
* The best avatar available for an agent identity: the real account picture when one can be
|
|
47
|
-
* fetched, otherwise
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
79
|
+
* fetched, otherwise `fallback`. Works for any identity with an `agentIdentityAccountId` —
|
|
80
|
+
* including the default Rovo agent, now that Rovo is provisioned its own identity account. A
|
|
81
|
+
* `Suspense` skeleton bridges the fetch, and an `ErrorBoundary` keeps a failed or unavailable
|
|
82
|
+
* fetch from ever breaking the caller — it just renders `fallback`.
|
|
51
83
|
*/
|
|
52
84
|
export var ResolvedAgentAvatar = function ResolvedAgentAvatar(_ref2) {
|
|
53
85
|
var agentIdentityAccountId = _ref2.agentIdentityAccountId,
|
|
@@ -57,12 +89,17 @@ export var ResolvedAgentAvatar = function ResolvedAgentAvatar(_ref2) {
|
|
|
57
89
|
showBorder = _ref2$showBorder === void 0 ? false : _ref2$showBorder,
|
|
58
90
|
_ref2$size = _ref2.size,
|
|
59
91
|
size = _ref2$size === void 0 ? 'medium' : _ref2$size;
|
|
92
|
+
var resolvedFallback = fallback !== null && fallback !== void 0 ? fallback : /*#__PURE__*/React.createElement(Avatar, {
|
|
93
|
+
appearance: "hexagon",
|
|
94
|
+
name: agentName,
|
|
95
|
+
size: size
|
|
96
|
+
});
|
|
60
97
|
var accountId = parseIdentityAccountId(agentIdentityAccountId);
|
|
61
98
|
if (!accountId) {
|
|
62
|
-
return
|
|
99
|
+
return resolvedFallback;
|
|
63
100
|
}
|
|
64
101
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
65
|
-
fallback:
|
|
102
|
+
fallback: resolvedFallback
|
|
66
103
|
}, /*#__PURE__*/React.createElement(Suspense, {
|
|
67
104
|
fallback: /*#__PURE__*/React.createElement(AvatarSkeleton, {
|
|
68
105
|
appearance: "hexagon",
|
|
@@ -71,7 +108,7 @@ export var ResolvedAgentAvatar = function ResolvedAgentAvatar(_ref2) {
|
|
|
71
108
|
}, /*#__PURE__*/React.createElement(FetchedAgentAvatar, {
|
|
72
109
|
accountId: accountId,
|
|
73
110
|
agentName: agentName,
|
|
74
|
-
fallback:
|
|
111
|
+
fallback: resolvedFallback,
|
|
75
112
|
showBorder: showBorder,
|
|
76
113
|
size: size
|
|
77
114
|
})));
|
|
@@ -2,16 +2,22 @@ import React from 'react';
|
|
|
2
2
|
import type { SizeType } from '@atlaskit/avatar/types';
|
|
3
3
|
/**
|
|
4
4
|
* The best avatar available for an agent identity: the real account picture when one can be
|
|
5
|
-
* fetched, otherwise
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* fetched, otherwise `fallback`. Works for any identity with an `agentIdentityAccountId` —
|
|
6
|
+
* including the default Rovo agent, now that Rovo is provisioned its own identity account. A
|
|
7
|
+
* `Suspense` skeleton bridges the fetch, and an `ErrorBoundary` keeps a failed or unavailable
|
|
8
|
+
* fetch from ever breaking the caller — it just renders `fallback`.
|
|
9
9
|
*/
|
|
10
10
|
export declare const ResolvedAgentAvatar: ({ agentIdentityAccountId, agentName, fallback, showBorder, size, }: {
|
|
11
|
+
/** Either the bare account id or the full identity ARI — whichever the caller already has. */
|
|
11
12
|
agentIdentityAccountId?: string | null;
|
|
12
13
|
agentName?: string;
|
|
13
|
-
/**
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Rendered when there's no account id, no picture on file, or the fetch fails. Defaults to a
|
|
16
|
+
* generic hexagon `Avatar` (renders its own agent icon with no `src`) — pass an explicit
|
|
17
|
+
* `fallback` only when the caller has something more specific to show (e.g. its own
|
|
18
|
+
* already-known picture, or an `agentNamedId` for a generated illustration).
|
|
19
|
+
*/
|
|
20
|
+
fallback?: React.JSX.Element;
|
|
15
21
|
/** Border/background treatment for the fetched picture, matching `AgentAvatar`'s own prop. */
|
|
16
22
|
showBorder?: boolean;
|
|
17
23
|
size?: SizeType;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/rovo-agent-components",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.13.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": {
|