@atlaskit/smart-card 44.3.23 → 44.4.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 (76) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/__tests__/vr-tests/__snapshots__/block-card/vrblock-card-resolved-rovo-actions--default.png +3 -0
  3. package/dist/cjs/messages.js +10 -0
  4. package/dist/cjs/state/hooks/use-rovo-chat/index.js +1 -1
  5. package/dist/cjs/utils/analytics/analytics.js +1 -1
  6. package/dist/cjs/view/BlockCard/views/ResolvedView.js +17 -11
  7. package/dist/cjs/view/FlexibleCard/components/actions/action/action-button/index.compiled.css +4 -0
  8. package/dist/cjs/view/FlexibleCard/components/actions/action/action-button/index.js +10 -1
  9. package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js +1 -1
  10. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/index.js +1 -1
  11. package/dist/cjs/view/FlexibleCard/components/actions/copy-link-action/index.js +1 -1
  12. package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +2 -2
  13. package/dist/cjs/view/FlexibleCard/components/actions/rovo-chat-action/index.js +41 -26
  14. package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +29 -11
  15. package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/resolved/index.compiled.css +3 -1
  16. package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +25 -7
  17. package/dist/cjs/view/FlexibleCard/components/container/hover-card-control/index.js +3 -7
  18. package/dist/cjs/view/FlexibleCard/components/elements/common/base-badge-element/index.js +6 -2
  19. package/dist/cjs/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/lozenge-action-item/index.js +3 -7
  20. package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +4 -7
  21. package/dist/cjs/view/LinkUrl/index.js +1 -1
  22. package/dist/es2019/__tests__/vr-tests/__snapshots__/block-card/vrblock-card-resolved-rovo-actions--default.png +3 -0
  23. package/dist/es2019/messages.js +10 -0
  24. package/dist/es2019/state/hooks/use-rovo-chat/index.js +1 -1
  25. package/dist/es2019/utils/analytics/analytics.js +1 -1
  26. package/dist/es2019/view/BlockCard/views/ResolvedView.js +29 -21
  27. package/dist/es2019/view/FlexibleCard/components/actions/action/action-button/index.compiled.css +4 -0
  28. package/dist/es2019/view/FlexibleCard/components/actions/action/action-button/index.js +12 -3
  29. package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js +1 -1
  30. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/index.js +1 -1
  31. package/dist/es2019/view/FlexibleCard/components/actions/copy-link-action/index.js +1 -1
  32. package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +2 -2
  33. package/dist/es2019/view/FlexibleCard/components/actions/rovo-chat-action/index.js +41 -28
  34. package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +29 -12
  35. package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/resolved/index.compiled.css +3 -1
  36. package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +22 -8
  37. package/dist/es2019/view/FlexibleCard/components/container/hover-card-control/index.js +3 -7
  38. package/dist/es2019/view/FlexibleCard/components/elements/common/base-badge-element/index.js +5 -2
  39. package/dist/es2019/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/lozenge-action-item/index.js +3 -7
  40. package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +4 -7
  41. package/dist/es2019/view/LinkUrl/index.js +1 -1
  42. package/dist/esm/__tests__/vr-tests/__snapshots__/block-card/vrblock-card-resolved-rovo-actions--default.png +3 -0
  43. package/dist/esm/messages.js +10 -0
  44. package/dist/esm/state/hooks/use-rovo-chat/index.js +1 -1
  45. package/dist/esm/utils/analytics/analytics.js +1 -1
  46. package/dist/esm/view/BlockCard/views/ResolvedView.js +18 -12
  47. package/dist/esm/view/FlexibleCard/components/actions/action/action-button/index.compiled.css +4 -0
  48. package/dist/esm/view/FlexibleCard/components/actions/action/action-button/index.js +12 -3
  49. package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js +1 -1
  50. package/dist/esm/view/FlexibleCard/components/actions/automation-action/index.js +1 -1
  51. package/dist/esm/view/FlexibleCard/components/actions/copy-link-action/index.js +1 -1
  52. package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +2 -2
  53. package/dist/esm/view/FlexibleCard/components/actions/rovo-chat-action/index.js +42 -27
  54. package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +30 -12
  55. package/dist/esm/view/FlexibleCard/components/blocks/footer-block/resolved/index.compiled.css +3 -1
  56. package/dist/esm/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +26 -8
  57. package/dist/esm/view/FlexibleCard/components/container/hover-card-control/index.js +3 -7
  58. package/dist/esm/view/FlexibleCard/components/elements/common/base-badge-element/index.js +6 -2
  59. package/dist/esm/view/FlexibleCard/components/elements/common/base-lozenge-element/lozenge-action/lozenge-action-item/index.js +3 -7
  60. package/dist/esm/view/HoverCard/components/HoverCardComponent.js +4 -7
  61. package/dist/esm/view/LinkUrl/index.js +1 -1
  62. package/dist/types/messages.d.ts +1 -1
  63. package/dist/types/view/FlexibleCard/components/actions/action/types.d.ts +6 -1
  64. package/dist/types/view/FlexibleCard/components/blocks/action-group/index.d.ts +1 -1
  65. package/dist/types/view/FlexibleCard/components/blocks/action-group/types.d.ts +4 -0
  66. package/dist/types/view/FlexibleCard/components/blocks/footer-block/types.d.ts +4 -0
  67. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +7 -2
  68. package/dist/types/view/FlexibleCard/components/elements/common/base-badge-element/index.d.ts +5 -0
  69. package/dist/types-ts4.5/messages.d.ts +1 -1
  70. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/types.d.ts +6 -1
  71. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/action-group/index.d.ts +1 -1
  72. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/action-group/types.d.ts +4 -0
  73. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/footer-block/types.d.ts +4 -0
  74. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +7 -2
  75. package/dist/types-ts4.5/view/FlexibleCard/components/elements/common/base-badge-element/index.d.ts +5 -0
  76. package/package.json +5 -7
