@atlaskit/smart-card 43.26.3 → 43.26.5

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 (51) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/analytics.spec.yaml +9 -0
  3. package/dist/cjs/extractors/flexible/actions/extract-rovo-chat-action.js +17 -1
  4. package/dist/cjs/extractors/flexible/actions/index.js +8 -1
  5. package/dist/cjs/messages.js +15 -10
  6. package/dist/cjs/state/hooks/use-invoke-client-action/index.js +4 -3
  7. package/dist/cjs/utils/analytics/analytics.js +1 -1
  8. package/dist/cjs/view/FlexibleCard/components/actions/copy-link-action/index.js +2 -1
  9. package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +3 -2
  10. package/dist/cjs/view/FlexibleCard/components/actions/rovo-chat-action/html-to-adf.js +180 -0
  11. package/dist/cjs/view/FlexibleCard/components/actions/rovo-chat-action/index.js +56 -19
  12. package/dist/cjs/view/FlexibleCard/components/actions/view-related-links-action/related-links-action-icon/index.js +2 -1
  13. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +5 -1
  14. package/dist/cjs/view/LinkUrl/index.js +1 -1
  15. package/dist/es2019/extractors/flexible/actions/extract-rovo-chat-action.js +19 -2
  16. package/dist/es2019/extractors/flexible/actions/index.js +8 -1
  17. package/dist/es2019/messages.js +15 -10
  18. package/dist/es2019/state/hooks/use-invoke-client-action/index.js +3 -1
  19. package/dist/es2019/utils/analytics/analytics.js +1 -1
  20. package/dist/es2019/view/FlexibleCard/components/actions/copy-link-action/index.js +2 -1
  21. package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +3 -2
  22. package/dist/es2019/view/FlexibleCard/components/actions/rovo-chat-action/html-to-adf.js +161 -0
  23. package/dist/es2019/view/FlexibleCard/components/actions/rovo-chat-action/index.js +34 -37
  24. package/dist/es2019/view/FlexibleCard/components/actions/view-related-links-action/related-links-action-icon/index.js +2 -1
  25. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +5 -1
  26. package/dist/es2019/view/LinkUrl/index.js +1 -1
  27. package/dist/esm/extractors/flexible/actions/extract-rovo-chat-action.js +18 -2
  28. package/dist/esm/extractors/flexible/actions/index.js +8 -1
  29. package/dist/esm/messages.js +15 -10
  30. package/dist/esm/state/hooks/use-invoke-client-action/index.js +4 -3
  31. package/dist/esm/utils/analytics/analytics.js +1 -1
  32. package/dist/esm/view/FlexibleCard/components/actions/copy-link-action/index.js +2 -1
  33. package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +3 -2
  34. package/dist/esm/view/FlexibleCard/components/actions/rovo-chat-action/html-to-adf.js +172 -0
  35. package/dist/esm/view/FlexibleCard/components/actions/rovo-chat-action/index.js +56 -19
  36. package/dist/esm/view/FlexibleCard/components/actions/view-related-links-action/related-links-action-icon/index.js +2 -1
  37. package/dist/esm/view/HoverCard/components/views/resolved/index.js +5 -1
  38. package/dist/esm/view/LinkUrl/index.js +1 -1
  39. package/dist/types/common/analytics/generated/analytics.types.d.ts +12 -1
  40. package/dist/types/extractors/flexible/actions/extract-rovo-chat-action.d.ts +10 -1
  41. package/dist/types/messages.d.ts +1 -1
  42. package/dist/types/state/flexible-ui-context/types.d.ts +1 -0
  43. package/dist/types/state/hooks/use-invoke-client-action/types.d.ts +6 -2
  44. package/dist/types/view/FlexibleCard/components/actions/rovo-chat-action/html-to-adf.d.ts +8 -0
  45. package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +12 -1
  46. package/dist/types-ts4.5/extractors/flexible/actions/extract-rovo-chat-action.d.ts +10 -1
  47. package/dist/types-ts4.5/messages.d.ts +1 -1
  48. package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +1 -0
  49. package/dist/types-ts4.5/state/hooks/use-invoke-client-action/types.d.ts +6 -2
  50. package/dist/types-ts4.5/view/FlexibleCard/components/actions/rovo-chat-action/html-to-adf.d.ts +8 -0
  51. package/package.json +9 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 43.26.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`3b6aa90b87394`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3b6aa90b87394) -
