@atlaskit/smart-card 44.1.2 → 44.3.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 (57) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/__tests__/vr-tests/__snapshots__/block-card/block-card-resolved-icon-variations-resolvedclient-icontesturls-/342/200/224-flexible-extractsmartlinkicon-path---default.png +3 -0
  3. package/dist/cjs/__tests__/vr-tests/__snapshots__/inline-card/inline-card-resolved-icon-variations-resolvedclient-icontesturls-/342/200/224-extracticon-document-non-document-paths---default.png +3 -0
  4. package/dist/cjs/constants.js +1 -1
  5. package/dist/cjs/extractors/flexible/actions/extract-rovo-chat-action.js +3 -2
  6. package/dist/cjs/extractors/flexible/actions/index.js +1 -1
  7. package/dist/cjs/messages.js +40 -0
  8. package/dist/cjs/utils/analytics/analytics.js +1 -1
  9. package/dist/cjs/view/BlockCard/views/ResolvedView.js +48 -2
  10. package/dist/cjs/view/FlexibleCard/components/actions/rovo-chat-action/index.js +83 -1
  11. package/dist/cjs/view/FlexibleCard/components/blocks/action-block/index.js +3 -3
  12. package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +20 -4
  13. package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +4 -1
  14. package/dist/cjs/view/FlexibleCard/components/blocks/hover-card-footer-block/index.js +1 -1
  15. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +11 -0
  16. package/dist/cjs/view/LinkUrl/index.js +1 -1
  17. package/dist/es2019/__tests__/vr-tests/__snapshots__/block-card/block-card-resolved-icon-variations-resolvedclient-icontesturls-/342/200/224-flexible-extractsmartlinkicon-path---default.png +3 -0
  18. package/dist/es2019/__tests__/vr-tests/__snapshots__/inline-card/inline-card-resolved-icon-variations-resolvedclient-icontesturls-/342/200/224-extracticon-document-non-document-paths---default.png +3 -0
  19. package/dist/es2019/constants.js +1 -1
  20. package/dist/es2019/extractors/flexible/actions/extract-rovo-chat-action.js +4 -3
  21. package/dist/es2019/extractors/flexible/actions/index.js +1 -1
  22. package/dist/es2019/messages.js +40 -0
  23. package/dist/es2019/utils/analytics/analytics.js +1 -1
  24. package/dist/es2019/view/BlockCard/views/ResolvedView.js +46 -2
  25. package/dist/es2019/view/FlexibleCard/components/actions/rovo-chat-action/index.js +84 -2
  26. package/dist/es2019/view/FlexibleCard/components/blocks/action-block/index.js +3 -3
  27. package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +20 -5
  28. package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +5 -2
  29. package/dist/es2019/view/FlexibleCard/components/blocks/hover-card-footer-block/index.js +2 -2
  30. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +11 -0
  31. package/dist/es2019/view/LinkUrl/index.js +1 -1
  32. package/dist/esm/__tests__/vr-tests/__snapshots__/block-card/block-card-resolved-icon-variations-resolvedclient-icontesturls-/342/200/224-flexible-extractsmartlinkicon-path---default.png +3 -0
  33. package/dist/esm/__tests__/vr-tests/__snapshots__/inline-card/inline-card-resolved-icon-variations-resolvedclient-icontesturls-/342/200/224-extracticon-document-non-document-paths---default.png +3 -0
  34. package/dist/esm/constants.js +1 -1
  35. package/dist/esm/extractors/flexible/actions/extract-rovo-chat-action.js +4 -3
  36. package/dist/esm/extractors/flexible/actions/index.js +1 -1
  37. package/dist/esm/messages.js +40 -0
  38. package/dist/esm/utils/analytics/analytics.js +1 -1
  39. package/dist/esm/view/BlockCard/views/ResolvedView.js +48 -2
  40. package/dist/esm/view/FlexibleCard/components/actions/rovo-chat-action/index.js +84 -2
  41. package/dist/esm/view/FlexibleCard/components/blocks/action-block/index.js +4 -4
  42. package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +21 -5
  43. package/dist/esm/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +5 -2
  44. package/dist/esm/view/FlexibleCard/components/blocks/hover-card-footer-block/index.js +2 -2
  45. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +11 -0
  46. package/dist/esm/view/LinkUrl/index.js +1 -1
  47. package/dist/types/constants.d.ts +2 -2
  48. package/dist/types/messages.d.ts +1 -1
  49. package/dist/types/state/flexible-ui-context/types.d.ts +1 -1
  50. package/dist/types/view/FlexibleCard/components/actions/rovo-chat-action/index.d.ts +5 -1
  51. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +1 -1
  52. package/dist/types-ts4.5/constants.d.ts +2 -2
  53. package/dist/types-ts4.5/messages.d.ts +1 -1
  54. package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +1 -1
  55. package/dist/types-ts4.5/view/FlexibleCard/components/actions/rovo-chat-action/index.d.ts +5 -1
  56. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +1 -1
  57. package/package.json +11 -11