@@ -11,6 +11,7 @@ require("./index.compiled.css");
11
11
  var _runtime = require("@compiled/react/runtime");
12
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
13
  var _react = _interopRequireWildcard(require("react"));
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
15
  var _compiled = require("@atlaskit/primitives/compiled");
15
16
  var _constants = require("../../../../../../constants");
16
17
  var _messages = require("../../../../../../messages");
@@ -84,13 +85,16 @@ var BaseBadgeRefreshNew = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
84
85
  _ref$testId = _ref.testId,
85
86
  testId = _ref$testId === void 0 ? 'smart-element-badge' : _ref$testId,
86
87
  url = _ref.url,
87
- color = _ref.color;
88
+ color = _ref.color,
89
+ _ref$hideLabel = _ref.hideLabel,
90
+ hideLabel = _ref$hideLabel === void 0 ? false : _ref$hideLabel;
88
91
  var ui = (0, _flexibleUiContext.useFlexibleUiOptionContext)();
89
92
  var formattedMessageOrLabel = getFormattedMessageFromIcon(icon) || label;
90
93
  var badgeIcon = renderAtlaskitIcon(icon, testId) || renderImageIcon(url, testId, ui === null || ui === void 0 ? void 0 : ui.hideLoadingSkeleton);
91
94
  if (!formattedMessageOrLabel || !badgeIcon) {
92
95
  return null;
93
96
  }
97
+ var shouldHideLabel = hideLabel && (0, _platformFeatureFlags.fg)('platform_sl_3p_auth_rovo_block_card_kill_switch');
94
98
  return /*#__PURE__*/_react.default.createElement("span", {
95
99
  "data-smart-element": name,
96
100
  "data-smart-element-badge": true,
@@ -103,7 +107,7 @@ var BaseBadgeRefreshNew = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
103
107
  }, !hideIcon && /*#__PURE__*/_react.default.createElement(_compiled.Box, {
104
108
  as: "span",
105
109
  xcss: styles.icon
106
- }, badgeIcon), /*#__PURE__*/_react.default.createElement(_compiled.Box, {
110
+ }, badgeIcon), !shouldHideLabel && /*#__PURE__*/_react.default.createElement(_compiled.Box, {
107
111
  as: "span",
108
112
  testId: "".concat(testId, "-label"),
109
113
  xcss: styles.text
@@ -6,11 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
9
  var _react = _interopRequireWildcard(require("react"));
11
10
  var _dropdownMenu = require("@atlaskit/dropdown-menu");
12
11
  var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
13
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
12
  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); }
15
13
  var LozengeActionItem = function LozengeActionItem(_ref) {
16
14
  var appearance = _ref.appearance,
@@ -30,13 +28,11 @@ var LozengeActionItem = function LozengeActionItem(_ref) {
30
28
  var _e$currentTarget;
31
29
  (_e$currentTarget = e.currentTarget) === null || _e$currentTarget === void 0 || (_e$currentTarget = _e$currentTarget.firstElementChild) === null || _e$currentTarget === void 0 || _e$currentTarget.focus();
32
30
  }, []);
33
- return /*#__PURE__*/_react.default.createElement("span", (0, _extends2.default)({}, (0, _platformFeatureFlags.fg)('platform_sl_a11y_enghealth_46829') ? {
34
- onFocus: handleMouseEnter
35
- } : undefined, {
36
- // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
31
+ return /*#__PURE__*/_react.default.createElement("span", {
32
+ onFocus: handleMouseEnter,
37
33
  onMouseEnter: handleMouseEnter,
38
34
  role: "presentation"
39
- }), /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
35
+ }, /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
40
36
  onClick: handleClick,
41
37
  testId: testId
42
38
  }, /*#__PURE__*/_react.default.createElement(_lozenge.default, {
@@ -248,10 +248,7 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
248
248
  return /*#__PURE__*/_react.default.createElement("span", {
249
249
  ref: parentSpan
250
250
  }, /*#__PURE__*/_react.default.createElement("span", (0, _extends2.default)({}, triggerProps, {
251
- // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
252
- onMouseOver: initShowCard
253
- // eslint-disable-next-line @atlassian/a11y/mouse-events-have-key-events
254
- ,
251
+ onMouseOver: initShowCard,
255
252
  onMouseLeave: initHideCard,
256
253
  onMouseMove: setMousePosition,
257
254
  onKeyDown: (0, _platformFeatureFlags.fg)('fix_hover_card_on_focus_a11y') ? handleKeyDown : undefined,
@@ -260,11 +257,11 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
260
257
  "data-testid": HOVER_CARD_TRIGGER_WRAPPER
261
258
  }, (0, _experiments.editorExperiment)('platform_editor_preview_panel_linking_exp', true) ? {
262
259
  className: HOVER_CARD_TRIGGER_WRAPPER
263
- } : {}, (0, _platformFeatureFlags.fg)('platform_sl_a11y_enghealth_46829') ? {
260
+ } : {}, {
264
261
  onFocus: _utils.noop,
265
262
  onBlur: _utils.noop,
266
- role: 'none'
267
- } : undefined), children));
263
+ role: "none"
264
+ }), children));
268
265
  }, [children, initHideCard, initShowCard, onChildClick, onContextMenuClick, setMousePosition, handleKeyDown]);
