@atlaskit/rovo-agent-components 8.10.6 → 8.12.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.
Files changed (111) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/agent-conversation-starters/package.json +10 -0
  3. package/conversation-starters/package.json +10 -0
  4. package/dist/cjs/common/ui/agent-chat-icon/index.js +1 -1
  5. package/dist/cjs/common/ui/chat-pill/index.js +1 -1
  6. package/dist/cjs/common/ui/link-icon-button/index.js +1 -1
  7. package/dist/cjs/common/ui/star-icon-button/index.js +1 -1
  8. package/dist/cjs/index.js +8 -6
  9. package/dist/cjs/ui/agent-avatar/agent-avatar-skeleton/index.js +1 -1
  10. package/dist/cjs/ui/agent-avatar/generated-avatars/assets/content-reviewer.js +73 -0
  11. package/dist/cjs/ui/agent-avatar/generated-avatars/index.js +16 -1
  12. package/dist/cjs/ui/agent-avatar/index.js +1 -1
  13. package/dist/cjs/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.js +88 -0
  14. package/dist/cjs/ui/agent-avatar/resolved-agent-avatar/__generated__/ResolvedAgentAvatarQuery.graphql.js +83 -0
  15. package/dist/cjs/ui/agent-conversation-starters/AgentConversationStarters.js +44 -0
  16. package/dist/cjs/ui/agent-conversation-starters/ConversationStarters.js +78 -0
  17. package/dist/cjs/ui/agent-conversation-starters/getConversationStarters.js +49 -0
  18. package/dist/cjs/ui/agent-conversation-starters/index.js +21 -149
  19. package/dist/cjs/ui/agent-dropdown-menu/AgentDropdownMenu.js +223 -0
  20. package/dist/cjs/ui/agent-dropdown-menu/ChatToAgentButton.js +46 -0
  21. package/dist/cjs/ui/agent-dropdown-menu/index.js +14 -249
  22. package/dist/cjs/ui/agent-menu-item-skeleton/index.js +1 -1
  23. package/dist/cjs/ui/agent-name-side-nav/index.js +1 -1
  24. package/dist/cjs/ui/agent-profile-info/agent-star-count/index.js +1 -1
  25. package/dist/cjs/ui/agent-profile-info/index.js +1 -1
  26. package/dist/cjs/ui/agent-verified/agent-verified-icon.js +40 -0
  27. package/dist/cjs/ui/agent-verified/agent-verified.js +22 -0
  28. package/dist/cjs/ui/agent-verified/agent-verified.stories.js +6 -6
  29. package/dist/cjs/ui/agent-verified/index.js +13 -47
  30. package/dist/es2019/common/ui/agent-chat-icon/index.js +1 -1
  31. package/dist/es2019/common/ui/chat-pill/index.js +1 -1
  32. package/dist/es2019/common/ui/link-icon-button/index.js +1 -1
  33. package/dist/es2019/common/ui/star-icon-button/index.js +1 -1
  34. package/dist/es2019/index.js +4 -2
  35. package/dist/es2019/ui/agent-avatar/agent-avatar-skeleton/index.js +1 -1
  36. package/dist/es2019/ui/agent-avatar/generated-avatars/assets/content-reviewer.js +65 -0
  37. package/dist/es2019/ui/agent-avatar/generated-avatars/index.js +10 -1
  38. package/dist/es2019/ui/agent-avatar/index.js +1 -1
  39. package/dist/es2019/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.js +78 -0
  40. package/dist/es2019/ui/agent-avatar/resolved-agent-avatar/__generated__/ResolvedAgentAvatarQuery.graphql.js +77 -0
  41. package/dist/es2019/ui/agent-conversation-starters/AgentConversationStarters.js +30 -0
  42. package/dist/es2019/ui/agent-conversation-starters/ConversationStarters.js +67 -0
  43. package/dist/es2019/ui/agent-conversation-starters/getConversationStarters.js +42 -0
  44. package/dist/es2019/ui/agent-conversation-starters/index.js +20 -136
  45. package/dist/es2019/ui/agent-dropdown-menu/AgentDropdownMenu.js +160 -0
  46. package/dist/es2019/ui/agent-dropdown-menu/ChatToAgentButton.js +39 -0
  47. package/dist/es2019/ui/agent-dropdown-menu/index.js +14 -192
  48. package/dist/es2019/ui/agent-menu-item-skeleton/index.js +1 -1
  49. package/dist/es2019/ui/agent-name-side-nav/index.js +1 -1
  50. package/dist/es2019/ui/agent-profile-info/agent-star-count/index.js +1 -1
  51. package/dist/es2019/ui/agent-profile-info/index.js +1 -1
  52. package/dist/es2019/ui/agent-verified/agent-verified-icon.js +34 -0
  53. package/dist/es2019/ui/agent-verified/agent-verified.js +16 -0
  54. package/dist/es2019/ui/agent-verified/agent-verified.stories.js +2 -2
  55. package/dist/es2019/ui/agent-verified/index.js +11 -48
  56. package/dist/esm/common/ui/agent-chat-icon/index.js +1 -1
  57. package/dist/esm/common/ui/chat-pill/index.js +1 -1
  58. package/dist/esm/common/ui/link-icon-button/index.js +1 -1
  59. package/dist/esm/common/ui/star-icon-button/index.js +1 -1
  60. package/dist/esm/index.js +4 -2
  61. package/dist/esm/ui/agent-avatar/agent-avatar-skeleton/index.js +1 -1
  62. package/dist/esm/ui/agent-avatar/generated-avatars/assets/content-reviewer.js +66 -0
  63. package/dist/esm/ui/agent-avatar/generated-avatars/index.js +14 -1
  64. package/dist/esm/ui/agent-avatar/index.js +1 -1
  65. package/dist/esm/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.js +78 -0
  66. package/dist/esm/ui/agent-avatar/resolved-agent-avatar/__generated__/ResolvedAgentAvatarQuery.graphql.js +77 -0
  67. package/dist/esm/ui/agent-conversation-starters/AgentConversationStarters.js +35 -0
  68. package/dist/esm/ui/agent-conversation-starters/ConversationStarters.js +71 -0
  69. package/dist/esm/ui/agent-conversation-starters/getConversationStarters.js +42 -0
  70. package/dist/esm/ui/agent-conversation-starters/index.js +20 -145
  71. package/dist/esm/ui/agent-dropdown-menu/AgentDropdownMenu.js +214 -0
  72. package/dist/esm/ui/agent-dropdown-menu/ChatToAgentButton.js +37 -0
  73. package/dist/esm/ui/agent-dropdown-menu/index.js +14 -244
  74. package/dist/esm/ui/agent-menu-item-skeleton/index.js +1 -1
  75. package/dist/esm/ui/agent-name-side-nav/index.js +1 -1
  76. package/dist/esm/ui/agent-profile-info/agent-star-count/index.js +1 -1
  77. package/dist/esm/ui/agent-profile-info/index.js +1 -1
  78. package/dist/esm/ui/agent-verified/agent-verified-icon.js +33 -0
  79. package/dist/esm/ui/agent-verified/agent-verified.js +15 -0
  80. package/dist/esm/ui/agent-verified/agent-verified.stories.js +2 -2
  81. package/dist/esm/ui/agent-verified/index.js +11 -46
  82. package/dist/types/index.d.ts +7 -2
  83. package/dist/types/ui/agent-avatar/generated-avatars/assets/content-reviewer.d.ts +8 -0
  84. package/dist/types/ui/agent-avatar/resolved-agent-avatar/ResolvedAgentAvatar.d.ts +18 -0
  85. package/dist/types/ui/agent-avatar/resolved-agent-avatar/__generated__/ResolvedAgentAvatarQuery.graphql.d.ts +23 -0
  86. package/dist/types/ui/agent-conversation-starters/AgentConversationStarters.d.ts +8 -0
  87. package/dist/types/ui/agent-conversation-starters/ConversationStarters.d.ts +11 -0
  88. package/dist/types/ui/agent-conversation-starters/getConversationStarters.d.ts +14 -0
  89. package/dist/types/ui/agent-conversation-starters/index.d.ts +14 -27
  90. package/dist/types/ui/agent-dropdown-menu/AgentDropdownMenu.d.ts +57 -0
  91. package/dist/types/ui/agent-dropdown-menu/ChatToAgentButton.d.ts +10 -0
  92. package/dist/types/ui/agent-dropdown-menu/index.d.ts +8 -58
  93. package/dist/types/ui/agent-verified/agent-verified-icon.d.ts +3 -0
  94. package/dist/types/ui/agent-verified/agent-verified.d.ts +13 -0
  95. package/dist/types/ui/agent-verified/index.d.ts +10 -14
  96. package/get-conversation-starters/package.json +10 -0
  97. package/package.json +3 -2
  98. package/ui/agent-avatar/ResolvedAgentAvatar/package.json +10 -0
  99. package/ui/agent-dropdown-menu/agent-dropdown-menu/package.json +10 -0
  100. package/ui/agent-dropdown-menu/chat-to-agent-button/package.json +10 -0
  101. package/ui/agent-verified/agent-verified/package.json +10 -0
  102. package/ui/agent-verified/agent-verified-icon/package.json +10 -0
  103. /package/dist/cjs/ui/agent-conversation-starters/{index.compiled.css → ConversationStarters.compiled.css} +0 -0
  104. /package/dist/cjs/ui/agent-dropdown-menu/{index.compiled.css → ChatToAgentButton.compiled.css} +0 -0
  105. /package/dist/cjs/ui/agent-verified/{index.compiled.css → agent-verified-icon.compiled.css} +0 -0
  106. /package/dist/es2019/ui/agent-conversation-starters/{index.compiled.css → ConversationStarters.compiled.css} +0 -0
  107. /package/dist/es2019/ui/agent-dropdown-menu/{index.compiled.css → ChatToAgentButton.compiled.css} +0 -0
  108. /package/dist/es2019/ui/agent-verified/{index.compiled.css → agent-verified-icon.compiled.css} +0 -0
  109. /package/dist/esm/ui/agent-conversation-starters/{index.compiled.css → ConversationStarters.compiled.css} +0 -0
  110. /package/dist/esm/ui/agent-dropdown-menu/{index.compiled.css → ChatToAgentButton.compiled.css} +0 -0
  111. /package/dist/esm/ui/agent-verified/{index.compiled.css → agent-verified-icon.compiled.css} +0 -0
