@atlaskit/smart-card 43.26.2 → 43.26.4
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.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/messages.js +15 -10
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/copy-link-action/index.js +2 -1
- package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +3 -2
- package/dist/cjs/view/FlexibleCard/components/actions/rovo-chat-action/html-to-adf.js +180 -0
- package/dist/cjs/view/FlexibleCard/components/actions/rovo-chat-action/index.js +25 -11
- package/dist/cjs/view/FlexibleCard/components/actions/view-related-links-action/related-links-action-icon/index.js +2 -1
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/messages.js +15 -10
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/copy-link-action/index.js +2 -1
- package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +3 -2
- package/dist/es2019/view/FlexibleCard/components/actions/rovo-chat-action/html-to-adf.js +161 -0
- package/dist/es2019/view/FlexibleCard/components/actions/rovo-chat-action/index.js +23 -29
- package/dist/es2019/view/FlexibleCard/components/actions/view-related-links-action/related-links-action-icon/index.js +2 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/messages.js +15 -10
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/copy-link-action/index.js +2 -1
- package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +3 -2
- package/dist/esm/view/FlexibleCard/components/actions/rovo-chat-action/html-to-adf.js +172 -0
- package/dist/esm/view/FlexibleCard/components/actions/rovo-chat-action/index.js +25 -11
- package/dist/esm/view/FlexibleCard/components/actions/view-related-links-action/related-links-action-icon/index.js +2 -1
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/actions/rovo-chat-action/html-to-adf.d.ts +8 -0
- package/dist/types-ts4.5/messages.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/rovo-chat-action/html-to-adf.d.ts +8 -0
- package/package.json +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 43.26.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4cf4d334bc493`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4cf4d334bc493) -
|
|
8
|
+
Covert Rovo Chat prompt message to ADF
|
|
9
|
+
- [`0359d27aff3b0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0359d27aff3b0) -
|
|
10
|
+
NAVX-3698: removed redundant screen reader announcements by marking decorative link icons as
|
|
11
|
+
aria-hidden
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 43.26.3
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 43.26.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/cjs/messages.js
CHANGED
|
@@ -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
|
});
|
|
@@ -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.
|
|
14
|
+
packageVersion: "43.26.3"
|
|
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:
|
|
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:
|
|
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:
|
|
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(/ /g, ' ').replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&').replace(/"/g, '"').replace(/'/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;
|
|
@@ -18,6 +18,7 @@ var _aiChapterIcon = _interopRequireDefault(require("../../../assets/ai-chapter-
|
|
|
18
18
|
var _aiEditIcon = _interopRequireDefault(require("../../../assets/ai-edit-icon"));
|
|
19
19
|
var _aiSearchIcon = _interopRequireDefault(require("../../../assets/ai-search-icon"));
|
|
20
20
|
var _action = _interopRequireDefault(require("../action"));
|
|
21
|
+
var _htmlToAdf = _interopRequireDefault(require("./html-to-adf"));
|
|
21
22
|
var _excluded = ["onClick", "prompts", "testId"];
|
|
22
23
|
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); }
|
|
23
24
|
var RovoChatPromptKey = exports.RovoChatPromptKey = /*#__PURE__*/function (RovoChatPromptKey) {
|
|
@@ -32,7 +33,6 @@ var getContext = function getContext(intl, product) {
|
|
|
32
33
|
case 'CONFLUENCE':
|
|
33
34
|
return {
|
|
34
35
|
contextLong: intl.formatMessage(_messages.messages.rovo_prompt_context_confluence_page),
|
|
35
|
-
contextLongPlural: intl.formatMessage(_messages.messages.rovo_prompt_context_confluence_page_plural),
|
|
36
36
|
contextShort: intl.formatMessage(_messages.messages.rovo_prompt_context_confluence_page_short)
|
|
37
37
|
};
|
|
38
38
|
case 'JSW':
|
|
@@ -41,24 +41,29 @@ var getContext = function getContext(intl, product) {
|
|
|
41
41
|
case 'JPD':
|
|
42
42
|
return {
|
|
43
43
|
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
44
|
contextShort: intl.formatMessage(_messages.messages.rovo_prompt_context_jira_work_item_short)
|
|
46
45
|
};
|
|
47
46
|
}
|
|
48
47
|
};
|
|
49
|
-
var getPromptAction = function getPromptAction(promptKey, intl
|
|
48
|
+
var getPromptAction = function getPromptAction(promptKey, intl) {
|
|
50
49
|
var _getContext;
|
|
50
|
+
var url = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
51
|
+
var product = arguments.length > 3 ? arguments[3] : undefined;
|
|
51
52
|
var _ref = (_getContext = getContext(intl, product)) !== null && _getContext !== void 0 ? _getContext : {
|
|
52
53
|
contextLong: intl.formatMessage(_messages.messages.rovo_prompt_context_generic),
|
|
53
|
-
contextLongPlural: intl.formatMessage(_messages.messages.rovo_prompt_context_generic_plural),
|
|
54
54
|
contextShort: intl.formatMessage(_messages.messages.rovo_prompt_context_generic)
|
|
55
55
|
},
|
|
56
56
|
contextLong = _ref.contextLong,
|
|
57
|
-
contextLongPlural = _ref.contextLongPlural,
|
|
58
57
|
contextShort = _ref.contextShort;
|
|
59
58
|
switch (promptKey) {
|
|
60
59
|
case RovoChatPromptKey.RECOMMEND_OTHER_SOURCES:
|
|
61
60
|
var label_recommend = intl.formatMessage(_messages.messages.rovo_prompt_button_recommend_other_sources);
|
|
61
|
+
var html_recommend = intl.formatMessage(_messages.messages.rovo_prompt_message_recommend_other_sources, {
|
|
62
|
+
context: contextLong,
|
|
63
|
+
url: url
|
|
64
|
+
}, {
|
|
65
|
+
ignoreTag: true
|
|
66
|
+
});
|
|
62
67
|
return {
|
|
63
68
|
icon: /*#__PURE__*/_react.default.createElement(_aiEditIcon.default, null),
|
|
64
69
|
content: label_recommend,
|
|
@@ -66,12 +71,17 @@ var getPromptAction = function getPromptAction(promptKey, intl, url, product) {
|
|
|
66
71
|
data: {
|
|
67
72
|
name: label_recommend,
|
|
68
73
|
dialogues: [],
|
|
69
|
-
|
|
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.")
|
|
74
|
+
prompt: (0, _htmlToAdf.default)(html_recommend)
|
|
71
75
|
}
|
|
72
76
|
};
|
|
73
77
|
case RovoChatPromptKey.SHOW_OTHER_MENTIONS:
|
|
74
78
|
var label_other_mentions = intl.formatMessage(_messages.messages.rovo_prompt_button_show_other_mentions);
|
|
79
|
+
var html_other_mentions = intl.formatMessage(_messages.messages.rovo_prompt_message_show_other_mentions, {
|
|
80
|
+
context: contextLong,
|
|
81
|
+
url: url
|
|
82
|
+
}, {
|
|
83
|
+
ignoreTag: true
|
|
84
|
+
});
|
|
75
85
|
return {
|
|
76
86
|
icon: /*#__PURE__*/_react.default.createElement(_aiChapterIcon.default, null),
|
|
77
87
|
content: label_other_mentions,
|
|
@@ -79,14 +89,19 @@ var getPromptAction = function getPromptAction(promptKey, intl, url, product) {
|
|
|
79
89
|
data: {
|
|
80
90
|
name: label_other_mentions,
|
|
81
91
|
dialogues: [],
|
|
82
|
-
|
|
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.")
|
|
92
|
+
prompt: (0, _htmlToAdf.default)(html_other_mentions)
|
|
84
93
|
}
|
|
85
94
|
};
|
|
86
95
|
case RovoChatPromptKey.SUGGEST_IMPROVEMENT:
|
|
87
96
|
var label_improvement = intl.formatMessage(_messages.messages.rovo_prompt_button_suggest_improvement, {
|
|
88
97
|
context: contextShort
|
|
89
98
|
});
|
|
99
|
+
var html_improvement = intl.formatMessage(_messages.messages.rovo_prompt_message_suggest_improvement, {
|
|
100
|
+
context: contextLong,
|
|
101
|
+
url: url
|
|
102
|
+
}, {
|
|
103
|
+
ignoreTag: true
|
|
104
|
+
});
|
|
90
105
|
return {
|
|
91
106
|
icon: /*#__PURE__*/_react.default.createElement(_aiSearchIcon.default, null),
|
|
92
107
|
content: label_improvement,
|
|
@@ -94,8 +109,7 @@ var getPromptAction = function getPromptAction(promptKey, intl, url, product) {
|
|
|
94
109
|
data: {
|
|
95
110
|
name: label_improvement,
|
|
96
111
|
dialogues: [],
|
|
97
|
-
|
|
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.")
|
|
112
|
+
prompt: (0, _htmlToAdf.default)(html_improvement)
|
|
99
113
|
}
|
|
100
114
|
};
|
|
101
115
|
}
|
|
@@ -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:
|
|
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;
|
|
@@ -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.
|
|
25
|
+
packageVersion: "43.26.3",
|
|
26
26
|
componentName: 'linkUrl'
|
|
27
27
|
};
|
|
28
28
|
var Anchor = (0, _click.withLinkClickedEvent)('a');
|
package/dist/es2019/messages.js
CHANGED
|
@@ -860,11 +860,6 @@ export const messages = defineMessages({
|
|
|
860
860
|
defaultMessage: 'Confluence page',
|
|
861
861
|
description: 'The Confluence page the user see Smart Link in, to be used as the {context} for Rovo prompt message'
|
|
862
862
|
},
|
|
863
|
-
rovo_prompt_context_confluence_page_plural: {
|
|
864
|
-
id: 'fabric.linking.rovo_prompt_context_confluence_page_plural.non-final',
|
|
865
|
-
defaultMessage: 'Confluence pages',
|
|
866
|
-
description: 'The Confluence page the user see Smart Link in, to be used as the {context} for Rovo prompt message'
|
|
867
|
-
},
|
|
868
863
|
rovo_prompt_context_confluence_page_short: {
|
|
869
864
|
id: 'fabric.linking.rovo_prompt_context_confluence_page_short.non-final',
|
|
870
865
|
defaultMessage: 'page',
|
|
@@ -875,11 +870,6 @@ export const messages = defineMessages({
|
|
|
875
870
|
defaultMessage: 'Jira work item',
|
|
876
871
|
description: 'The Jira work item the user see Smart Link in, to be used as the {context} for Rovo prompt message'
|
|
877
872
|
},
|
|
878
|
-
rovo_prompt_context_jira_work_item_plural: {
|
|
879
|
-
id: 'fabric.linking.rovo_prompt_context_jira_work_item_plural.non-final',
|
|
880
|
-
defaultMessage: 'Jira work items',
|
|
881
|
-
description: 'The Jira work item the user see Smart Link in, to be used as the {context} for Rovo prompt message'
|
|
882
|
-
},
|
|
883
873
|
rovo_prompt_context_jira_work_item_short: {
|
|
884
874
|
id: 'fabric.linking.rovo_prompt_context_jira_work_item_short.non-final',
|
|
885
875
|
defaultMessage: 'work item',
|
|
@@ -890,14 +880,29 @@ export const messages = defineMessages({
|
|
|
890
880
|
defaultMessage: 'Recommend other sources',
|
|
891
881
|
description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
|
|
892
882
|
},
|
|
883
|
+
rovo_prompt_message_recommend_other_sources: {
|
|
884
|
+
id: 'fabric.linking.rovo_prompt_message_recommend_other_sources.non-final',
|
|
885
|
+
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>',
|
|
886
|
+
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.)'
|
|
887
|
+
},
|
|
893
888
|
rovo_prompt_button_show_other_mentions: {
|
|
894
889
|
id: 'fabric.linking.rovo_prompt_button_show_other_mentions.non-final',
|
|
895
890
|
defaultMessage: 'Show other mentions',
|
|
896
891
|
description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
|
|
897
892
|
},
|
|
893
|
+
rovo_prompt_message_show_other_mentions: {
|
|
894
|
+
id: 'fabric.linking.rovo_prompt_message_show_other_mentions.non-final',
|
|
895
|
+
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>',
|
|
896
|
+
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.)'
|
|
897
|
+
},
|
|
898
898
|
rovo_prompt_button_suggest_improvement: {
|
|
899
899
|
id: 'fabric.linking.rovo_prompt_button_suggest_improvement.non-final',
|
|
900
900
|
defaultMessage: 'Suggest {context} improvement',
|
|
901
901
|
description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
|
|
902
|
+
},
|
|
903
|
+
rovo_prompt_message_suggest_improvement: {
|
|
904
|
+
id: 'fabric.linking.rovo_prompt_message_suggest_improvement.non-final',
|
|
905
|
+
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>',
|
|
906
|
+
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.)'
|
|
902
907
|
}
|
|
903
908
|
});
|
|
@@ -2,7 +2,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
2
2
|
export const context = {
|
|
3
3
|
componentName: 'smart-cards',
|
|
4
4
|
packageName: "@atlaskit/smart-card",
|
|
5
|
-
packageVersion: "43.26.
|
|
5
|
+
packageVersion: "43.26.3"
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { useCallback, useState } from 'react';
|
|
3
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
4
|
import LinkIcon from '@atlaskit/icon/core/link';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { ActionName } from '../../../../../constants';
|
|
6
7
|
import { messages } from '../../../../../messages';
|
|
7
8
|
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
@@ -33,7 +34,7 @@ const CopyLinkAction = ({
|
|
|
33
34
|
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.copy_url_to_clipboard),
|
|
34
35
|
icon: /*#__PURE__*/React.createElement(LinkIcon, {
|
|
35
36
|
color: "currentColor",
|
|
36
|
-
label:
|
|
37
|
+
label: fg('navx-3698-flexible-card-a11y-fix') ? '' : 'copy url',
|
|
37
38
|
spacing: "spacious"
|
|
38
39
|
}),
|
|
39
40
|
onClick: onClick,
|
|
@@ -3,6 +3,7 @@ import React, { useCallback } from 'react';
|
|
|
3
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
4
|
import MediaServicesActualSizeIcon from '@atlaskit/icon/core/grow-diagonal';
|
|
5
5
|
import PanelRightIcon from '@atlaskit/icon/core/panel-right';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
8
|
import { ActionName } from '../../../../../constants';
|
|
8
9
|
import { messages } from '../../../../../messages';
|
|
@@ -32,13 +33,13 @@ const PreviewAction = ({
|
|
|
32
33
|
return /*#__PURE__*/React.createElement(PanelRightIcon, {
|
|
33
34
|
color: "currentColor",
|
|
34
35
|
spacing: "spacious",
|
|
35
|
-
label:
|
|
36
|
+
label: fg('navx-3698-flexible-card-a11y-fix') ? '' : 'Open preview panel'
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
39
|
return /*#__PURE__*/React.createElement(MediaServicesActualSizeIcon, {
|
|
39
40
|
color: "currentColor",
|
|
40
41
|
spacing: "spacious",
|
|
41
|
-
label:
|
|
42
|
+
label: fg('navx-3698-flexible-card-a11y-fix') ? '' : 'Open preview'
|
|
42
43
|
});
|
|
43
44
|
}, [hasPreviewPanel]);
|
|
44
45
|
const actionLabel = useCallback(() => {
|