8
+ Send analytics event on RovoChatAction clicked
9
+ - Updated dependencies
10
+
11
+ ## 43.26.4
12
+
13
+ ### Patch Changes
14
+
15
+ - [`4cf4d334bc493`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4cf4d334bc493) -
16
+ Covert Rovo Chat prompt message to ADF
17
+ - [`0359d27aff3b0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0359d27aff3b0) -
18
+ NAVX-3698: removed redundant screen reader announcements by marking decorative link icons as
19
+ aria-hidden
20
+ - Updated dependencies
21
+
3
22
  ## 43.26.3
4
23
 
5
24
  ### Patch Changes
@@ -202,6 +202,15 @@ events:
202
202
  description: fired when an ai summary is clicked
203
203
  attributes:
204
204
  <<: [*PackageMetaDataContext, *ResolvedContext]
205
+ - button clicked (rovoChatPrompt):
206
+ type: ui
207
+ description: Fired when sending prompt to RovoChat via click
208
+ attributes:
209
+ <<: [ *PackageMetaDataContext, *ResolvedContext, *ClientActionAttributes ]
210
+ prompt:
211
+ required: false
212
+ type: string
213
+ description: Key for RovoChat prompts
205
214
 
206
215
  - button clicked (copySummary):
207
216
  type: ui
@@ -5,12 +5,19 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _linkExtractors = require("@atlaskit/link-extractors");
8
+ var _constants = require("../../../constants");
8
9
  var _helpers = require("../../../state/helpers");
9
10
  var _canShowAction = require("../../../utils/actions/can-show-action");
10
11
  var _rovo = require("../../../utils/rovo");
11
12
  var _types = require("../../../view/Card/types");
12
- var extractRovoChatAction = function extractRovoChatAction(response, rovoConfig, actionOptions, product) {
13
+ var extractRovoChatAction = function extractRovoChatAction(_ref) {
13
14
  var _actionOptions$rovoCh;
15
+ var actionOptions = _ref.actionOptions,
16
+ appearance = _ref.appearance,
17
+ id = _ref.id,
18
+ product = _ref.product,
19
+ response = _ref.response,
20
+ rovoConfig = _ref.rovoConfig;
14
21
  if (!(0, _canShowAction.canShowAction)(_types.CardAction.RovoChatAction, actionOptions)) {
15
22
  return;
16
23
  }
@@ -25,6 +32,15 @@ var extractRovoChatAction = function extractRovoChatAction(response, rovoConfig,
25
32
  var isOptIn = (actionOptions === null || actionOptions === void 0 || (_actionOptions$rovoCh = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh === void 0 ? void 0 : _actionOptions$rovoCh.optIn) === true;
26
33
  var url = (0, _linkExtractors.extractSmartLinkUrl)(response);
27
34
  return isSupportedFeature && isOptIn ? {
35
+ invokeAction: {
36
+ actionSubjectId: 'rovoChatPrompt',
37
+ actionType: _constants.InternalActionName.RovoChatAction,
38
+ definitionId: (0, _helpers.getDefinitionId)(response),
39
+ display: appearance,
40
+ extensionKey: (0, _helpers.getExtensionKey)(response),
41
+ id: id,
42
+ resourceType: (0, _helpers.getResourceType)(response)
43
+ },
28
44
  product: product,
29
45
  url: url
30
46
  } : undefined;
@@ -50,7 +50,14 @@ var extractFlexibleCardActions = exports.extractFlexibleCardActions = function e
50
50
  response: response,
51
51
  isPreviewPanelAvailable: isPreviewPanelAvailable,
52
52
  openPreviewPanel: openPreviewPanel
53
- })), _constants.ActionName.AutomationAction, (0, _extractAutomationAction.extractAutomationAction)(response)), _constants.InternalActionName.AISummaryAction, (0, _extractAiSummaryAction.extractAISummaryAction)(response, url, actionOptions, aiSummaryConfig)), (0, _platformFeatureFlags.fg)('platform_sl_3p_auth_rovo_action_kill_switch') ? (0, _defineProperty2.default)({}, _constants.InternalActionName.RovoChatAction, (0, _extractRovoChatAction.default)(response, rovoConfig, actionOptions, product)) : undefined), {}, (0, _defineProperty2.default)({}, _constants.InternalActionName.ViewRelatedLinksAction, (0, _extractViewRelatedLinksAction.extractViewRelatedLinksAction)(response)));
53
+ })), _constants.ActionName.AutomationAction, (0, _extractAutomationAction.extractAutomationAction)(response)), _constants.InternalActionName.AISummaryAction, (0, _extractAiSummaryAction.extractAISummaryAction)(response, url, actionOptions, aiSummaryConfig)), (0, _platformFeatureFlags.fg)('platform_sl_3p_auth_rovo_action_kill_switch') ? (0, _defineProperty2.default)({}, _constants.InternalActionName.RovoChatAction, (0, _extractRovoChatAction.default)({
54
+ actionOptions: actionOptions,
55
+ appearance: appearance,
56
+ id: id,
57
+ product: product,
58
+ response: response,
59
+ rovoConfig: rovoConfig
60
+ })) : undefined), {}, (0, _defineProperty2.default)({}, _constants.InternalActionName.ViewRelatedLinksAction, (0, _extractViewRelatedLinksAction.extractViewRelatedLinksAction)(response)));
54
61
  return Object.values(action).some(function (value) {
55
62
  return Boolean(value);
56
63
  }) ? action : undefined;
@@ -866,11 +866,6 @@ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
866
866
  defaultMessage: 'Confluence page',
867
867
  description: 'The Confluence page the user see Smart Link in, to be used as the {context} for Rovo prompt message'
868
868
  },
869
- rovo_prompt_context_confluence_page_plural: {
870
- id: 'fabric.linking.rovo_prompt_context_confluence_page_plural.non-final',
871
- defaultMessage: 'Confluence pages',
872
- description: 'The Confluence page the user see Smart Link in, to be used as the {context} for Rovo prompt message'
873
- },
874
869
  rovo_prompt_context_confluence_page_short: {
875
870
  id: 'fabric.linking.rovo_prompt_context_confluence_page_short.non-final',
876
871
  defaultMessage: 'page',
@@ -881,11 +876,6 @@ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
881
876
  defaultMessage: 'Jira work item',
882
877
  description: 'The Jira work item the user see Smart Link in, to be used as the {context} for Rovo prompt message'
883
878
  },
884
- rovo_prompt_context_jira_work_item_plural: {
885
- id: 'fabric.linking.rovo_prompt_context_jira_work_item_plural.non-final',
886
- defaultMessage: 'Jira work items',
887
- description: 'The Jira work item the user see Smart Link in, to be used as the {context} for Rovo prompt message'
888
- },
889
879
  rovo_prompt_context_jira_work_item_short: {
890
880
  id: 'fabric.linking.rovo_prompt_context_jira_work_item_short.non-final',
891
881
  defaultMessage: 'work item',
@@ -896,14 +886,29 @@ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
896
886
  defaultMessage: 'Recommend other sources',
897
887
  description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
898
888
  },
889
+ rovo_prompt_message_recommend_other_sources: {
890
+ id: 'fabric.linking.rovo_prompt_message_recommend_other_sources.non-final',
891
+ defaultMessage: '<p>From this <a>{url}</a> and the {context} I’m viewing now as context:</p><ul><li><p>Search across all sources I can access for items that discuss <b>similar concepts, themes, or problems</b>, or that <b>reference similar or closely related sources</b> (including links to the same or related pages, issues, or docs).</p></li><li><p>Return the results as a list or table with columns: <code>Item</code>, <code>Type</code>, <code>Short summary</code>, and <code>Why it’s similar</code>.</p></li><li><p>For each result, give a one‑sentence <b>Short summary</b> of what the item is about.</p></li><li><p>In <b>Why it’s similar</b>, briefly explain (in a phrase or short sentence) what makes it related to this Smart Link and/or the item I’m viewing (for example: same project, similar decision, shared requirements, overlapping stakeholders, similar metrics, or referencing related docs).</p></li><li><p>Order the list from <b>most to least relevant</b> based on Rovo’s assessment of semantic similarity to both the Smart Link target and the current item. Prioritize items that I do not own or have not contributed to.</p></li><li><p>If there are more than 5 results, show the <b>5 most relevant</b> and state how many additional items you found.</p></li></ul>',
892
+ 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.)'
893
+ },
899
894
  rovo_prompt_button_show_other_mentions: {
900
895
  id: 'fabric.linking.rovo_prompt_button_show_other_mentions.non-final',
901
896
  defaultMessage: 'Show other mentions',
902
897
  description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
903
898
  },
899
+ rovo_prompt_message_show_other_mentions: {
900
+ id: 'fabric.linking.rovo_prompt_message_show_other_mentions.non-final',
901
+ defaultMessage: '<p>From <a>{url}</a> and the {context} I’m viewing now:</p><ul><li><p>Search across all Confluence pages and Jira work items I can access for other items that contain this exact Smart Link (same underlying URL/resource).</p></li><li><p>List all matching items in a table with columns: <code>Item</code>, <code>Type</code>, <code>Short summary</code>, <code>How this item uses the link</code>, and <code>Relevance to current item</code>.</p></li><li><p>For <code>Short summary</code>, give a one‑sentence description of what the {context} is about.</p></li><li><p>For <code>How this item uses the link</code>, briefly explain the role this link plays there (e.g., decision doc, background context, implementation details, status update).</p></li><li><p>For <code>Relevance to current item</code>, compare each item to the {context} I’m viewing now and label it <code>High</code>, <code>Medium</code>, or <code>Low</code> relevance, with a short reason (a phrase or single clause).</p></li><li><p>If there are more than 15 matches, show the 15 most relevant and tell me how many additional matches exist.</p></li></ul>',
902
+ 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.)'
903
+ },
904
904
  rovo_prompt_button_suggest_improvement: {
905
905
  id: 'fabric.linking.rovo_prompt_button_suggest_improvement.non-final',
906
906
  defaultMessage: 'Suggest {context} improvement',
907
907
  description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
908
+ },
909
+ rovo_prompt_message_suggest_improvement: {
910
+ id: 'fabric.linking.rovo_prompt_message_suggest_improvement.non-final',
911
+ defaultMessage: '<p>Using the {context} I’m viewing now, plus all files and links referenced in it (including <a>{url}</a>):</p><ul><li><p>Identify unclear reasoning, missing context, or contradictions between the item and its linked files.</p></li><li><p>Call out any places where assumptions are not backed up by data or prior docs.</p></li><li><p>Stay concise: summarize your findings in <b>no more than three short paragraphs of content listed as bullets</b> of no more than a couple of sentences long focused only on the two points above.</p></li><li><p>After presenting that summary, <b>ask me explicitly</b> if I want you to go deeper. Only if I say yes, then:</p><ul><li><p>Suggest concrete rewrites (bullets or short paragraphs) to make the argument clearer, more concise, and better aligned with the supporting files.</p></li><li><p>Propose 3–5 follow‑up edits or additions that would make this item and its linked docs “share‑ready” for stakeholders.</p></li></ul></li></ul>',
912
+ 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.)'
908
913
  }
909
914
  });
@@ -28,11 +28,11 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
28
28
  var fireEvent = fireEventProp !== null && fireEventProp !== void 0 ? fireEventProp : defaultFireEvent;
29
29
  return (0, _react.useCallback)( /*#__PURE__*/function () {
30
30
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref2) {
31
- var actionSubjectId, actionType, actionFn, _ref2$definitionId, definitionId, extensionKey, display, id, _ref2$resourceType, resourceType, experienceId, markName, _measure$getMeasure$d, _measure$getMeasure, result, _measure$getMeasure$d2, _measure$getMeasure2, reason;
31
+ var actionSubjectId, actionType, actionFn, _ref2$definitionId, definitionId, extensionKey, display, id, prompt, _ref2$resourceType, resourceType, experienceId, markName, _measure$getMeasure$d, _measure$getMeasure, result, _measure$getMeasure$d2, _measure$getMeasure2, reason;
32
32
  return _regenerator.default.wrap(function _callee$(_context) {
33
33
  while (1) switch (_context.prev = _context.next) {
34
34
  case 0:
35
- actionSubjectId = _ref2.actionSubjectId, actionType = _ref2.actionType, actionFn = _ref2.actionFn, _ref2$definitionId = _ref2.definitionId, definitionId = _ref2$definitionId === void 0 ? null : _ref2$definitionId, extensionKey = _ref2.extensionKey, display = _ref2.display, id = _ref2.id, _ref2$resourceType = _ref2.resourceType, resourceType = _ref2$resourceType === void 0 ? null : _ref2$resourceType;
35
+ actionSubjectId = _ref2.actionSubjectId, actionType = _ref2.actionType, actionFn = _ref2.actionFn, _ref2$definitionId = _ref2.definitionId, definitionId = _ref2$definitionId === void 0 ? null : _ref2$definitionId, extensionKey = _ref2.extensionKey, display = _ref2.display, id = _ref2.id, prompt = _ref2.prompt, _ref2$resourceType = _ref2.resourceType, resourceType = _ref2$resourceType === void 0 ? null : _ref2$resourceType;
36
36
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
37
37
  experienceId = (0, _uuid.default)(); // Begin performance instrumentation.
38
38
  markName = "".concat(experienceId, "-").concat(actionType);
@@ -53,7 +53,8 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
53
53
  definitionId: definitionId,
54
54
  display: display !== null && display !== void 0 ? display : null,
55
55
  id: id !== null && id !== void 0 ? id : experienceId,
56
- resourceType: resourceType
56
+ resourceType: resourceType,
57
+ prompt: prompt
57
58
  });
58
59
  }
59
60
  // Invoke action
@@ -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: "43.26.2"
14
+ packageVersion: "0.0.0-development"
15
15
  };
16
16
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
17
17
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -15,6 +15,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
15
15
  var _react = _interopRequireWildcard(require("react"));
16
16
  var _reactIntlNext = require("react-intl-next");
17
17
  var _link = _interopRequireDefault(require("@atlaskit/icon/core/link"));
18
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
19
  var _constants = require("../../../../../constants");
19
20
  var _messages = require("../../../../../messages");
20
21
  var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
@@ -67,7 +68,7 @@ var CopyLinkAction = function CopyLinkAction(_ref) {
67
68
  content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.copy_url_to_clipboard),
68
69
  icon: /*#__PURE__*/_react.default.createElement(_link.default, {
69
70
  color: "currentColor",
70
- label: "copy url",
71
+ label: (0, _platformFeatureFlags.fg)('navx-3698-flexible-card-a11y-fix') ? '' : 'copy url',
71
72
  spacing: "spacious"
72
73
  }),
73
74
  onClick: onClick,
@@ -12,6 +12,7 @@ var _react = _interopRequireWildcard(require("react"));
12
12
  var _reactIntlNext = require("react-intl-next");
13
13
  var _growDiagonal = _interopRequireDefault(require("@atlaskit/icon/core/grow-diagonal"));
14
14
  var _panelRight = _interopRequireDefault(require("@atlaskit/icon/core/panel-right"));
15
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
16
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
16
17
  var _constants = require("../../../../../constants");
17
18
  var _messages = require("../../../../../messages");
@@ -42,13 +43,13 @@ var PreviewAction = function PreviewAction(_ref) {
42
43
  return /*#__PURE__*/_react.default.createElement(_panelRight.default, {
43
44
  color: "currentColor",
44
45
  spacing: "spacious",
45
- label: "Open preview panel"
46
+ label: (0, _platformFeatureFlags.fg)('navx-3698-flexible-card-a11y-fix') ? '' : 'Open preview panel'
46
47
  });
47
48
  }
48
49
  return /*#__PURE__*/_react.default.createElement(_growDiagonal.default, {
49
50
  color: "currentColor",
50
51
  spacing: "spacious",
51
- label: "Open preview"
52
+ label: (0, _platformFeatureFlags.fg)('navx-3698-flexible-card-a11y-fix') ? '' : 'Open preview'
52
53
  });
53
54
  }, [hasPreviewPanel]);
54
55
  var actionLabel = (0, _react.useCallback)(function () {
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
+ var _builders = require("@atlaskit/adf-utils/builders");
10
+ /**
11
+ * This is a simplified version of html to adf conversion,
12
+ * used specifically for SL RovoChatAction prompt message,
13
+ * and does not support all ADF offered via @atlaskit/adf-utils
14
+ *
15
+ * Support: p, ul, li, text, b, strong, code, inlineCard (replace a hyperlink)
16
+ */
17
+
18
+ var INLINE_TAG_NAMES = ['b', 'strong', 'code', 'a', 'inlineCard'];
19
+ var BLOCK_TAG_NAMES = ['p', 'ul', 'ol', 'li'];
20
+
21
+ /**
22
+ * Group Captures Example
23
+ * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
24
+ * match[1] Self-closing tag name br from <br/> or <img src="x"/>
25
+ * match[2] Opening tag name div from <div> or <div class="x">
26
+ * match[3] Closing tag name div from </div>
27
+ * match[4] Text content Hello world
28
+ */
29
+ var htmlRegex = /<\s*(\w+)[^>]*?\s*\/\s*>|<\s*(\w+)[^>]*>|<\s*\/\s*(\w+)\s*>|([^<]+)/g;
30
+ var decodeHtmlEntities = function decodeHtmlEntities() {
31
+ var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
32
+ return text.replace(/&nbsp;/g, ' ').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&').replace(/&quot;/g, '"').replace(/&#39;/g, "'");
33
+ };
34
+ var tokenizeHtml = function tokenizeHtml(html) {
35
+ var tokens = [];
36
+ var match;
37
+ while ((match = htmlRegex.exec(html)) !== null) {
38
+ var selfClosingTag = match[1];
39
+ var openingTag = match[2];
40
+ var closingTag = match[3];
41
+ var textContent = match[4];
42
+ if (selfClosingTag) {
43
+ tokens.push({
44
+ type: 'selfClosing',
45
+ tagName: selfClosingTag.toLowerCase()
46
+ });
47
+ } else if (openingTag) {
48
+ tokens.push({
49
+ type: 'open',
50
+ tagName: openingTag.toLowerCase()
51
+ });
52
+ } else if (closingTag) {
53
+ tokens.push({
54
+ type: 'close',
55
+ tagName: closingTag.toLowerCase()
56
+ });
57
+ } else if (textContent) {
58
+ if (textContent !== null && textContent !== void 0 && textContent.trim()) {
59
+ tokens.push({
60
+ type: 'text',
61
+ content: decodeHtmlEntities(textContent)
62
+ });
63
+ }
64
+ }
65
+ }
66
+ return tokens;
67
+ };
68
+ var buildListItem = function buildListItem() {
69
+ var content = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
70
+ // Check if content has only text/inline elements
71
+ var hasOnlyInlineContent = content.every(function (node) {
72
+ return node.type === 'text' || node.type === 'hardBreak' || !node.type;
73
+ });
74
+ if (hasOnlyInlineContent) {
75
+ // Wrap text content in a paragraph
76
+ return (0, _builders.li)([_builders.p.apply(void 0, (0, _toConsumableArray2.default)(content))]);
77
+ }
78
+
79
+ // Content has block elements (like nested lists), use as-is
80
+ return (0, _builders.li)(content);
81
+ };
82
+ var blockToAdf = function blockToAdf(tagName) {
83
+ var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
84
+ switch (tagName) {
85
+ case 'p':
86
+ return _builders.p.apply(void 0, (0, _toConsumableArray2.default)(content));
87
+ case 'ul':
88
+ return _builders.ul.apply(void 0, (0, _toConsumableArray2.default)(content));
89
+ case 'li':
90
+ return buildListItem(content);
91
+ }
92
+ };
93
+ var inlineToAdf = function inlineToAdf(tagName, content) {
94
+ switch (tagName) {
95
+ case 'b':
96
+ case 'strong':
97
+ return (0, _builders.b)(content);
98
+ case 'code':
99
+ return (0, _builders.code)(content);
100
+ case 'a':
101
+ case 'inlineCard':
102
+ return (0, _builders.inlineCard)({
103
+ url: content
104
+ });
105
+ default:
106
+ return (0, _builders.text)(content);
107
+ }
108
+ };
109
+ var parseTokensToAdf = function parseTokensToAdf(tokens) {
110
+ var stack = [{
111
+ type: 'root',
112
+ content: []
113
+ }];
114
+ var currentMarks = [];
115
+ var _loop = function _loop() {
116
+ var token = tokens[i];
117
+ var current = stack[stack.length - 1];
118
+ switch (token.type) {
119
+ case 'text':
120
+ if (token.content) {
121
+ var _currentMarks;
122
+ var inlineAdfNode = inlineToAdf((_currentMarks = currentMarks) === null || _currentMarks === void 0 || (_currentMarks = _currentMarks[0]) === null || _currentMarks === void 0 ? void 0 : _currentMarks.type, token.content);
123
+ current.content.push(inlineAdfNode);
124
+ }
125
+ break;
126
+ case 'open':
127
+ if (INLINE_TAG_NAMES.includes(token.tagName)) {
128
+ currentMarks.push({
129
+ type: token.tagName
130
+ });
131
+ } else if (BLOCK_TAG_NAMES.includes(token.tagName)) {
132
+ stack.push({
133
+ type: token.tagName,
134
+ content: []
135
+ });
136
+ }
137
+ break;
138
+ case 'close':
139
+ // Inline formatting
140
+ if (token.tagName && INLINE_TAG_NAMES.includes(token.tagName)) {
141
+ currentMarks = currentMarks.filter(function (m) {
142
+ return m.type !== token.tagName;
143
+ });
144
+ }
145
+ // Block elements
146
+ else if (stack.length > 1) {
147
+ var closed = stack.pop();
148
+ var parent = stack[stack.length - 1];
149
+ var adfNode = blockToAdf(closed === null || closed === void 0 ? void 0 : closed.type, closed === null || closed === void 0 ? void 0 : closed.content);
150
+ if (adfNode) {
151
+ parent.content.push(adfNode);
152
+ }
153
+ }
154
+ break;
155
+ }
156
+ };
157
+ for (var i = 0; i < tokens.length; i++) {
158
+ _loop();
159
+ }
160
+
161
+ // Return root content
162
+ return stack[0].content;
163
+ };
164
+
165
+ /**
166
+ * Convert HTML string to ADF format
167
+ *
168
+ * This is a simplified version specific for RovoChatAction prompt message
169
+ * and does not support all ADF offered via @atlaskit/adf-utils
170
+ */
171
+ var htmlToAdf = function htmlToAdf(html) {
172
+ try {
173
+ var tokens = tokenizeHtml(html);
174
+ var adfContent = parseTokensToAdf(tokens);
175
+ return _builders.doc.apply(void 0, (0, _toConsumableArray2.default)(adfContent));
176
+ } catch (_unused) {
177
+ return html;
178
+ }
179
+ };
180
+ var _default = exports.default = htmlToAdf;
@@ -6,20 +6,27 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = exports.RovoChatPromptKey = void 0;
9
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
13
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
14
  var _react = _interopRequireWildcard(require("react"));
12
15
  var _reactIntlNext = require("react-intl-next");
13
16
  var _constants = require("../../../../../constants");
14
17
  var _messages = require("../../../../../messages");
15
18
  var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
19
+ var _useInvokeClientAction = _interopRequireDefault(require("../../../../../state/hooks/use-invoke-client-action"));
16
20
  var _useRovoChat2 = _interopRequireDefault(require("../../../../../state/hooks/use-rovo-chat"));
17
21
  var _aiChapterIcon = _interopRequireDefault(require("../../../assets/ai-chapter-icon"));
18
22
  var _aiEditIcon = _interopRequireDefault(require("../../../assets/ai-edit-icon"));
19
23
  var _aiSearchIcon = _interopRequireDefault(require("../../../assets/ai-search-icon"));
20
24
  var _action = _interopRequireDefault(require("../action"));
25
+ var _htmlToAdf = _interopRequireDefault(require("./html-to-adf"));
21
26
  var _excluded = ["onClick", "prompts", "testId"];
22
27
  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); }
28
+ 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; }
29
+ 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; }
23
30
  var RovoChatPromptKey = exports.RovoChatPromptKey = /*#__PURE__*/function (RovoChatPromptKey) {
24
31
  RovoChatPromptKey["RECOMMEND_OTHER_SOURCES"] = "recommend-other-sources";
25
32
  RovoChatPromptKey["SHOW_OTHER_MENTIONS"] = "show-other-mentions";
@@ -32,7 +39,6 @@ var getContext = function getContext(intl, product) {
32
39
  case 'CONFLUENCE':
33
40
  return {
34
41
  contextLong: intl.formatMessage(_messages.messages.rovo_prompt_context_confluence_page),
35
- contextLongPlural: intl.formatMessage(_messages.messages.rovo_prompt_context_confluence_page_plural),
36
42
  contextShort: intl.formatMessage(_messages.messages.rovo_prompt_context_confluence_page_short)
37
43
  };
38
44
  case 'JSW':
@@ -41,24 +47,29 @@ var getContext = function getContext(intl, product) {
41
47
  case 'JPD':
42
48
  return {
43
49
  contextLong: intl.formatMessage(_messages.messages.rovo_prompt_context_jira_work_item),
44
- contextLongPlural: intl.formatMessage(_messages.messages.rovo_prompt_context_jira_work_item_plural),
45
50
  contextShort: intl.formatMessage(_messages.messages.rovo_prompt_context_jira_work_item_short)
46
51
  };
47
52
  }
48
53
  };
49
- var getPromptAction = function getPromptAction(promptKey, intl, url, product) {
54
+ var getPromptAction = function getPromptAction(promptKey, intl) {
50
55
  var _getContext;
56
+ var url = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
57
+ var product = arguments.length > 3 ? arguments[3] : undefined;
51
58
  var _ref = (_getContext = getContext(intl, product)) !== null && _getContext !== void 0 ? _getContext : {
52
59
  contextLong: intl.formatMessage(_messages.messages.rovo_prompt_context_generic),
53
- contextLongPlural: intl.formatMessage(_messages.messages.rovo_prompt_context_generic_plural),
54
60
  contextShort: intl.formatMessage(_messages.messages.rovo_prompt_context_generic)
55
61
  },
56
62
  contextLong = _ref.contextLong,
57
- contextLongPlural = _ref.contextLongPlural,
58
63
  contextShort = _ref.contextShort;
59
64
  switch (promptKey) {
60
65
  case RovoChatPromptKey.RECOMMEND_OTHER_SOURCES:
61
66
  var label_recommend = intl.formatMessage(_messages.messages.rovo_prompt_button_recommend_other_sources);
67
+ var html_recommend = intl.formatMessage(_messages.messages.rovo_prompt_message_recommend_other_sources, {
68
+ context: contextLong,
69
+ url: url
70
+ }, {
71
+ ignoreTag: true
72
+ });
62
73
  return {
63
74
  icon: /*#__PURE__*/_react.default.createElement(_aiEditIcon.default, null),
64
75
  content: label_recommend,
@@ -66,12 +77,17 @@ var getPromptAction = function getPromptAction(promptKey, intl, url, product) {
66
77
  data: {
67
78
  name: label_recommend,
68
79
  dialogues: [],
69
- // NAVX-3581: To be translated and converted to ADF
70
- prompt: "From this ".concat(url, " and the ").concat(contextLong, " I\u2019m viewing now as context:\n- Search across all sources I can access for items that discuss similar concepts, themes, or problems, or that reference similar or closely related sources (including links to the same or related pages, issues, or docs).\n- Return the results as a list or table with columns: Item, Type, Short summary, and Why it\u2019s similar.\n- For each result, give a one\u2011sentence Short summary of what the item is about.\n- In Why it\u2019s similar, briefly explain (in a phrase or short sentence) what makes it related to this Smart Link and/or the item I\u2019m viewing (for example: same project, similar decision, shared requirements, overlapping stakeholders, similar metrics, or referencing related docs).\n- Order the list from most to least relevant based on Rovo\u2019s assessment of semantic similarity to both the Smart Link target and the current item. Prioritize items that I do not own or have not contributed to.\n- If there are more than 5 results, show the 5 most relevant and state how many additional items you found.")
80
+ prompt: (0, _htmlToAdf.default)(html_recommend)
71
81
  }
72
82
  };
73
83
  case RovoChatPromptKey.SHOW_OTHER_MENTIONS:
74
84
  var label_other_mentions = intl.formatMessage(_messages.messages.rovo_prompt_button_show_other_mentions);
85
+ var html_other_mentions = intl.formatMessage(_messages.messages.rovo_prompt_message_show_other_mentions, {
86
+ context: contextLong,
87
+ url: url
88
+ }, {
89
+ ignoreTag: true
90
+ });
75
91
  return {
76
92
  icon: /*#__PURE__*/_react.default.createElement(_aiChapterIcon.default, null),
77
93
  content: label_other_mentions,
@@ -79,14 +95,19 @@ var getPromptAction = function getPromptAction(promptKey, intl, url, product) {
79
95
  data: {
80
96
  name: label_other_mentions,
81
97
  dialogues: [],
82
- // NAVX-3581: To be translated and converted to ADF
83
- prompt: "From this ".concat(url, " and the ").concat(contextLong, " I\u2019m viewing now:\n- Search across all ").concat(contextLongPlural, " I can access for other items that contain this exact Smart Link (same underlying URL/resource).\n- List all matching items in a table with columns: Item, Type, Short summary, How this item uses the link, and Relevance to current item.\n- For Short summary, give a one\u2011sentence description of what the page/issue is about.\n- For How this item uses the link, briefly explain the role this link plays there (e.g., decision doc, background context, implementation details, status update).\n- For Relevance to current item, compare each item to the page/issue I\u2019m viewing now and label it High, Medium, or Low relevance, with a short reason (a phrase or single clause).\n- If there are more than 15 matches, show the 15 most relevant and tell me how many additional matches exist.")
98
+ prompt: (0, _htmlToAdf.default)(html_other_mentions)
84
99
  }
85
100
  };
86
101
  case RovoChatPromptKey.SUGGEST_IMPROVEMENT:
87
102
  var label_improvement = intl.formatMessage(_messages.messages.rovo_prompt_button_suggest_improvement, {
88
103
  context: contextShort
89
104
  });
105
+ var html_improvement = intl.formatMessage(_messages.messages.rovo_prompt_message_suggest_improvement, {
106
+ context: contextLong,
107
+ url: url
108
+ }, {
109
+ ignoreTag: true
110
+ });
90
111
  return {
91
112
  icon: /*#__PURE__*/_react.default.createElement(_aiSearchIcon.default, null),
92
113
  content: label_improvement,
@@ -94,8 +115,7 @@ var getPromptAction = function getPromptAction(promptKey, intl, url, product) {
94
115
  data: {
95
116
  name: label_improvement,
96
117
  dialogues: [],
97
- // NAVX-3581: To be translated and converted to ADF
98
- prompt: "Using the ".concat(contextLong, " I\u2019m viewing now, plus all files and links referenced in it (including this ").concat(url, "):\n- Identify unclear reasoning, missing context, or contradictions between the item and its linked files.\n- Call out any places where assumptions are not backed up by data or prior docs.\n- Stay concise: summarize your findings in no more than three short paragraphs of content listed as bullets of no more than a couple of sentences long focused only on the two points above.\n- After presenting that summary, ask me explicitly if I want you to go deeper. Only if I say yes, then:\n- Suggest concrete rewrites (bullets or short paragraphs) to make the argument clearer, more concise, and better aligned with the supporting files.\n- Propose 3\u20135 follow\u2011up edits or additions that would make this item and its linked docs \u201Cshare\u2011ready\u201D for stakeholders.")
118
+ prompt: (0, _htmlToAdf.default)(html_improvement)
99
119
  }
100
120
  };
101
121
  }
@@ -114,15 +134,32 @@ var RovoChatAction = function RovoChatAction(_ref2) {
114
134
  sendPromptMessage = _useRovoChat.sendPromptMessage;
115
135
  var context = (0, _flexibleUiContext.useFlexibleUiContext)();
116
136
  var data = context === null || context === void 0 || (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[_constants.InternalActionName.RovoChatAction];
117
- var _onClick = (0, _react.useCallback)(function (promptData) {
118
- if (promptData) {
119
- sendPromptMessage(promptData);
120
-
121
- // NAVX-3599: Add analytics event, possibly as useInvokeClientAction()
122
-
137
+ var invoke = (0, _useInvokeClientAction.default)({});
138
+ var _onClick = (0, _react.useCallback)(function (promptData, promptKey) {
139
+ if (promptData && data !== null && data !== void 0 && data.invokeAction) {
140
+ invoke(_objectSpread(_objectSpread({}, data === null || data === void 0 ? void 0 : data.invokeAction), {}, {
141
+ actionFn: function () {
142
+ var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
143
+ return _regenerator.default.wrap(function _callee$(_context) {
144
+ while (1) switch (_context.prev = _context.next) {
145
+ case 0:
146
+ return _context.abrupt("return", sendPromptMessage(promptData));
147
+ case 1:
148
+ case "end":
149
+ return _context.stop();
150
+ }
151
+ }, _callee);
152
+ }));
153
+ function actionFn() {
154
+ return _actionFn.apply(this, arguments);
155
+ }
156
+ return actionFn;
157
+ }(),
158
+ prompt: promptKey
159
+ }));
123
160
  onClickCallback === null || onClickCallback === void 0 || onClickCallback();
124
161
  }
125
- }, [onClickCallback, sendPromptMessage]);
162
+ }, [data === null || data === void 0 ? void 0 : data.invokeAction, invoke, onClickCallback, sendPromptMessage]);
126
163
  var promptActions = (0, _react.useMemo)(function () {
127
164
  return prompts.map(function (promptKey, idx) {
128
165
  var _ref3 = getPromptAction(promptKey, intl, data === null || data === void 0 ? void 0 : data.url, data === null || data === void 0 ? void 0 : data.product) || {},
@@ -135,7 +172,7 @@ var RovoChatAction = function RovoChatAction(_ref2) {
135
172
  icon: icon,
136
173
  key: promptKey,
137
174
  onClick: function onClick() {
138
- return _onClick(promptData);
175
+ return _onClick(promptData, promptKey);
139
176
  },
140
177
  testId: "".concat(testId, "-").concat(idx + 1),
141
178
  tooltipMessage: tooltipMessage
@@ -7,11 +7,12 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _clock = _interopRequireDefault(require("@atlaskit/icon/core/clock"));
10
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
11
  var RelatedLinksActionIcon = function RelatedLinksActionIcon() {
11
12
  return /*#__PURE__*/_react.default.createElement(_clock.default, {
12
13
  color: "currentColor",
13
14
  spacing: "spacious",
14
- label: "View related links..."
15
+ label: (0, _platformFeatureFlags.fg)('navx-3698-flexible-card-a11y-fix') ? '' : 'View related links...'
15
16
  });
16
17
  };
17
18
  var _default = exports.default = RelatedLinksActionIcon;
@@ -48,7 +48,11 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
48
48
  var isRovoSummaryEnabled = (0, _platformFeatureFlags.fg)('platform_sl_3p_auth_rovo_action_kill_switch') ?
49
49
  // eslint-disable-next-line react-hooks/rules-of-hooks
50
50
  (0, _react.useMemo)(function () {
51
- return (cardState === null || cardState === void 0 ? void 0 : cardState.details) && (0, _extractRovoChatAction.default)(cardState.details, rovoConfig, actionOptions) !== undefined;
51
+ return (cardState === null || cardState === void 0 ? void 0 : cardState.details) && (0, _extractRovoChatAction.default)({
52
+ response: cardState.details,
53
+ rovoConfig: rovoConfig,
54
+ actionOptions: actionOptions
55
+ }) !== undefined;
52
56
  }, [actionOptions, cardState === null || cardState === void 0 ? void 0 : cardState.details, rovoConfig]) : false;
53
57
  (0, _react.useEffect)(function () {
54
58
  // Since this hover view is only rendered on resolved status,
@@ -22,7 +22,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
22
22
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
23
23
  var PACKAGE_DATA = {
24
24
  packageName: "@atlaskit/smart-card",
25
- packageVersion: "43.26.2",
25
+ packageVersion: "0.0.0-development",
26
26
  componentName: 'linkUrl'
27
27
  };
28
28
  var Anchor = (0, _click.withLinkClickedEvent)('a');