@atlaskit/smart-card 44.26.0 → 44.28.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 (44) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/cjs/__tests__/vr-tests/__snapshots__/inline-card/inline-card-resolved-view-with-rovo-actions-cta-treatment---default.png +2 -2
  3. package/dist/cjs/messages.js +40 -0
  4. package/dist/cjs/state/actions/index.js +16 -20
  5. package/dist/cjs/utils/analytics/analytics.js +1 -1
  6. package/dist/cjs/view/CardWithUrl/component.js +30 -9
  7. package/dist/cjs/view/FlexibleCard/components/actions/rovo-chat-action/index.js +8 -1
  8. package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +2 -1
  9. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +4 -12
  10. package/dist/cjs/view/InlineCard/ResolvedView/InlineCardResolvedViewFunctional.js +2 -3
  11. package/dist/cjs/view/InlineCard/common/rovo-actions-cta/index.js +82 -14
  12. package/dist/cjs/view/LinkUrl/index.js +1 -1
  13. package/dist/cjs/view/common/rovo-chat-utils/index.js +118 -8
  14. package/dist/es2019/__tests__/vr-tests/__snapshots__/inline-card/inline-card-resolved-view-with-rovo-actions-cta-treatment---default.png +2 -2
  15. package/dist/es2019/messages.js +40 -0
  16. package/dist/es2019/state/actions/index.js +17 -21
  17. package/dist/es2019/utils/analytics/analytics.js +1 -1
  18. package/dist/es2019/view/CardWithUrl/component.js +30 -9
  19. package/dist/es2019/view/FlexibleCard/components/actions/rovo-chat-action/index.js +8 -1
  20. package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +6 -0
  21. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +1 -7
  22. package/dist/es2019/view/InlineCard/ResolvedView/InlineCardResolvedViewFunctional.js +2 -3
  23. package/dist/es2019/view/InlineCard/common/rovo-actions-cta/index.js +63 -15
  24. package/dist/es2019/view/LinkUrl/index.js +1 -1
  25. package/dist/es2019/view/common/rovo-chat-utils/index.js +115 -1
  26. package/dist/esm/__tests__/vr-tests/__snapshots__/inline-card/inline-card-resolved-view-with-rovo-actions-cta-treatment---default.png +2 -2
  27. package/dist/esm/messages.js +40 -0
  28. package/dist/esm/state/actions/index.js +17 -21
  29. package/dist/esm/utils/analytics/analytics.js +1 -1
  30. package/dist/esm/view/CardWithUrl/component.js +30 -9
  31. package/dist/esm/view/FlexibleCard/components/actions/rovo-chat-action/index.js +8 -1
  32. package/dist/esm/view/HoverCard/components/HoverCardComponent.js +2 -1
  33. package/dist/esm/view/HoverCard/components/HoverCardContent.js +4 -12
  34. package/dist/esm/view/InlineCard/ResolvedView/InlineCardResolvedViewFunctional.js +2 -3
  35. package/dist/esm/view/InlineCard/common/rovo-actions-cta/index.js +83 -15
  36. package/dist/esm/view/LinkUrl/index.js +1 -1
  37. package/dist/esm/view/common/rovo-chat-utils/index.js +118 -8
  38. package/dist/types/messages.d.ts +1 -1
  39. package/dist/types/view/InlineCard/common/rovo-actions-cta/index.d.ts +3 -1
  40. package/dist/types/view/common/rovo-chat-utils/index.d.ts +17 -2
  41. package/dist/types-ts4.5/messages.d.ts +1 -1
  42. package/dist/types-ts4.5/view/InlineCard/common/rovo-actions-cta/index.d.ts +3 -1
  43. package/dist/types-ts4.5/view/common/rovo-chat-utils/index.d.ts +17 -2
  44. package/package.json +6 -9