@@ -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,35 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["userDefinedConversationStarters", "isAgentDefault"];
4
+ import React, { useMemo } from 'react';
5
+ import { useIntl } from 'react-intl';
6
+ import { ConversationStarters } from './ConversationStarters';
7
+ import { getConversationStarters } from './getConversationStarters';
8
+ export var AgentConversationStarters = function AgentConversationStarters(_ref) {
9
+ var userDefinedConversationStarters = _ref.userDefinedConversationStarters,
10
+ isAgentDefault = _ref.isAgentDefault,
11
+ props = _objectWithoutProperties(_ref, _excluded);
12
+ var _useIntl = useIntl(),
13
+ formatMessage = _useIntl.formatMessage;
14
+ var _useMemo = useMemo(function () {
15
+ return getConversationStarters({
16
+ userDefinedConversationStarters: userDefinedConversationStarters,
17
+ isAgentDefault: isAgentDefault
18
+ });
19
+ }, [userDefinedConversationStarters, isAgentDefault]),
20
+ combinedConversationStarters = _useMemo.combinedConversationStarters;
21
+ var starters = useMemo(function () {
22
+ return combinedConversationStarters.map(function (starter) {
23
+ return typeof starter.message === 'string' ? {
24
+ message: starter.message,
25
+ type: starter.type
26
+ } : {
27
+ message: formatMessage(starter.message),
28
+ type: starter.type
29
+ };
30
+ });
31
+ }, [combinedConversationStarters, formatMessage]);
32
+ return /*#__PURE__*/React.createElement(ConversationStarters, _extends({
33
+ starters: starters
34
+ }, props));
35
+ };
@@ -0,0 +1,71 @@
1
+ /* ConversationStarters.tsx generated by @compiled/babel-plugin v3.0.2 */
2
+ import "./ConversationStarters.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
4
+ import React from 'react';
5
+ import IconButton from '@atlaskit/button/icon/button';
6
+ import { cx } from '@atlaskit/css';
7
+ import RetryIcon from '@atlaskit/icon/core/retry';
8
+ import { Box, Inline, Pressable, Stack } from '@atlaskit/primitives/compiled';
9
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
10
+ import { AgentChatIcon } from '../../common/ui/agent-chat-icon';
11
+ import { BrowseAgentsPill } from '../../common/ui/chat-pill';
12
+ var styles = {
13
+ conversationStartersList: "_qtt8glyw _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1bsb1osq",
14
+ conversationStartersListWithRefreshDesign: "_19pkze3t",
15
+ conversationStaterItem: "_ca0qze3t",
16
+ conversationStarterIcon: "_1o9zidpf",
17
+ conversationStarterText: "_1reo15vq _18m915vq _1bto1l2s _o5721q9c _1o9zkb7n _1ul9idpf",
18
+ button: "_11c8fhey _2rko12b0 _v564k6bl _syazazsu _ca0q12x7 _u5f312x7 _n3td12x7 _19bv12x7 _k48p1wq8 _1bto1l2s _o5721q9c _1o9zkb7n _1bsb1osq _bfhksm61 _irr31dpa _1ggl5xtf _1di6fcek",
19
+ button_motion: "_11c8fhey _2rko12b0 _v564k6bl _syazazsu _ca0q12x7 _u5f312x7 _n3td12x7 _19bv12x7 _k48p1wq8 _1bto1l2s _o5721q9c _1o9zkb7n _1bsb1osq _bfhksm61 _irr31dpa _1ggl5xtf _1di6fcek"
20
+ };
21
+ export var ConversationStarters = function ConversationStarters(_ref) {
22
+ var starters = _ref.starters,
23
+ onConversationStarterClick = _ref.onConversationStarterClick,
24
+ _ref$showReloadButton = _ref.showReloadButton,
25
+ showReloadButton = _ref$showReloadButton === void 0 ? false : _ref$showReloadButton,
26
+ _ref$onReloadButtonCl = _ref.onReloadButtonClick,
27
+ onReloadButtonClick = _ref$onReloadButtonCl === void 0 ? function () {} : _ref$onReloadButtonCl,
28
+ onBrowseAgentsClick = _ref.onBrowseAgentsClick,
29
+ _ref$refreshDesignEna = _ref.refreshDesignEnabled,
30
+ refreshDesignEnabled = _ref$refreshDesignEna === void 0 ? false : _ref$refreshDesignEna;
31
+ return /*#__PURE__*/React.createElement(Stack, {
32
+ as: "ul",
33
+ space: "space.050",
34
+ xcss: cx(styles.conversationStartersList, refreshDesignEnabled && styles.conversationStartersListWithRefreshDesign)
35
+ }, starters.map(function (starter, index) {
36
+ var isLastStarter = index === starters.length - 1;
37
+ var chatPill = /*#__PURE__*/React.createElement(Box, {
38
+ as: "li",
39
+ key: starter.message,
40
+ xcss: refreshDesignEnabled && styles.conversationStaterItem
41
+ }, /*#__PURE__*/React.createElement(Pressable, {
42
+ xcss: fg('platform-dst-motion-uplift-custom-button') ? styles.button_motion : styles.button,
43
+ onClick: function onClick() {
44
+ return onConversationStarterClick(starter);
45
+ },
46
+ testId: "conversation-starter"
47
+ }, /*#__PURE__*/React.createElement(Inline, {
48
+ space: "space.150",
49
+ alignBlock: "center"
50
+ }, /*#__PURE__*/React.createElement(Box, {
51
+ xcss: styles.conversationStarterIcon
52
+ }, /*#__PURE__*/React.createElement(AgentChatIcon, null)), /*#__PURE__*/React.createElement(Box, {
53
+ xcss: styles.conversationStarterText
54
+ }, starter.message))));
55
+ return isLastStarter && showReloadButton ? /*#__PURE__*/React.createElement(Inline, {
56
+ space: "space.050",
57
+ grow: "fill",
58
+ alignInline: "end",
59
+ key: starter.message
60
+ }, chatPill, /*#__PURE__*/React.createElement(IconButton, {
61
+ icon: RetryIcon,
62
+ onClick: onReloadButtonClick,
63
+ appearance: "subtle",
64
+ label: ""
65
+ })) : chatPill;
66
+ }), !!onBrowseAgentsClick && /*#__PURE__*/React.createElement(Box, {
67
+ as: "li"
68
+ }, /*#__PURE__*/React.createElement(BrowseAgentsPill, {
69
+ onClick: onBrowseAgentsClick
70
+ })));
71
+ };
@@ -0,0 +1,42 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import { messages } from './messages';
3
+ export var getConversationStarters = function getConversationStarters(_ref) {
4
+ var userDefinedConversationStartersParam = _ref.userDefinedConversationStarters,
5
+ isAgentDefault = _ref.isAgentDefault;
6
+ var type = 'static';
7
+ var customAgentConversationStarters = [{
8
+ message: messages.agentEmptyStateSuggestion1,
9
+ type: type
10
+ }, {
11
+ message: messages.agentEmptyStateSuggestion2,
12
+ type: type
13
+ }, {
14
+ message: messages.agentEmptyStateSuggestion3,
15
+ type: type
16
+ }];
17
+ var userDefinedConversationStarters = userDefinedConversationStartersParam !== null && userDefinedConversationStartersParam !== void 0 ? userDefinedConversationStartersParam : [];
18
+ var defaultAgentConversationStarters = [{
19
+ message: messages.emptyStateSuggestion1,
20
+ type: type
21
+ }, {
22
+ message: messages.emptyStateSuggestion2,
23
+ type: type
24
+ }, {
25
+ message: messages.emptyStateSuggestion3,
26
+ type: type
27
+ }];
28
+ var getCombinedConversationStarters = function getCombinedConversationStarters() {
29
+ var shouldCombine = !isAgentDefault;
30
+ if (shouldCombine) {
31
+ // Return user defined suggestions + static fallback suggestions with a max of 3 suggestions (user defined taking precendence over fallback)
32
+ return [].concat(_toConsumableArray(userDefinedConversationStarters), customAgentConversationStarters).slice(0, 3);
33
+ }
34
+ return defaultAgentConversationStarters;
35
+ };
36
+ return {
37
+ userDefinedConversationStarters: userDefinedConversationStarters,
38
+ customAgentConversationStarters: customAgentConversationStarters,
39
+ defaultAgentConversationStarters: defaultAgentConversationStarters,
40
+ combinedConversationStarters: getCombinedConversationStarters()
41
+ };
42
+ };
@@ -1,145 +1,20 @@
1
- /* index.tsx generated by @compiled/babel-plugin v3.0.1 */
2
- import _extends from "@babel/runtime/helpers/extends";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
5
- var _excluded = ["userDefinedConversationStarters", "isAgentDefault"];
6
- import "./index.compiled.css";
7
- import { ax, ix } from "@compiled/react/runtime";
8
- import React, { useMemo } from 'react';
9
- import { useIntl } from 'react-intl';
10
- import IconButton from '@atlaskit/button/icon/button';
11
- import { cx } from '@atlaskit/css';
12
- import RetryIcon from '@atlaskit/icon/core/retry';
13
- import { Box, Inline, Pressable, Stack } from '@atlaskit/primitives/compiled';
14
- import { fg } from '@atlaskit/platform-feature-flags/fg';
15
- import { AgentChatIcon } from '../../common/ui/agent-chat-icon';
16
- import { BrowseAgentsPill } from '../../common/ui/chat-pill';
17
- import { messages } from './messages';
18
- var styles = {
19
- conversationStartersList: "_qtt8glyw _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _1bsb1osq",
20
- conversationStartersListWithRefreshDesign: "_19pkze3t",
21
- conversationStaterItem: "_ca0qze3t",
22
- conversationStarterIcon: "_1o9zidpf",
23
- conversationStarterText: "_1reo15vq _18m915vq _1bto1l2s _o5721q9c _1o9zkb7n _1ul9idpf",
24
- button: "_11c8fhey _2rko12b0 _v564k6bl _syazazsu _ca0q12x7 _u5f312x7 _n3td12x7 _19bv12x7 _k48p1wq8 _1bto1l2s _o5721q9c _1o9zkb7n _1bsb1osq _bfhksm61 _irr31dpa _1ggl5xtf _1di6fcek",
25
- button_motion: "_11c8fhey _2rko12b0 _v564k6bl _syazazsu _ca0q12x7 _u5f312x7 _n3td12x7 _19bv12x7 _k48p1wq8 _1bto1l2s _o5721q9c _1o9zkb7n _1bsb1osq _bfhksm61 _irr31dpa _1ggl5xtf _1di6fcek"
26
- };
27
- export var getConversationStarters = function getConversationStarters(_ref) {
28
- var userDefinedConversationStartersParam = _ref.userDefinedConversationStarters,
29
- isAgentDefault = _ref.isAgentDefault;
30
- var type = 'static';
31
- var customAgentConversationStarters = [{
32
- message: messages.agentEmptyStateSuggestion1,
33
- type: type
34
- }, {
35
- message: messages.agentEmptyStateSuggestion2,
36
- type: type
37
- }, {
38
- message: messages.agentEmptyStateSuggestion3,
39
- type: type
40
- }];
41
- var userDefinedConversationStarters = userDefinedConversationStartersParam !== null && userDefinedConversationStartersParam !== void 0 ? userDefinedConversationStartersParam : [];
42
- var defaultAgentConversationStarters = [{
43
- message: messages.emptyStateSuggestion1,
44
- type: type
45
- }, {
46
- message: messages.emptyStateSuggestion2,
47
- type: type
48
- }, {
49
- message: messages.emptyStateSuggestion3,
50
- type: type
51
- }];
52
- var getCombinedConversationStarters = function getCombinedConversationStarters() {
53
- var shouldCombine = !isAgentDefault;
54
- if (shouldCombine) {
55
- // Return user defined suggestions + static fallback suggestions with a max of 3 suggestions (user defined taking precendence over fallback)
56
- return [].concat(_toConsumableArray(userDefinedConversationStarters), customAgentConversationStarters).slice(0, 3);
57
- }
58
- return defaultAgentConversationStarters;
59
- };
60
- return {
61
- userDefinedConversationStarters: userDefinedConversationStarters,
62
- customAgentConversationStarters: customAgentConversationStarters,
63
- defaultAgentConversationStarters: defaultAgentConversationStarters,
64
- combinedConversationStarters: getCombinedConversationStarters()
65
- };
66
- };
67
- export var AgentConversationStarters = function AgentConversationStarters(_ref2) {
68
- var userDefinedConversationStarters = _ref2.userDefinedConversationStarters,
69
- isAgentDefault = _ref2.isAgentDefault,
70
- props = _objectWithoutProperties(_ref2, _excluded);
71
- var _useIntl = useIntl(),
72
- formatMessage = _useIntl.formatMessage;
73
- var _useMemo = useMemo(function () {
74
- return getConversationStarters({
75
- userDefinedConversationStarters: userDefinedConversationStarters,
76
- isAgentDefault: isAgentDefault
77
- });
78
- }, [userDefinedConversationStarters, isAgentDefault]),
79
- combinedConversationStarters = _useMemo.combinedConversationStarters;
80
- var starters = useMemo(function () {
81
- return combinedConversationStarters.map(function (starter) {
82
- return typeof starter.message === 'string' ? {
83
- message: starter.message,
84
- type: starter.type
85
- } : {
86
- message: formatMessage(starter.message),
87
- type: starter.type
88
- };
89
- });
90
- }, [combinedConversationStarters, formatMessage]);
91
- return /*#__PURE__*/React.createElement(ConversationStarters, _extends({
92
- starters: starters
93
- }, props));
94
- };
95
- export var ConversationStarters = function ConversationStarters(_ref3) {
96
- var starters = _ref3.starters,
97
- onConversationStarterClick = _ref3.onConversationStarterClick,
98
- _ref3$showReloadButto = _ref3.showReloadButton,
99
- showReloadButton = _ref3$showReloadButto === void 0 ? false : _ref3$showReloadButto,
100
- _ref3$onReloadButtonC = _ref3.onReloadButtonClick,
101
- onReloadButtonClick = _ref3$onReloadButtonC === void 0 ? function () {} : _ref3$onReloadButtonC,
102
- onBrowseAgentsClick = _ref3.onBrowseAgentsClick,
103
- _ref3$refreshDesignEn = _ref3.refreshDesignEnabled,
104
- refreshDesignEnabled = _ref3$refreshDesignEn === void 0 ? false : _ref3$refreshDesignEn;
105
- return /*#__PURE__*/React.createElement(Stack, {
106
- as: "ul",
107
- space: "space.050",
108
- xcss: cx(styles.conversationStartersList, refreshDesignEnabled && styles.conversationStartersListWithRefreshDesign)
109
- }, starters.map(function (starter, index) {
110
- var isLastStarter = index === starters.length - 1;
111
- var chatPill = /*#__PURE__*/React.createElement(Box, {
112
- as: "li",
113
- key: starter.message,
114
- xcss: refreshDesignEnabled && styles.conversationStaterItem
115
- }, /*#__PURE__*/React.createElement(Pressable, {
116
- xcss: fg('platform-dst-motion-uplift-custom-button') ? styles.button_motion : styles.button,
117
- onClick: function onClick() {
118
- return onConversationStarterClick(starter);
119
- },
120
- testId: "conversation-starter"
121
- }, /*#__PURE__*/React.createElement(Inline, {
122
- space: "space.150",
123
- alignBlock: "center"
124
- }, /*#__PURE__*/React.createElement(Box, {
125
- xcss: styles.conversationStarterIcon
126
- }, /*#__PURE__*/React.createElement(AgentChatIcon, null)), /*#__PURE__*/React.createElement(Box, {
127
- xcss: styles.conversationStarterText
128
- }, starter.message))));
129
- return isLastStarter && showReloadButton ? /*#__PURE__*/React.createElement(Inline, {
130
- space: "space.050",
131
- grow: "fill",
132
- alignInline: "end",
133
- key: starter.message
134
- }, chatPill, /*#__PURE__*/React.createElement(IconButton, {
135
- icon: RetryIcon,
136
- onClick: onReloadButtonClick,
137
- appearance: "subtle",
138
- label: ""
139
- })) : chatPill;
140
- }), !!onBrowseAgentsClick && /*#__PURE__*/React.createElement(Box, {
141
- as: "li"
142
- }, /*#__PURE__*/React.createElement(BrowseAgentsPill, {
143
- onClick: onBrowseAgentsClick
144
- })));
145
- };
1
+ /* eslint-disable @repo/internal/deprecations/deprecation-ticket-required -- VOLTC-139 tracks removal of these deprecated re-export shims. */
2
+
3
+ /**
4
+ * @deprecated Use `import { getConversationStarters } from '@atlaskit/rovo-agent-components/get-conversation-starters'` instead.
5
+ */
6
+ // eslint-disable-next-line no-barrel-files/no-barrel-files -- VOLTC-139 tracks removal of this deprecated re-export shim.
7
+ export { getConversationStarters } from './getConversationStarters';
8
+ /**
9
+ * @deprecated Use `import { AgentConversationStarters } from '@atlaskit/rovo-agent-components/agent-conversation-starters'` instead.
10
+ */
11
+ // eslint-disable-next-line no-barrel-files/no-barrel-files -- VOLTC-139 tracks removal of this deprecated re-export shim.
12
+ export { AgentConversationStarters } from './AgentConversationStarters';
13
+ // eslint-disable-next-line no-barrel-files/no-barrel-files -- VOLTC-139 tracks removal of this deprecated re-export shim.
14
+
15
+ /**
16
+ * @deprecated Use `import { ConversationStarters } from '@atlaskit/rovo-agent-components/conversation-starters'` instead.
17
+ */
18
+ // eslint-disable-next-line no-barrel-files/no-barrel-files -- VOLTC-139 tracks removal of this deprecated re-export shim.
19
+ export { ConversationStarters } from './ConversationStarters';
20
+ // eslint-disable-next-line no-barrel-files/no-barrel-files -- VOLTC-139 tracks removal of this deprecated re-export shim.