@atlaskit/smart-card 46.13.7 → 46.13.8

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 (62) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +3 -0
  3. package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png +3 -0
  4. package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +3 -0
  5. package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png +3 -0
  6. package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +3 -0
  7. package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png +3 -0
  8. package/dist/cjs/messages.js +10 -0
  9. package/dist/cjs/state/hooks/use-block-card-rovo-action-experiment/index.js +2 -0
  10. package/dist/cjs/utils/analytics/analytics.js +1 -1
  11. package/dist/cjs/utils/is-rovo-chat-action-visualize-enabled.js +43 -0
  12. package/dist/cjs/utils/is-special-key.js +1 -4
  13. package/dist/cjs/view/BlockCard/views/ResolvedView.js +9 -2
  14. package/dist/cjs/view/EmbedCard/components/rovo-actions-footer/index.js +4 -1
  15. package/dist/cjs/view/EmbedCard/views/ResolvedView.js +5 -2
  16. package/dist/cjs/view/InlineCard/common/rovo-actions-cta/index.js +28 -5
  17. package/dist/cjs/view/LinkUrl/index.js +1 -1
  18. package/dist/cjs/view/common/rovo-chat-utils/index.js +28 -0
  19. package/dist/cjs/view/common/rovo-post-auth-prompts/index.js +16 -1
  20. package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +3 -0
  21. package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png +3 -0
  22. package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +3 -0
  23. package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png +3 -0
  24. package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +3 -0
  25. package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png +3 -0
  26. package/dist/es2019/messages.js +10 -0
  27. package/dist/es2019/state/hooks/use-block-card-rovo-action-experiment/index.js +2 -0
  28. package/dist/es2019/utils/analytics/analytics.js +1 -1
  29. package/dist/es2019/utils/is-rovo-chat-action-visualize-enabled.js +34 -0
  30. package/dist/es2019/utils/is-special-key.js +1 -5
  31. package/dist/es2019/view/BlockCard/views/ResolvedView.js +9 -2
  32. package/dist/es2019/view/EmbedCard/components/rovo-actions-footer/index.js +5 -2
  33. package/dist/es2019/view/EmbedCard/views/ResolvedView.js +5 -2
  34. package/dist/es2019/view/InlineCard/common/rovo-actions-cta/index.js +28 -5
  35. package/dist/es2019/view/LinkUrl/index.js +1 -1
  36. package/dist/es2019/view/common/rovo-chat-utils/index.js +26 -0
  37. package/dist/es2019/view/common/rovo-post-auth-prompts/index.js +15 -1
  38. package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +3 -0
  39. package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png +3 -0
  40. package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +3 -0
  41. package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png +3 -0
  42. package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +3 -0
  43. package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png +3 -0
  44. package/dist/esm/messages.js +10 -0
  45. package/dist/esm/state/hooks/use-block-card-rovo-action-experiment/index.js +2 -0
  46. package/dist/esm/utils/analytics/analytics.js +1 -1
  47. package/dist/esm/utils/is-rovo-chat-action-visualize-enabled.js +37 -0
  48. package/dist/esm/utils/is-special-key.js +1 -5
  49. package/dist/esm/view/BlockCard/views/ResolvedView.js +9 -2
  50. package/dist/esm/view/EmbedCard/components/rovo-actions-footer/index.js +5 -2
  51. package/dist/esm/view/EmbedCard/views/ResolvedView.js +5 -2
  52. package/dist/esm/view/InlineCard/common/rovo-actions-cta/index.js +28 -5
  53. package/dist/esm/view/LinkUrl/index.js +1 -1
  54. package/dist/esm/view/common/rovo-chat-utils/index.js +28 -0
  55. package/dist/esm/view/common/rovo-post-auth-prompts/index.js +16 -1
  56. package/dist/types/messages.d.ts +1 -1
  57. package/dist/types/utils/is-rovo-chat-action-visualize-enabled.d.ts +18 -0
  58. package/dist/types/utils/is-special-key.d.ts +0 -2
  59. package/dist/types/view/EmbedCard/components/rovo-actions-footer/index.d.ts +1 -1
  60. package/dist/types/view/common/rovo-chat-utils/index.d.ts +2 -1
  61. package/dist/types/view/common/rovo-post-auth-prompts/index.d.ts +10 -1
  62. package/package.json +2 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 46.13.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7f0754c33e3cc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7f0754c33e3cc) -