package/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 44.28.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`5efd60bd04eb3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5efd60bd04eb3) -
8
+ NAVX-5109 Implementing provider specific logic for new inline cta
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
14
+ ## 44.27.1
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
20
+ ## 44.27.0
21
+
22
+ ### Minor Changes
23
+
24
+ - [`ed3587ea908e3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ed3587ea908e3) -
25
+ [ux] Clean up platform apps same-tab link behavior experiment
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies
30
+
31
+ ## 44.26.1
32
+
33
+ ### Patch Changes
34
+
35
+ - [`299e30381fd33`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/299e30381fd33) -
36
+ Update anchor href with cross-product analytics
37
+ - [`6d0485dce81c4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6d0485dce81c4) -
38
+ Internal: updated to the new `@atlaskit/top-layer` `Popover`/`Dialog` behaviour where the host
39
+ element unmounts after the exit animation completes. No consumer action required.
40
+ - Updated dependencies
41
+
3
42
  ## 44.26.0
4
43
 
5
44
  ### Minor Changes
@@ -1,3 +1,3 @@
1
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:13d8e863b7dcc6b41eef967c98a4e961078c5442a20e9d14ce373567ec6ea6f9
3
- size 12894
2
+ oid sha256:aa200619a891e5d125bc1afc6e360cd61508fef825ffeb5fa88c30f5df2bbefa
3
+ size 21197
@@ -1087,6 +1087,46 @@ var messages = exports.messages = (0, _reactIntl.defineMessages)({
1087
1087
  defaultMessage: "Show me what's relevant",
1088
1088
  description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
1089
1089
  },
1090
+ rovo_prompt_message_summarize_document: {
1091
+ id: 'fabric.linking.rovo_prompt_message_summarize_document.non-final',
1092
+ defaultMessage: "Summarize this doc {url} into a concise, easy-to-scan overview. Adapt to whatever the content is and focus on the main ideas, important decisions, key updates, and next steps, only include these if they exist; don't mention their absence. Avoid unnecessary detail, repetition, or formatting commentary. Write in plain language and optimize for a quick 5\u201310 second read",
1093
+ description: 'The prompt message to send to Rovo Chat. {url} refers to Smart Link that the user triggers this action from.'
1094
+ },
1095
+ rovo_prompt_message_summarize_presentation: {
1096
+ id: 'fabric.linking.rovo_prompt_message_summarize_presentation.non-final',
1097
+ defaultMessage: "Summarize this Google Slides deck {url} into a concise executive overview. Focus on the tldr, key findings, decisions, metrics, risks, and next steps, if there are any. Use a short executive summary followed by 2-3 bullet points. Avoid slide-by-slide narration, design details, repetition, and filler.",
1098
+ description: 'The prompt message to send to Rovo Chat. {url} refers to Smart Link that the user triggers this action from.'
1099
+ },
1100
+ rovo_prompt_button_explain_code: {
1101
+ id: 'fabric.linking.rovo_prompt_button_explain_code.non-final',
1102
+ defaultMessage: "Explain",
1103
+ description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
1104
+ },
1105
+ rovo_prompt_message_explain_code: {
1106
+ id: 'fabric.linking.rovo_prompt_message_explain_code.non-final',
1107
+ defaultMessage: "<p>Explain this code, pull request, or commit {url} in clear, plain language for a non-technical audience.</p><p>Cover:</p><ol><li><strong>Purpose</strong> \u2014 What problem does it solve or what goal does it achieve?</li><li><strong>How it works</strong> \u2014 High-level mechanics (no implementation detail unless critical to understanding).</li><li><strong>Why</strong> \u2014 Motivation for the change or design choice.</li><li><strong>Impact</strong> \u2014 Key behavior changes, risks, or downstream effects worth noting.</li></ol><p>Constraints:</p><ul><li>3\u20135 sentences or 100\u2013150 words max.</li><li>Omit sections with nothing meaningful to say.</li><li>Prefer concrete language over abstract descriptions (e.g., \"speeds up page load by caching results\" over \"improves performance\").</li></ul>",
1108
+ 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.)'
1109
+ },
1110
+ rovo_prompt_button_catch_up: {
1111
+ id: 'fabric.linking.rovo_prompt_button_catch_up.non-final',
1112
+ defaultMessage: "Catch up",
1113
+ description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
1114
+ },
1115
+ rovo_prompt_message_catch_up: {
1116
+ id: 'fabric.linking.rovo_prompt_message_catch_up.non-final',
1117
+ defaultMessage: "Catch me up on the latest {provider} conversations or channel activity in {url} from the last two weeks. If there's no activity in the past two weeks, expand the window to the most recent 30 days (or until meaningful activity is found). Summarize the most important updates, decisions, and discussions so the user can quickly understand what they missed. Focus on key changes, unresolved questions, and any action items or follow-ups. Prioritize recent messages with the most activity. Keep the response concise \u2014 ideally 80\u2013150 words or a short set of 3\u20135 key bullets.",
1118
+ description: 'The prompt message to send to Rovo Chat. {url} refers to Smart Link that the user triggers this action from. {provider} is the 3P app name (Please make sure all html tags remain the same.)'
1119
+ },
1120
+ rovo_prompt_button_salesforce_prep: {
1121
+ id: 'fabric.linking.rovo_prompt_button_salesforce_prep.non-final',
1122
+ defaultMessage: "Prep",
1123
+ description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
1124
+ },
1125
+ rovo_prompt_message_salesforce_prep: {
1126
+ id: 'fabric.linking.rovo_prompt_message_salesforce_prep.non-final',
1127
+ defaultMessage: "Prep me for this Salesforce record {url}. What's the current state, what's the recent activity, what risks or opportunities should I be aware of, and what would be useful to know before a conversation about it?",
1128
+ description: 'The prompt message to send to Rovo Chat. {url} refers to Smart Link that the user triggers this action from'
1129
+ },
1090
1130
  // TODO: remove when social-proof-3p-unauth-block-fg is cleaned up
1091
1131
  pre_auth_block_social_proof_not_low: {
1092
1132
  id: 'fabric.linking.pre_auth_block_social_proof_not_low',
@@ -26,7 +26,9 @@ var _useActionFlags = _interopRequireDefault(require("../hooks/use-action-flags"
26
26
  var _useInvokeClientAction = _interopRequireDefault(require("../hooks/use-invoke-client-action"));
27
27
  var _useResolve = _interopRequireDefault(require("../hooks/use-resolve"));
28
28
  var POST_AUTH_CHAT_EXTENSION_KEY = 'google-object-provider';
29
- var SMART_LINK_TO_ROVO_SOURCE = 'smart-link';
29
+ // Smart Card resolver key differs from the consumer-facing Rovo payload key.
30
+ var POST_AUTH_CHAT_PAYLOAD_EXTENSION_KEY = 'google-drive';
31
+ var SMART_LINK_3P_POST_AUTH_SOURCE = 'smart-link-3p-post-auth';
30
32
  var getPostAuthChatPayloadId = function getPostAuthChatPayloadId() {
31
33
  if (typeof crypto !== 'undefined') {
32
34
  if (typeof crypto.randomUUID === 'function') {
@@ -42,31 +44,25 @@ var getPostAuthChatPayloadId = function getPostAuthChatPayloadId() {
42
44
  }
43
45
  return "smart-link-post-auth-chat-".concat(Date.now());
44
46
  };
45
- var sendPostAuthChatOpenMessage = function sendPostAuthChatOpenMessage(url) {
47
+ var sendPostAuthChatOpenMessage = function sendPostAuthChatOpenMessage(url, documentTitle) {
46
48
  var _window$parent;
47
49
  if (typeof window === 'undefined' || typeof ((_window$parent = window.parent) === null || _window$parent === void 0 ? void 0 : _window$parent.postMessage) !== 'function') {
48
50
  return;
49
51
  }
50
52
  var payload = {
51
- type: 'chat-new',
52
- source: SMART_LINK_TO_ROVO_SOURCE,
53
+ type: 'chat-smartlink-3p-post-auth-launch',
54
+ source: SMART_LINK_3P_POST_AUTH_SOURCE,
55
+ openChat: true,
56
+ openChatMode: 'mini-modal',
53
57
  data: {
54
- dialogues: [],
55
- mode: {
56
- useCurrentPageContext: false
57
- },
58
- aiFeatureContext: {
59
- projectContext: {
60
- projectId: url,
61
- // Use the URL as projectName to avoid introducing a hardcoded
62
- // user-facing provider label in Smart Card.
63
- projectName: url,
64
- projectUrl: url
65
- }
58
+ extensionKey: POST_AUTH_CHAT_PAYLOAD_EXTENSION_KEY,
59
+ provider: 'Google Drive',
60
+ projectContext: {
61
+ projectId: url,
62
+ projectName: documentTitle !== null && documentTitle !== void 0 ? documentTitle : 'Google Drive',
63
+ projectUrl: url
66
64
  }
67
- },
68
- openChat: true,
69
- openChatMode: 'mini-modal'
65
+ }
70
66
  };
71
67
  window.parent.postMessage({
72
68
  eventType: _postMessageToPubsub.ROVO_POST_MESSAGE_EVENT_TYPE,
@@ -302,7 +298,7 @@ var useSmartCardActions = exports.useSmartCardActions = function useSmartCardAct
302
298
  }
303
299
  reload();
304
300
  if (isPostAuthChatTreatment) {
305
- sendPostAuthChatOpenMessage(url);
301
+ sendPostAuthChatOpenMessage(url, (0, _linkExtractors.extractSmartLinkTitle)(details));
306
302
  }
307
303
  }, function (err) {
308
304
  var _err$type;
@@ -11,7 +11,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
11
11
  var context = exports.context = {
12
12
  componentName: 'smart-cards',
13
13
  packageName: "@atlaskit/smart-card" || '',
14
- packageVersion: "44.25.1" || ''
14
+ packageVersion: "44.27.1" || ''
15
15
  };
16
16
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
17
17
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -112,6 +112,21 @@ function Component(_ref) {
112
112
 
113
113
  // Shared scope guard for all 3P-click handlers.
114
114
  var shouldFire3PClickEvent = thirdPartyARI && thirdPartyARI.startsWith(thirdPartyARIPrefix) && (0, _helpers.getClickUrl)(url, state.details) === url && fire3PClickEvent && (0, _platformFeatureFlags.fg)('platform_smartlink_3pclick_analytics');
115
+ var getDestinationUrl = (0, _react.useCallback)(function () {
116
+ var _getClickUrl, _appendCrossProductAn;
117
+ var preferredUrl = (_getClickUrl = (0, _helpers.getClickUrl)(url, state.details)) !== null && _getClickUrl !== void 0 ? _getClickUrl : url;
118
+ return (_appendCrossProductAn = appendCrossProductAnalyticsParams(preferredUrl)) !== null && _appendCrossProductAn !== void 0 ? _appendCrossProductAn : preferredUrl;
119
+ }, [appendCrossProductAnalyticsParams, state.details, url]);
120
+ var updateAnchorHref = (0, _react.useCallback)(function (event, destinationUrl) {
121
+ if (!(event.currentTarget instanceof HTMLAnchorElement)) {
122
+ return;
123
+ }
124
+
125
+ // FIXME: destinationUrl should be rendered in the DOM anchor href instead of derived at click time
126
+ // href is only defined when currentTarget is an anchor element.
127
+ // Update the anchor href so the browser context menu uses the decorated URL.
128
+ event.currentTarget.href = destinationUrl;
129
+ }, []);
115
130
 
116
131
  // Setup UI handlers.
117
132
  var handleClickWrapper = (0, _react.useCallback)(function (event) {
@@ -131,7 +146,6 @@ function Component(_ref) {
131
146
  exposure: true
132
147
  });
133
148
  if ((0, _platformFeatureFlags.fg)('platform_smartlink_xpc_url_wrapping')) {
134
- var _appendCrossProductAn;
135
149
  // FIXME: InlineCard, BlockCard and EmbedCard call event.preventDefault() internally
136
150
  // before the event bubbles up to this handler. This forces us to snapshot
137
151
  // event.defaultPrevented before calling onClick to detect whether the consumer
@@ -163,16 +177,14 @@ function Component(_ref) {
163
177
  });
164
178
  return;
165
179
  }
180
+ var destinationUrl = getDestinationUrl();
181
+ updateAnchorHref(event, destinationUrl);
166
182
 
167
183
  // For FlexibleCard, read target from the clicked anchor element (e.g. _blank for links
168
184
  // rendered with explicit target). For classic cards, default to _self
169
185
  var _getAnchorAttributesF = (0, _clickHelpers.getAnchorAttributesFromEvent)(event),
170
186
  anchorTarget = _getAnchorAttributesF.target;
171
187
  var target = (0, _utils.isSpecialEvent)(event) ? '_blank' : isFlexibleUi ? anchorTarget : '_self';
172
-
173
- // FIXME: preferredUrl should be rendered in the DOM anchor href instead of derived at click time
174
- var preferredUrl = (0, _helpers.getClickUrl)(url, state.details);
175
- var destinationUrl = (_appendCrossProductAn = appendCrossProductAnalyticsParams(preferredUrl)) !== null && _appendCrossProductAn !== void 0 ? _appendCrossProductAn : preferredUrl;
176
188
  onClick === null || onClick === void 0 || onClick(event, {
177
189
  url: url,
178
190
  destinationUrl: destinationUrl
@@ -244,7 +256,7 @@ function Component(_ref) {
244
256
  (0, _click.fireLinkClickedEvent)(createAnalyticsEvent)(event);
245
257
  }
246
258
  }
247
- }, [fireEvent, id, isFlexibleUi, appearance, definitionId, onClick, url, appendCrossProductAnalyticsParams, state.details, ari, name, fire3PClickEvent, shouldFire3PClickEvent, isPreviewPanelAvailable, openPreviewPanel, createAnalyticsEvent, disablePreviewPanel]);
259
+ }, [fireEvent, id, isFlexibleUi, appearance, definitionId, getDestinationUrl, onClick, url, updateAnchorHref, state.details, ari, name, fire3PClickEvent, shouldFire3PClickEvent, isPreviewPanelAvailable, openPreviewPanel, createAnalyticsEvent, disablePreviewPanel]);
248
260
 
249
261
  // Exposure fires once per eligible mount; click-time reads use no-exposure variant.
250
262
  (0, _react.useEffect)(function () {
@@ -256,23 +268,32 @@ function Component(_ref) {
256
268
  // Middle-click handler to trigger fire3PClickEvent on middle-clicks.
257
269
  // Scope is limited to 3P click analytics to keep the experiment focused.
258
270
  var handleFrameAuxClick = (0, _react.useCallback)(function (event) {
271
+ if ((0, _platformFeatureFlags.fg)('platform_smartlink_xpc_url_wrapping')) {
272
+ var destinationUrl = getDestinationUrl();
273
+ updateAnchorHref(event, destinationUrl);
274
+ }
275
+
259
276
  // isAuxClick filters Windows right-clicks (button === 2) that also fire onAuxClick.
260
277
  if ((0, _clickHelpers.isAuxClick)(event) && shouldFire3PClickEvent && (0, _expValEqualsNoExposure.expValEqualsNoExposure)(TRACK_NON_PRIMARY_3P_CLICKS_EXPERIMENT, 'isEnabled', true)) {
261
278
  fire3PClickEvent === null || fire3PClickEvent === void 0 || fire3PClickEvent({
262
279
  isAuxClick: true
263
280
  });
264
281
  }
265
- }, [fire3PClickEvent, shouldFire3PClickEvent]);
282
+ }, [fire3PClickEvent, getDestinationUrl, shouldFire3PClickEvent, updateAnchorHref]);
266
283
 
267
284
  // Right-click handler to trigger fire3PClickEvent on right-clicks.
268
285
  // Scope is limited to 3P click analytics to keep the experiment focused.
269
- var handleFrameContextMenu = (0, _react.useCallback)(function (_event) {
286
+ var handleFrameContextMenu = (0, _react.useCallback)(function (event) {
287
+ if ((0, _platformFeatureFlags.fg)('platform_smartlink_xpc_url_wrapping')) {
288
+ var destinationUrl = getDestinationUrl();
289
+ updateAnchorHref(event, destinationUrl);
290
+ }
270
291
  if (shouldFire3PClickEvent && (0, _expValEqualsNoExposure.expValEqualsNoExposure)(TRACK_NON_PRIMARY_3P_CLICKS_EXPERIMENT, 'isEnabled', true)) {
271
292
  fire3PClickEvent === null || fire3PClickEvent === void 0 || fire3PClickEvent({
272
293
  isContextMenu: true
273
294
  });
274
295
  }
275
- }, [fire3PClickEvent, shouldFire3PClickEvent]);
296
+ }, [fire3PClickEvent, getDestinationUrl, shouldFire3PClickEvent, updateAnchorHref]);
276
297
  var reload = actions.reload;
277
298
  var handleAuthorize = (0, _react.useCallback)(function () {
278
299
  return actions.authorize(appearance);
@@ -72,7 +72,14 @@ var RovoChatAction = function RovoChatAction(_ref) {
72
72
  }, [data === null || data === void 0 ? void 0 : data.invokeAction, invoke, onClickCallback, sendPromptMessage]);
73
73
  var promptActions = (0, _react.useMemo)(function () {
74
74
  return resolvedPrompts.map(function (promptKey, idx) {
75
- var _ref2 = (0, _rovoChatUtils.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) || {},
75
+ var _ref2 = (0, _rovoChatUtils.getPromptAction)({
76
+ promptKey: promptKey,
77
+ intl: intl,
78
+ url: data === null || data === void 0 ? void 0 : data.url,
79
+ product: data === null || data === void 0 ? void 0 : data.product,
80
+ iconSize: props.iconSize,
81
+ cardAppearance: props.cardAppearance
82
+ }) || {},
76
83
  icon = _ref2.icon,
77
84
  content = _ref2.content,
78
85
  tooltipMessage = _ref2.tooltipMessage,
@@ -22,7 +22,7 @@ var _SmartLinkAnalyticsContext = require("../../../utils/analytics/SmartLinkAnal
22
22
  var _CustomPopupContainer = require("../components/CustomPopupContainer");
23
23
  var _HoverCardContent = _interopRequireDefault(require("../components/HoverCardContent"));
24
24
  var _styled = require("../styled");
25
- var _excluded = ["aria-haspopup", "aria-expanded"];
25
+ var _excluded = ["aria-haspopup", "aria-expanded", "aria-controls"];
26
26
  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); }
27
27
  var HOVER_CARD_SOURCE = exports.HOVER_CARD_SOURCE = 'smartLinkPreviewHoverCard';
28
28
  var HOVER_CARD_TRIGGER_WRAPPER = 'hover-card-trigger-wrapper';
@@ -240,6 +240,7 @@ var HoverCardComponent = exports.HoverCardComponent = function HoverCardComponen
240
240
  var trigger = (0, _react.useCallback)(function (_ref3) {
241
241
  var _ariaHasPopup = _ref3['aria-haspopup'],
242
242
  _ariaExpanded = _ref3['aria-expanded'],
243
+ _ariaControls = _ref3['aria-controls'],
243
244
  triggerProps = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
244
245
  return /*#__PURE__*/_react.default.createElement("span", {
245
246
  ref: parentSpan
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.hoverCardClassName = exports.default = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
10
  var _react = _interopRequireWildcard(require("react"));
12
11
  var _analyticsNext = require("@atlaskit/analytics-next");
13
12
  var _linkProvider = require("@atlaskit/link-provider");
@@ -35,8 +34,6 @@ var _resolving = _interopRequireDefault(require("./views/resolving"));
35
34
  var _unauthorised = _interopRequireDefault(require("./views/unauthorised"));
36
35
  var _RovoUnauthorisedView = _interopRequireDefault(require("./views/unauthorised/RovoUnauthorisedView"));
37
36
  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); }
38
- 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; }
39
- 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; }
40
37
  var hoverCardClassName = exports.hoverCardClassName = 'smart-links-hover-preview';
41
38
  var useIsResolvedView = function useIsResolvedView(_ref) {
42
39
  var _hoverPreviewOptions$;
@@ -172,18 +169,13 @@ var HoverCardContent = function HoverCardContent(_ref4) {
172
169
  var _getMetadata = (0, _utils2.getMetadata)(extensionKey, data),
173
170
  subtitle = _getMetadata.subtitle;
174
171
  var titleMaxLines = subtitle && subtitle.length > 0 ? 1 : 2;
175
-
176
- // Platform apps (Home, Goals, Projects, and Teams) should by default open in the same tab when the FF is enabled.
177
- var isSameTabAlignmentEnabled = (0, _platformFeatureFlags.fg)('townsquare-same-tab-alignment-gcko-849');
178
- var anchorTarget = product === 'ATLAS' && isSameTabAlignmentEnabled ? '_self' : undefined;
179
- var titleBlockProps = _objectSpread({
172
+ var titleBlockProps = {
180
173
  maxLines: titleMaxLines,
181
174
  size: _constants.SmartLinkSize.Large,
182
175
  position: _constants.SmartLinkPosition.Center,
183
- subtitle: subtitle
184
- }, isSameTabAlignmentEnabled ? {
185
- anchorTarget: anchorTarget
186
- } : undefined);
176
+ subtitle: subtitle,
177
+ anchorTarget: product === 'ATLAS' ? '_self' : undefined
178
+ };
187
179
  var uiOptions = _styled.flexibleUiOptions;
188
180
  uiOptions.enableSnippetRenderer = true;
189
181
  var flexibleCardProps = {
@@ -110,7 +110,8 @@ function InlineCardResolvedViewFunctionalWithRovoActions(_ref2) {
110
110
  hideIconLoadingSkeleton: hideIconLoadingSkeleton
111
111
  }), (0, _renderLozenge.renderLozenge)(lozenge), isInlineTailoredRovoActionEnabled && /*#__PURE__*/_react.default.createElement(_rovoActionsCta.InlineRovoActionButton, {
112
112
  testId: "".concat(testId, "-rovo-actions-cta"),
113
- url: link
113
+ url: link,
114
+ actionOptions: actionOptions
114
115
  }));
115
116
  if (!showHoverPreview || !link) {
116
117
  return frame;
@@ -122,6 +123,4 @@ function InlineCardResolvedViewFunctionalWithRovoActions(_ref2) {
122
123
  hoverPreviewOptions: hoverPreviewOptions
123
124
  }, frame);
124
125
  }
125
-
126
- // Todo: replace with platform_sl_3p_auth_inline_tailored_cta_killswitch after cleanup of rovogrowth-640-inline-action-nudge-fg
127
126
  var InlineCardResolvedViewFunctional = exports.InlineCardResolvedViewFunctional = (0, _platformFeatureFlagsReact.componentWithFG)('platform_sl_3p_auth_inline_tailored_cta_killswitch', InlineCardResolvedViewFunctionalWithRovoActions, InlineCardResolvedViewBase);
@@ -9,16 +9,26 @@ Object.defineProperty(exports, "__esModule", {
9
9
  exports.RovoActionsCta = exports.InlineRovoActionButton = void 0;
10
10
  require("./index.compiled.css");
11
11
  var _runtime = require("@compiled/react/runtime");
12
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
13
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
14
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
15
  var _react = _interopRequireWildcard(require("react"));
13
16
  var _reactIntl = require("react-intl");
14
17
  var _css = require("@atlaskit/css");
15
- var _aiGenerativeTextSummary = _interopRequireDefault(require("@atlaskit/icon/core/ai-generative-text-summary"));
16
18
  var _rovoChat = _interopRequireDefault(require("@atlaskit/icon/core/rovo-chat"));
19
+ var _linkExtractors = require("@atlaskit/link-extractors");
17
20
  var _compiled = require("@atlaskit/primitives/compiled");
21
+ var _extractRovoChatAction = _interopRequireDefault(require("../../../../extractors/flexible/actions/extract-rovo-chat-action"));
22
+ var _helpers = require("../../../../state/helpers");
23
+ var _useInvokeClientAction = _interopRequireDefault(require("../../../../state/hooks/use-invoke-client-action"));
18
24
  var _useRovoChat2 = _interopRequireDefault(require("../../../../state/hooks/use-rovo-chat"));
25
+ var _useRovoConfig = _interopRequireDefault(require("../../../../state/hooks/use-rovo-config"));
26
+ var _store = require("../../../../state/store");
19
27
  var _rovoChatUtils = require("../../../common/rovo-chat-utils");
20
28
  var _actionButton = require("../action-button");
21
29
  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); }
30
+ 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; }
31
+ 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; }
22
32
  var styles = {
23
33
  innerContainer: "_1e0c1nu9 _1y1m1u8q _16d9qvcn _19bv12x7 _u5f312x7",
24
34
  rovoIcon: "_syaz15cr _80omtlke _bfhkjmqp _qrwqlb4i _1o0zlb4i _ca0qv77o _n3tdv77o",
@@ -37,31 +47,89 @@ var RovoActionsCta = exports.RovoActionsCta = function RovoActionsCta(_ref) {
37
47
  };
38
48
  var InlineRovoActionButton = exports.InlineRovoActionButton = function InlineRovoActionButton(_ref2) {
39
49
  var testId = _ref2.testId,
40
- url = _ref2.url;
50
+ url = _ref2.url,
51
+ actionOptions = _ref2.actionOptions;
41
52
  var _useRovoChat = (0, _useRovoChat2.default)(),
42
53
  sendPromptMessage = _useRovoChat.sendPromptMessage,
43
54
  isRovoChatEnabled = _useRovoChat.isRovoChatEnabled;
44
55
  var intl = (0, _reactIntl.useIntl)();
45
-
46
- // TODO: NAVX-5109 implement tailored rovo chat actions here
47
- var _ref3 = (0, _rovoChatUtils.getPromptAction)(_rovoChatUtils.RovoChatPromptKey.SUMMARIZE_LINK, intl, url) || {},
56
+ var cardState = (0, _store.useSmartCardState)(url !== null && url !== void 0 ? url : '');
57
+ var extensionKey = (0, _helpers.getExtensionKey)(cardState.details);
58
+ var rovoConfig = (0, _useRovoConfig.default)();
59
+ var rovoChatAction = (0, _react.useMemo)(function () {
60
+ return cardState.details && (0, _extractRovoChatAction.default)({
61
+ response: cardState.details,
62
+ actionOptions: actionOptions,
63
+ rovoConfig: rovoConfig
64
+ });
65
+ }, [cardState.details, rovoConfig, actionOptions]);
66
+ var provider = (0, _react.useMemo)(function () {
67
+ return cardState.details && (0, _linkExtractors.extractSmartLinkProvider)(cardState.details);
68
+ }, [cardState.details]);
69
+ var invoke = (0, _useInvokeClientAction.default)({});
70
+ var promptKey = (0, _react.useMemo)(function () {
71
+ var _cardState$details, _cardState$details2;
72
+ 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')) {
73
+ return;
74
+ }
75
+ switch (extensionKey) {
76
+ case 'google-object-provider':
77
+ 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')) {
78
+ return _rovoChatUtils.RovoChatPromptKey.SUMMARIZE_PRESENTATION;
79
+ }
80
+ return _rovoChatUtils.RovoChatPromptKey.SUMMARIZE_DOCUMENT;
81
+ case 'onedrive-object-provider':
82
+ return _rovoChatUtils.RovoChatPromptKey.SUMMARIZE_DOCUMENT;
83
+ case 'github-object-provider':
84
+ case 'gitlab-object-provider':
85
+ return _rovoChatUtils.RovoChatPromptKey.EXPLAIN_CODE;
86
+ case 'slack-object-provider':
87
+ case 'ms-teams-object-provider':
88
+ return _rovoChatUtils.RovoChatPromptKey.CATCH_UP;
89
+ case 'salesforce-object-provider':
90
+ return _rovoChatUtils.RovoChatPromptKey.SALESFORCE_PREP;
91
+ }
92
+ }, [extensionKey, cardState]);
93
+ var _ref3 = promptKey ? (0, _rovoChatUtils.getPromptAction)({
94
+ promptKey: promptKey,
95
+ intl: intl,
96
+ url: url,
97
+ iconSize: 'small',
98
+ provider: provider === null || provider === void 0 ? void 0 : provider.text
99
+ }) || {} : {},
48
100
  promptData = _ref3.data,
49
- content = _ref3.content;
101
+ content = _ref3.content,
102
+ icon = _ref3.icon;
50
103
  var handleClick = (0, _react.useCallback)(function (event) {
51
104
  event.preventDefault();
52
105
  event.stopPropagation();
53
- if (isRovoChatEnabled && promptData) {
54
- sendPromptMessage(promptData);
106
+ if (isRovoChatEnabled && promptData && rovoChatAction !== null && rovoChatAction !== void 0 && rovoChatAction.invokeAction) {
107
+ invoke(_objectSpread(_objectSpread({}, rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.invokeAction), {}, {
108
+ actionFn: function () {
109
+ var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
110
+ return _regenerator.default.wrap(function (_context) {
111
+ while (1) switch (_context.prev = _context.next) {
112
+ case 0:
113
+ return _context.abrupt("return", sendPromptMessage(promptData));
114
+ case 1:
115
+ case "end":
116
+ return _context.stop();
117
+ }
118
+ }, _callee);
119
+ }));
120
+ function actionFn() {
121
+ return _actionFn.apply(this, arguments);
122
+ }
123
+ return actionFn;
124
+ }(),
125
+ prompt: promptKey
126
+ }));
55
127
  }
56
- }, [sendPromptMessage, isRovoChatEnabled, promptData]);
128
+ }, [sendPromptMessage, isRovoChatEnabled, promptData, rovoChatAction, promptKey, invoke]);
57
129
  return promptData && content ? /*#__PURE__*/_react.default.createElement(_actionButton.ActionButton, {
58
130
  onClick: handleClick,
59
131
  testId: testId
60
- }, /*#__PURE__*/_react.default.createElement(_aiGenerativeTextSummary.default, {
61
- label: "Rovo",
62
- color: "var(--ds-icon, #292A2E)",
63
- size: "small"
64
- }), /*#__PURE__*/_react.default.createElement(_compiled.Box, {
132
+ }, icon, /*#__PURE__*/_react.default.createElement(_compiled.Box, {
65
133
  xcss: styles.text
66
134
  }, /*#__PURE__*/_react.default.createElement(_compiled.Text, {
67
135
  size: "small"
@@ -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: "44.25.1",
22
+ packageVersion: "44.27.1",
23
23
  componentName: 'linkUrl'
24
24
  };
25
25
  var LinkUrl = function LinkUrl(_ref) {