269
266
  var popupComponent = (0, _react.useMemo)(
270
267
  // Within the Popup component, if shouldRenderToParent, the zIndex prop is ignored
@@ -22,7 +22,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
22
22
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
23
23
  var PACKAGE_DATA = {
24
24
  packageName: "@atlaskit/smart-card",
25
- packageVersion: "44.3.22",
25
+ packageVersion: "44.3.24",
26
26
  componentName: 'linkUrl'
27
27
  };
28
28
  var Anchor = (0, _click.withLinkClickedEvent)('a');
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f54ddd4636708cd0a4059a713a6a6bf3d0402d68a5aa2a69b7c430aa659fe8ef
3
+ size 25593
@@ -1001,6 +1001,16 @@ export const messages = defineMessages({
1001
1001
  defaultMessage: '<p>Look at this <a>{url}</a> and list any open questions, unresolved decisions, or asks that still need follow‑up. Group them by owner if possible and keep it concise.</p>',
1002
1002
  description: 'The prompt message to send to Rovo Chat. {url} refers to Smart Link that the user triggers this action from. (Please make sure all html tags remain the same.)'
1003
1003
  },
1004
+ rovo_prompt_button_key_highlights: {
1005
+ id: 'fabric.linking.rovo_prompt_button_find_open_questions.non-final',
1006
+ defaultMessage: `Key highlights`,
1007
+ description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
1008
+ },
1009
+ rovo_prompt_message_key_highlights: {
1010
+ id: 'fabric.linking.rovo_prompt_message_find_open_questions.non-final',
1011
+ defaultMessage: '<p>Based on this <a>{url}</a> and the page or ticket I’m currently viewing, highlight the parts of the linked content that are most relevant to this work. Explain briefly why each part is relevant.</p>',
1012
+ description: 'The prompt message to send to Rovo Chat. {url} refers to Smart Link that the user triggers this action from. (Please make sure all html tags remain the same.)'
1013
+ },
1004
1014
  rovo_chat_action_section_header: {
1005
1015
  id: 'fabric.linking.rovo_chat_action_section_header.non-final',
1006
1016
  defaultMessage: 'Ask Rovo',
@@ -27,7 +27,7 @@ const useRovoChat = () => {
27
27
  agentId: undefined
28
28
  },
29
29
  openChat: true,
30
- openChatMode: product && jiraProducts.includes(product) && fg('platform_sl_3p_auth_rovo_block_jira_kill_switch') || fg('rovogrowth-640-inline-action-nudge-fg') ? 'mini-modal' : 'sidebar'
30
+ openChatMode: product && jiraProducts.includes(product) && (fg('platform_sl_3p_auth_rovo_block_jira_kill_switch') || fg('rovogrowth-640-inline-action-nudge-fg')) ? 'mini-modal' : 'sidebar'
31
31
  },
32
32
  onAcknowledgeTimeout: () => {
33
33
  // NAVX-3599: Add analytics event
@@ -2,7 +2,7 @@ export const ANALYTICS_CHANNEL = 'media';
2
2
  export const context = {
3
3
  componentName: 'smart-cards',
4
4
  packageName: "@atlaskit/smart-card" || '',
5
- packageVersion: "44.3.22" || ''
5
+ packageVersion: "44.3.24" || ''
6
6
  };
7
7
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
8
8
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -6,7 +6,7 @@ import { ax, ix } from "@compiled/react/runtime";
6
6
  import { useEffect, useMemo, useState } from 'react';
7
7
  import { browser } from '@atlaskit/linking-common/user-agent';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
- import { ActionName, ElementName, SmartLinkPosition } from '../../../constants';
9
+ import { ActionName, CardDisplay, ElementName, SmartLinkPosition } from '../../../constants';
10
10
  import extractRovoChatAction from '../../../extractors/flexible/actions/extract-rovo-chat-action';
11
11
  import { getExtensionKey } from '../../../state/helpers';
12
12
  import useRovoConfig from '../../../state/hooks/use-rovo-config';
@@ -64,7 +64,7 @@ const ResolvedView = ({
64
64
  const prompts = useMemo(() => {
65
65
  if (fg('platform_sl_3p_auth_rovo_block_card_kill_switch')) {
66
66
  var _cardState$details, _cardState$details$da;
67
- const defaultPrompts = [RovoChatPromptKey.HIGHLIGHT_RELEVANT_CONTENT, RovoChatPromptKey.ASK_ROVO_ANYTHING];
67
+ const defaultPrompts = [RovoChatPromptKey.KEY_HIGHLIGHTS];
68
68
  const linkType = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : (_cardState$details$da = _cardState$details.data) === null || _cardState$details$da === void 0 ? void 0 : _cardState$details$da['@type'];
69
69
  if (extensionKey === 'slack-object-provider') {
70
70
  return [RovoChatPromptKey.FIND_OPEN_QUESTIONS, ...defaultPrompts];
@@ -79,25 +79,32 @@ const ResolvedView = ({
79
79
  }
80
80
  return [];
81
81
  }, [cardState === null || cardState === void 0 ? void 0 : (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data, extensionKey]);
82
- const footerActions = useMemo(() => showRovoResolvedView && fg('platform_sl_3p_auth_rovo_block_card_kill_switch') ? [{
83
- name: ActionName.RovoChatAction,
84
- prompts: prompts
85
- }, {
86
- name: ActionName.FollowAction,
87
- hideIcon: true
88
- }, {
89
- name: ActionName.DownloadAction,
90
- hideIcon: true
91
- }] : [{
92
- name: ActionName.FollowAction,
93
- hideIcon: true
94
- }, {
95
- name: ActionName.PreviewAction,
96
- hideIcon: true
97
- }, {
98
- name: ActionName.DownloadAction,
99
- hideIcon: true
100
- }], [showRovoResolvedView, prompts]);
82
+ const footerActions = useMemo(() => {
83
+ if (showRovoResolvedView && fg('platform_sl_3p_auth_rovo_block_card_kill_switch')) {
84
+ return [{
85
+ name: ActionName.RovoChatAction,
86
+ prompts: prompts,
87
+ iconSize: 'small',
88
+ cardAppearance: CardDisplay.Block
89
+ }, {
90
+ name: ActionName.FollowAction,
91
+ iconSize: 'small'
92
+ }, {
93
+ name: ActionName.DownloadAction,
94
+ iconSize: 'small'
95
+ }];
96
+ }
97
+ return [{
98
+ name: ActionName.FollowAction,
99
+ hideIcon: true
100
+ }, {
101
+ name: ActionName.PreviewAction,
102
+ hideIcon: true
103
+ }, {
104
+ name: ActionName.DownloadAction,
105
+ hideIcon: true
106
+ }];
107
+ }, [showRovoResolvedView, prompts]);
101
108
  const uiOptions = FlexibleCardUiOptions;
102
109
  uiOptions.enableSnippetRenderer = true;
103
110
  uiOptions.hideLoadingSkeleton = hideIconLoadingSkeleton;
@@ -134,6 +141,7 @@ const ResolvedView = ({
134
141
  }
135
142
  })) : null, /*#__PURE__*/React.createElement(FooterBlock, {
136
143
  actions: footerActions,
144
+ isPreviewBlockErrored: isPreviewBlockErrored,
137
145
  className: ax(["_4t3i1k8s _1e0c1txw _1bah1yb4 _4cvresu3 _1wpz1fhb", safari && "_4t3i1osq"])
138
146
  }));
139
147
  };
@@ -1,4 +1,5 @@
1
1
  ._11c8wadc{font:var(--ds-font-body-small,normal 400 9pt/1pc "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
2
+ ._13bowadc button{font:var(--ds-font-body-small,normal 400 9pt/1pc "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
2
3
  ._11lv1b66 button{padding-left:var(--ds-space-050,4px)}
3
4
  ._11lvidpf button{padding-left:0}
4
5
  ._11lvv77o button{padding-left:var(--ds-space-025,2px)}
@@ -12,10 +13,13 @@
12
13
  ._1gqnv77o button{padding-bottom:var(--ds-space-025,2px)}
13
14
  ._1i3bidpf button:active>span{margin-top:0}
14
15
  ._1l0qidpf button:hover>span{margin-right:0}
16
+ ._1q9t1wq8 button{font-weight:var(--ds-font-weight-medium,500)}
17
+ ._1rlg1g80 button{flex-wrap:wrap}
15
18
  ._1vtwidpf button:active>span{margin-left:0}
16
19
  ._3kh9idpf button:active>span{margin-bottom:0}
17
20
  ._4wlcidpf button:hover>span{margin-top:0}
18
21
  ._8pvjidpf button:hover>span{margin-bottom:0}
22
+ ._bdn61h6o button{align-content:center}
19
23
  ._i2vxidpf button:focus>span{margin-bottom:0}
20
24
  ._ijvwidpf button:focus>span{margin-left:0}
21
25
  ._k48p1wq8{font-weight:var(--ds-font-weight-medium,500)}
@@ -2,16 +2,21 @@
2
2
  import "./index.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { forwardRef, useCallback, useMemo } from 'react';
5
+ import { cx } from '@compiled/react';
5
6
  import { LoadingButton } from '@atlaskit/button';
6
7
  import Button, { IconButton, LinkButton, LinkIconButton } from '@atlaskit/button/new';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
7
9
  import { Box } from '@atlaskit/primitives/compiled';
8
10
  import Tooltip from '@atlaskit/tooltip';
9
- import { SmartLinkSize } from '../../../../../../constants';
10
- import { useFlexibleUiOptionContext } from '../../../../../../state/flexible-ui-context';
11
+ import { ActionName, SmartLinkSize } from '../../../../../../constants';
12
+ import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../../state/flexible-ui-context';
11
13
  import { withOverrideCss } from '../../../common/with-override-css';
12
14
  import { sizeToButtonSpacing } from '../../../utils';
13
15
  const IconOnlyLarge = null;
14
16
  const SizeSmall = null;
17
+ const styles = {
18
+ textSmall: "_13bowadc _1q9t1wq8 _1rlg1g80 _bdn61h6o"
19
+ };
15
20
  const SizeSmallIconOnly = null;
16
21
  const SizeSmallNotIconOnly = null;
17
22
  const IconButtonAppearanceMap = {
@@ -49,7 +54,10 @@ const ActionButtonRefresh = /*#__PURE__*/forwardRef(({
49
54
  href,
50
55
  ariaLabel
51
56
  }, ref) => {
57
+ var _context$actions;
52
58
  const iconOnly = !content;
59
+ const context = useFlexibleUiContext();
60
+ const isRovoSupported = !!(context !== null && context !== void 0 && (_context$actions = context.actions) !== null && _context$actions !== void 0 && _context$actions[ActionName.RovoChatAction]) && fg('platform_sl_3p_auth_rovo_block_card_kill_switch');
53
61
  const onButtonClick = useCallback(handler => e => {
54
62
  e.preventDefault();
55
63
  handler();
@@ -124,7 +132,8 @@ const ActionButtonRefresh = /*#__PURE__*/forwardRef(({
124
132
  }, [appearance, ariaLabel, content, href, iconAfter, iconBefore, iconOnly, isDisabled, isLoading, onButtonClick, onClick, size, testId, tooltipMessage]);
125
133
  return /*#__PURE__*/React.createElement(Box, {
126
134
  testId: `${testId}-button-wrapper`,
127
- ref: ref
135
+ ref: ref,
136
+ xcss: cx(isRovoSupported && size === SmartLinkSize.Small && styles.textSmall)
128
137
  }, button);
129
138
  });
130
139
  const ActionButtonRefreshWithOverrideCss = withOverrideCss(ActionButtonRefresh);
@@ -40,7 +40,7 @@ export function AISummariseAction({
40
40
  spacing: "spacious",
41
41
  color: "currentColor",
42
42
  label: "Summarise with AI"
43
- }, fg('platform_sl_3p_auth_rovo_action_kill_switch') ? {
43
+ }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || fg('platform_sl_3p_auth_rovo_block_card_kill_switch') ? {
44
44
  size: props.iconSize
45
45
  } : {})),
46
46
  onClick: handleActionClick,
@@ -76,7 +76,7 @@ const AutomationAction = props => {
76
76
  spacing: "spacious",
77
77
  color: "currentColor",
78
78
  label: automationActionIconLabel
79
- }, fg('platform_sl_3p_auth_rovo_action_kill_switch') ? {
79
+ }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || fg('platform_sl_3p_auth_rovo_block_card_kill_switch') ? {
80
80
  size: props.iconSize
81
81
  } : {})),
82
82
  testId: "smart-action-automation-action",
@@ -36,7 +36,7 @@ const CopyLinkAction = ({
36
36
  color: "currentColor",
37
37
  label: fg('navx-3698-flexible-card-a11y-fix') ? '' : 'copy url',
38
38
  spacing: "spacious"
39
- }, fg('platform_sl_3p_auth_rovo_action_kill_switch') ? {
39
+ }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || fg('platform_sl_3p_auth_rovo_block_card_kill_switch') ? {
40
40
  size: props.iconSize
41
41
  } : {})),
42
42
  onClick: onClick,
@@ -34,7 +34,7 @@ const PreviewAction = ({
34
34
  color: "currentColor",
35
35
  spacing: "spacious",
36
36
  label: fg('navx-3698-flexible-card-a11y-fix') ? '' : 'Open preview panel'
37
- }, fg('platform_sl_3p_auth_rovo_action_kill_switch') ? {
37
+ }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || fg('platform_sl_3p_auth_rovo_block_card_kill_switch') ? {
38
38
  size: props.iconSize
39
39
  } : {}));
40
40
  }
@@ -42,7 +42,7 @@ const PreviewAction = ({
42
42
  color: "currentColor",
43
43
  spacing: "spacious",
44
44
  label: fg('navx-3698-flexible-card-a11y-fix') ? '' : 'Open preview'
45
- }, fg('platform_sl_3p_auth_rovo_action_kill_switch') ? {
45
+ }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || fg('platform_sl_3p_auth_rovo_block_card_kill_switch') ? {
46
46
  size: props.iconSize
47
47
  } : {}));
48
48
  }, [hasPreviewPanel, props.iconSize]);
@@ -1,12 +1,14 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback, useMemo } from 'react';
3
3
  import { useIntl } from 'react-intl';
4
- import AiGenerativeTextIcon from '@atlaskit/icon-lab/core/ai-generative-text';
5
4
  import AiSearchIcon from '@atlaskit/icon-lab/core/ai-search';
5
+ import AiChatIcon from '@atlaskit/icon/core/ai-chat';
6
6
  import AiGenerativeTextSummaryIcon from '@atlaskit/icon/core/ai-generative-text-summary';
7
7
  import RovoChatIcon from '@atlaskit/icon/core/rovo-chat';
8
+ import { RovoIcon } from '@atlaskit/logo';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
8
10
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
9
- import { ActionName } from '../../../../../constants';
11
+ import { ActionName, CardDisplay } from '../../../../../constants';
10
12
  import { messages } from '../../../../../messages';
11
13
  import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
12
14
  import useInvokeClientAction from '../../../../../state/hooks/use-invoke-client-action';
@@ -54,7 +56,7 @@ const getContext = (intl, product) => {
54
56
  };
55
57
  }
56
58
  };
57
- const getPromptAction = (promptKey, intl, url = '', product) => {
59
+ const getPromptAction = (promptKey, intl, url = '', product, iconSize, cardAppearance) => {
58
60
  var _getContext;
59
61
  const {
60
62
  contextLong,
@@ -128,7 +130,10 @@ const getPromptAction = (promptKey, intl, url = '', product) => {
128
130
  ignoreTag: true
129
131
  });
130
132
  return {
131
- icon: /*#__PURE__*/React.createElement(AIEditIcon, null),
133
+ icon: cardAppearance === CardDisplay.Block && fg('platform_sl_3p_auth_rovo_block_card_kill_switch') ? /*#__PURE__*/React.createElement(AiChatIcon, {
134
+ label: label_summarize,
135
+ size: iconSize
136
+ }) : /*#__PURE__*/React.createElement(AIEditIcon, null),
132
137
  content: label_summarize,
133
138
  tooltipMessage: label_summarize,
134
139
  data: {
@@ -162,9 +167,9 @@ const getPromptAction = (promptKey, intl, url = '', product) => {
162
167
  }
163
168
  }
164
169
  };
165
- case RovoChatPromptKey.KEY_HIGHLIGHTS:
166
- const label_key_highlights = intl.formatMessage(messages.rovo_prompt_button_highlight_relevant_content);
167
- const html_key_highlights = intl.formatMessage(messages.rovo_prompt_message_highlight_relevant_content, {
170
+ case RovoChatPromptKey.HIGHLIGHT_RELEVANT_CONTENT:
171
+ const label_highlight_relevant_content = intl.formatMessage(messages.rovo_prompt_button_highlight_relevant_content);
172
+ const html_highlight_relevant_content = intl.formatMessage(messages.rovo_prompt_message_highlight_relevant_content, {
168
173
  context: contextLong,
169
174
  url
170
175
  }, {
@@ -172,12 +177,12 @@ const getPromptAction = (promptKey, intl, url = '', product) => {
172
177
  });
173
178
  return {
174
179
  icon: /*#__PURE__*/React.createElement(AiChapterIcon, null),
175
- content: label_key_highlights,
176
- tooltipMessage: label_key_highlights,
180
+ content: label_highlight_relevant_content,
181
+ tooltipMessage: label_highlight_relevant_content,
177
182
  data: {
178
- name: label_key_highlights,
183
+ name: label_highlight_relevant_content,
179
184
  dialogues: [],
180
- prompt: htmlToAdf(html_key_highlights),
185
+ prompt: htmlToAdf(html_highlight_relevant_content),
181
186
  mode: {
182
187
  fastModeEnabled: true
183
188
  }
@@ -189,7 +194,11 @@ const getPromptAction = (promptKey, intl, url = '', product) => {
189
194
  url
190
195
  });
191
196
  return {
192
- icon: /*#__PURE__*/React.createElement(AISearchIcon, null),
197
+ icon: cardAppearance === CardDisplay.Block && fg('platform_sl_3p_auth_rovo_block_card_kill_switch') ? /*#__PURE__*/React.createElement(RovoIcon, {
198
+ label: label_ask_rovo_anything,
199
+ size: 'xxsmall',
200
+ shouldUseHexLogo: true
201
+ }) : /*#__PURE__*/React.createElement(AISearchIcon, null),
193
202
  content: label_ask_rovo_anything,
194
203
  tooltipMessage: label_ask_rovo_anything,
195
204
  data: {
@@ -219,24 +228,25 @@ const getPromptAction = (promptKey, intl, url = '', product) => {
219
228
  placeholderType: 'generic'
220
229
  }
221
230
  };
222
- case RovoChatPromptKey.HIGHLIGHT_RELEVANT_CONTENT:
223
- const label_highlight_relevant_content = intl.formatMessage(messages.rovo_prompt_button_highlight_relevant_content);
224
- const html_highlight_relevant_content = intl.formatMessage(messages.rovo_prompt_message_highlight_relevant_content, {
231
+ case RovoChatPromptKey.KEY_HIGHLIGHTS:
232
+ const label_key_highlights = intl.formatMessage(messages.rovo_prompt_button_key_highlights);
233
+ const html_key_highlights = intl.formatMessage(messages.rovo_prompt_message_key_highlights, {
225
234
  context: contextLong,
226
235
  url
227
236
  }, {
228
237
  ignoreTag: true
229
238
  });
230
239
  return {
231
- icon: /*#__PURE__*/React.createElement(AiGenerativeTextIcon, {
232
- label: label_highlight_relevant_content
240
+ icon: /*#__PURE__*/React.createElement(AiChatIcon, {
241
+ label: label_key_highlights,
242
+ size: iconSize
233
243
  }),
234
- content: label_highlight_relevant_content,
235
- tooltipMessage: label_highlight_relevant_content,
244
+ content: label_key_highlights,
245
+ tooltipMessage: label_key_highlights,
236
246
  data: {
237
- name: label_highlight_relevant_content,
247
+ name: label_key_highlights,
238
248
  dialogues: [],
239
- prompt: htmlToAdf(html_highlight_relevant_content)
249
+ prompt: htmlToAdf(html_key_highlights)
240
250
  }
241
251
  };
242
252
  case RovoChatPromptKey.SHOW_ME_WHATS_RELEVANT:
@@ -267,8 +277,9 @@ const getPromptAction = (promptKey, intl, url = '', product) => {
267
277
  ignoreTag: true
268
278
  });
269
279
  return {
270
- icon: /*#__PURE__*/React.createElement(AiGenerativeTextIcon, {
271
- label: label_identify_key_trends
280
+ icon: /*#__PURE__*/React.createElement(AiChatIcon, {
281
+ label: label_identify_key_trends,
282
+ size: iconSize
272
283
  }),
273
284
  content: label_identify_key_trends,
274
285
  tooltipMessage: label_identify_key_trends,
@@ -286,8 +297,9 @@ const getPromptAction = (promptKey, intl, url = '', product) => {
286
297
  ignoreTag: true
287
298
  });
288
299
  return {
289
- icon: /*#__PURE__*/React.createElement(AiGenerativeTextIcon, {
290
- label: label_identify_key_points
300
+ icon: /*#__PURE__*/React.createElement(AiChatIcon, {
301
+ label: label_identify_key_points,
302
+ size: iconSize
291
303
  }),
292
304
  content: label_identify_key_points,
293
305
  tooltipMessage: label_identify_key_points,
@@ -305,8 +317,9 @@ const getPromptAction = (promptKey, intl, url = '', product) => {
305
317
  ignoreTag: true
306
318
  });
307
319
  return {
308
- icon: /*#__PURE__*/React.createElement(AiGenerativeTextIcon, {
309
- label: label_find_open_questions
320
+ icon: /*#__PURE__*/React.createElement(AiChatIcon, {
321
+ label: label_find_open_questions,
322
+ size: iconSize
310
323
  }),
311
324
  content: label_find_open_questions,
312
325
  tooltipMessage: label_find_open_questions,
@@ -359,7 +372,7 @@ const RovoChatAction = ({
359
372
  content,
360
373
  tooltipMessage,
361
374
  data: promptData
362
- } = getPromptAction(promptKey, intl, data === null || data === void 0 ? void 0 : data.url, data === null || data === void 0 ? void 0 : data.product) || {};
375
+ } = getPromptAction(promptKey, intl, data === null || data === void 0 ? void 0 : data.url, data === null || data === void 0 ? void 0 : data.product, props.iconSize, props.cardAppearance) || {};
363
376
  return promptData ? /*#__PURE__*/React.createElement(Action, _extends({
364
377
  content: content,
365
378
  icon: icon,
@@ -14,13 +14,16 @@ import DropdownMenu from '@atlaskit/dropdown-menu';
14
14
  import MoreIcon from '@atlaskit/icon/core/show-more-horizontal';
15
15
  import { fg } from '@atlaskit/platform-feature-flags';
16
16
  import Tooltip from '@atlaskit/tooltip';
17
- import { ActionName, SmartLinkSize } from '../../../../../constants';
17
+ import { ActionName, CardDisplay, SmartLinkSize } from '../../../../../constants';
18
18
  import { messages } from '../../../../../messages';
19
19
  import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
20
+ import { RovoChatPromptKey } from '../../actions/rovo-chat-action';
20
21
  import { sizeToButtonSpacing } from '../../utils';
21
22
  import { filterActionItems } from '../utils';
22
23
  import ActionGroupItem from './action-group-item';
23
24
  const styles = null;
25
+ const FULL_ACTIONS_SIZE = 450;
26
+ const REDUCED_ACTIONS_SIZE = 360;
24
27
  const renderActionItems = (items = [], size = SmartLinkSize.Medium, appearance, asDropDownItems, onActionItemClick) => items.map((item, idx) => /*#__PURE__*/React.createElement(ActionGroupItem, {
25
28
  item: item,
26
29
  key: idx,
@@ -42,7 +45,8 @@ const ActionGroup = ({
42
45
  size = SmartLinkSize.Medium,
43
46
  appearance,
44
47
  visibleButtonsNum = 2,
45
- onDropdownOpenChange
48
+ onDropdownOpenChange,
49
+ containerWidth = Infinity
46
50
  }) => {
47
51
  var _context$actions;
48
52
  const context = useFlexibleUiContext();
@@ -50,7 +54,7 @@ const ActionGroup = ({
50
54
  const [isOpen, setIsOpen] = useState(false);
51
55
  const renderableActionItems = useMemo(() => filterActionItems(items, context), [context, items]);
52
56
  const isMoreThenTwoItems = renderableActionItems.length > visibleButtonsNum;
53
- const isRovoActionsEnabled = !!(context !== null && context !== void 0 && (_context$actions = context.actions) !== null && _context$actions !== void 0 && _context$actions[ActionName.RovoChatAction]);
57
+ const isRovoActionsEnabled = !!(context !== null && context !== void 0 && (_context$actions = context.actions) !== null && _context$actions !== void 0 && _context$actions[ActionName.RovoChatAction]) && fg('platform_sl_3p_auth_rovo_block_card_kill_switch');
54
58
  const onOpenChange = useCallback(attrs => {
55
59
  setIsOpen(attrs.isOpen);
56
60
  if (onDropdownOpenChange) {
@@ -65,21 +69,34 @@ const ActionGroup = ({
65
69
  }
66
70
  }, [isOpen, onOpenChange]);
67
71
  const actionButtons = useMemo(() => {
68
- if (isRovoActionsEnabled && fg('platform_sl_3p_auth_rovo_block_card_kill_switch')) {
69
- const rovoActions = [...renderableActionItems.slice(0, visibleButtonsNum - 1), {
70
- name: ActionName.PreviewAction,
71
- hideContent: true
72
+ if (isRovoActionsEnabled) {
73
+ const rovoActions = [...(containerWidth >= REDUCED_ACTIONS_SIZE ? renderableActionItems.slice(0, visibleButtonsNum - 1) : []), {
74
+ name: ActionName.RovoChatAction,
75
+ prompts: [RovoChatPromptKey.ASK_ROVO_ANYTHING],
76
+ iconSize: 'small',
77
+ cardAppearance: CardDisplay.Block,
78
+ hideContent: containerWidth < FULL_ACTIONS_SIZE && containerWidth >= REDUCED_ACTIONS_SIZE
72
79
  }, {
73
80
  name: ActionName.CopyLinkAction,
74
- hideContent: true
81
+ hideContent: true,
82
+ iconSize: 'small'
83
+ }, {
84
+ name: ActionName.PreviewAction,
85
+ hideContent: true,
86
+ iconSize: 'small'
75
87
  }];
76
88
  return renderActionItems(rovoActions, size, appearance, false, onActionItemClick);
77
89
  }
78
90
  const actionItems = isMoreThenTwoItems ? renderableActionItems.slice(0, visibleButtonsNum - 1) : renderableActionItems;
79
91
  return renderActionItems(actionItems, size, appearance, false, onActionItemClick);
80
- }, [appearance, isMoreThenTwoItems, onActionItemClick, renderableActionItems, size, visibleButtonsNum, isRovoActionsEnabled]);
92
+ }, [appearance, isMoreThenTwoItems, isRovoActionsEnabled, onActionItemClick, renderableActionItems, size, visibleButtonsNum, containerWidth]);
81
93
  const moreActionDropdown = useMemo(() => {
82
- const actionItems = isMoreThenTwoItems || isRovoActionsEnabled && fg('platform_sl_3p_auth_rovo_block_card_kill_switch') ? renderableActionItems.slice(visibleButtonsNum - 1) : [];
94
+ let actionItems;
95
+ if (isRovoActionsEnabled && containerWidth < REDUCED_ACTIONS_SIZE) {
96
+ actionItems = renderableActionItems;
97
+ } else {
98
+ actionItems = isMoreThenTwoItems ? renderableActionItems.slice(visibleButtonsNum - 1) : [];
99
+ }
83
100
  if (actionItems.length > 0) {
84
101
  const spacing = sizeToButtonSpacing[size];
85
102
  const moreIcon = /*#__PURE__*/React.createElement(MoreIcon, {
@@ -99,7 +116,7 @@ const ActionGroup = ({
99
116
  testId: "action-group-more-button-tooltip",
100
117
  tag: "span"
101
118
  }, /*#__PURE__*/React.createElement(Button, _extends({}, props, {
102
- spacing: spacing,
119
+ spacing: isRovoActionsEnabled && fg('platform_sl_3p_auth_rovo_block_card_kill_switch') ? size === SmartLinkSize.XLarge ? 'default' : 'compact' : spacing,
103
120
  testId: "action-group-more-button",
104
121
  iconBefore: moreIcon,
105
122
  ref: triggerRef
@@ -111,7 +128,7 @@ const ActionGroup = ({
111
128
  }, renderActionItems(actionItems, size, appearance, true, onActionItemClick));
112
129
  }
113
130
  return null;
114
- }, [appearance, isMoreThenTwoItems, isOpen, onActionItemClick, onOpenChange, renderableActionItems, size, ui === null || ui === void 0 ? void 0 : ui.zIndex, visibleButtonsNum, isRovoActionsEnabled]);
131
+ }, [appearance, isMoreThenTwoItems, isOpen, isRovoActionsEnabled, onActionItemClick, onOpenChange, renderableActionItems, size, ui === null || ui === void 0 ? void 0 : ui.zIndex, visibleButtonsNum, containerWidth]);
115
132
  return renderableActionItems.length > 0 ? /*#__PURE__*/React.createElement("div", {
116
133
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
117
134
  className: ax(["_1e0c116y _dzc21h6o _1ilq1i6y", "actions-button-group"]),
@@ -1,2 +1,4 @@
1
+ ._1wpz1h6o{align-self:center}
1
2
  ._4t3i1osq{height:100%}
2
- ._c71lxy5q{max-height:var(--ds-space-400,2pc)}
3
+ ._c71lxy5q{max-height:var(--ds-space-400,2pc)}
4
+ ._kqswh2mm{position:relative}