8
+ [ux] Add a Rovo "Visualize" prompt for Google Sheets Smart Links (inline, block and embed card) in
9
+ Confluence, behind the `platform_sl_3p_auth_visualize_exp` experiment and
10
+ `platform_sl_3p_auth_visualize_killswitch` kill switch.
11
+ - [`6429528944cd2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6429528944cd2) -
12
+ Clean up `platform-smart-card-shift-key` while retaining the existing Ctrl and Command click
13
+ behavior.
14
+ - Updated dependencies
15
+
3
16
  ## 46.13.7
4
17
 
5
18
  ### Patch Changes
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ee0b8e92f9b9c2b3ef643ddd4e755acaff8fd52fb3006b4f413390039d170dc
3
+ size 15497
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:27b5287bebe80d65e79b2e2aad2482266f37cc3a30355fa0fd03723d6fbe1ab8
3
+ size 14553
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8c95a690756802b01e261263cfa50f0e618423cba1d794ac64304d8a00e3a11a
3
+ size 13556
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6211d122b7ed1b0a8ebd4a1638b7898affa4956ad73122166d837e4995c1757c
3
+ size 12961
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db641c996de33386cdc38f5196e715e29fb02c19557707ee2ff3e7b7298b3327
3
+ size 3898
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b730f2848a00ea72ec96045cac382e4a3cd3b1f1f19d5a64e39e307e68f07d05
3
+ size 2802
@@ -1117,5 +1117,15 @@ var messages = exports.messages = (0, _reactIntl.defineMessages)({
1117
1117
  id: 'fabric.linking.pre_auth_block_social_proof_low',
1118
1118
  defaultMessage: 'Your team sees richer <b>{provider}</b> previews.',
1119
1119
  description: 'Social proof message shown on unauthorized 3P block cards when less than 30% of the tenant has connected the provider. {provider} is the 3P app name (e.g. OneDrive).'
1120
+ },
1121
+ rovo_prompt_button_visualize: {
1122
+ id: 'fabric.linking.rovo_prompt_button_visualize.non-final',
1123
+ defaultMessage: 'Visualize',
1124
+ description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
1125
+ },
1126
+ rovo_prompt_message_visualize: {
1127
+ id: 'fabric.linking.rovo_prompt_message_visualize.non-final',
1128
+ defaultMessage: '<p>Visualize this link <a>{url}</a></p>',
1129
+ 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.)'
1120
1130
  }
1121
1131
  });
@@ -32,6 +32,8 @@ var useBlockCardRovoAction = function useBlockCardRovoAction(url, actionOptions)
32
32
  var isRovoChatEnabled = (0, _rovo.getIsRovoChatEnabled)(rovoConfig);
33
33
  var cardState = (0, _store.useSmartCardState)(url !== null && url !== void 0 ? url : '');
34
34
  var extensionKey = (0, _getExtensionKey.getExtensionKey)(cardState.details);
35
+ // TODO: ASIMO-5567 - Also check canShowAction(CardAction.RovoChatAction, actionOptions) so the
36
+ // hook returns false when the consumer hides the Rovo chat action via actionOptions.hide/exclude.
35
37
  var isRovoChatActionOptedIn = (_actionOptions$rovoCh = actionOptions === null || actionOptions === void 0 || (_actionOptions$rovoCh2 = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh2 === void 0 ? void 0 : _actionOptions$rovoCh2.optIn) !== null && _actionOptions$rovoCh !== void 0 ? _actionOptions$rovoCh : false;
36
38
  return (0, _react.useMemo)(function () {
37
39
  if (!isRovoChatEnabled || !url || !isRovoChatActionOptedIn) {
@@ -25,7 +25,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
25
25
  var context = exports.context = {
26
26
  componentName: 'smart-cards',
27
27
  packageName: "@atlaskit/smart-card" || '',
28
- packageVersion: "46.13.6" || ''
28
+ packageVersion: "46.13.7" || ''
29
29
  };
30
30
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
31
31
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isRovoChatActionVisualizeEnabled = void 0;
7
+ var _expVal = require("@atlaskit/platform-feature-experiments/exp-val");
8
+ var _fg = require("@atlaskit/platform-feature-flags/fg");
9
+ /**
10
+ * Rollout state only (kill switch, then experiment). Evaluating the experiment
11
+ * fires exposure, so this must run after every business rule has passed.
12
+ * Remove this function on experiment cleanup; the business rules stay.
13
+ */
14
+ var isVisualizeExperimentEnabled = function isVisualizeExperimentEnabled() {
15
+ return (0, _fg.fg)('platform_sl_3p_auth_visualize_killswitch') && (0, _expVal.expVal)('platform_sl_3p_auth_visualize_exp', 'isEnabled', false);
16
+ };
17
+
18
+ /**
19
+ * `@type` is a string or string array per JSON-LD, but it comes from the network, so guard
20
+ * against any other shape rather than calling `.includes` on it directly.
21
+ */
22
+ var isGoogleSheetsType = function isGoogleSheetsType(response) {
23
+ var _response$data;
24
+ var type = response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data['@type'];
25
+ var types = Array.isArray(type) ? type : [type];
26
+ return types.includes('schema:SpreadsheetDigitalDocument');
27
+ };
28
+
29
+ /**
30
+ * Whether the Rovo chat "Visualize" action is offered for a resolved link.
31
+ *
32
+ * Business rules: Google Sheets links in Confluence.
33
+ *
34
+ * Callers must only call this once the Rovo chat action will be shown for the
35
+ * link (resolved, Rovo chat enabled, opted in and not hidden), so experiment
36
+ * exposure matches what the user sees.
37
+ */
38
+ var isRovoChatActionVisualizeEnabled = exports.isRovoChatActionVisualizeEnabled = function isRovoChatActionVisualizeEnabled(_ref) {
39
+ var extensionKey = _ref.extensionKey,
40
+ product = _ref.product,
41
+ response = _ref.response;
42
+ return product === 'CONFLUENCE' && extensionKey === 'google-object-provider' && isGoogleSheetsType(response) && isVisualizeExperimentEnabled();
43
+ };
@@ -4,18 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isSpecialKey = void 0;
7
- var _fg = require("@atlaskit/platform-feature-flags/fg");
8
7
  /**
9
8
  * Meta key = cmd on mac, windows key on windows
10
9
  * Ctrl key on mac by default triggers a right click instead of left click
11
10
  * Ctrl key on Windows has the same behaviour of cmd key of mac (open in new tab)
12
- * Shift key is also a "special" key because the default behavior of Chromium-based browsers is to open the
13
- * link in a new window; Arc browser has custom logic to show links in its "peek" window when shift is held.
14
11
  *
15
12
  * `isSpecialKey` on a mouse event on mac with default behaviour should be equivalent to opening in new tab
16
13
  * On Windows it will be equivalent to opening a new tab, unless its the Window key that is held
17
14
  * in which case typically only a standard clickthrough will occur, this is likely a small portion of events
18
15
  */
19
16
  var isSpecialKey = exports.isSpecialKey = function isSpecialKey(event) {
20
- return (0, _fg.fg)('platform-smart-card-shift-key') ? event.metaKey || event.ctrlKey || event.shiftKey : event.metaKey || event.ctrlKey;
17
+ return event.metaKey || event.ctrlKey;
21
18
  };
@@ -19,6 +19,7 @@ var _extractRovoChatAction = _interopRequireDefault(require("../../../extractors
19
19
  var _getExtensionKey = require("../../../state/getExtensionKey");
20
20
  var _useBlockCardRovoActionExperiment = _interopRequireDefault(require("../../../state/hooks/use-block-card-rovo-action-experiment"));
21
21
  var _useRovoConfig = _interopRequireDefault(require("../../../state/hooks/use-rovo-config"));
22
+ var _isRovoChatActionVisualizeEnabled = require("../../../utils/is-rovo-chat-action-visualize-enabled");
22
23
  var _rovoChatUtils = require("../../common/rovo-chat-utils");
23
24
  var _FlexibleCard = _interopRequireDefault(require("../../FlexibleCard"));
24
25
  var _footerBlock = _interopRequireDefault(require("../../FlexibleCard/components/blocks/footer-block"));
@@ -40,7 +41,6 @@ var footerBlockSafariStyles = null;
40
41
  * @see FlexibleCardProps
41
42
  */
42
43
  var ResolvedView = function ResolvedView(_ref) {
43
- var _cardState$details2;
44
44
  var cardState = _ref.cardState,
45
45
  onClick = _ref.onClick,
46
46
  onAuxClick = _ref.onAuxClick,
@@ -86,12 +86,19 @@ var ResolvedView = function ResolvedView(_ref) {
86
86
  return [_rovoChatUtils.RovoChatPromptKey.IDENTIFY_KEY_POINTS].concat(defaultPrompts);
87
87
  }
88
88
  if (extensionKey === 'google-object-provider' && linkType !== null && linkType !== void 0 && linkType.includes('schema:SpreadsheetDigitalDocument')) {
89
+ if ((0, _isRovoChatActionVisualizeEnabled.isRovoChatActionVisualizeEnabled)({
90
+ extensionKey: extensionKey,
91
+ product: rovoConfig === null || rovoConfig === void 0 ? void 0 : rovoConfig.product,
92
+ response: cardState === null || cardState === void 0 ? void 0 : cardState.details
93
+ })) {
94
+ return [_rovoChatUtils.RovoChatPromptKey.IDENTIFY_KEY_TRENDS, _rovoChatUtils.RovoChatPromptKey.VISUALIZE].concat(defaultPrompts);
95
+ }
89
96
  return [_rovoChatUtils.RovoChatPromptKey.IDENTIFY_KEY_TRENDS].concat(defaultPrompts);
90
97
  }
91
98
  return [_rovoChatUtils.RovoChatPromptKey.SUMMARIZE_LINK].concat(defaultPrompts);
92
99
  }
93
100
  return [];
94
- }, [cardState === null || cardState === void 0 || (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data, extensionKey, is3PRovoBlockRovoActionEnabled]);
101
+ }, [cardState === null || cardState === void 0 ? void 0 : cardState.details, extensionKey, is3PRovoBlockRovoActionEnabled, rovoConfig === null || rovoConfig === void 0 ? void 0 : rovoConfig.product]);
95
102
  var footerActions = (0, _react.useMemo)(function () {
96
103
  var showRovoResolvedView = (cardState === null || cardState === void 0 ? void 0 : cardState.status) === 'resolved' && cardState.details && (0, _extractRovoChatAction.default)({
97
104
  response: cardState.details,
@@ -111,9 +111,12 @@ var EmbedRovoActionsFooter = function EmbedRovoActionsFooter(_ref2) {
111
111
  return actions;
112
112
  }
113
113
  var isPrimaryAction = actions.length === 0;
114
+ // The primary action normally uses the branded AI icon. Visualize keeps its own
115
+ // chart icon so the action stays recognisable, including in the icon-only view.
116
+ var shouldUseBrandedIcon = isPrimaryAction && promptKey !== _rovoChatUtils.RovoChatPromptKey.VISUALIZE;
114
117
  actions.push( /*#__PURE__*/_react.default.createElement(RovoPromptButton, {
115
118
  hideContent: isPrimaryAction && shouldHidePrimaryActionContent,
116
- icon: isPrimaryAction ? /*#__PURE__*/_react.default.createElement(_aiEditIcon.default, null) : promptAction.icon,
119
+ icon: shouldUseBrandedIcon ? /*#__PURE__*/_react.default.createElement(_aiEditIcon.default, null) : promptAction.icon,
117
120
  key: promptKey,
118
121
  onClick: onClick,
119
122
  promptAction: promptAction,
@@ -84,9 +84,12 @@ var EmbedFrameWithRovoFooter = function EmbedFrameWithRovoFooter(_ref) {
84
84
  return [];
85
85
  }
86
86
  return (0, _rovoPostAuthPrompts.getRovoPostAuthPromptKeys)({
87
- extensionKey: (0, _getExtensionKey.getExtensionKey)(details)
87
+ extensionKey: (0, _getExtensionKey.getExtensionKey)(details),
88
+ isRovoChatActionShown: !!rovoActionData,
89
+ product: product,
90
+ response: details
88
91
  });
89
- }, [details, isEmbedRovoActionsFooterEnabled]);
92
+ }, [details, isEmbedRovoActionsFooterEnabled, product, rovoActionData]);
90
93
  var footer = _react.default.useMemo(function () {
91
94
  return rovoActionData && prompts.length > 0 ? (0, _fg.fg)('platform_sl_replace_react_loadable') ? /*#__PURE__*/_react.default.createElement(LazyEmbedRovoActionsFooter, {
92
95
  actionData: rovoActionData,
@@ -24,6 +24,7 @@ var _useInvokeClientAction = _interopRequireDefault(require("../../../../state/h
24
24
  var _useRovoChat3 = _interopRequireDefault(require("../../../../state/hooks/use-rovo-chat"));
25
25
  var _useRovoConfig = _interopRequireDefault(require("../../../../state/hooks/use-rovo-config"));
26
26
  var _store = require("../../../../state/store");
27
+ var _isRovoChatActionVisualizeEnabled = require("../../../../utils/is-rovo-chat-action-visualize-enabled");
27
28
  var _rovoChatUtils = require("../../../common/rovo-chat-utils");
28
29
  var _actionButton = require("../action-button");
29
30
  var _async = require("../one-click-chat-spotlight/async");
@@ -62,11 +63,19 @@ var InlineRovoActionButtonLegacy = function InlineRovoActionButtonLegacy(_ref) {
62
63
  var invoke = (0, _useInvokeClientAction.default)({});
63
64
  var promptKey = (0, _react.useMemo)(function () {
64
65
  var _cardState$details, _cardState$details2;
65
- if (extensionKey === 'google-object-provider' && (_cardState$details = cardState.details) !== null && _cardState$details !== void 0 && (_cardState$details = _cardState$details.data) !== null && _cardState$details !== void 0 && (_cardState$details = _cardState$details['@type']) !== null && _cardState$details !== void 0 && _cardState$details.includes('schema:SpreadsheetDigitalDocument')) {
66
- return;
67
- }
68
66
  switch (extensionKey) {
69
67
  case 'google-object-provider':
68
+ if ((_cardState$details = cardState.details) !== null && _cardState$details !== void 0 && (_cardState$details = _cardState$details.data) !== null && _cardState$details !== void 0 && (_cardState$details = _cardState$details['@type']) !== null && _cardState$details !== void 0 && _cardState$details.includes('schema:SpreadsheetDigitalDocument')) {
69
+ // Only evaluate Visualize (and fire exposure) when the Rovo chat action is available.
70
+ if (rovoChatAction && (0, _isRovoChatActionVisualizeEnabled.isRovoChatActionVisualizeEnabled)({
71
+ extensionKey: extensionKey,
72
+ product: rovoConfig === null || rovoConfig === void 0 ? void 0 : rovoConfig.product,
73
+ response: cardState.details
74
+ })) {
75
+ return _rovoChatUtils.RovoChatPromptKey.VISUALIZE;
76
+ }
77
+ return;
78
+ }
70
79
  if ((_cardState$details2 = cardState.details) !== null && _cardState$details2 !== void 0 && (_cardState$details2 = _cardState$details2.data) !== null && _cardState$details2 !== void 0 && (_cardState$details2 = _cardState$details2['@type']) !== null && _cardState$details2 !== void 0 && _cardState$details2.includes('schema:PresentationDigitalDocument')) {
71
80
  return _rovoChatUtils.RovoChatPromptKey.SUMMARIZE_PRESENTATION;
72
81
  }
@@ -82,7 +91,7 @@ var InlineRovoActionButtonLegacy = function InlineRovoActionButtonLegacy(_ref) {
82
91
  case 'salesforce-object-provider':
83
92
  return _rovoChatUtils.RovoChatPromptKey.SALESFORCE_PREP;
84
93
  }
85
- }, [extensionKey, cardState]);
94
+ }, [extensionKey, cardState, rovoChatAction, rovoConfig === null || rovoConfig === void 0 ? void 0 : rovoConfig.product]);
86
95
  var _ref2 = promptKey ? (0, _rovoChatUtils.getPromptAction)({
87
96
  promptKey: promptKey,
88
97
  intl: intl,
@@ -153,6 +162,14 @@ var InlineRovoActionButtonWithSpotlight = function InlineRovoActionButtonWithSpo
153
162
  var promptKey = (0, _react.useMemo)(function () {
154
163
  var _cardState$details3, _cardState$details4;
155
164
  if (extensionKey === 'google-object-provider' && (_cardState$details3 = cardState.details) !== null && _cardState$details3 !== void 0 && (_cardState$details3 = _cardState$details3.data) !== null && _cardState$details3 !== void 0 && (_cardState$details3 = _cardState$details3['@type']) !== null && _cardState$details3 !== void 0 && _cardState$details3.includes('schema:SpreadsheetDigitalDocument')) {
165
+ // Only evaluate Visualize (and fire exposure) when the Rovo chat action is available.
166
+ if (rovoChatAction && (0, _isRovoChatActionVisualizeEnabled.isRovoChatActionVisualizeEnabled)({
167
+ extensionKey: extensionKey,
168
+ product: rovoConfig === null || rovoConfig === void 0 ? void 0 : rovoConfig.product,
169
+ response: cardState.details
170
+ })) {
171
+ return _rovoChatUtils.RovoChatPromptKey.VISUALIZE;
172
+ }
156
173
  return;
157
174
  }
158
175
  switch (extensionKey) {
@@ -172,7 +189,7 @@ var InlineRovoActionButtonWithSpotlight = function InlineRovoActionButtonWithSpo
172
189
  case 'salesforce-object-provider':
173
190
  return _rovoChatUtils.RovoChatPromptKey.SALESFORCE_PREP;
174
191
  }
175
- }, [extensionKey, cardState]);
192
+ }, [extensionKey, cardState, rovoChatAction, rovoConfig === null || rovoConfig === void 0 ? void 0 : rovoConfig.product]);
176
193
  var _ref4 = promptKey ? (0, _rovoChatUtils.getPromptAction)({
177
194
  promptKey: promptKey,
178
195
  intl: intl,
@@ -222,6 +239,12 @@ var InlineRovoActionButtonWithSpotlight = function InlineRovoActionButtonWithSpo
222
239
  }, /*#__PURE__*/_react.default.createElement(_text.Text, {
223
240
  size: "small"
224
241
  }, content))) : null;
242
+
243
+ // Visualize is not part of the spotlight: its copy is generic ("See takeaways") and Sheets
244
+ // links are excluded from the spotlight experiment, so render the plain button.
245
+ if (promptKey === _rovoChatUtils.RovoChatPromptKey.VISUALIZE) {
246
+ return button;
247
+ }
225
248
  return button && isRovoChatEnabled && rovoChatAction !== null && rovoChatAction !== void 0 && rovoChatAction.invokeAction ? /*#__PURE__*/_react.default.createElement(_async.OneClickChatSpotlightLoader, {
226
249
  key: url,
227
250
  url: url,
@@ -19,7 +19,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
19
19
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
20
20
  var PACKAGE_DATA = {
21
21
  packageName: "@atlaskit/smart-card",
22
- packageVersion: "46.13.6",
22
+ packageVersion: "46.13.7",
23
23
  componentName: 'linkUrl'
24
24
  };
25
25
  var LinkUrl = function LinkUrl(_ref) {
@@ -5,10 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.getPromptAction = exports.RovoChatPromptKey = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
8
9
  var _react = _interopRequireDefault(require("react"));
9
10
  var _aiSearch = _interopRequireDefault(require("@atlaskit/icon-lab/core/ai-search"));
10
11
  var _aiChat = _interopRequireDefault(require("@atlaskit/icon/core/ai-chat"));
11
12
  var _aiGenerativeTextSummary = _interopRequireDefault(require("@atlaskit/icon/core/ai-generative-text-summary"));
13
+ var _chartBar = _interopRequireDefault(require("@atlaskit/icon/core/chart-bar"));
12
14
  var _rovoChat = _interopRequireDefault(require("@atlaskit/icon/core/rovo-chat"));
13
15
  var _icon = require("@atlaskit/logo/rovo/icon");
14
16
  var _constants = require("../../../constants");
@@ -16,6 +18,8 @@ var _messages = require("../../../messages");
16
18
  var _aiChapterIcon = _interopRequireDefault(require("../../FlexibleCard/assets/ai-chapter-icon"));
17
19
  var _aiSearchIcon = _interopRequireDefault(require("../../FlexibleCard/assets/ai-search-icon"));
18
20
  var _htmlToAdf = _interopRequireDefault(require("../../FlexibleCard/components/actions/rovo-chat-action/html-to-adf"));
21
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
22
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
19
23
  var RovoChatPromptKey = exports.RovoChatPromptKey = /*#__PURE__*/function (RovoChatPromptKey) {
20
24
  RovoChatPromptKey["SUMMARIZE_LINK"] = "summarize-link";
21
25
  RovoChatPromptKey["KEY_HIGHLIGHTS"] = "key-highlights";
@@ -32,6 +36,7 @@ var RovoChatPromptKey = exports.RovoChatPromptKey = /*#__PURE__*/function (RovoC
32
36
  RovoChatPromptKey["EXPLAIN_CODE"] = "explain-code";
33
37
  RovoChatPromptKey["CATCH_UP"] = "catch-up";
34
38
  RovoChatPromptKey["SALESFORCE_PREP"] = "salesforce-prep";
39
+ RovoChatPromptKey["VISUALIZE"] = "visualize";
35
40
  return RovoChatPromptKey;
36
41
  }({});
37
42
  var getContext = function getContext(intl, product) {
@@ -371,5 +376,28 @@ var getPromptAction = exports.getPromptAction = function getPromptAction(_ref) {
371
376
  size: iconSize
372
377
  })
373
378
  };
379
+ case RovoChatPromptKey.VISUALIZE:
380
+ var label_visualize = intl.formatMessage(_messages.messages.rovo_prompt_button_visualize);
381
+ var html_visualize = intl.formatMessage(_messages.messages.rovo_prompt_message_visualize, {
382
+ url: url
383
+ }, {
384
+ ignoreTag: true
385
+ });
386
+ var visualizeIconProps = _objectSpread({
387
+ label: label_visualize,
388
+ size: iconSize
389
+ }, cardAppearance === _constants.CardDisplay.HoverCardPreview ? {
390
+ spacing: 'spacious'
391
+ } : {});
392
+ return {
393
+ content: label_visualize,
394
+ tooltipMessage: label_visualize,
395
+ data: {
396
+ name: label_visualize,
397
+ dialogues: [],
398
+ prompt: (0, _htmlToAdf.default)(html_visualize)
399
+ },
400
+ icon: /*#__PURE__*/_react.default.createElement(_chartBar.default, visualizeIconProps)
401
+ };
374
402
  }
375
403
  };
@@ -4,12 +4,27 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getRovoPostAuthPromptKeys = void 0;
7
+ var _isRovoChatActionVisualizeEnabled = require("../../../utils/is-rovo-chat-action-visualize-enabled");
7
8
  var _rovoChatUtils = require("../rovo-chat-utils");
8
9
  var getRovoPostAuthPromptKeys = exports.getRovoPostAuthPromptKeys = function getRovoPostAuthPromptKeys(_ref) {
9
- var extensionKey = _ref.extensionKey;
10
+ var extensionKey = _ref.extensionKey,
11
+ _ref$isRovoChatAction = _ref.isRovoChatActionShown,
12
+ isRovoChatActionShown = _ref$isRovoChatAction === void 0 ? false : _ref$isRovoChatAction,
13
+ product = _ref.product,
14
+ response = _ref.response;
10
15
  var defaultPrompts = [_rovoChatUtils.RovoChatPromptKey.KEY_HIGHLIGHTS];
11
16
  if (extensionKey === 'github-object-provider' || extensionKey === 'gitlab-object-provider') {
12
17
  return [_rovoChatUtils.RovoChatPromptKey.EXPLAIN_CODE].concat(defaultPrompts);
13
18
  }
19
+ if (isRovoChatActionShown && (0, _isRovoChatActionVisualizeEnabled.isRovoChatActionVisualizeEnabled)({
20
+ extensionKey: extensionKey,
21
+ product: product,
22
+ response: response
23
+ })) {
24
+ // Visualize goes first (PM decision). The embed Rovo actions footer hides every prompt after
25
+ // the first below 320px (HIDE_SECONDARY_ACTIONS_WIDTH), so this keeps Visualize visible on
26
+ // narrow embeds whenever exposure fires.
27
+ return [_rovoChatUtils.RovoChatPromptKey.VISUALIZE, _rovoChatUtils.RovoChatPromptKey.SUMMARIZE_DOCUMENT].concat(defaultPrompts);
28
+ }
14
29
  return [_rovoChatUtils.RovoChatPromptKey.SUMMARIZE_DOCUMENT].concat(defaultPrompts);
15
30
  };
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ee0b8e92f9b9c2b3ef643ddd4e755acaff8fd52fb3006b4f413390039d170dc
3
+ size 15497
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:27b5287bebe80d65e79b2e2aad2482266f37cc3a30355fa0fd03723d6fbe1ab8
3
+ size 14553
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8c95a690756802b01e261263cfa50f0e618423cba1d794ac64304d8a00e3a11a
3
+ size 13556
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6211d122b7ed1b0a8ebd4a1638b7898affa4956ad73122166d837e4995c1757c
3
+ size 12961
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db641c996de33386cdc38f5196e715e29fb02c19557707ee2ff3e7b7298b3327
3
+ size 3898
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b730f2848a00ea72ec96045cac382e4a3cd3b1f1f19d5a64e39e307e68f07d05
3
+ size 2802
@@ -1111,5 +1111,15 @@ export const messages = defineMessages({
1111
1111
  id: 'fabric.linking.pre_auth_block_social_proof_low',
1112
1112
  defaultMessage: 'Your team sees richer <b>{provider}</b> previews.',
1113
1113
  description: 'Social proof message shown on unauthorized 3P block cards when less than 30% of the tenant has connected the provider. {provider} is the 3P app name (e.g. OneDrive).'
1114
+ },
1115
+ rovo_prompt_button_visualize: {
1116
+ id: 'fabric.linking.rovo_prompt_button_visualize.non-final',
1117
+ defaultMessage: 'Visualize',
1118
+ description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
1119
+ },
1120
+ rovo_prompt_message_visualize: {
1121
+ id: 'fabric.linking.rovo_prompt_message_visualize.non-final',
1122
+ defaultMessage: '<p>Visualize this link <a>{url}</a></p>',
1123
+ 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.)'
1114
1124
  }
1115
1125
  });
@@ -26,6 +26,8 @@ const useBlockCardRovoAction = (url, actionOptions) => {
26
26
  const isRovoChatEnabled = getIsRovoChatEnabled(rovoConfig);
27
27
  const cardState = useSmartCardState(url !== null && url !== void 0 ? url : '');
28
28
  const extensionKey = getExtensionKey(cardState.details);
29
+ // TODO: ASIMO-5567 - Also check canShowAction(CardAction.RovoChatAction, actionOptions) so the
30
+ // hook returns false when the consumer hides the Rovo chat action via actionOptions.hide/exclude.
29
31
  const isRovoChatActionOptedIn = (_actionOptions$rovoCh = actionOptions === null || actionOptions === void 0 ? void 0 : (_actionOptions$rovoCh2 = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh2 === void 0 ? void 0 : _actionOptions$rovoCh2.optIn) !== null && _actionOptions$rovoCh !== void 0 ? _actionOptions$rovoCh : false;
30
32
  return useMemo(() => {
31
33
  if (!isRovoChatEnabled || !url || !isRovoChatActionOptedIn) {
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
4
4
  export const context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card" || '',
7
- packageVersion: "46.13.6" || ''
7
+ packageVersion: "46.13.7" || ''
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -0,0 +1,34 @@
1
+ import { expVal } from '@atlaskit/platform-feature-experiments/exp-val';
2
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
3
+ /**
4
+ * Rollout state only (kill switch, then experiment). Evaluating the experiment
5
+ * fires exposure, so this must run after every business rule has passed.
6
+ * Remove this function on experiment cleanup; the business rules stay.
7
+ */
8
+ const isVisualizeExperimentEnabled = () => fg('platform_sl_3p_auth_visualize_killswitch') && expVal('platform_sl_3p_auth_visualize_exp', 'isEnabled', false);
9
+
10
+ /**
11
+ * `@type` is a string or string array per JSON-LD, but it comes from the network, so guard
12
+ * against any other shape rather than calling `.includes` on it directly.
13
+ */
14
+ const isGoogleSheetsType = response => {
15
+ var _response$data;
16
+ const type = response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data['@type'];
17
+ const types = Array.isArray(type) ? type : [type];
18
+ return types.includes('schema:SpreadsheetDigitalDocument');
19
+ };
20
+
21
+ /**
22
+ * Whether the Rovo chat "Visualize" action is offered for a resolved link.
23
+ *
24
+ * Business rules: Google Sheets links in Confluence.
25
+ *
26
+ * Callers must only call this once the Rovo chat action will be shown for the
27
+ * link (resolved, Rovo chat enabled, opted in and not hidden), so experiment
28
+ * exposure matches what the user sees.
29
+ */
30
+ export const isRovoChatActionVisualizeEnabled = ({
31
+ extensionKey,
32
+ product,
33
+ response
34
+ }) => product === 'CONFLUENCE' && extensionKey === 'google-object-provider' && isGoogleSheetsType(response) && isVisualizeExperimentEnabled();
@@ -1,16 +1,12 @@
1
- import { fg } from '@atlaskit/platform-feature-flags/fg';
2
-
3
1
  /**
4
2
  * Meta key = cmd on mac, windows key on windows
5
3
  * Ctrl key on mac by default triggers a right click instead of left click
6
4
  * Ctrl key on Windows has the same behaviour of cmd key of mac (open in new tab)
7
- * Shift key is also a "special" key because the default behavior of Chromium-based browsers is to open the
8
- * link in a new window; Arc browser has custom logic to show links in its "peek" window when shift is held.
9
5
  *
10
6
  * `isSpecialKey` on a mouse event on mac with default behaviour should be equivalent to opening in new tab
11
7
  * On Windows it will be equivalent to opening a new tab, unless its the Window key that is held
12
8
  * in which case typically only a standard clickthrough will occur, this is likely a small portion of events
13
9
  */
14
10
  export const isSpecialKey = event => {
15
- return fg('platform-smart-card-shift-key') ? event.metaKey || event.ctrlKey || event.shiftKey : event.metaKey || event.ctrlKey;
11
+ return event.metaKey || event.ctrlKey;
16
12
  };
@@ -10,6 +10,7 @@ import extractRovoChatAction from '../../../extractors/flexible/actions/extract-
10
10
  import { getExtensionKey } from '../../../state/getExtensionKey';
11
11
  import useBlockCardRovoAction from '../../../state/hooks/use-block-card-rovo-action-experiment';
12
12
  import useRovoConfig from '../../../state/hooks/use-rovo-config';
13
+ import { isRovoChatActionVisualizeEnabled } from '../../../utils/is-rovo-chat-action-visualize-enabled';
13
14
  import { RovoChatPromptKey } from '../../common/rovo-chat-utils';
14
15
  import FlexibleCard from '../../FlexibleCard';
15
16
  import { default as FooterBlock } from '../../FlexibleCard/components/blocks/footer-block';
@@ -42,7 +43,6 @@ const ResolvedView = ({
42
43
  CompetitorPrompt,
43
44
  hideIconLoadingSkeleton
44
45
  }) => {
45
- var _cardState$details2;
46
46
  const [isPreviewBlockErrored, setIsPreviewBlockErrored] = useState(false);
47
47
  const extensionKey = getExtensionKey(cardState.details);
48
48
  const is3PRovoBlockRovoActionEnabled = useBlockCardRovoAction(url, actionOptions);
@@ -72,12 +72,19 @@ const ResolvedView = ({
72
72
  return [RovoChatPromptKey.IDENTIFY_KEY_POINTS, ...defaultPrompts];
73
73
  }
74
74
  if (extensionKey === 'google-object-provider' && linkType !== null && linkType !== void 0 && linkType.includes('schema:SpreadsheetDigitalDocument')) {
75
+ if (isRovoChatActionVisualizeEnabled({
76
+ extensionKey,
77
+ product: rovoConfig === null || rovoConfig === void 0 ? void 0 : rovoConfig.product,
78
+ response: cardState === null || cardState === void 0 ? void 0 : cardState.details
79
+ })) {
80
+ return [RovoChatPromptKey.IDENTIFY_KEY_TRENDS, RovoChatPromptKey.VISUALIZE, ...defaultPrompts];
81
+ }
75
82
  return [RovoChatPromptKey.IDENTIFY_KEY_TRENDS, ...defaultPrompts];
76
83
  }
77
84
  return [RovoChatPromptKey.SUMMARIZE_LINK, ...defaultPrompts];
78
85
  }
79
86
  return [];
80
- }, [cardState === null || cardState === void 0 ? void 0 : (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data, extensionKey, is3PRovoBlockRovoActionEnabled]);
87
+ }, [cardState === null || cardState === void 0 ? void 0 : cardState.details, extensionKey, is3PRovoBlockRovoActionEnabled, rovoConfig === null || rovoConfig === void 0 ? void 0 : rovoConfig.product]);
81
88
  const footerActions = useMemo(() => {
82
89
  const showRovoResolvedView = (cardState === null || cardState === void 0 ? void 0 : cardState.status) === 'resolved' && cardState.details && extractRovoChatAction({
83
90
  response: cardState.details,
@@ -7,7 +7,7 @@ import Button from '@atlaskit/button/default/button';
7
7
  import { WidthObserver } from '@atlaskit/width-detector/width-observer';
8
8
  import useInvokeClientAction from '../../../../state/hooks/use-invoke-client-action';
9
9
  import useRovoChat from '../../../../state/hooks/use-rovo-chat';
10
- import { getPromptAction } from '../../../common/rovo-chat-utils';
10
+ import { getPromptAction, RovoChatPromptKey } from '../../../common/rovo-chat-utils';
11
11
  import AIEditIcon from '../../../FlexibleCard/assets/ai-edit-icon';
12
12
  const HIDE_SECONDARY_ACTIONS_WIDTH = 320;
13
13
  const PRIMARY_ACTION_ICON_ONLY_WIDTH = 220;
@@ -74,9 +74,12 @@ const EmbedRovoActionsFooter = ({
74
74
  return actions;
75
75
  }
76
76
  const isPrimaryAction = actions.length === 0;
77
+ // The primary action normally uses the branded AI icon. Visualize keeps its own
78
+ // chart icon so the action stays recognisable, including in the icon-only view.
79
+ const shouldUseBrandedIcon = isPrimaryAction && promptKey !== RovoChatPromptKey.VISUALIZE;
77
80
  actions.push( /*#__PURE__*/React.createElement(RovoPromptButton, {
78
81
  hideContent: isPrimaryAction && shouldHidePrimaryActionContent,
79
- icon: isPrimaryAction ? /*#__PURE__*/React.createElement(AIEditIcon, null) : promptAction.icon,
82
+ icon: shouldUseBrandedIcon ? /*#__PURE__*/React.createElement(AIEditIcon, null) : promptAction.icon,
80
83
  key: promptKey,
81
84
  onClick: onClick,
82
85
  promptAction: promptAction,
@@ -63,9 +63,12 @@ const EmbedFrameWithRovoFooter = ({
63
63
  return [];
64
64
  }
65
65
  return getRovoPostAuthPromptKeys({
66
- extensionKey: getExtensionKey(details)
66
+ extensionKey: getExtensionKey(details),
67
+ isRovoChatActionShown: !!rovoActionData,
68
+ product,
69
+ response: details
67
70
  });
68
- }, [details, isEmbedRovoActionsFooterEnabled]);
71
+ }, [details, isEmbedRovoActionsFooterEnabled, product, rovoActionData]);
69
72
  const footer = React.useMemo(() => rovoActionData && prompts.length > 0 ? fg('platform_sl_replace_react_loadable') ? /*#__PURE__*/React.createElement(LazyEmbedRovoActionsFooter, {
70
73
  actionData: rovoActionData,
71
74
  prompts: prompts,