@@ -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.1.1"
5
+ packageVersion: "44.2.0"
6
6
  };
7
7
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
8
8
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -5,8 +5,13 @@ import * as React from 'react';
5
5
  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
+ import { fg } from "@atlaskit/platform-feature-flags";
8
9
  import { ActionName, ElementName, SmartLinkPosition } from '../../../constants';
10
+ import extractRovoChatAction from '../../../extractors/flexible/actions/extract-rovo-chat-action';
11
+ import { getExtensionKey } from '../../../state/helpers';
12
+ import useRovoConfig from '../../../state/hooks/use-rovo-config';
9
13
  import FlexibleCard from '../../FlexibleCard';
14
+ import { RovoChatPromptKey } from '../../FlexibleCard/components/actions/rovo-chat-action';
10
15
  import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock } from '../../FlexibleCard/components/blocks';
11
16
  import { FlexibleCardUiOptions, getSimulatedBetterMetadata, PreviewBlockOptions, titleBlockOptions } from './utils';
12
17
  import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
@@ -30,7 +35,19 @@ const ResolvedView = ({
30
35
  CompetitorPrompt,
31
36
  hideIconLoadingSkeleton
32
37
  }) => {
38
+ var _cardState$details2;
33
39
  const [isPreviewBlockErrored, setIsPreviewBlockErrored] = useState(false);
40
+ const extensionKey = getExtensionKey(cardState.details);
41
+ const rovoConfig = fg('platform_sl_3p_auth_rovo_block_card_kill_switch') ?
42
+ // eslint-disable-next-line react-hooks/rules-of-hooks
43
+ useRovoConfig() : undefined;
44
+ const showRovoResolvedView = fg('platform_sl_3p_auth_rovo_block_card_kill_switch') ?
45
+ // eslint-disable-next-line react-hooks/rules-of-hooks
46
+ useMemo(() => (cardState === null || cardState === void 0 ? void 0 : cardState.status) === 'resolved' && cardState.details && extractRovoChatAction({
47
+ response: cardState.details,
48
+ rovoConfig,
49
+ actionOptions: actionOptions
50
+ }) !== undefined, [actionOptions, cardState === null || cardState === void 0 ? void 0 : cardState.details, cardState === null || cardState === void 0 ? void 0 : cardState.status, rovoConfig]) : undefined;
34
51
 
35
52
  // eslint-disable-next-line react-hooks/rules-of-hooks
36
53
  const {
@@ -44,7 +61,34 @@ const ResolvedView = ({
44
61
  topMetadata,
45
62
  bottomMetadata
46
63
  } = getSimulatedBetterMetadata(cardState.details);
47
- const footerActions = useMemo(() => [{
64
+ const prompts = useMemo(() => {
65
+ if (fg('platform_sl_3p_auth_rovo_block_card_kill_switch')) {
66
+ var _cardState$details, _cardState$details$da;
67
+ const defaultPrompts = [RovoChatPromptKey.HIGHLIGHT_RELEVANT_CONTENT, RovoChatPromptKey.ASK_ROVO_ANYTHING];
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
+ if (extensionKey === 'slack-object-provider') {
70
+ return [RovoChatPromptKey.FIND_OPEN_QUESTIONS, ...defaultPrompts];
71
+ }
72
+ if (extensionKey === 'google-object-provider' && linkType !== null && linkType !== void 0 && linkType.includes('schema:PresentationDigitalDocument')) {
73
+ return [RovoChatPromptKey.IDENTIFY_KEY_POINTS, ...defaultPrompts];
74
+ }
75
+ if (extensionKey === 'google-object-provider' && linkType !== null && linkType !== void 0 && linkType.includes('schema:SpreadsheetDigitalDocument')) {
76
+ return [RovoChatPromptKey.IDENTIFY_KEY_TRENDS, ...defaultPrompts];
77
+ }
78
+ return [RovoChatPromptKey.SUMMARIZE_LINK, ...defaultPrompts];
79
+ }
80
+ return [];
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
+ }] : [{
48
92
  name: ActionName.FollowAction,
49
93
  hideIcon: true
50
94
  }, {
@@ -53,7 +97,7 @@ const ResolvedView = ({
53
97
  }, {
54
98
  name: ActionName.DownloadAction,
55
99
  hideIcon: true
56
- }], []);
100
+ }], [showRovoResolvedView, prompts]);
57
101
  const uiOptions = FlexibleCardUiOptions;
58
102
  uiOptions.enableSnippetRenderer = true;
59
103
  uiOptions.hideLoadingSkeleton = hideIconLoadingSkeleton;
@@ -1,8 +1,9 @@
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';
4
5
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
5
- import { InternalActionName } from '../../../../../constants';
6
+ import { ActionName } from '../../../../../constants';
6
7
  import { messages } from '../../../../../messages';
7
8
  import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
8
9
  import useInvokeClientAction from '../../../../../state/hooks/use-invoke-client-action';
@@ -19,6 +20,10 @@ export let RovoChatPromptKey = /*#__PURE__*/function (RovoChatPromptKey) {
19
20
  RovoChatPromptKey["SUMMARIZE_LINK"] = "summarize-link";
20
21
  RovoChatPromptKey["KEY_HIGHLIGHTS"] = "key-highlights";
21
22
  RovoChatPromptKey["ASK_ROVO_ANYTHING"] = "ask-rovo-anything";
23
+ RovoChatPromptKey["IDENTIFY_KEY_POINTS"] = "identify-key-points";
24
+ RovoChatPromptKey["IDENTIFY_KEY_TRENDS"] = "identify-key-trends";
25
+ RovoChatPromptKey["FIND_OPEN_QUESTIONS"] = "find-open-questions";
26
+ RovoChatPromptKey["HIGHLIGHT_RELEVANT_CONTENT"] = "highlight-relevant-content";
22
27
  return RovoChatPromptKey;
23
28
  }({});
24
29
  const GOOGLE_PROMPTS = [RovoChatPromptKey.RECOMMEND_OTHER_SOURCES, RovoChatPromptKey.SHOW_OTHER_MENTIONS, RovoChatPromptKey.SUGGEST_IMPROVEMENT];
@@ -166,6 +171,83 @@ const getPromptAction = (promptKey, intl, url = '', product) => {
166
171
  placeholderType: 'generic'
167
172
  }
168
173
  };
174
+ case RovoChatPromptKey.HIGHLIGHT_RELEVANT_CONTENT:
175
+ const label_highlight_relevant_content = intl.formatMessage(messages.rovo_prompt_button_highlight_relevant_content);
176
+ const html_highlight_relevant_content = intl.formatMessage(messages.rovo_prompt_message_highlight_relevant_content, {
177
+ context: contextLong,
178
+ url
179
+ }, {
180
+ ignoreTag: true
181
+ });
182
+ return {
183
+ icon: /*#__PURE__*/React.createElement(AiGenerativeTextIcon, {
184
+ label: label_highlight_relevant_content
185
+ }),
186
+ content: label_highlight_relevant_content,
187
+ tooltipMessage: label_highlight_relevant_content,
188
+ data: {
189
+ name: label_highlight_relevant_content,
190
+ dialogues: [],
191
+ prompt: htmlToAdf(html_highlight_relevant_content)
192
+ }
193
+ };
194
+ case RovoChatPromptKey.IDENTIFY_KEY_TRENDS:
195
+ const label_identify_key_trends = intl.formatMessage(messages.rovo_prompt_button_identify_key_trends);
196
+ const html_identify_key_trends = intl.formatMessage(messages.rovo_prompt_message_identify_key_trends, {
197
+ url
198
+ }, {
199
+ ignoreTag: true
200
+ });
201
+ return {
202
+ icon: /*#__PURE__*/React.createElement(AiGenerativeTextIcon, {
203
+ label: label_identify_key_trends
204
+ }),
205
+ content: label_identify_key_trends,
206
+ tooltipMessage: label_identify_key_trends,
207
+ data: {
208
+ name: label_identify_key_trends,
209
+ dialogues: [],
210
+ prompt: htmlToAdf(html_identify_key_trends)
211
+ }
212
+ };
213
+ case RovoChatPromptKey.IDENTIFY_KEY_POINTS:
214
+ const label_identify_key_points = intl.formatMessage(messages.rovo_prompt_button_identify_key_points);
215
+ const html_identify_key_points = intl.formatMessage(messages.rovo_prompt_message_identify_key_points, {
216
+ url
217
+ }, {
218
+ ignoreTag: true
219
+ });
220
+ return {
221
+ icon: /*#__PURE__*/React.createElement(AiGenerativeTextIcon, {
222
+ label: label_identify_key_points
223
+ }),
224
+ content: label_identify_key_points,
225
+ tooltipMessage: label_identify_key_points,
226
+ data: {
227
+ name: label_identify_key_points,
228
+ dialogues: [],
229
+ prompt: htmlToAdf(html_identify_key_points)
230
+ }
231
+ };
232
+ case RovoChatPromptKey.FIND_OPEN_QUESTIONS:
233
+ const label_find_open_questions = intl.formatMessage(messages.rovo_prompt_button_find_open_questions);
234
+ const html_find_open_questions = intl.formatMessage(messages.rovo_prompt_message_find_open_questions, {
235
+ url
236
+ }, {
237
+ ignoreTag: true
238
+ });
239
+ return {
240
+ icon: /*#__PURE__*/React.createElement(AiGenerativeTextIcon, {
241
+ label: label_find_open_questions
242
+ }),
243
+ content: label_find_open_questions,
244
+ tooltipMessage: label_find_open_questions,
245
+ data: {
246
+ name: label_find_open_questions,
247
+ dialogues: [],
248
+ prompt: htmlToAdf(html_find_open_questions)
249
+ }
250
+ };
169
251
  }
170
252
  };
171
253
  const RovoChatAction = ({
@@ -181,7 +263,7 @@ const RovoChatAction = ({
181
263
  sendPromptMessage
182
264
  } = useRovoChat();
183
265
  const context = useFlexibleUiContext();
184
- const data = context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[InternalActionName.RovoChatAction];
266
+ const data = context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.RovoChatAction];
185
267
  const resolvedPrompts = useMemo(() => {
186
268
  var _data$invokeAction;
187
269
  if (prompts) {
@@ -5,7 +5,7 @@ import { ax, ix } from "@compiled/react/runtime";
5
5
  import { useCallback, useMemo, useState } from 'react';
6
6
  import { di } from 'react-magnetic-di';
7
7
  import { fg } from '@atlaskit/platform-feature-flags';
8
- import { InternalActionName, SmartLinkSize } from '../../../../../constants';
8
+ import { ActionName, SmartLinkSize } from '../../../../../constants';
9
9
  import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
10
10
  import * as Actions from '../../actions';
11
11
  import { ActionFooter } from './action-footer';
@@ -52,7 +52,7 @@ const ActionBlock = ({
52
52
  var _context$actions;
53
53
  const context = useFlexibleUiContext();
54
54
  const ui = useFlexibleUiOptionContext();
55
- const isRovoChatActionAvailable = (fg('platform_sl_3p_auth_rovo_action_kill_switch') || fg('rovogrowth-640-inline-action-nudge-fg')) && isAny3pRovoActionsExperimentOn ? (context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[InternalActionName.RovoChatAction]) !== undefined : undefined;
55
+ const isRovoChatActionAvailable = (fg('platform_sl_3p_auth_rovo_action_kill_switch') || fg('rovogrowth-640-inline-action-nudge-fg')) && isAny3pRovoActionsExperimentOn ? (context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.RovoChatAction]) !== undefined : undefined;
56
56
  const [message, setMessage] = useState();
57
57
  const [isLoading, setIsLoading] = useState(false);
58
58
  const onLoadingChange = useCallback(isLoading => {
@@ -70,7 +70,7 @@ const ActionBlock = ({
70
70
  if (!(context !== null && context !== void 0 && context.actions)) {
71
71
  return;
72
72
  }
73
- const arr = fg('platform_sl_3p_auth_rovo_action_kill_switch') || fg('rovogrowth-640-inline-action-nudge-fg') ? isRovoChatActionAvailable ? [InternalActionName.RovoChatAction] : Object.keys(context.actions).filter(name => name !== InternalActionName.RovoChatAction) : Object.keys(context.actions);
73
+ const arr = fg('platform_sl_3p_auth_rovo_action_kill_switch') || fg('rovogrowth-640-inline-action-nudge-fg') ? isRovoChatActionAvailable ? [ActionName.RovoChatAction] : Object.keys(context.actions).filter(name => name !== ActionName.RovoChatAction) : Object.keys(context.actions);
74
74
  arr.sort(sort);
75
75
  const renderAction = name => {
76
76
  const Action = name in Actions ? Actions[name] : undefined;
@@ -12,8 +12,9 @@ import ButtonGroup from '@atlaskit/button/button-group';
12
12
  import Button from '@atlaskit/button/standard-button';
13
13
  import DropdownMenu from '@atlaskit/dropdown-menu';
14
14
  import MoreIcon from '@atlaskit/icon/core/show-more-horizontal';
15
+ import { fg } from "@atlaskit/platform-feature-flags";
15
16
  import Tooltip from '@atlaskit/tooltip';
16
- import { SmartLinkSize } from '../../../../../constants';
17
+ import { ActionName, SmartLinkSize } from '../../../../../constants';
17
18
  import { messages } from '../../../../../messages';
18
19
  import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
19
20
  import { sizeToButtonSpacing } from '../../utils';
@@ -43,11 +44,13 @@ const ActionGroup = ({
43
44
  visibleButtonsNum = 2,
44
45
  onDropdownOpenChange
45
46
  }) => {
47
+ var _context$actions;
46
48
  const context = useFlexibleUiContext();
47
49
  const ui = useFlexibleUiOptionContext();
48
50
  const [isOpen, setIsOpen] = useState(false);
49
51
  const renderableActionItems = useMemo(() => filterActionItems(items, context), [context, items]);
50
52
  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]);
51
54
  const onOpenChange = useCallback(attrs => {
52
55
  setIsOpen(attrs.isOpen);
53
56
  if (onDropdownOpenChange) {
@@ -62,11 +65,21 @@ const ActionGroup = ({
62
65
  }
63
66
  }, [isOpen, onOpenChange]);
64
67
  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
+ }, {
73
+ name: ActionName.CopyLinkAction,
74
+ hideContent: true
75
+ }];
76
+ return renderActionItems(rovoActions, size, appearance, false, onActionItemClick);
77
+ }
65
78
  const actionItems = isMoreThenTwoItems ? renderableActionItems.slice(0, visibleButtonsNum - 1) : renderableActionItems;
66
79
  return renderActionItems(actionItems, size, appearance, false, onActionItemClick);
67
- }, [appearance, isMoreThenTwoItems, onActionItemClick, renderableActionItems, size, visibleButtonsNum]);
80
+ }, [appearance, isMoreThenTwoItems, onActionItemClick, renderableActionItems, size, visibleButtonsNum, isRovoActionsEnabled]);
68
81
  const moreActionDropdown = useMemo(() => {
69
- const actionItems = isMoreThenTwoItems ? renderableActionItems.slice(visibleButtonsNum - 1) : [];
82
+ const actionItems = isMoreThenTwoItems || isRovoActionsEnabled && fg('platform_sl_3p_auth_rovo_block_card_kill_switch') ? renderableActionItems.slice(visibleButtonsNum - 1) : [];
70
83
  if (actionItems.length > 0) {
71
84
  const spacing = sizeToButtonSpacing[size];
72
85
  const moreIcon = /*#__PURE__*/React.createElement(MoreIcon, {
@@ -90,13 +103,15 @@ const ActionGroup = ({
90
103
  testId: "action-group-more-button",
91
104
  iconBefore: moreIcon,
92
105
  ref: triggerRef
93
- }))),
106
+ }, fg('platform_sl_3p_auth_rovo_block_card_kill_switch') ? {
107
+ appearance
108
+ } : {}))),
94
109
  testId: "action-group-dropdown",
95
110
  zIndex: ui === null || ui === void 0 ? void 0 : ui.zIndex
96
111
  }, renderActionItems(actionItems, size, appearance, true, onActionItemClick));
97
112
  }
98
113
  return null;
99
- }, [appearance, isMoreThenTwoItems, isOpen, onActionItemClick, onOpenChange, renderableActionItems, size, ui === null || ui === void 0 ? void 0 : ui.zIndex, visibleButtonsNum]);
114
+ }, [appearance, isMoreThenTwoItems, isOpen, onActionItemClick, onOpenChange, renderableActionItems, size, ui === null || ui === void 0 ? void 0 : ui.zIndex, visibleButtonsNum, isRovoActionsEnabled]);
100
115
  return renderableActionItems.length > 0 ? /*#__PURE__*/React.createElement("div", {
101
116
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
102
117
  className: ax(["_1e0c116y _dzc21h6o _1ilq1i6y", "actions-button-group"]),
@@ -5,7 +5,8 @@ import * as React from 'react';
5
5
  import { ax, ix } from "@compiled/react/runtime";
6
6
  import { useCallback, useMemo } from 'react';
7
7
  import { browser } from '@atlaskit/linking-common/user-agent';
8
- import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
8
+ import { fg } from "@atlaskit/platform-feature-flags";
9
+ import { ActionName, SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
9
10
  import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context';
10
11
  import { Provider } from '../../../elements';
11
12
  import ActionGroup from '../../action-group';
@@ -15,6 +16,7 @@ import { filterActionItems } from '../../utils';
15
16
  const actionGroupStyles = null;
16
17
  const safariStyles = null;
17
18
  const FooterBlockResolvedView = props => {
19
+ var _context$actions;
18
20
  const {
19
21
  actions,
20
22
  testId,
@@ -23,6 +25,7 @@ const FooterBlockResolvedView = props => {
23
25
  hideProvider
24
26
  } = props;
25
27
  const context = useFlexibleUiContext();
28
+ const isRovoSupportedFeature = !!(context !== null && context !== void 0 && (_context$actions = context.actions) !== null && _context$actions !== void 0 && _context$actions[ActionName.RovoChatAction]);
26
29
  const hasActions = useMemo(() => {
27
30
  var _filterActionItems;
28
31
  return ((_filterActionItems = filterActionItems(actions, context)) === null || _filterActionItems === void 0 ? void 0 : _filterActionItems.length) > 0;
@@ -53,7 +56,7 @@ const FooterBlockResolvedView = props => {
53
56
  }, /*#__PURE__*/React.createElement(ActionGroup, {
54
57
  onDropdownOpenChange: onDropdownOpenChange,
55
58
  items: actions,
56
- appearance: "default",
59
+ appearance: isRovoSupportedFeature && fg('platform_sl_3p_auth_rovo_block_card_kill_switch') ? 'subtle' : 'default',
57
60
  size: size
58
61
  })) : null);
59
62
  };
@@ -4,7 +4,7 @@ import "./index.compiled.css";
4
4
  import * as React from 'react';
5
5
  import { ax, ix } from "@compiled/react/runtime";
6
6
  import { useMemo } from 'react';
7
- import { InternalActionName } from '../../../../../constants';
7
+ import { ActionName } from '../../../../../constants';
8
8
  import { useFlexibleCardContext } from '../../../../../state/flexible-ui-context';
9
9
  import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
10
10
  import * as Actions from '../../actions';
@@ -14,7 +14,7 @@ import Block from '../block';
14
14
  * Allowed footer actions for HoverCard, in display order. Fetched from context.
15
15
  * @featureGate platform_sl_3p_auth_rovo_action_kill_switch
16
16
  */
17
- const HIDDEN_HOVER_CARD_FOOTER_ACTIONS = [InternalActionName.RovoChatAction];
17
+ const HIDDEN_HOVER_CARD_FOOTER_ACTIONS = [ActionName.RovoChatAction];
18
18
  const ignoreContainerMarginStyles = null;
19
19
  const elevatedFooterStyles = null;
20
20
  const providerStyles = null;
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { ActionName, ElementName, SmartLinkSize } from '../../../../constants';
4
5
  import { isFlexibleUiElement } from '../../../../utils/flexible';
5
6
  import * as Elements from '../elements';
@@ -84,6 +85,16 @@ export const filterActionItems = (items = [], context) => {
84
85
  case ActionName.CustomAction:
85
86
  // Named and custom actions that user defines.
86
87
  return Boolean(ActionName[item.name]);
88
+ case ActionName.RovoChatAction:
89
+ if (fg('platform_sl_3p_auth_rovo_block_card_kill_switch')) {
90
+ return Boolean(ActionName[item.name]);
91
+ }
92
+ // same as default case below
93
+ // remove on cleanup of platform_sl_3p_auth_rovo_block_card_kill_switch
94
+ if ((context === null || context === void 0 ? void 0 : context.actions) === undefined) {
95
+ return false;
96
+ }
97
+ return Boolean(item.name in context.actions ? context.actions[item.name] : undefined);
87
98
  default:
88
99
  // Action that require data from the data context to render.
89
100
  if ((context === null || context === void 0 ? void 0 : context.actions) === undefined) {
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
12
12
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
13
13
  const PACKAGE_DATA = {
14
14
  packageName: "@atlaskit/smart-card",
15
- packageVersion: "44.1.1",
15
+ packageVersion: "44.2.0",
16
16
  componentName: 'linkUrl'
17
17
  };
18
18
  const Anchor = withLinkClickedEvent('a');
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a2c5d8cedcee65ebf67384ac162fba2794960b99578ebb32f203f6df1045ad54
3
+ size 251795
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:94c916c880e3ac977bfb43883a1ae9ba3c763192cfced87f8dac58778be5286f
3
+ size 61477
@@ -159,11 +159,11 @@ export var ActionName = /*#__PURE__*/function (ActionName) {
159
159
  ActionName["AutomationAction"] = "AutomationAction";
160
160
  ActionName["DownloadAction"] = "DownloadAction";
161
161
  ActionName["CustomAction"] = "CustomAction";
162
+ ActionName["RovoChatAction"] = "RovoChatAction";
162
163
  return ActionName;
163
164
  }({});
164
165
  export var InternalActionName = /*#__PURE__*/function (InternalActionName) {
165
166
  InternalActionName["AISummaryAction"] = "AISummaryAction";
166
- InternalActionName["RovoChatAction"] = "RovoChatAction";
167
167
  InternalActionName["UnresolvedAction"] = "UnresolvedAction";
168
168
  InternalActionName["ViewRelatedLinksAction"] = "ViewRelatedLinksAction";
169
169
  return InternalActionName;
@@ -1,6 +1,6 @@
1
1
  import { extractSmartLinkUrl } from '@atlaskit/link-extractors';
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
- import { InternalActionName } from '../../../constants';
3
+ import { ActionName } from '../../../constants';
4
4
  import { getDefinitionId, getExtensionKey, getResourceType } from '../../../state/helpers';
5
5
  import { canShowAction } from '../../../utils/actions/can-show-action';
6
6
  import { getIsRovoChatEnabled } from '../../../utils/rovo';
@@ -24,13 +24,14 @@ var extractRovoChatAction = function extractRovoChatAction(_ref) {
24
24
  var isGoogleProvider = getExtensionKey(response) === 'google-object-provider';
25
25
  var is3PAuthRovoActionEnabled = isGoogleProvider && fg('platform_sl_3p_auth_rovo_action_kill_switch');
26
26
  var is3PInlinePostAuthActionsEnabled = !isGoogleProvider && fg('rovogrowth-640-inline-action-nudge-fg');
27
- var isSupportedFeature = supportsRovoActions && is3PInlinePostAuthActionsEnabled || is3PAuthRovoActionEnabled;
27
+ var is3PBlockPostAuthActionsEnabled = supportsRovoActions && fg('platform_sl_3p_auth_rovo_block_card_kill_switch');
28
+ var isSupportedFeature = supportsRovoActions && is3PInlinePostAuthActionsEnabled || is3PAuthRovoActionEnabled || is3PBlockPostAuthActionsEnabled;
28
29
  var isOptIn = (actionOptions === null || actionOptions === void 0 || (_actionOptions$rovoCh = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh === void 0 ? void 0 : _actionOptions$rovoCh.optIn) === true;
29
30
  var url = extractSmartLinkUrl(response);
30
31
  return isSupportedFeature && isOptIn ? {
31
32
  invokeAction: {
32
33
  actionSubjectId: 'rovoChatPrompt',
33
- actionType: InternalActionName.RovoChatAction,
34
+ actionType: ActionName.RovoChatAction,
34
35
  definitionId: getDefinitionId(response),
35
36
  display: appearance,
36
37
  extensionKey: getExtensionKey(response),
@@ -43,7 +43,7 @@ export var extractFlexibleCardActions = function extractFlexibleCardActions(_ref
43
43
  response: response,
44
44
  isPreviewPanelAvailable: isPreviewPanelAvailable,
45
45
  openPreviewPanel: openPreviewPanel
46
- })), ActionName.AutomationAction, extractAutomationAction(response)), InternalActionName.AISummaryAction, extractAISummaryAction(response, url, actionOptions, aiSummaryConfig)), fg('platform_sl_3p_auth_rovo_action_kill_switch') || fg('rovogrowth-640-inline-action-nudge-fg') ? _defineProperty({}, InternalActionName.RovoChatAction, extractRovoChatAction({
46
+ })), ActionName.AutomationAction, extractAutomationAction(response)), InternalActionName.AISummaryAction, extractAISummaryAction(response, url, actionOptions, aiSummaryConfig)), fg('platform_sl_3p_auth_rovo_action_kill_switch') || fg('rovogrowth-640-inline-action-nudge-fg') ? _defineProperty({}, ActionName.RovoChatAction, extractRovoChatAction({
47
47
  actionOptions: actionOptions,
48
48
  appearance: appearance,
49
49
  id: id,
@@ -970,5 +970,45 @@ export var messages = defineMessages({
970
970
  id: 'fabric.linking.rovo_prompt_message_ask_rovo_anything.non-final',
971
971
  defaultMessage: '`I have a question about this linked item` {url}',
972
972
  description: 'The placeholder prompt message pre-filled in Rovo Chat input. {url} refers to the Smart Link URL. This is not auto-submitted — the user types their question.'
973
+ },
974
+ rovo_prompt_button_highlight_relevant_content: {
975
+ id: 'fabric.linking.rovo_prompt_button_highlight_relevant_content.non-final',
976
+ defaultMessage: "Highlight what's relevant",
977
+ description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
978
+ },
979
+ rovo_prompt_message_highlight_relevant_content: {
980
+ id: 'fabric.linking.rovo_prompt_message_highlight_relevant_content.non-final',
981
+ defaultMessage: '<p>Based on this linked item (<a>{url}</a>) and the {context} 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>',
982
+ description: 'The prompt message to send to Rovo Chat. {context} refers to the content the user triggered from, e.g. Confluence page or Jira work item. {url} refers to Smart Link that the user triggers this action from. (Please make sure all html tags remain the same.)'
983
+ },
984
+ rovo_prompt_button_identify_key_trends: {
985
+ id: 'fabric.linking.rovo_prompt_button_identify_key_trends.non-final',
986
+ defaultMessage: "Identify key trends",
987
+ description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
988
+ },
989
+ rovo_prompt_message_identify_key_trends: {
990
+ id: 'fabric.linking.rovo_prompt_message_identify_key_trends.non-final',
991
+ defaultMessage: '<p>From this <a>{url}</a>, identify the key trends, anomalies, and headline numbers. Call out anything increasing/decreasing significantly, noteworthy comparisons, and any risks or opportunities the data suggests.</p>',
992
+ 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.)'
993
+ },
994
+ rovo_prompt_button_identify_key_points: {
995
+ id: 'fabric.linking.rovo_prompt_button_identify_key_points.non-final',
996
+ defaultMessage: "Identify key points",
997
+ description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
998
+ },
999
+ rovo_prompt_message_identify_key_points: {
1000
+ id: 'fabric.linking.rovo_prompt_message_identify_key_points.non-final',
1001
+ defaultMessage: '<p>From this <a>{url}</a>, identify the key points, proposals, and decisions. Focus on what someone skimming the deck should know in order to understand the main message.</p>',
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
+ },
1004
+ rovo_prompt_button_find_open_questions: {
1005
+ id: 'fabric.linking.rovo_prompt_button_find_open_questions.non-final',
1006
+ defaultMessage: "Find open questions",
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_find_open_questions: {
1010
+ id: 'fabric.linking.rovo_prompt_message_find_open_questions.non-final',
1011
+ 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>',
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.)'
973
1013
  }
974
1014
  });
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
4
4
  export var context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card",
7
- packageVersion: "44.1.1"
7
+ packageVersion: "44.2.0"
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -6,8 +6,13 @@ import * as React from 'react';
6
6
  import { ax, ix } from "@compiled/react/runtime";
7
7
  import { useEffect, useMemo, useState } from 'react';
8
8
  import { browser } from '@atlaskit/linking-common/user-agent';
9
+ import { fg } from "@atlaskit/platform-feature-flags";
9
10
  import { ActionName, ElementName, SmartLinkPosition } from '../../../constants';
11
+ import extractRovoChatAction from '../../../extractors/flexible/actions/extract-rovo-chat-action';
12
+ import { getExtensionKey } from '../../../state/helpers';
13
+ import useRovoConfig from '../../../state/hooks/use-rovo-config';
10
14
  import FlexibleCard from '../../FlexibleCard';
15
+ import { RovoChatPromptKey } from '../../FlexibleCard/components/actions/rovo-chat-action';
11
16
  import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock } from '../../FlexibleCard/components/blocks';
12
17
  import { FlexibleCardUiOptions, getSimulatedBetterMetadata, PreviewBlockOptions, titleBlockOptions } from './utils';
13
18
  import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
@@ -21,6 +26,7 @@ var footerBlockSafariStyles = null;
21
26
  * @see FlexibleCardProps
22
27
  */
23
28
  var ResolvedView = function ResolvedView(_ref) {
29
+ var _cardState$details2;
24
30
  var cardState = _ref.cardState,
25
31
  onClick = _ref.onClick,
26
32
  onError = _ref.onError,
@@ -35,6 +41,19 @@ var ResolvedView = function ResolvedView(_ref) {
35
41
  _useState2 = _slicedToArray(_useState, 2),
36
42
  isPreviewBlockErrored = _useState2[0],
37
43
  setIsPreviewBlockErrored = _useState2[1];
44
+ var extensionKey = getExtensionKey(cardState.details);
45
+ var rovoConfig = fg('platform_sl_3p_auth_rovo_block_card_kill_switch') ?
46
+ // eslint-disable-next-line react-hooks/rules-of-hooks
47
+ useRovoConfig() : undefined;
48
+ var showRovoResolvedView = fg('platform_sl_3p_auth_rovo_block_card_kill_switch') ?
49
+ // eslint-disable-next-line react-hooks/rules-of-hooks
50
+ useMemo(function () {
51
+ return (cardState === null || cardState === void 0 ? void 0 : cardState.status) === 'resolved' && cardState.details && extractRovoChatAction({
52
+ response: cardState.details,
53
+ rovoConfig: rovoConfig,
54
+ actionOptions: actionOptions
55
+ }) !== undefined;
56
+ }, [actionOptions, cardState === null || cardState === void 0 ? void 0 : cardState.details, cardState === null || cardState === void 0 ? void 0 : cardState.status, rovoConfig]) : undefined;
38
57
 
39
58
  // eslint-disable-next-line react-hooks/rules-of-hooks
40
59
  var _useMemo = useMemo(function () {
@@ -49,8 +68,35 @@ var ResolvedView = function ResolvedView(_ref) {
49
68
  titleMetadata = _getSimulatedBetterMe.titleMetadata,
50
69
  topMetadata = _getSimulatedBetterMe.topMetadata,
51
70
  bottomMetadata = _getSimulatedBetterMe.bottomMetadata;
71
+ var prompts = useMemo(function () {
72
+ if (fg('platform_sl_3p_auth_rovo_block_card_kill_switch')) {
73
+ var _cardState$details;
74
+ var defaultPrompts = [RovoChatPromptKey.HIGHLIGHT_RELEVANT_CONTENT, RovoChatPromptKey.ASK_ROVO_ANYTHING];
75
+ var linkType = (_cardState$details = cardState.details) === null || _cardState$details === void 0 || (_cardState$details = _cardState$details.data) === null || _cardState$details === void 0 ? void 0 : _cardState$details['@type'];
76
+ if (extensionKey === 'slack-object-provider') {
77
+ return [RovoChatPromptKey.FIND_OPEN_QUESTIONS].concat(defaultPrompts);
78
+ }
79
+ if (extensionKey === 'google-object-provider' && linkType !== null && linkType !== void 0 && linkType.includes('schema:PresentationDigitalDocument')) {
80
+ return [RovoChatPromptKey.IDENTIFY_KEY_POINTS].concat(defaultPrompts);
81
+ }
82
+ if (extensionKey === 'google-object-provider' && linkType !== null && linkType !== void 0 && linkType.includes('schema:SpreadsheetDigitalDocument')) {
83
+ return [RovoChatPromptKey.IDENTIFY_KEY_TRENDS].concat(defaultPrompts);
84
+ }
85
+ return [RovoChatPromptKey.SUMMARIZE_LINK].concat(defaultPrompts);
86
+ }
87
+ return [];
88
+ }, [cardState === null || cardState === void 0 || (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data, extensionKey]);
52
89
  var footerActions = useMemo(function () {
53
- return [{
90
+ return showRovoResolvedView && fg('platform_sl_3p_auth_rovo_block_card_kill_switch') ? [{
91
+ name: ActionName.RovoChatAction,
92
+ prompts: prompts
93
+ }, {
94
+ name: ActionName.FollowAction,
95
+ hideIcon: true
96
+ }, {
97
+ name: ActionName.DownloadAction,
98
+ hideIcon: true
99
+ }] : [{
54
100
  name: ActionName.FollowAction,
55
101
  hideIcon: true
56
102
  }, {
@@ -60,7 +106,7 @@ var ResolvedView = function ResolvedView(_ref) {
60
106
  name: ActionName.DownloadAction,
61
107
  hideIcon: true
62
108
  }];
63
- }, []);
109
+ }, [showRovoResolvedView, prompts]);
64
110
  var uiOptions = FlexibleCardUiOptions;
65
111
  uiOptions.enableSnippetRenderer = true;
66
112
  uiOptions.hideLoadingSkeleton = hideIconLoadingSkeleton;