@atlaskit/smart-card 26.48.4 → 26.48.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.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +37 -26
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +11 -5
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +6 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +13 -10
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/common/ai-summary/index.js +23 -5
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +21 -14
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +11 -10
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +6 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +18 -13
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/common/ai-summary/index.js +19 -9
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +37 -26
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +11 -5
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +6 -1
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +15 -12
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/common/ai-summary/index.js +22 -5
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +2 -0
- package/dist/types/view/common/ai-summary/index.d.ts +3 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +2 -0
- package/dist/types-ts4.5/view/common/ai-summary/index.d.ts +3 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 26.48.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#77953](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/77953) [`484ed33c13bd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/484ed33c13bd) - AI summary: Set generic error state
|
|
8
|
+
- [#76006](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/76006) [`2798568fef46`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2798568fef46) - AI Summary: Add AI icon after the summary
|
|
9
|
+
|
|
3
10
|
## 26.48.4
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -118,21 +118,22 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
|
118
118
|
} finally {
|
|
119
119
|
_iterator2.f();
|
|
120
120
|
}
|
|
121
|
-
_context2.
|
|
121
|
+
_context2.prev = 4;
|
|
122
|
+
_context2.next = 7;
|
|
122
123
|
return this.fetchStream(summaryStyle);
|
|
123
|
-
case
|
|
124
|
+
case 7:
|
|
124
125
|
stream = _context2.sent;
|
|
125
126
|
bufferContent = '';
|
|
126
127
|
_iteratorAbruptCompletion = false;
|
|
127
128
|
_didIteratorError = false;
|
|
128
|
-
_context2.prev =
|
|
129
|
+
_context2.prev = 11;
|
|
129
130
|
_iterator = _asyncIterator(stream);
|
|
130
|
-
case
|
|
131
|
-
_context2.next =
|
|
131
|
+
case 13:
|
|
132
|
+
_context2.next = 15;
|
|
132
133
|
return _iterator.next();
|
|
133
|
-
case
|
|
134
|
+
case 15:
|
|
134
135
|
if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
|
|
135
|
-
_context2.next =
|
|
136
|
+
_context2.next = 21;
|
|
136
137
|
break;
|
|
137
138
|
}
|
|
138
139
|
chunk = _step.value;
|
|
@@ -152,43 +153,53 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
|
152
153
|
_iterator3.f();
|
|
153
154
|
}
|
|
154
155
|
}
|
|
155
|
-
case
|
|
156
|
+
case 18:
|
|
156
157
|
_iteratorAbruptCompletion = false;
|
|
157
|
-
_context2.next =
|
|
158
|
+
_context2.next = 13;
|
|
158
159
|
break;
|
|
159
|
-
case
|
|
160
|
-
_context2.next =
|
|
160
|
+
case 21:
|
|
161
|
+
_context2.next = 27;
|
|
161
162
|
break;
|
|
162
|
-
case
|
|
163
|
-
_context2.prev =
|
|
164
|
-
_context2.t0 = _context2["catch"](
|
|
163
|
+
case 23:
|
|
164
|
+
_context2.prev = 23;
|
|
165
|
+
_context2.t0 = _context2["catch"](11);
|
|
165
166
|
_didIteratorError = true;
|
|
166
167
|
_iteratorError = _context2.t0;
|
|
167
|
-
case
|
|
168
|
-
_context2.prev = 26;
|
|
168
|
+
case 27:
|
|
169
169
|
_context2.prev = 27;
|
|
170
|
+
_context2.prev = 28;
|
|
170
171
|
if (!(_iteratorAbruptCompletion && _iterator.return != null)) {
|
|
171
|
-
_context2.next =
|
|
172
|
+
_context2.next = 32;
|
|
172
173
|
break;
|
|
173
174
|
}
|
|
174
|
-
_context2.next =
|
|
175
|
+
_context2.next = 32;
|
|
175
176
|
return _iterator.return();
|
|
176
|
-
case
|
|
177
|
-
_context2.prev =
|
|
177
|
+
case 32:
|
|
178
|
+
_context2.prev = 32;
|
|
178
179
|
if (!_didIteratorError) {
|
|
179
|
-
_context2.next =
|
|
180
|
+
_context2.next = 35;
|
|
180
181
|
break;
|
|
181
182
|
}
|
|
182
183
|
throw _iteratorError;
|
|
183
|
-
case 34:
|
|
184
|
-
return _context2.finish(31);
|
|
185
184
|
case 35:
|
|
186
|
-
return _context2.finish(
|
|
185
|
+
return _context2.finish(32);
|
|
187
186
|
case 36:
|
|
187
|
+
return _context2.finish(27);
|
|
188
|
+
case 37:
|
|
188
189
|
this.state = {
|
|
189
190
|
status: 'done',
|
|
190
191
|
content: bufferContent
|
|
191
192
|
};
|
|
193
|
+
_context2.next = 43;
|
|
194
|
+
break;
|
|
195
|
+
case 40:
|
|
196
|
+
_context2.prev = 40;
|
|
197
|
+
_context2.t1 = _context2["catch"](4);
|
|
198
|
+
this.state = {
|
|
199
|
+
status: 'error',
|
|
200
|
+
content: ''
|
|
201
|
+
};
|
|
202
|
+
case 43:
|
|
192
203
|
_iterator4 = _createForOfIteratorHelper(this.subscribedStateSetters);
|
|
193
204
|
try {
|
|
194
205
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
@@ -200,11 +211,11 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
|
|
|
200
211
|
} finally {
|
|
201
212
|
_iterator4.f();
|
|
202
213
|
}
|
|
203
|
-
case
|
|
214
|
+
case 45:
|
|
204
215
|
case "end":
|
|
205
216
|
return _context2.stop();
|
|
206
217
|
}
|
|
207
|
-
}, _callee2, this, [[
|
|
218
|
+
}, _callee2, this, [[4, 40], [11, 23, 27, 37], [28,, 32, 36]]);
|
|
208
219
|
}));
|
|
209
220
|
function summariseUrl() {
|
|
210
221
|
return _summariseUrl.apply(this, arguments);
|
|
@@ -22,7 +22,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
22
22
|
var context = exports.context = {
|
|
23
23
|
componentName: 'smart-cards',
|
|
24
24
|
packageName: "@atlaskit/smart-card",
|
|
25
|
-
packageVersion: "26.48.
|
|
25
|
+
packageVersion: "26.48.5"
|
|
26
26
|
};
|
|
27
27
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
28
28
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -7,28 +7,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
10
|
var _react = _interopRequireDefault(require("react"));
|
|
12
11
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
13
12
|
var _tooltip = _interopRequireWildcard(require("@atlaskit/tooltip"));
|
|
14
13
|
var _primitives = require("@atlaskit/primitives");
|
|
15
|
-
var _templateObject;
|
|
16
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
|
-
var AIIndicatorTooltipPrimitive = (0, _styled.default)(_tooltip.TooltipPrimitive)(
|
|
16
|
+
var AIIndicatorTooltipPrimitive = (0, _styled.default)(_tooltip.TooltipPrimitive)({
|
|
17
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
18
|
+
backgroundColor: "var(--ds-surface-raised, white)",
|
|
19
|
+
boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))",
|
|
20
|
+
boxSizing: 'content-box',
|
|
21
|
+
padding: "var(--ds-space-200, 16px)",
|
|
22
|
+
maxWidth: '350px'
|
|
23
|
+
});
|
|
19
24
|
var triggerStyles = (0, _primitives.xcss)({
|
|
20
25
|
display: 'inline-flex'
|
|
21
26
|
});
|
|
22
27
|
var AIIndicatorTooltip = function AIIndicatorTooltip(_ref) {
|
|
23
28
|
var content = _ref.content,
|
|
24
|
-
trigger = _ref.trigger
|
|
29
|
+
trigger = _ref.trigger,
|
|
30
|
+
overrideXcss = _ref.xcss;
|
|
25
31
|
return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
26
32
|
component: AIIndicatorTooltipPrimitive,
|
|
27
33
|
content: content,
|
|
28
34
|
tag: "span"
|
|
29
35
|
}, function (tooltipProps) {
|
|
30
36
|
return /*#__PURE__*/_react.default.createElement(_primitives.Box, (0, _extends2.default)({
|
|
31
|
-
xcss: triggerStyles
|
|
37
|
+
xcss: [triggerStyles, overrideXcss]
|
|
32
38
|
}, tooltipProps), trigger);
|
|
33
39
|
});
|
|
34
40
|
};
|
|
@@ -49,6 +49,10 @@ var iconTooltipDescStyles = (0, _primitives.xcss)({
|
|
|
49
49
|
fontWeight: '400',
|
|
50
50
|
lineHeight: '14px'
|
|
51
51
|
});
|
|
52
|
+
var iconTooltipTriggerStyles = (0, _primitives.xcss)({
|
|
53
|
+
position: 'relative',
|
|
54
|
+
bottom: 'space.negative.050'
|
|
55
|
+
});
|
|
52
56
|
var AIStateDone = function AIStateDone(_ref) {
|
|
53
57
|
var appearance = _ref.appearance,
|
|
54
58
|
testId = _ref.testId;
|
|
@@ -81,7 +85,8 @@ var AIStateDone = function AIStateDone(_ref) {
|
|
|
81
85
|
}
|
|
82
86
|
}
|
|
83
87
|
}))))),
|
|
84
|
-
trigger: icon
|
|
88
|
+
trigger: icon,
|
|
89
|
+
xcss: iconTooltipTriggerStyles
|
|
85
90
|
});
|
|
86
91
|
default:
|
|
87
92
|
return (0, _react2.jsx)(_aiIndicatorContainer.default, {
|
|
@@ -19,21 +19,21 @@ var _elementGroup = _interopRequireDefault(require("../../element-group"));
|
|
|
19
19
|
var _aiStateIndicator = _interopRequireDefault(require("../ai-state-indicator"));
|
|
20
20
|
var _utils = require("../../utils");
|
|
21
21
|
var _messages = require("../../../../../../messages");
|
|
22
|
-
var _aiIcon = _interopRequireDefault(require("../../../../../common/ai-icon"));
|
|
23
|
-
var _aiSummary = _interopRequireDefault(require("../../../../../common/ai-summary"));
|
|
24
22
|
var _useAiSummary = require("../../../../../../state/hooks/use-ai-summary");
|
|
25
23
|
var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
|
|
24
|
+
var _aiIcon = _interopRequireDefault(require("../../../../../common/ai-icon"));
|
|
25
|
+
var _aiSummary = _interopRequireDefault(require("../../../../../common/ai-summary"));
|
|
26
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
27
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
28
28
|
var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
29
29
|
var _props$actions = props.actions,
|
|
30
30
|
actions = _props$actions === void 0 ? [] : _props$actions,
|
|
31
31
|
metadata = props.metadata,
|
|
32
|
-
testId = props.testId,
|
|
33
32
|
onActionMenuOpenChange = props.onActionMenuOpenChange,
|
|
34
33
|
onAIActionChange = props.onAIActionChange,
|
|
35
34
|
_props$size = props.size,
|
|
36
|
-
size = _props$size === void 0 ? _constants.SmartLinkSize.Medium : _props$size
|
|
35
|
+
size = _props$size === void 0 ? _constants.SmartLinkSize.Medium : _props$size,
|
|
36
|
+
testId = props.testId;
|
|
37
37
|
var _useState = (0, _react.useState)('ready'),
|
|
38
38
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
39
39
|
aiState = _useState2[0],
|
|
@@ -44,7 +44,8 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
44
44
|
var aiSummary = (0, _useAiSummary.useAISummary)({
|
|
45
45
|
url: url
|
|
46
46
|
});
|
|
47
|
-
var content = aiSummary.state.content
|
|
47
|
+
var content = aiSummary.state.content,
|
|
48
|
+
isSummarisedOnMount = aiSummary.isSummarisedOnMount;
|
|
48
49
|
var onAIActionClick = (0, _react.useCallback)(function () {
|
|
49
50
|
setAIState('loading');
|
|
50
51
|
if (onAIActionChange) {
|
|
@@ -59,7 +60,7 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
59
60
|
onClick: onAIActionClick,
|
|
60
61
|
testId: "".concat(testId, "-ai-summary-action"),
|
|
61
62
|
icon: /*#__PURE__*/_react.default.createElement(_aiIcon.default, {
|
|
62
|
-
label: "
|
|
63
|
+
label: "AIIcon"
|
|
63
64
|
})
|
|
64
65
|
};
|
|
65
66
|
return [aiAction].concat((0, _toConsumableArray2.default)(actions));
|
|
@@ -77,17 +78,19 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
77
78
|
direction: _constants.SmartLinkDirection.Vertical,
|
|
78
79
|
testId: "".concat(testId, "-resolved-view")
|
|
79
80
|
}), /*#__PURE__*/_react.default.createElement(_aiSummary.default, {
|
|
80
|
-
content: content
|
|
81
|
+
content: content,
|
|
82
|
+
showIcon: isSummarisedOnMount
|
|
81
83
|
}), /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
|
|
82
84
|
alignBlock: "center",
|
|
83
85
|
alignInline: "end",
|
|
84
86
|
grow: "fill",
|
|
85
87
|
spread: "space-between"
|
|
86
|
-
}, /*#__PURE__*/_react.default.createElement(_primitives.Box, null, aiState === 'loading' || aiState === 'done' ? /*#__PURE__*/_react.default.createElement(_aiStateIndicator.default, {
|
|
88
|
+
}, /*#__PURE__*/_react.default.createElement(_primitives.Box, null, !isSummarisedOnMount && (aiState === 'loading' || aiState === 'done') ? /*#__PURE__*/_react.default.createElement(_aiStateIndicator.default, {
|
|
87
89
|
state: aiState,
|
|
88
|
-
testId: testId
|
|
90
|
+
testId: "".concat(testId, "-state-indicator")
|
|
89
91
|
}) : /*#__PURE__*/_react.default.createElement(_elementGroup.default, {
|
|
90
|
-
width: _constants.SmartLinkWidth.FitToContent
|
|
92
|
+
width: _constants.SmartLinkWidth.FitToContent,
|
|
93
|
+
testId: "".concat(testId, "-metadata-group")
|
|
91
94
|
}, metadataElements)), /*#__PURE__*/_react.default.createElement(_primitives.Box, null, /*#__PURE__*/_react.default.createElement(_actionGroup.default, {
|
|
92
95
|
onDropdownOpenChange: onDropdownOpenChange,
|
|
93
96
|
items: combinedActions,
|
|
@@ -17,7 +17,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
|
|
|
17
17
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
18
18
|
var PACKAGE_DATA = {
|
|
19
19
|
packageName: "@atlaskit/smart-card",
|
|
20
|
-
packageVersion: "26.48.
|
|
20
|
+
packageVersion: "26.48.5",
|
|
21
21
|
componentName: 'linkUrl'
|
|
22
22
|
};
|
|
23
23
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -5,13 +5,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
8
|
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _markdownToJsx = _interopRequireDefault(require("markdown-to-jsx"));
|
|
11
10
|
var _react2 = require("@emotion/react");
|
|
12
|
-
var
|
|
11
|
+
var _aiStateIndicator = _interopRequireDefault(require("../../FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator"));
|
|
13
12
|
/** @jsx jsx */
|
|
14
|
-
|
|
13
|
+
|
|
14
|
+
var AITooltipIcon = function AITooltipIcon() {
|
|
15
|
+
return (0, _react2.jsx)(_aiStateIndicator.default, {
|
|
16
|
+
appearance: "icon-only",
|
|
17
|
+
state: "done",
|
|
18
|
+
testId: "ai-tooltip"
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var AISummaryCSS = (0, _react2.css)({
|
|
22
|
+
fontSize: '0.75rem',
|
|
23
|
+
lineHeight: '1rem',
|
|
24
|
+
wordWrap: 'break-word',
|
|
25
|
+
whiteSpace: 'normal'
|
|
26
|
+
});
|
|
15
27
|
/**
|
|
16
28
|
* A component to render a response from AI in markdown text.
|
|
17
29
|
* @internal
|
|
@@ -20,6 +32,9 @@ var AISummaryCSS = (0, _react2.css)(_templateObject || (_templateObject = (0, _t
|
|
|
20
32
|
|
|
21
33
|
var AISummary = function AISummary(_ref) {
|
|
22
34
|
var content = _ref.content,
|
|
35
|
+
_ref$showIcon = _ref.showIcon,
|
|
36
|
+
showIcon = _ref$showIcon === void 0 ? false : _ref$showIcon,
|
|
37
|
+
iconComponent = _ref.iconComponent,
|
|
23
38
|
overrideCss = _ref.overrideCss,
|
|
24
39
|
_ref$testId = _ref.testId,
|
|
25
40
|
testId = _ref$testId === void 0 ? 'ai-summary' : _ref$testId;
|
|
@@ -29,9 +44,12 @@ var AISummary = function AISummary(_ref) {
|
|
|
29
44
|
return (0, _react2.jsx)(_markdownToJsx.default, {
|
|
30
45
|
"data-testid": testId,
|
|
31
46
|
css: [AISummaryCSS, overrideCss],
|
|
32
|
-
children: content,
|
|
47
|
+
children: showIcon ? "".concat(content, " <Icon />") : content,
|
|
33
48
|
options: {
|
|
34
|
-
forceWrapper: true
|
|
49
|
+
forceWrapper: true,
|
|
50
|
+
overrides: {
|
|
51
|
+
Icon: iconComponent !== null && iconComponent !== void 0 ? iconComponent : AITooltipIcon
|
|
52
|
+
}
|
|
35
53
|
}
|
|
36
54
|
});
|
|
37
55
|
};
|
|
@@ -50,23 +50,30 @@ export class AISummaryService {
|
|
|
50
50
|
for (const subscriber of this.subscribedStateSetters) {
|
|
51
51
|
subscriber(this.state);
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
subscriber
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
try {
|
|
54
|
+
const stream = await this.fetchStream(summaryStyle);
|
|
55
|
+
let bufferContent = '';
|
|
56
|
+
for await (const chunk of stream) {
|
|
57
|
+
if (chunk.type === 'ANSWER_PART') {
|
|
58
|
+
bufferContent += chunk.message.content;
|
|
59
|
+
for (const subscriber of this.subscribedStateSetters) {
|
|
60
|
+
subscriber({
|
|
61
|
+
...this.state,
|
|
62
|
+
content: bufferContent
|
|
63
|
+
});
|
|
64
|
+
}
|
|
63
65
|
}
|
|
64
66
|
}
|
|
67
|
+
this.state = {
|
|
68
|
+
status: 'done',
|
|
69
|
+
content: bufferContent
|
|
70
|
+
};
|
|
71
|
+
} catch {
|
|
72
|
+
this.state = {
|
|
73
|
+
status: 'error',
|
|
74
|
+
content: ''
|
|
75
|
+
};
|
|
65
76
|
}
|
|
66
|
-
this.state = {
|
|
67
|
-
status: 'done',
|
|
68
|
-
content: bufferContent
|
|
69
|
-
};
|
|
70
77
|
for (const subscriber of this.subscribedStateSetters) {
|
|
71
78
|
subscriber(this.state);
|
|
72
79
|
}
|
|
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export const context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "26.48.
|
|
7
|
+
packageVersion: "26.48.5"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -3,27 +3,28 @@ import React from 'react';
|
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
4
|
import Tooltip, { TooltipPrimitive } from '@atlaskit/tooltip';
|
|
5
5
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
6
|
-
const AIIndicatorTooltipPrimitive = styled(TooltipPrimitive)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
padding:
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
const AIIndicatorTooltipPrimitive = styled(TooltipPrimitive)({
|
|
7
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
8
|
+
backgroundColor: "var(--ds-surface-raised, white)",
|
|
9
|
+
boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))",
|
|
10
|
+
boxSizing: 'content-box',
|
|
11
|
+
padding: "var(--ds-space-200, 16px)",
|
|
12
|
+
maxWidth: '350px'
|
|
13
|
+
});
|
|
14
14
|
const triggerStyles = xcss({
|
|
15
15
|
display: 'inline-flex'
|
|
16
16
|
});
|
|
17
17
|
const AIIndicatorTooltip = ({
|
|
18
18
|
content,
|
|
19
|
-
trigger
|
|
19
|
+
trigger,
|
|
20
|
+
xcss: overrideXcss
|
|
20
21
|
}) => {
|
|
21
22
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
22
23
|
component: AIIndicatorTooltipPrimitive,
|
|
23
24
|
content: content,
|
|
24
25
|
tag: "span"
|
|
25
26
|
}, tooltipProps => /*#__PURE__*/React.createElement(Box, _extends({
|
|
26
|
-
xcss: triggerStyles
|
|
27
|
+
xcss: [triggerStyles, overrideXcss]
|
|
27
28
|
}, tooltipProps), trigger));
|
|
28
29
|
};
|
|
29
30
|
export default AIIndicatorTooltip;
|
|
@@ -41,6 +41,10 @@ const iconTooltipDescStyles = xcss({
|
|
|
41
41
|
fontWeight: '400',
|
|
42
42
|
lineHeight: '14px'
|
|
43
43
|
});
|
|
44
|
+
const iconTooltipTriggerStyles = xcss({
|
|
45
|
+
position: 'relative',
|
|
46
|
+
bottom: 'space.negative.050'
|
|
47
|
+
});
|
|
44
48
|
const AIStateDone = ({
|
|
45
49
|
appearance,
|
|
46
50
|
testId
|
|
@@ -72,7 +76,8 @@ const AIStateDone = ({
|
|
|
72
76
|
}, chunks)
|
|
73
77
|
}
|
|
74
78
|
}))))),
|
|
75
|
-
trigger: icon
|
|
79
|
+
trigger: icon,
|
|
80
|
+
xcss: iconTooltipTriggerStyles
|
|
76
81
|
});
|
|
77
82
|
default:
|
|
78
83
|
return jsx(AIIndicatorContainer, {
|
|
@@ -2,25 +2,25 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
3
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
4
|
import { Box, Inline } from '@atlaskit/primitives';
|
|
5
|
-
import { ActionName, SmartLinkSize, SmartLinkWidth
|
|
5
|
+
import { ActionName, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
|
|
6
6
|
import ActionGroup from '../../action-group';
|
|
7
7
|
import Block from '../../block';
|
|
8
8
|
import ElementGroup from '../../element-group';
|
|
9
9
|
import AIStateIndicator from '../ai-state-indicator';
|
|
10
10
|
import { renderElementItems } from '../../utils';
|
|
11
11
|
import { messages } from '../../../../../../messages';
|
|
12
|
-
import AiIcon from '../../../../../common/ai-icon';
|
|
13
|
-
import AISummary from '../../../../../common/ai-summary';
|
|
14
12
|
import { useAISummary } from '../../../../../../state/hooks/use-ai-summary';
|
|
15
13
|
import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context';
|
|
14
|
+
import AIIcon from '../../../../../common/ai-icon';
|
|
15
|
+
import AISummary from '../../../../../common/ai-summary';
|
|
16
16
|
const AISummaryBlockResolvedView = props => {
|
|
17
17
|
const {
|
|
18
18
|
actions = [],
|
|
19
19
|
metadata,
|
|
20
|
-
testId,
|
|
21
20
|
onActionMenuOpenChange,
|
|
22
21
|
onAIActionChange,
|
|
23
|
-
size = SmartLinkSize.Medium
|
|
22
|
+
size = SmartLinkSize.Medium,
|
|
23
|
+
testId
|
|
24
24
|
} = props;
|
|
25
25
|
const [aiState, setAIState] = useState('ready');
|
|
26
26
|
const metadataElements = renderElementItems(metadata);
|
|
@@ -30,8 +30,11 @@ const AISummaryBlockResolvedView = props => {
|
|
|
30
30
|
url
|
|
31
31
|
});
|
|
32
32
|
const {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
state: {
|
|
34
|
+
content
|
|
35
|
+
},
|
|
36
|
+
isSummarisedOnMount
|
|
37
|
+
} = aiSummary;
|
|
35
38
|
const onAIActionClick = useCallback(() => {
|
|
36
39
|
setAIState('loading');
|
|
37
40
|
if (onAIActionChange) {
|
|
@@ -45,8 +48,8 @@ const AISummaryBlockResolvedView = props => {
|
|
|
45
48
|
name: ActionName.CustomAction,
|
|
46
49
|
onClick: onAIActionClick,
|
|
47
50
|
testId: `${testId}-ai-summary-action`,
|
|
48
|
-
icon: /*#__PURE__*/React.createElement(
|
|
49
|
-
label: "
|
|
51
|
+
icon: /*#__PURE__*/React.createElement(AIIcon, {
|
|
52
|
+
label: "AIIcon"
|
|
50
53
|
})
|
|
51
54
|
};
|
|
52
55
|
return [aiAction, ...actions];
|
|
@@ -64,17 +67,19 @@ const AISummaryBlockResolvedView = props => {
|
|
|
64
67
|
direction: SmartLinkDirection.Vertical,
|
|
65
68
|
testId: `${testId}-resolved-view`
|
|
66
69
|
}), /*#__PURE__*/React.createElement(AISummary, {
|
|
67
|
-
content: content
|
|
70
|
+
content: content,
|
|
71
|
+
showIcon: isSummarisedOnMount
|
|
68
72
|
}), /*#__PURE__*/React.createElement(Inline, {
|
|
69
73
|
alignBlock: "center",
|
|
70
74
|
alignInline: "end",
|
|
71
75
|
grow: "fill",
|
|
72
76
|
spread: "space-between"
|
|
73
|
-
}, /*#__PURE__*/React.createElement(Box, null, aiState === 'loading' || aiState === 'done' ? /*#__PURE__*/React.createElement(AIStateIndicator, {
|
|
77
|
+
}, /*#__PURE__*/React.createElement(Box, null, !isSummarisedOnMount && (aiState === 'loading' || aiState === 'done') ? /*#__PURE__*/React.createElement(AIStateIndicator, {
|
|
74
78
|
state: aiState,
|
|
75
|
-
testId: testId
|
|
79
|
+
testId: `${testId}-state-indicator`
|
|
76
80
|
}) : /*#__PURE__*/React.createElement(ElementGroup, {
|
|
77
|
-
width: SmartLinkWidth.FitToContent
|
|
81
|
+
width: SmartLinkWidth.FitToContent,
|
|
82
|
+
testId: `${testId}-metadata-group`
|
|
78
83
|
}, metadataElements)), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(ActionGroup, {
|
|
79
84
|
onDropdownOpenChange: onDropdownOpenChange,
|
|
80
85
|
items: combinedActions,
|
|
@@ -7,7 +7,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
|
|
|
7
7
|
import LinkWarningModal from './LinkWarningModal';
|
|
8
8
|
const PACKAGE_DATA = {
|
|
9
9
|
packageName: "@atlaskit/smart-card",
|
|
10
|
-
packageVersion: "26.48.
|
|
10
|
+
packageVersion: "26.48.5",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
const Link = withLinkClickedEvent('a');
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import Markdown from 'markdown-to-jsx';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
import AIStateIndicator from '../../FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator';
|
|
6
|
+
const AITooltipIcon = () => jsx(AIStateIndicator, {
|
|
7
|
+
appearance: "icon-only",
|
|
8
|
+
state: "done",
|
|
9
|
+
testId: "ai-tooltip"
|
|
10
|
+
});
|
|
11
|
+
const AISummaryCSS = css({
|
|
12
|
+
fontSize: '0.75rem',
|
|
13
|
+
lineHeight: '1rem',
|
|
14
|
+
wordWrap: 'break-word',
|
|
15
|
+
whiteSpace: 'normal'
|
|
16
|
+
});
|
|
12
17
|
/**
|
|
13
18
|
* A component to render a response from AI in markdown text.
|
|
14
19
|
* @internal
|
|
@@ -17,6 +22,8 @@ const AISummaryCSS = css`
|
|
|
17
22
|
|
|
18
23
|
const AISummary = ({
|
|
19
24
|
content,
|
|
25
|
+
showIcon = false,
|
|
26
|
+
iconComponent,
|
|
20
27
|
overrideCss,
|
|
21
28
|
testId = 'ai-summary'
|
|
22
29
|
}) => {
|
|
@@ -26,9 +33,12 @@ const AISummary = ({
|
|
|
26
33
|
return jsx(Markdown, {
|
|
27
34
|
"data-testid": testId,
|
|
28
35
|
css: [AISummaryCSS, overrideCss],
|
|
29
|
-
children: content,
|
|
36
|
+
children: showIcon ? `${content} <Icon />` : content,
|
|
30
37
|
options: {
|
|
31
|
-
forceWrapper: true
|
|
38
|
+
forceWrapper: true,
|
|
39
|
+
overrides: {
|
|
40
|
+
Icon: iconComponent !== null && iconComponent !== void 0 ? iconComponent : AITooltipIcon
|
|
41
|
+
}
|
|
32
42
|
}
|
|
33
43
|
});
|
|
34
44
|
};
|
|
@@ -111,21 +111,22 @@ export var AISummaryService = /*#__PURE__*/function () {
|
|
|
111
111
|
} finally {
|
|
112
112
|
_iterator2.f();
|
|
113
113
|
}
|
|
114
|
-
_context2.
|
|
114
|
+
_context2.prev = 4;
|
|
115
|
+
_context2.next = 7;
|
|
115
116
|
return this.fetchStream(summaryStyle);
|
|
116
|
-
case
|
|
117
|
+
case 7:
|
|
117
118
|
stream = _context2.sent;
|
|
118
119
|
bufferContent = '';
|
|
119
120
|
_iteratorAbruptCompletion = false;
|
|
120
121
|
_didIteratorError = false;
|
|
121
|
-
_context2.prev =
|
|
122
|
+
_context2.prev = 11;
|
|
122
123
|
_iterator = _asyncIterator(stream);
|
|
123
|
-
case
|
|
124
|
-
_context2.next =
|
|
124
|
+
case 13:
|
|
125
|
+
_context2.next = 15;
|
|
125
126
|
return _iterator.next();
|
|
126
|
-
case
|
|
127
|
+
case 15:
|
|
127
128
|
if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
|
|
128
|
-
_context2.next =
|
|
129
|
+
_context2.next = 21;
|
|
129
130
|
break;
|
|
130
131
|
}
|
|
131
132
|
chunk = _step.value;
|
|
@@ -145,43 +146,53 @@ export var AISummaryService = /*#__PURE__*/function () {
|
|
|
145
146
|
_iterator3.f();
|
|
146
147
|
}
|
|
147
148
|
}
|
|
148
|
-
case
|
|
149
|
+
case 18:
|
|
149
150
|
_iteratorAbruptCompletion = false;
|
|
150
|
-
_context2.next =
|
|
151
|
+
_context2.next = 13;
|
|
151
152
|
break;
|
|
152
|
-
case
|
|
153
|
-
_context2.next =
|
|
153
|
+
case 21:
|
|
154
|
+
_context2.next = 27;
|
|
154
155
|
break;
|
|
155
|
-
case
|
|
156
|
-
_context2.prev =
|
|
157
|
-
_context2.t0 = _context2["catch"](
|
|
156
|
+
case 23:
|
|
157
|
+
_context2.prev = 23;
|
|
158
|
+
_context2.t0 = _context2["catch"](11);
|
|
158
159
|
_didIteratorError = true;
|
|
159
160
|
_iteratorError = _context2.t0;
|
|
160
|
-
case
|
|
161
|
-
_context2.prev = 26;
|
|
161
|
+
case 27:
|
|
162
162
|
_context2.prev = 27;
|
|
163
|
+
_context2.prev = 28;
|
|
163
164
|
if (!(_iteratorAbruptCompletion && _iterator.return != null)) {
|
|
164
|
-
_context2.next =
|
|
165
|
+
_context2.next = 32;
|
|
165
166
|
break;
|
|
166
167
|
}
|
|
167
|
-
_context2.next =
|
|
168
|
+
_context2.next = 32;
|
|
168
169
|
return _iterator.return();
|
|
169
|
-
case
|
|
170
|
-
_context2.prev =
|
|
170
|
+
case 32:
|
|
171
|
+
_context2.prev = 32;
|
|
171
172
|
if (!_didIteratorError) {
|
|
172
|
-
_context2.next =
|
|
173
|
+
_context2.next = 35;
|
|
173
174
|
break;
|
|
174
175
|
}
|
|
175
176
|
throw _iteratorError;
|
|
176
|
-
case 34:
|
|
177
|
-
return _context2.finish(31);
|
|
178
177
|
case 35:
|
|
179
|
-
return _context2.finish(
|
|
178
|
+
return _context2.finish(32);
|
|
180
179
|
case 36:
|
|
180
|
+
return _context2.finish(27);
|
|
181
|
+
case 37:
|
|
181
182
|
this.state = {
|
|
182
183
|
status: 'done',
|
|
183
184
|
content: bufferContent
|
|
184
185
|
};
|
|
186
|
+
_context2.next = 43;
|
|
187
|
+
break;
|
|
188
|
+
case 40:
|
|
189
|
+
_context2.prev = 40;
|
|
190
|
+
_context2.t1 = _context2["catch"](4);
|
|
191
|
+
this.state = {
|
|
192
|
+
status: 'error',
|
|
193
|
+
content: ''
|
|
194
|
+
};
|
|
195
|
+
case 43:
|
|
185
196
|
_iterator4 = _createForOfIteratorHelper(this.subscribedStateSetters);
|
|
186
197
|
try {
|
|
187
198
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
@@ -193,11 +204,11 @@ export var AISummaryService = /*#__PURE__*/function () {
|
|
|
193
204
|
} finally {
|
|
194
205
|
_iterator4.f();
|
|
195
206
|
}
|
|
196
|
-
case
|
|
207
|
+
case 45:
|
|
197
208
|
case "end":
|
|
198
209
|
return _context2.stop();
|
|
199
210
|
}
|
|
200
|
-
}, _callee2, this, [[
|
|
211
|
+
}, _callee2, this, [[4, 40], [11, 23, 27, 37], [28,, 32, 36]]);
|
|
201
212
|
}));
|
|
202
213
|
function summariseUrl() {
|
|
203
214
|
return _summariseUrl.apply(this, arguments);
|
|
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
15
15
|
export var context = {
|
|
16
16
|
componentName: 'smart-cards',
|
|
17
17
|
packageName: "@atlaskit/smart-card",
|
|
18
|
-
packageVersion: "26.48.
|
|
18
|
+
packageVersion: "26.48.5"
|
|
19
19
|
};
|
|
20
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
21
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
3
|
-
var _templateObject;
|
|
4
2
|
import React from 'react';
|
|
5
3
|
import styled from '@emotion/styled';
|
|
6
4
|
import Tooltip, { TooltipPrimitive } from '@atlaskit/tooltip';
|
|
7
5
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
8
|
-
var AIIndicatorTooltipPrimitive = styled(TooltipPrimitive)(
|
|
6
|
+
var AIIndicatorTooltipPrimitive = styled(TooltipPrimitive)({
|
|
7
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
8
|
+
backgroundColor: "var(--ds-surface-raised, white)",
|
|
9
|
+
boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))",
|
|
10
|
+
boxSizing: 'content-box',
|
|
11
|
+
padding: "var(--ds-space-200, 16px)",
|
|
12
|
+
maxWidth: '350px'
|
|
13
|
+
});
|
|
9
14
|
var triggerStyles = xcss({
|
|
10
15
|
display: 'inline-flex'
|
|
11
16
|
});
|
|
12
17
|
var AIIndicatorTooltip = function AIIndicatorTooltip(_ref) {
|
|
13
18
|
var content = _ref.content,
|
|
14
|
-
trigger = _ref.trigger
|
|
19
|
+
trigger = _ref.trigger,
|
|
20
|
+
overrideXcss = _ref.xcss;
|
|
15
21
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
16
22
|
component: AIIndicatorTooltipPrimitive,
|
|
17
23
|
content: content,
|
|
18
24
|
tag: "span"
|
|
19
25
|
}, function (tooltipProps) {
|
|
20
26
|
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
21
|
-
xcss: triggerStyles
|
|
27
|
+
xcss: [triggerStyles, overrideXcss]
|
|
22
28
|
}, tooltipProps), trigger);
|
|
23
29
|
});
|
|
24
30
|
};
|
|
@@ -41,6 +41,10 @@ var iconTooltipDescStyles = xcss({
|
|
|
41
41
|
fontWeight: '400',
|
|
42
42
|
lineHeight: '14px'
|
|
43
43
|
});
|
|
44
|
+
var iconTooltipTriggerStyles = xcss({
|
|
45
|
+
position: 'relative',
|
|
46
|
+
bottom: 'space.negative.050'
|
|
47
|
+
});
|
|
44
48
|
var AIStateDone = function AIStateDone(_ref) {
|
|
45
49
|
var appearance = _ref.appearance,
|
|
46
50
|
testId = _ref.testId;
|
|
@@ -73,7 +77,8 @@ var AIStateDone = function AIStateDone(_ref) {
|
|
|
73
77
|
}
|
|
74
78
|
}
|
|
75
79
|
}))))),
|
|
76
|
-
trigger: icon
|
|
80
|
+
trigger: icon,
|
|
81
|
+
xcss: iconTooltipTriggerStyles
|
|
77
82
|
});
|
|
78
83
|
default:
|
|
79
84
|
return jsx(AIIndicatorContainer, {
|
|
@@ -4,26 +4,26 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
4
4
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
5
5
|
import { FormattedMessage } from 'react-intl-next';
|
|
6
6
|
import { Box, Inline } from '@atlaskit/primitives';
|
|
7
|
-
import { ActionName, SmartLinkSize, SmartLinkWidth
|
|
7
|
+
import { ActionName, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
|
|
8
8
|
import ActionGroup from '../../action-group';
|
|
9
9
|
import Block from '../../block';
|
|
10
10
|
import ElementGroup from '../../element-group';
|
|
11
11
|
import AIStateIndicator from '../ai-state-indicator';
|
|
12
12
|
import { renderElementItems } from '../../utils';
|
|
13
13
|
import { messages } from '../../../../../../messages';
|
|
14
|
-
import AiIcon from '../../../../../common/ai-icon';
|
|
15
|
-
import AISummary from '../../../../../common/ai-summary';
|
|
16
14
|
import { useAISummary } from '../../../../../../state/hooks/use-ai-summary';
|
|
17
15
|
import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context';
|
|
16
|
+
import AIIcon from '../../../../../common/ai-icon';
|
|
17
|
+
import AISummary from '../../../../../common/ai-summary';
|
|
18
18
|
var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
19
19
|
var _props$actions = props.actions,
|
|
20
20
|
actions = _props$actions === void 0 ? [] : _props$actions,
|
|
21
21
|
metadata = props.metadata,
|
|
22
|
-
testId = props.testId,
|
|
23
22
|
onActionMenuOpenChange = props.onActionMenuOpenChange,
|
|
24
23
|
onAIActionChange = props.onAIActionChange,
|
|
25
24
|
_props$size = props.size,
|
|
26
|
-
size = _props$size === void 0 ? SmartLinkSize.Medium : _props$size
|
|
25
|
+
size = _props$size === void 0 ? SmartLinkSize.Medium : _props$size,
|
|
26
|
+
testId = props.testId;
|
|
27
27
|
var _useState = useState('ready'),
|
|
28
28
|
_useState2 = _slicedToArray(_useState, 2),
|
|
29
29
|
aiState = _useState2[0],
|
|
@@ -34,7 +34,8 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
34
34
|
var aiSummary = useAISummary({
|
|
35
35
|
url: url
|
|
36
36
|
});
|
|
37
|
-
var content = aiSummary.state.content
|
|
37
|
+
var content = aiSummary.state.content,
|
|
38
|
+
isSummarisedOnMount = aiSummary.isSummarisedOnMount;
|
|
38
39
|
var onAIActionClick = useCallback(function () {
|
|
39
40
|
setAIState('loading');
|
|
40
41
|
if (onAIActionChange) {
|
|
@@ -48,8 +49,8 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
48
49
|
name: ActionName.CustomAction,
|
|
49
50
|
onClick: onAIActionClick,
|
|
50
51
|
testId: "".concat(testId, "-ai-summary-action"),
|
|
51
|
-
icon: /*#__PURE__*/React.createElement(
|
|
52
|
-
label: "
|
|
52
|
+
icon: /*#__PURE__*/React.createElement(AIIcon, {
|
|
53
|
+
label: "AIIcon"
|
|
53
54
|
})
|
|
54
55
|
};
|
|
55
56
|
return [aiAction].concat(_toConsumableArray(actions));
|
|
@@ -67,17 +68,19 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
67
68
|
direction: SmartLinkDirection.Vertical,
|
|
68
69
|
testId: "".concat(testId, "-resolved-view")
|
|
69
70
|
}), /*#__PURE__*/React.createElement(AISummary, {
|
|
70
|
-
content: content
|
|
71
|
+
content: content,
|
|
72
|
+
showIcon: isSummarisedOnMount
|
|
71
73
|
}), /*#__PURE__*/React.createElement(Inline, {
|
|
72
74
|
alignBlock: "center",
|
|
73
75
|
alignInline: "end",
|
|
74
76
|
grow: "fill",
|
|
75
77
|
spread: "space-between"
|
|
76
|
-
}, /*#__PURE__*/React.createElement(Box, null, aiState === 'loading' || aiState === 'done' ? /*#__PURE__*/React.createElement(AIStateIndicator, {
|
|
78
|
+
}, /*#__PURE__*/React.createElement(Box, null, !isSummarisedOnMount && (aiState === 'loading' || aiState === 'done') ? /*#__PURE__*/React.createElement(AIStateIndicator, {
|
|
77
79
|
state: aiState,
|
|
78
|
-
testId: testId
|
|
80
|
+
testId: "".concat(testId, "-state-indicator")
|
|
79
81
|
}) : /*#__PURE__*/React.createElement(ElementGroup, {
|
|
80
|
-
width: SmartLinkWidth.FitToContent
|
|
82
|
+
width: SmartLinkWidth.FitToContent,
|
|
83
|
+
testId: "".concat(testId, "-metadata-group")
|
|
81
84
|
}, metadataElements)), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(ActionGroup, {
|
|
82
85
|
onDropdownOpenChange: onDropdownOpenChange,
|
|
83
86
|
items: combinedActions,
|
|
@@ -10,7 +10,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
|
|
|
10
10
|
import LinkWarningModal from './LinkWarningModal';
|
|
11
11
|
var PACKAGE_DATA = {
|
|
12
12
|
packageName: "@atlaskit/smart-card",
|
|
13
|
-
packageVersion: "26.48.
|
|
13
|
+
packageVersion: "26.48.5",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
var Link = withLinkClickedEvent('a');
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject;
|
|
3
1
|
/** @jsx jsx */
|
|
4
2
|
import React from 'react';
|
|
5
3
|
import Markdown from 'markdown-to-jsx';
|
|
6
4
|
import { css, jsx } from '@emotion/react';
|
|
7
|
-
|
|
5
|
+
import AIStateIndicator from '../../FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator';
|
|
6
|
+
var AITooltipIcon = function AITooltipIcon() {
|
|
7
|
+
return jsx(AIStateIndicator, {
|
|
8
|
+
appearance: "icon-only",
|
|
9
|
+
state: "done",
|
|
10
|
+
testId: "ai-tooltip"
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var AISummaryCSS = css({
|
|
14
|
+
fontSize: '0.75rem',
|
|
15
|
+
lineHeight: '1rem',
|
|
16
|
+
wordWrap: 'break-word',
|
|
17
|
+
whiteSpace: 'normal'
|
|
18
|
+
});
|
|
8
19
|
/**
|
|
9
20
|
* A component to render a response from AI in markdown text.
|
|
10
21
|
* @internal
|
|
@@ -13,6 +24,9 @@ var AISummaryCSS = css(_templateObject || (_templateObject = _taggedTemplateLite
|
|
|
13
24
|
|
|
14
25
|
var AISummary = function AISummary(_ref) {
|
|
15
26
|
var content = _ref.content,
|
|
27
|
+
_ref$showIcon = _ref.showIcon,
|
|
28
|
+
showIcon = _ref$showIcon === void 0 ? false : _ref$showIcon,
|
|
29
|
+
iconComponent = _ref.iconComponent,
|
|
16
30
|
overrideCss = _ref.overrideCss,
|
|
17
31
|
_ref$testId = _ref.testId,
|
|
18
32
|
testId = _ref$testId === void 0 ? 'ai-summary' : _ref$testId;
|
|
@@ -22,9 +36,12 @@ var AISummary = function AISummary(_ref) {
|
|
|
22
36
|
return jsx(Markdown, {
|
|
23
37
|
"data-testid": testId,
|
|
24
38
|
css: [AISummaryCSS, overrideCss],
|
|
25
|
-
children: content,
|
|
39
|
+
children: showIcon ? "".concat(content, " <Icon />") : content,
|
|
26
40
|
options: {
|
|
27
|
-
forceWrapper: true
|
|
41
|
+
forceWrapper: true,
|
|
42
|
+
overrides: {
|
|
43
|
+
Icon: iconComponent !== null && iconComponent !== void 0 ? iconComponent : AITooltipIcon
|
|
44
|
+
}
|
|
28
45
|
}
|
|
29
46
|
});
|
|
30
47
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import type { XCSS } from '@atlaskit/primitives';
|
|
2
3
|
import type { TooltipProps } from '@atlaskit/tooltip';
|
|
3
4
|
import type { AIState } from '../types';
|
|
4
5
|
export type AIStateAppearance = 'default' | 'icon-only';
|
|
@@ -15,4 +16,5 @@ export type AIIndicatorContainerProps = {
|
|
|
15
16
|
export type AIIndicatorTooltipProps = {
|
|
16
17
|
content: TooltipProps['content'];
|
|
17
18
|
trigger: React.ReactNode;
|
|
19
|
+
xcss?: XCSS;
|
|
18
20
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { type MarkdownToJSX } from 'markdown-to-jsx';
|
|
3
4
|
import { SerializedStyles } from '@emotion/react';
|
|
4
5
|
type AISummaryProps = {
|
|
5
6
|
content?: string;
|
|
6
|
-
|
|
7
|
+
showIcon?: boolean;
|
|
8
|
+
iconComponent?: MarkdownToJSX.Override;
|
|
7
9
|
overrideCss?: SerializedStyles;
|
|
8
10
|
/**
|
|
9
11
|
* appears as a data attribute `data-testid` in the rendered code,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import type { XCSS } from '@atlaskit/primitives';
|
|
2
3
|
import type { TooltipProps } from '@atlaskit/tooltip';
|
|
3
4
|
import type { AIState } from '../types';
|
|
4
5
|
export type AIStateAppearance = 'default' | 'icon-only';
|
|
@@ -15,4 +16,5 @@ export type AIIndicatorContainerProps = {
|
|
|
15
16
|
export type AIIndicatorTooltipProps = {
|
|
16
17
|
content: TooltipProps['content'];
|
|
17
18
|
trigger: React.ReactNode;
|
|
19
|
+
xcss?: XCSS;
|
|
18
20
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { type MarkdownToJSX } from 'markdown-to-jsx';
|
|
3
4
|
import { SerializedStyles } from '@emotion/react';
|
|
4
5
|
type AISummaryProps = {
|
|
5
6
|
content?: string;
|
|
6
|
-
|
|
7
|
+
showIcon?: boolean;
|
|
8
|
+
iconComponent?: MarkdownToJSX.Override;
|
|
7
9
|
overrideCss?: SerializedStyles;
|
|
8
10
|
/**
|
|
9
11
|
* appears as a data attribute `data-testid` in the rendered code,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "26.48.
|
|
3
|
+
"version": "26.48.5",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@atlaskit/avatar-group": "^9.5.0",
|
|
32
32
|
"@atlaskit/badge": "^15.2.0",
|
|
33
33
|
"@atlaskit/button": "^17.6.0",
|
|
34
|
-
"@atlaskit/dropdown-menu": "^12.
|
|
34
|
+
"@atlaskit/dropdown-menu": "^12.6.0",
|
|
35
35
|
"@atlaskit/icon": "^22.1.0",
|
|
36
36
|
"@atlaskit/icon-file-type": "^6.4.0",
|
|
37
37
|
"@atlaskit/icon-object": "^6.3.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@atlaskit/modal-dialog": "^12.10.0",
|
|
48
48
|
"@atlaskit/outbound-auth-flow-client": "^3.4.0",
|
|
49
49
|
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
50
|
-
"@atlaskit/popup": "^1.
|
|
50
|
+
"@atlaskit/popup": "^1.13.0",
|
|
51
51
|
"@atlaskit/primitives": "^3.1.0",
|
|
52
52
|
"@atlaskit/spinner": "^16.0.0",
|
|
53
53
|
"@atlaskit/theme": "^12.6.0",
|
|
@@ -102,6 +102,7 @@
|
|
|
102
102
|
"fetch-mock": "^8.0.0",
|
|
103
103
|
"jest-emotion": "^10.0.32",
|
|
104
104
|
"jest-extended": "^0.11.2",
|
|
105
|
+
"jest-fetch-mock": "^3.0.3",
|
|
105
106
|
"jsdom": "^17.0.0",
|
|
106
107
|
"lorem-ipsum": "^1.0.6",
|
|
107
108
|
"react": "^16.8.0",
|