@atlaskit/smart-card 26.67.0 → 26.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/index.js +1 -0
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/index.js +5 -4
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-footer-block/resolved/ai-footer-metadata.js +7 -7
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +8 -3
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +13 -0
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +3 -7
- package/dist/cjs/view/HoverCard/components/views/resolved/redesign.js +81 -0
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/index.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/index.js +3 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-footer-block/resolved/ai-footer-metadata.js +7 -7
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +8 -3
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +13 -0
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +4 -8
- package/dist/es2019/view/HoverCard/components/views/resolved/redesign.js +73 -0
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/index.js +1 -0
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/index.js +5 -4
- package/dist/esm/view/FlexibleCard/components/blocks/ai-footer-block/resolved/ai-footer-metadata.js +7 -7
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +8 -3
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +13 -0
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +4 -8
- package/dist/esm/view/HoverCard/components/views/resolved/redesign.js +71 -0
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/__fixtures__/flexible-ui-data-context.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +7 -2
- package/dist/types/view/HoverCard/components/views/resolved/redesign.d.ts +4 -0
- package/dist/types-ts4.5/__fixtures__/flexible-ui-data-context.d.ts +1 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +7 -2
- package/dist/types-ts4.5/view/HoverCard/components/views/resolved/redesign.d.ts +4 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 26.68.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#100572](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100572)
|
|
8
|
+
[`f7db86ab4de9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f7db86ab4de9) -
|
|
9
|
+
[ux] Remove footer AI icon tooltip and realign AI information quality tooltip
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#99219](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99219)
|
|
14
|
+
[`3df318ff4439`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3df318ff4439) -
|
|
15
|
+
Hover preview: Move resolved view redesign into its own separate component
|
|
16
|
+
|
|
3
17
|
## 26.67.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -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.
|
|
25
|
+
packageVersion: "26.68.0"
|
|
26
26
|
};
|
|
27
27
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
28
28
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -17,6 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
18
|
var buttonStyles = (0, _primitives.xcss)({
|
|
19
19
|
all: 'unset',
|
|
20
|
+
cursor: 'pointer',
|
|
20
21
|
padding: 'space.050',
|
|
21
22
|
width: '100%',
|
|
22
23
|
':focus:not(:focus-visible)': {
|
|
@@ -41,16 +41,17 @@ var AutomationAction = function AutomationAction(props) {
|
|
|
41
41
|
var automationActionTitle = /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.automation_action_title);
|
|
42
42
|
var automationActionTooltip = /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.automation_action_tooltip);
|
|
43
43
|
var automationActionIconLabel = formatMessage(_messages.messages.automation_action_icon_label);
|
|
44
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_action.default, (0, _extends2.default)({
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_action.default, (0, _extends2.default)({
|
|
45
45
|
content: automationActionTitle,
|
|
46
46
|
icon: /*#__PURE__*/_react.default.createElement(_manaulTriggersIcon.default, {
|
|
47
47
|
label: automationActionIconLabel
|
|
48
48
|
}),
|
|
49
|
-
onClick: function onClick() {
|
|
50
|
-
return handleAutomateActionClick(setIsModalOpen);
|
|
51
|
-
},
|
|
52
49
|
testId: "smart-action-automation-action",
|
|
53
50
|
tooltipMessage: automationActionTooltip
|
|
51
|
+
}, data, props, {
|
|
52
|
+
onClick: function onClick() {
|
|
53
|
+
return handleAutomateActionClick(setIsModalOpen);
|
|
54
|
+
}
|
|
54
55
|
})));
|
|
55
56
|
};
|
|
56
57
|
var _default = exports.default = AutomationAction;
|
package/dist/cjs/view/FlexibleCard/components/blocks/ai-footer-block/resolved/ai-footer-metadata.js
CHANGED
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.AIFooterMetadata = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
9
10
|
var _reactMagneticDi = require("react-magnetic-di");
|
|
10
11
|
var _reactIntlNext = require("react-intl-next");
|
|
11
|
-
var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
|
|
12
12
|
var _primitives = require("@atlaskit/primitives");
|
|
13
|
-
var
|
|
13
|
+
var _aiIcon = _interopRequireDefault(require("../../../../../common/ai-icon"));
|
|
14
14
|
var _info = require("../icons/info");
|
|
15
15
|
var _messages = require("../../../../../../messages");
|
|
16
16
|
var _useAiSummary = require("../../../../../../state/hooks/use-ai-summary");
|
|
@@ -35,16 +35,16 @@ var AIFooterMetadata = exports.AIFooterMetadata = function AIFooterMetadata(_ref
|
|
|
35
35
|
grow: "fill"
|
|
36
36
|
}, /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
37
37
|
content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.ai_summarized_info_short),
|
|
38
|
-
position: "
|
|
38
|
+
position: "bottom"
|
|
39
39
|
}, function (tooltipProps) {
|
|
40
40
|
return /*#__PURE__*/_react.default.createElement(_primitives.Box, tooltipProps, /*#__PURE__*/_react.default.createElement(_info.InfoIcon, {
|
|
41
41
|
label: "Information",
|
|
42
42
|
size: "small",
|
|
43
43
|
primaryColor: "var(--ds-icon-subtle, #626F86)"
|
|
44
44
|
}));
|
|
45
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
}), /*#__PURE__*/_react.default.createElement(_aiIcon.default, {
|
|
46
|
+
label: "AI",
|
|
47
|
+
size: "small",
|
|
48
|
+
primaryColor: "var(--ds-icon-subtle, #626F86)"
|
|
49
49
|
}));
|
|
50
50
|
};
|
|
@@ -73,7 +73,8 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
73
73
|
testId = props.testId,
|
|
74
74
|
_props$aiSummaryMinHe = props.aiSummaryMinHeight,
|
|
75
75
|
aiSummaryMinHeight = _props$aiSummaryMinHe === void 0 ? 0 : _props$aiSummaryMinHe,
|
|
76
|
-
metadata = props.metadata
|
|
76
|
+
metadata = props.metadata,
|
|
77
|
+
placeholder = props.placeholder;
|
|
77
78
|
var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
|
|
78
79
|
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
79
80
|
var context = (0, _flexibleUiContext.useFlexibleUiContext)();
|
|
@@ -99,6 +100,7 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
99
100
|
status === 'loading' && !!content;
|
|
100
101
|
var isSummarisedOnMountRef = (0, _react.useRef)(status === 'done');
|
|
101
102
|
var isErroredOnMountRef = (0, _react.useRef)(status === 'error');
|
|
103
|
+
var minHeight = (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.hover-card-action-redesign') && isSummarisedOnMountRef.current ? 0 : aiSummaryMinHeight;
|
|
102
104
|
(0, _react.useEffect)(function () {
|
|
103
105
|
// if the error was apparent on mount and the status is changed to loading we can
|
|
104
106
|
// clear the initial error on mount state
|
|
@@ -141,6 +143,9 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
141
143
|
});
|
|
142
144
|
}
|
|
143
145
|
}, [onActionMenuOpenChange]);
|
|
146
|
+
if (!showAISummary && (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.hover-card-action-redesign')) {
|
|
147
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, placeholder);
|
|
148
|
+
}
|
|
144
149
|
return /*#__PURE__*/_react.default.createElement(_block.default, (0, _extends2.default)({}, props, {
|
|
145
150
|
direction: _constants.SmartLinkDirection.Vertical,
|
|
146
151
|
testId: "".concat(testId, "-resolved-view")
|
|
@@ -154,12 +159,12 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
154
159
|
}), status === 'done' && /*#__PURE__*/_react.default.createElement(_aiEventSummaryViewed.default, {
|
|
155
160
|
fromCache: isSummarisedOnMountRef.current
|
|
156
161
|
}), /*#__PURE__*/_react.default.createElement(_motionWrapper.default, {
|
|
157
|
-
minHeight:
|
|
162
|
+
minHeight: minHeight,
|
|
158
163
|
show: showAISummary,
|
|
159
164
|
showTransition: !isSummarisedOnMountRef.current
|
|
160
165
|
}, /*#__PURE__*/_react.default.createElement(_aiSummary.default, {
|
|
161
166
|
testId: "".concat(testId, "-ai-summary"),
|
|
162
|
-
minHeight:
|
|
167
|
+
minHeight: minHeight,
|
|
163
168
|
content: content,
|
|
164
169
|
showIcon: !(0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.hover-card-action-redesign') && isSummarisedOnMountRef.current
|
|
165
170
|
})), !(0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.hover-card-action-redesign') && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
|
|
@@ -23,6 +23,7 @@ var _utils2 = require("../utils");
|
|
|
23
23
|
var _resolving = _interopRequireDefault(require("./views/resolving"));
|
|
24
24
|
var _unauthorised = _interopRequireDefault(require("./views/unauthorised"));
|
|
25
25
|
var _resolved = _interopRequireDefault(require("./views/resolved"));
|
|
26
|
+
var _redesign = _interopRequireDefault(require("./views/resolved/redesign"));
|
|
26
27
|
var _reactIntlNext = require("react-intl-next");
|
|
27
28
|
var _messages = require("../../../messages");
|
|
28
29
|
var _click = require("../../../utils/analytics/click");
|
|
@@ -191,6 +192,18 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
191
192
|
});
|
|
192
193
|
}
|
|
193
194
|
if (cardState.status === 'resolved') {
|
|
195
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.hover-card-action-redesign')) {
|
|
196
|
+
return (0, _react.jsx)(_redesign.default, {
|
|
197
|
+
analytics: analytics,
|
|
198
|
+
cardState: cardState,
|
|
199
|
+
extensionKey: extensionKey,
|
|
200
|
+
flexibleCardProps: flexibleCardProps,
|
|
201
|
+
isAISummaryEnabled: isAISummaryEnabled,
|
|
202
|
+
onActionClick: onActionClick,
|
|
203
|
+
titleBlockProps: titleBlockProps,
|
|
204
|
+
url: url
|
|
205
|
+
});
|
|
206
|
+
}
|
|
194
207
|
return (0, _react.jsx)(_resolved.default, {
|
|
195
208
|
id: id,
|
|
196
209
|
url: url,
|
|
@@ -86,7 +86,7 @@ var ConnectedAIBlock = function ConnectedAIBlock(_ref) {
|
|
|
86
86
|
return showData ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !imagePreview && /*#__PURE__*/_react.default.createElement(_blocks.SnippetBlock, {
|
|
87
87
|
testId: 'connected-AI',
|
|
88
88
|
status: _constants.SmartLinkStatus.Resolved
|
|
89
|
-
}),
|
|
89
|
+
}), /*#__PURE__*/_react.default.createElement(_blocks.MetadataBlock, {
|
|
90
90
|
primary: bottomPrimary,
|
|
91
91
|
size: _constants.SmartLinkSize.Large,
|
|
92
92
|
overrideCss: _styled.metadataBlockCss,
|
|
@@ -145,7 +145,6 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
145
145
|
data: data,
|
|
146
146
|
fallbackElementHeight: snippetHeight.current
|
|
147
147
|
});
|
|
148
|
-
var isActionBlockEnabled = (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.hover-card-action-redesign') ? true : false;
|
|
149
148
|
return /*#__PURE__*/_react.default.createElement(_FlexibleCard.default, flexibleCardProps, imagePreview, /*#__PURE__*/_react.default.createElement(_blocks.TitleBlock, (0, _extends2.default)({}, titleBlockProps, {
|
|
150
149
|
metadataPosition: _constants.SmartLinkPosition.Top
|
|
151
150
|
})), /*#__PURE__*/_react.default.createElement(_blocks.MetadataBlock, {
|
|
@@ -173,7 +172,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
173
172
|
onRender: onSnippetRender,
|
|
174
173
|
blockRef: snippetBlockRef,
|
|
175
174
|
overrideCss: _styled.hiddenSnippetStyles
|
|
176
|
-
}), !isAISummaryEnabled &&
|
|
175
|
+
}), !isAISummaryEnabled && /*#__PURE__*/_react.default.createElement(_blocks.MetadataBlock, {
|
|
177
176
|
primary: tertiary,
|
|
178
177
|
size: _constants.SmartLinkSize.Large,
|
|
179
178
|
overrideCss: _styled.metadataBlockCss,
|
|
@@ -188,10 +187,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
188
187
|
}],
|
|
189
188
|
actions: footerActions,
|
|
190
189
|
aiSummaryMinHeight: connectedAIBlockHeight.current
|
|
191
|
-
}),
|
|
192
|
-
onClick: onActionClick,
|
|
193
|
-
spaceInline: "space.100"
|
|
194
|
-
}), isActionBlockEnabled && /*#__PURE__*/_react.default.createElement(_blocks.AIFooterBlock, null), !isAISummaryEnabled && !isActionBlockEnabled && /*#__PURE__*/_react.default.createElement(_blocks.FooterBlock, {
|
|
190
|
+
}), !isAISummaryEnabled && /*#__PURE__*/_react.default.createElement(_blocks.FooterBlock, {
|
|
195
191
|
actions: footerActions,
|
|
196
192
|
size: _constants.SmartLinkSize.Large,
|
|
197
193
|
overrideCss: _styled.footerBlockCss
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _constants = require("../../../../../constants");
|
|
12
|
+
var _helpers = require("../../../../../state/helpers");
|
|
13
|
+
var _FlexibleCard = _interopRequireDefault(require("../../../../FlexibleCard"));
|
|
14
|
+
var _blocks = require("../../../../FlexibleCard/components/blocks");
|
|
15
|
+
var _utils = require("../../../utils");
|
|
16
|
+
var _ImagePreview = _interopRequireDefault(require("../../ImagePreview"));
|
|
17
|
+
var _styled = require("./styled");
|
|
18
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
+
var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
21
|
+
var _cardState$details;
|
|
22
|
+
var analytics = _ref.analytics,
|
|
23
|
+
cardState = _ref.cardState,
|
|
24
|
+
extensionKey = _ref.extensionKey,
|
|
25
|
+
flexibleCardProps = _ref.flexibleCardProps,
|
|
26
|
+
isAISummaryEnabled = _ref.isAISummaryEnabled,
|
|
27
|
+
onActionClick = _ref.onActionClick,
|
|
28
|
+
titleBlockProps = _ref.titleBlockProps;
|
|
29
|
+
var canBeDatasource = (0, _helpers.getCanBeDatasource)(cardState.details);
|
|
30
|
+
(0, _react.useEffect)(function () {
|
|
31
|
+
// Since this hover view is only rendered on resolved status,
|
|
32
|
+
// there is no need to check for statuses.
|
|
33
|
+
analytics.ui.renderSuccessEvent({
|
|
34
|
+
display: _constants.CardDisplay.HoverCardPreview,
|
|
35
|
+
status: cardState.status,
|
|
36
|
+
canBeDatasource: canBeDatasource
|
|
37
|
+
});
|
|
38
|
+
}, [analytics.ui, cardState.status, canBeDatasource]);
|
|
39
|
+
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
40
|
+
var _useMemo = (0, _react.useMemo)(function () {
|
|
41
|
+
return (0, _utils.getMetadata)(extensionKey, data);
|
|
42
|
+
}, [data, extensionKey]),
|
|
43
|
+
primary = _useMemo.primary,
|
|
44
|
+
secondary = _useMemo.secondary;
|
|
45
|
+
var snippetHeight = _react.default.useRef(0);
|
|
46
|
+
var snippetBlockRef = (0, _react.useRef)(null);
|
|
47
|
+
var onSnippetRender = (0, _react.useCallback)(function () {
|
|
48
|
+
var _snippetBlockRef$curr, _snippetBlockRef$curr2;
|
|
49
|
+
snippetHeight.current = (_snippetBlockRef$curr = (_snippetBlockRef$curr2 = snippetBlockRef.current) === null || _snippetBlockRef$curr2 === void 0 ? void 0 : _snippetBlockRef$curr2.getBoundingClientRect().height) !== null && _snippetBlockRef$curr !== void 0 ? _snippetBlockRef$curr : 0;
|
|
50
|
+
}, []);
|
|
51
|
+
var imagePreview = (0, _ImagePreview.default)({
|
|
52
|
+
data: data,
|
|
53
|
+
fallbackElementHeight: snippetHeight.current
|
|
54
|
+
});
|
|
55
|
+
var snippet = imagePreview ? null : /*#__PURE__*/_react.default.createElement(_blocks.SnippetBlock, {
|
|
56
|
+
status: _constants.SmartLinkStatus.Resolved
|
|
57
|
+
});
|
|
58
|
+
var aiSummaryMinHeight = snippet ? snippetHeight.current : 0;
|
|
59
|
+
return /*#__PURE__*/_react.default.createElement(_FlexibleCard.default, flexibleCardProps, imagePreview, /*#__PURE__*/_react.default.createElement(_blocks.TitleBlock, (0, _extends2.default)({}, titleBlockProps, {
|
|
60
|
+
metadataPosition: _constants.SmartLinkPosition.Top
|
|
61
|
+
})), /*#__PURE__*/_react.default.createElement(_blocks.MetadataBlock, {
|
|
62
|
+
primary: primary,
|
|
63
|
+
secondary: secondary,
|
|
64
|
+
overrideCss: _styled.metadataBlockCss,
|
|
65
|
+
maxLines: 1,
|
|
66
|
+
size: _constants.SmartLinkSize.Medium
|
|
67
|
+
}), isAISummaryEnabled ? /*#__PURE__*/_react.default.createElement(_blocks.AISummaryBlock, {
|
|
68
|
+
aiSummaryMinHeight: aiSummaryMinHeight,
|
|
69
|
+
placeholder: snippet,
|
|
70
|
+
status: _constants.SmartLinkStatus.Resolved
|
|
71
|
+
}) : snippet, /*#__PURE__*/_react.default.createElement(_blocks.SnippetBlock, {
|
|
72
|
+
testId: "hidden-snippet",
|
|
73
|
+
onRender: onSnippetRender,
|
|
74
|
+
blockRef: snippetBlockRef,
|
|
75
|
+
overrideCss: _styled.hiddenSnippetStyles
|
|
76
|
+
}), /*#__PURE__*/_react.default.createElement(_blocks.ActionBlock, {
|
|
77
|
+
onClick: onActionClick,
|
|
78
|
+
spaceInline: "space.100"
|
|
79
|
+
}), /*#__PURE__*/_react.default.createElement(_blocks.AIFooterBlock, null));
|
|
80
|
+
};
|
|
81
|
+
var _default = exports.default = HoverCardResolvedView;
|
|
@@ -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.
|
|
20
|
+
packageVersion: "26.68.0",
|
|
21
21
|
componentName: 'linkUrl'
|
|
22
22
|
};
|
|
23
23
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -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.
|
|
7
|
+
packageVersion: "26.68.0"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -28,14 +28,15 @@ const AutomationAction = props => {
|
|
|
28
28
|
const automationActionTitle = /*#__PURE__*/React.createElement(FormattedMessage, messages.automation_action_title);
|
|
29
29
|
const automationActionTooltip = /*#__PURE__*/React.createElement(FormattedMessage, messages.automation_action_tooltip);
|
|
30
30
|
const automationActionIconLabel = formatMessage(messages.automation_action_icon_label);
|
|
31
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Action, _extends({
|
|
31
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Action, _extends({
|
|
32
32
|
content: automationActionTitle,
|
|
33
33
|
icon: /*#__PURE__*/React.createElement(AutomationManualTriggersGlyph, {
|
|
34
34
|
label: automationActionIconLabel
|
|
35
35
|
}),
|
|
36
|
-
onClick: () => handleAutomateActionClick(setIsModalOpen),
|
|
37
36
|
testId: "smart-action-automation-action",
|
|
38
37
|
tooltipMessage: automationActionTooltip
|
|
38
|
+
}, data, props, {
|
|
39
|
+
onClick: () => handleAutomateActionClick(setIsModalOpen)
|
|
39
40
|
})));
|
|
40
41
|
};
|
|
41
42
|
export default AutomationAction;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
2
3
|
import { di } from 'react-magnetic-di';
|
|
3
4
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
|
-
import Tooltip from '@atlaskit/tooltip';
|
|
5
5
|
import { Box, Inline } from '@atlaskit/primitives';
|
|
6
|
-
import
|
|
6
|
+
import AIIcon from '../../../../../common/ai-icon';
|
|
7
7
|
import { InfoIcon } from '../icons/info';
|
|
8
8
|
import { messages } from '../../../../../../messages';
|
|
9
9
|
import { useAISummary } from '../../../../../../state/hooks/use-ai-summary';
|
|
@@ -32,14 +32,14 @@ export const AIFooterMetadata = ({
|
|
|
32
32
|
grow: "fill"
|
|
33
33
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
34
34
|
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summarized_info_short),
|
|
35
|
-
position: "
|
|
35
|
+
position: "bottom"
|
|
36
36
|
}, tooltipProps => /*#__PURE__*/React.createElement(Box, tooltipProps, /*#__PURE__*/React.createElement(InfoIcon, {
|
|
37
37
|
label: "Information",
|
|
38
38
|
size: "small",
|
|
39
39
|
primaryColor: "var(--ds-icon-subtle, #626F86)"
|
|
40
|
-
}))), /*#__PURE__*/React.createElement(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
}))), /*#__PURE__*/React.createElement(AIIcon, {
|
|
41
|
+
label: "AI",
|
|
42
|
+
size: "small",
|
|
43
|
+
primaryColor: "var(--ds-icon-subtle, #626F86)"
|
|
44
44
|
}));
|
|
45
45
|
};
|
|
@@ -60,7 +60,8 @@ const AISummaryBlockResolvedView = props => {
|
|
|
60
60
|
size = SmartLinkSize.Medium,
|
|
61
61
|
testId,
|
|
62
62
|
aiSummaryMinHeight = 0,
|
|
63
|
-
metadata
|
|
63
|
+
metadata,
|
|
64
|
+
placeholder
|
|
64
65
|
} = props;
|
|
65
66
|
const {
|
|
66
67
|
fireEvent
|
|
@@ -91,6 +92,7 @@ const AISummaryBlockResolvedView = props => {
|
|
|
91
92
|
status === 'loading' && !!content;
|
|
92
93
|
const isSummarisedOnMountRef = useRef(status === 'done');
|
|
93
94
|
const isErroredOnMountRef = useRef(status === 'error');
|
|
95
|
+
const minHeight = getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') && isSummarisedOnMountRef.current ? 0 : aiSummaryMinHeight;
|
|
94
96
|
useEffect(() => {
|
|
95
97
|
// if the error was apparent on mount and the status is changed to loading we can
|
|
96
98
|
// clear the initial error on mount state
|
|
@@ -133,6 +135,9 @@ const AISummaryBlockResolvedView = props => {
|
|
|
133
135
|
});
|
|
134
136
|
}
|
|
135
137
|
}, [onActionMenuOpenChange]);
|
|
138
|
+
if (!showAISummary && getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign')) {
|
|
139
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, placeholder);
|
|
140
|
+
}
|
|
136
141
|
return /*#__PURE__*/React.createElement(Block, _extends({}, props, {
|
|
137
142
|
direction: SmartLinkDirection.Vertical,
|
|
138
143
|
testId: `${testId}-resolved-view`
|
|
@@ -146,12 +151,12 @@ const AISummaryBlockResolvedView = props => {
|
|
|
146
151
|
}), status === 'done' && /*#__PURE__*/React.createElement(AIEventSummaryViewed, {
|
|
147
152
|
fromCache: isSummarisedOnMountRef.current
|
|
148
153
|
}), /*#__PURE__*/React.createElement(MotionWrapper, {
|
|
149
|
-
minHeight:
|
|
154
|
+
minHeight: minHeight,
|
|
150
155
|
show: showAISummary,
|
|
151
156
|
showTransition: !isSummarisedOnMountRef.current
|
|
152
157
|
}, /*#__PURE__*/React.createElement(AISummary, {
|
|
153
158
|
testId: `${testId}-ai-summary`,
|
|
154
|
-
minHeight:
|
|
159
|
+
minHeight: minHeight,
|
|
155
160
|
content: content,
|
|
156
161
|
showIcon: !getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') && isSummarisedOnMountRef.current
|
|
157
162
|
})), !getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Inline, {
|
|
@@ -14,6 +14,7 @@ import { getMetadata } from '../utils';
|
|
|
14
14
|
import HoverCardLoadingView from './views/resolving';
|
|
15
15
|
import HoverCardUnauthorisedView from './views/unauthorised';
|
|
16
16
|
import HoverCardResolvedView from './views/resolved';
|
|
17
|
+
import HoverCardRedesignedResolvedView from './views/resolved/redesign';
|
|
17
18
|
import { FormattedMessage } from 'react-intl-next';
|
|
18
19
|
import { messages } from '../../../messages';
|
|
19
20
|
import { fireLinkClickedEvent } from '../../../utils/analytics/click';
|
|
@@ -153,6 +154,18 @@ const HoverCardContent = ({
|
|
|
153
154
|
});
|
|
154
155
|
}
|
|
155
156
|
if (cardState.status === 'resolved') {
|
|
157
|
+
if (getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign')) {
|
|
158
|
+
return jsx(HoverCardRedesignedResolvedView, {
|
|
159
|
+
analytics: analytics,
|
|
160
|
+
cardState: cardState,
|
|
161
|
+
extensionKey: extensionKey,
|
|
162
|
+
flexibleCardProps: flexibleCardProps,
|
|
163
|
+
isAISummaryEnabled: isAISummaryEnabled,
|
|
164
|
+
onActionClick: onActionClick,
|
|
165
|
+
titleBlockProps: titleBlockProps,
|
|
166
|
+
url: url
|
|
167
|
+
});
|
|
168
|
+
}
|
|
156
169
|
return jsx(HoverCardResolvedView, {
|
|
157
170
|
id: id,
|
|
158
171
|
url: url,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import { ActionName, CardDisplay, ElementName, SmartLinkPosition, SmartLinkSize, SmartLinkDirection } from '../../../../../constants';
|
|
4
|
-
import { FooterBlock, MetadataBlock, RelatedUrlsBlock, SnippetBlock, TitleBlock, AISummaryBlock, CustomBlock
|
|
4
|
+
import { FooterBlock, MetadataBlock, RelatedUrlsBlock, SnippetBlock, TitleBlock, AISummaryBlock, CustomBlock } from '../../../../FlexibleCard/components/blocks';
|
|
5
5
|
import { footerBlockCss, hiddenSnippetStyles, metadataBlockCss } from './styled';
|
|
6
6
|
import FlexibleCard from '../../../../FlexibleCard';
|
|
7
7
|
import { getMetadata } from '../../../utils';
|
|
@@ -80,7 +80,7 @@ const ConnectedAIBlock = ({
|
|
|
80
80
|
return showData ? /*#__PURE__*/React.createElement(React.Fragment, null, !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
81
81
|
testId: 'connected-AI',
|
|
82
82
|
status: SmartLinkStatus.Resolved
|
|
83
|
-
}),
|
|
83
|
+
}), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
84
84
|
primary: bottomPrimary,
|
|
85
85
|
size: SmartLinkSize.Large,
|
|
86
86
|
overrideCss: metadataBlockCss,
|
|
@@ -138,7 +138,6 @@ const HoverCardResolvedView = ({
|
|
|
138
138
|
data: data,
|
|
139
139
|
fallbackElementHeight: snippetHeight.current
|
|
140
140
|
});
|
|
141
|
-
const isActionBlockEnabled = getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') ? true : false;
|
|
142
141
|
return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps, imagePreview, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockProps, {
|
|
143
142
|
metadataPosition: SmartLinkPosition.Top
|
|
144
143
|
})), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
@@ -166,7 +165,7 @@ const HoverCardResolvedView = ({
|
|
|
166
165
|
onRender: onSnippetRender,
|
|
167
166
|
blockRef: snippetBlockRef,
|
|
168
167
|
overrideCss: hiddenSnippetStyles
|
|
169
|
-
}), !isAISummaryEnabled &&
|
|
168
|
+
}), !isAISummaryEnabled && /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
170
169
|
primary: tertiary,
|
|
171
170
|
size: SmartLinkSize.Large,
|
|
172
171
|
overrideCss: metadataBlockCss,
|
|
@@ -181,10 +180,7 @@ const HoverCardResolvedView = ({
|
|
|
181
180
|
}],
|
|
182
181
|
actions: footerActions,
|
|
183
182
|
aiSummaryMinHeight: connectedAIBlockHeight.current
|
|
184
|
-
}),
|
|
185
|
-
onClick: onActionClick,
|
|
186
|
-
spaceInline: "space.100"
|
|
187
|
-
}), isActionBlockEnabled && /*#__PURE__*/React.createElement(AIFooterBlock, null), !isAISummaryEnabled && !isActionBlockEnabled && /*#__PURE__*/React.createElement(FooterBlock, {
|
|
183
|
+
}), !isAISummaryEnabled && /*#__PURE__*/React.createElement(FooterBlock, {
|
|
188
184
|
actions: footerActions,
|
|
189
185
|
size: SmartLinkSize.Large,
|
|
190
186
|
overrideCss: footerBlockCss
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
|
+
import { CardDisplay, SmartLinkPosition, SmartLinkSize, SmartLinkStatus } from '../../../../../constants';
|
|
4
|
+
import { getCanBeDatasource } from '../../../../../state/helpers';
|
|
5
|
+
import FlexibleCard from '../../../../FlexibleCard';
|
|
6
|
+
import { ActionBlock, AIFooterBlock, AISummaryBlock, MetadataBlock, SnippetBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
|
|
7
|
+
import { getMetadata } from '../../../utils';
|
|
8
|
+
import ImagePreview from '../../ImagePreview';
|
|
9
|
+
import { hiddenSnippetStyles, metadataBlockCss } from './styled';
|
|
10
|
+
const HoverCardResolvedView = ({
|
|
11
|
+
analytics,
|
|
12
|
+
cardState,
|
|
13
|
+
extensionKey,
|
|
14
|
+
flexibleCardProps,
|
|
15
|
+
isAISummaryEnabled,
|
|
16
|
+
onActionClick,
|
|
17
|
+
titleBlockProps
|
|
18
|
+
}) => {
|
|
19
|
+
var _cardState$details;
|
|
20
|
+
const canBeDatasource = getCanBeDatasource(cardState.details);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
// Since this hover view is only rendered on resolved status,
|
|
23
|
+
// there is no need to check for statuses.
|
|
24
|
+
analytics.ui.renderSuccessEvent({
|
|
25
|
+
display: CardDisplay.HoverCardPreview,
|
|
26
|
+
status: cardState.status,
|
|
27
|
+
canBeDatasource
|
|
28
|
+
});
|
|
29
|
+
}, [analytics.ui, cardState.status, canBeDatasource]);
|
|
30
|
+
const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
31
|
+
const {
|
|
32
|
+
primary,
|
|
33
|
+
secondary
|
|
34
|
+
} = useMemo(() => {
|
|
35
|
+
return getMetadata(extensionKey, data);
|
|
36
|
+
}, [data, extensionKey]);
|
|
37
|
+
const snippetHeight = React.useRef(0);
|
|
38
|
+
const snippetBlockRef = useRef(null);
|
|
39
|
+
const onSnippetRender = useCallback(() => {
|
|
40
|
+
var _snippetBlockRef$curr, _snippetBlockRef$curr2;
|
|
41
|
+
snippetHeight.current = (_snippetBlockRef$curr = (_snippetBlockRef$curr2 = snippetBlockRef.current) === null || _snippetBlockRef$curr2 === void 0 ? void 0 : _snippetBlockRef$curr2.getBoundingClientRect().height) !== null && _snippetBlockRef$curr !== void 0 ? _snippetBlockRef$curr : 0;
|
|
42
|
+
}, []);
|
|
43
|
+
const imagePreview = ImagePreview({
|
|
44
|
+
data: data,
|
|
45
|
+
fallbackElementHeight: snippetHeight.current
|
|
46
|
+
});
|
|
47
|
+
const snippet = imagePreview ? null : /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
48
|
+
status: SmartLinkStatus.Resolved
|
|
49
|
+
});
|
|
50
|
+
const aiSummaryMinHeight = snippet ? snippetHeight.current : 0;
|
|
51
|
+
return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps, imagePreview, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockProps, {
|
|
52
|
+
metadataPosition: SmartLinkPosition.Top
|
|
53
|
+
})), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
54
|
+
primary: primary,
|
|
55
|
+
secondary: secondary,
|
|
56
|
+
overrideCss: metadataBlockCss,
|
|
57
|
+
maxLines: 1,
|
|
58
|
+
size: SmartLinkSize.Medium
|
|
59
|
+
}), isAISummaryEnabled ? /*#__PURE__*/React.createElement(AISummaryBlock, {
|
|
60
|
+
aiSummaryMinHeight: aiSummaryMinHeight,
|
|
61
|
+
placeholder: snippet,
|
|
62
|
+
status: SmartLinkStatus.Resolved
|
|
63
|
+
}) : snippet, /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
64
|
+
testId: "hidden-snippet",
|
|
65
|
+
onRender: onSnippetRender,
|
|
66
|
+
blockRef: snippetBlockRef,
|
|
67
|
+
overrideCss: hiddenSnippetStyles
|
|
68
|
+
}), /*#__PURE__*/React.createElement(ActionBlock, {
|
|
69
|
+
onClick: onActionClick,
|
|
70
|
+
spaceInline: "space.100"
|
|
71
|
+
}), /*#__PURE__*/React.createElement(AIFooterBlock, null));
|
|
72
|
+
};
|
|
73
|
+
export default HoverCardResolvedView;
|
|
@@ -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.
|
|
10
|
+
packageVersion: "26.68.0",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
const Link = withLinkClickedEvent('a');
|
|
@@ -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.
|
|
18
|
+
packageVersion: "26.68.0"
|
|
19
19
|
};
|
|
20
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
21
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -31,16 +31,17 @@ var AutomationAction = function AutomationAction(props) {
|
|
|
31
31
|
var automationActionTitle = /*#__PURE__*/React.createElement(FormattedMessage, messages.automation_action_title);
|
|
32
32
|
var automationActionTooltip = /*#__PURE__*/React.createElement(FormattedMessage, messages.automation_action_tooltip);
|
|
33
33
|
var automationActionIconLabel = formatMessage(messages.automation_action_icon_label);
|
|
34
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Action, _extends({
|
|
34
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Action, _extends({
|
|
35
35
|
content: automationActionTitle,
|
|
36
36
|
icon: /*#__PURE__*/React.createElement(AutomationManualTriggersGlyph, {
|
|
37
37
|
label: automationActionIconLabel
|
|
38
38
|
}),
|
|
39
|
-
onClick: function onClick() {
|
|
40
|
-
return handleAutomateActionClick(setIsModalOpen);
|
|
41
|
-
},
|
|
42
39
|
testId: "smart-action-automation-action",
|
|
43
40
|
tooltipMessage: automationActionTooltip
|
|
41
|
+
}, data, props, {
|
|
42
|
+
onClick: function onClick() {
|
|
43
|
+
return handleAutomateActionClick(setIsModalOpen);
|
|
44
|
+
}
|
|
44
45
|
})));
|
|
45
46
|
};
|
|
46
47
|
export default AutomationAction;
|
package/dist/esm/view/FlexibleCard/components/blocks/ai-footer-block/resolved/ai-footer-metadata.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
2
3
|
import { di } from 'react-magnetic-di';
|
|
3
4
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
|
-
import Tooltip from '@atlaskit/tooltip';
|
|
5
5
|
import { Box, Inline } from '@atlaskit/primitives';
|
|
6
|
-
import
|
|
6
|
+
import AIIcon from '../../../../../common/ai-icon';
|
|
7
7
|
import { InfoIcon } from '../icons/info';
|
|
8
8
|
import { messages } from '../../../../../../messages';
|
|
9
9
|
import { useAISummary } from '../../../../../../state/hooks/use-ai-summary';
|
|
@@ -28,16 +28,16 @@ export var AIFooterMetadata = function AIFooterMetadata(_ref) {
|
|
|
28
28
|
grow: "fill"
|
|
29
29
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
30
30
|
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summarized_info_short),
|
|
31
|
-
position: "
|
|
31
|
+
position: "bottom"
|
|
32
32
|
}, function (tooltipProps) {
|
|
33
33
|
return /*#__PURE__*/React.createElement(Box, tooltipProps, /*#__PURE__*/React.createElement(InfoIcon, {
|
|
34
34
|
label: "Information",
|
|
35
35
|
size: "small",
|
|
36
36
|
primaryColor: "var(--ds-icon-subtle, #626F86)"
|
|
37
37
|
}));
|
|
38
|
-
}), /*#__PURE__*/React.createElement(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
}), /*#__PURE__*/React.createElement(AIIcon, {
|
|
39
|
+
label: "AI",
|
|
40
|
+
size: "small",
|
|
41
|
+
primaryColor: "var(--ds-icon-subtle, #626F86)"
|
|
42
42
|
}));
|
|
43
43
|
};
|
|
@@ -63,7 +63,8 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
63
63
|
testId = props.testId,
|
|
64
64
|
_props$aiSummaryMinHe = props.aiSummaryMinHeight,
|
|
65
65
|
aiSummaryMinHeight = _props$aiSummaryMinHe === void 0 ? 0 : _props$aiSummaryMinHe,
|
|
66
|
-
metadata = props.metadata
|
|
66
|
+
metadata = props.metadata,
|
|
67
|
+
placeholder = props.placeholder;
|
|
67
68
|
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
68
69
|
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
69
70
|
var context = useFlexibleUiContext();
|
|
@@ -89,6 +90,7 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
89
90
|
status === 'loading' && !!content;
|
|
90
91
|
var isSummarisedOnMountRef = useRef(status === 'done');
|
|
91
92
|
var isErroredOnMountRef = useRef(status === 'error');
|
|
93
|
+
var minHeight = getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') && isSummarisedOnMountRef.current ? 0 : aiSummaryMinHeight;
|
|
92
94
|
useEffect(function () {
|
|
93
95
|
// if the error was apparent on mount and the status is changed to loading we can
|
|
94
96
|
// clear the initial error on mount state
|
|
@@ -131,6 +133,9 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
131
133
|
});
|
|
132
134
|
}
|
|
133
135
|
}, [onActionMenuOpenChange]);
|
|
136
|
+
if (!showAISummary && getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign')) {
|
|
137
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, placeholder);
|
|
138
|
+
}
|
|
134
139
|
return /*#__PURE__*/React.createElement(Block, _extends({}, props, {
|
|
135
140
|
direction: SmartLinkDirection.Vertical,
|
|
136
141
|
testId: "".concat(testId, "-resolved-view")
|
|
@@ -144,12 +149,12 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
144
149
|
}), status === 'done' && /*#__PURE__*/React.createElement(AIEventSummaryViewed, {
|
|
145
150
|
fromCache: isSummarisedOnMountRef.current
|
|
146
151
|
}), /*#__PURE__*/React.createElement(MotionWrapper, {
|
|
147
|
-
minHeight:
|
|
152
|
+
minHeight: minHeight,
|
|
148
153
|
show: showAISummary,
|
|
149
154
|
showTransition: !isSummarisedOnMountRef.current
|
|
150
155
|
}, /*#__PURE__*/React.createElement(AISummary, {
|
|
151
156
|
testId: "".concat(testId, "-ai-summary"),
|
|
152
|
-
minHeight:
|
|
157
|
+
minHeight: minHeight,
|
|
153
158
|
content: content,
|
|
154
159
|
showIcon: !getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') && isSummarisedOnMountRef.current
|
|
155
160
|
})), !getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Inline, {
|
|
@@ -16,6 +16,7 @@ import { getMetadata } from '../utils';
|
|
|
16
16
|
import HoverCardLoadingView from './views/resolving';
|
|
17
17
|
import HoverCardUnauthorisedView from './views/unauthorised';
|
|
18
18
|
import HoverCardResolvedView from './views/resolved';
|
|
19
|
+
import HoverCardRedesignedResolvedView from './views/resolved/redesign';
|
|
19
20
|
import { FormattedMessage } from 'react-intl-next';
|
|
20
21
|
import { messages } from '../../../messages';
|
|
21
22
|
import { fireLinkClickedEvent } from '../../../utils/analytics/click';
|
|
@@ -180,6 +181,18 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
180
181
|
});
|
|
181
182
|
}
|
|
182
183
|
if (cardState.status === 'resolved') {
|
|
184
|
+
if (getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign')) {
|
|
185
|
+
return jsx(HoverCardRedesignedResolvedView, {
|
|
186
|
+
analytics: analytics,
|
|
187
|
+
cardState: cardState,
|
|
188
|
+
extensionKey: extensionKey,
|
|
189
|
+
flexibleCardProps: flexibleCardProps,
|
|
190
|
+
isAISummaryEnabled: isAISummaryEnabled,
|
|
191
|
+
onActionClick: onActionClick,
|
|
192
|
+
titleBlockProps: titleBlockProps,
|
|
193
|
+
url: url
|
|
194
|
+
});
|
|
195
|
+
}
|
|
183
196
|
return jsx(HoverCardResolvedView, {
|
|
184
197
|
id: id,
|
|
185
198
|
url: url,
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { ActionName, CardDisplay, ElementName, SmartLinkPosition, SmartLinkSize, SmartLinkDirection } from '../../../../../constants';
|
|
5
|
-
import { FooterBlock, MetadataBlock, RelatedUrlsBlock, SnippetBlock, TitleBlock, AISummaryBlock, CustomBlock
|
|
5
|
+
import { FooterBlock, MetadataBlock, RelatedUrlsBlock, SnippetBlock, TitleBlock, AISummaryBlock, CustomBlock } from '../../../../FlexibleCard/components/blocks';
|
|
6
6
|
import { footerBlockCss, hiddenSnippetStyles, metadataBlockCss } from './styled';
|
|
7
7
|
import FlexibleCard from '../../../../FlexibleCard';
|
|
8
8
|
import { getMetadata } from '../../../utils';
|
|
@@ -77,7 +77,7 @@ var ConnectedAIBlock = function ConnectedAIBlock(_ref) {
|
|
|
77
77
|
return showData ? /*#__PURE__*/React.createElement(React.Fragment, null, !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
78
78
|
testId: 'connected-AI',
|
|
79
79
|
status: SmartLinkStatus.Resolved
|
|
80
|
-
}),
|
|
80
|
+
}), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
81
81
|
primary: bottomPrimary,
|
|
82
82
|
size: SmartLinkSize.Large,
|
|
83
83
|
overrideCss: metadataBlockCss,
|
|
@@ -136,7 +136,6 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
136
136
|
data: data,
|
|
137
137
|
fallbackElementHeight: snippetHeight.current
|
|
138
138
|
});
|
|
139
|
-
var isActionBlockEnabled = getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') ? true : false;
|
|
140
139
|
return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps, imagePreview, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockProps, {
|
|
141
140
|
metadataPosition: SmartLinkPosition.Top
|
|
142
141
|
})), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
@@ -164,7 +163,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
164
163
|
onRender: onSnippetRender,
|
|
165
164
|
blockRef: snippetBlockRef,
|
|
166
165
|
overrideCss: hiddenSnippetStyles
|
|
167
|
-
}), !isAISummaryEnabled &&
|
|
166
|
+
}), !isAISummaryEnabled && /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
168
167
|
primary: tertiary,
|
|
169
168
|
size: SmartLinkSize.Large,
|
|
170
169
|
overrideCss: metadataBlockCss,
|
|
@@ -179,10 +178,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
179
178
|
}],
|
|
180
179
|
actions: footerActions,
|
|
181
180
|
aiSummaryMinHeight: connectedAIBlockHeight.current
|
|
182
|
-
}),
|
|
183
|
-
onClick: onActionClick,
|
|
184
|
-
spaceInline: "space.100"
|
|
185
|
-
}), isActionBlockEnabled && /*#__PURE__*/React.createElement(AIFooterBlock, null), !isAISummaryEnabled && !isActionBlockEnabled && /*#__PURE__*/React.createElement(FooterBlock, {
|
|
181
|
+
}), !isAISummaryEnabled && /*#__PURE__*/React.createElement(FooterBlock, {
|
|
186
182
|
actions: footerActions,
|
|
187
183
|
size: SmartLinkSize.Large,
|
|
188
184
|
overrideCss: footerBlockCss
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
3
|
+
import { CardDisplay, SmartLinkPosition, SmartLinkSize, SmartLinkStatus } from '../../../../../constants';
|
|
4
|
+
import { getCanBeDatasource } from '../../../../../state/helpers';
|
|
5
|
+
import FlexibleCard from '../../../../FlexibleCard';
|
|
6
|
+
import { ActionBlock, AIFooterBlock, AISummaryBlock, MetadataBlock, SnippetBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
|
|
7
|
+
import { getMetadata } from '../../../utils';
|
|
8
|
+
import ImagePreview from '../../ImagePreview';
|
|
9
|
+
import { hiddenSnippetStyles, metadataBlockCss } from './styled';
|
|
10
|
+
var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
11
|
+
var _cardState$details;
|
|
12
|
+
var analytics = _ref.analytics,
|
|
13
|
+
cardState = _ref.cardState,
|
|
14
|
+
extensionKey = _ref.extensionKey,
|
|
15
|
+
flexibleCardProps = _ref.flexibleCardProps,
|
|
16
|
+
isAISummaryEnabled = _ref.isAISummaryEnabled,
|
|
17
|
+
onActionClick = _ref.onActionClick,
|
|
18
|
+
titleBlockProps = _ref.titleBlockProps;
|
|
19
|
+
var canBeDatasource = getCanBeDatasource(cardState.details);
|
|
20
|
+
useEffect(function () {
|
|
21
|
+
// Since this hover view is only rendered on resolved status,
|
|
22
|
+
// there is no need to check for statuses.
|
|
23
|
+
analytics.ui.renderSuccessEvent({
|
|
24
|
+
display: CardDisplay.HoverCardPreview,
|
|
25
|
+
status: cardState.status,
|
|
26
|
+
canBeDatasource: canBeDatasource
|
|
27
|
+
});
|
|
28
|
+
}, [analytics.ui, cardState.status, canBeDatasource]);
|
|
29
|
+
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
30
|
+
var _useMemo = useMemo(function () {
|
|
31
|
+
return getMetadata(extensionKey, data);
|
|
32
|
+
}, [data, extensionKey]),
|
|
33
|
+
primary = _useMemo.primary,
|
|
34
|
+
secondary = _useMemo.secondary;
|
|
35
|
+
var snippetHeight = React.useRef(0);
|
|
36
|
+
var snippetBlockRef = useRef(null);
|
|
37
|
+
var onSnippetRender = useCallback(function () {
|
|
38
|
+
var _snippetBlockRef$curr, _snippetBlockRef$curr2;
|
|
39
|
+
snippetHeight.current = (_snippetBlockRef$curr = (_snippetBlockRef$curr2 = snippetBlockRef.current) === null || _snippetBlockRef$curr2 === void 0 ? void 0 : _snippetBlockRef$curr2.getBoundingClientRect().height) !== null && _snippetBlockRef$curr !== void 0 ? _snippetBlockRef$curr : 0;
|
|
40
|
+
}, []);
|
|
41
|
+
var imagePreview = ImagePreview({
|
|
42
|
+
data: data,
|
|
43
|
+
fallbackElementHeight: snippetHeight.current
|
|
44
|
+
});
|
|
45
|
+
var snippet = imagePreview ? null : /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
46
|
+
status: SmartLinkStatus.Resolved
|
|
47
|
+
});
|
|
48
|
+
var aiSummaryMinHeight = snippet ? snippetHeight.current : 0;
|
|
49
|
+
return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps, imagePreview, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockProps, {
|
|
50
|
+
metadataPosition: SmartLinkPosition.Top
|
|
51
|
+
})), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
52
|
+
primary: primary,
|
|
53
|
+
secondary: secondary,
|
|
54
|
+
overrideCss: metadataBlockCss,
|
|
55
|
+
maxLines: 1,
|
|
56
|
+
size: SmartLinkSize.Medium
|
|
57
|
+
}), isAISummaryEnabled ? /*#__PURE__*/React.createElement(AISummaryBlock, {
|
|
58
|
+
aiSummaryMinHeight: aiSummaryMinHeight,
|
|
59
|
+
placeholder: snippet,
|
|
60
|
+
status: SmartLinkStatus.Resolved
|
|
61
|
+
}) : snippet, /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
62
|
+
testId: "hidden-snippet",
|
|
63
|
+
onRender: onSnippetRender,
|
|
64
|
+
blockRef: snippetBlockRef,
|
|
65
|
+
overrideCss: hiddenSnippetStyles
|
|
66
|
+
}), /*#__PURE__*/React.createElement(ActionBlock, {
|
|
67
|
+
onClick: onActionClick,
|
|
68
|
+
spaceInline: "space.100"
|
|
69
|
+
}), /*#__PURE__*/React.createElement(AIFooterBlock, null));
|
|
70
|
+
};
|
|
71
|
+
export default HoverCardResolvedView;
|
|
@@ -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.
|
|
13
|
+
packageVersion: "26.68.0",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
var Link = withLinkClickedEvent('a');
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ActionItem, type BlockProps, type ElementItem } from '../types';
|
|
3
|
+
import { type OnActionMenuOpenChangeOptions } from '../types';
|
|
3
4
|
export type AISummaryBlockProps = {
|
|
4
5
|
/**
|
|
5
6
|
* An array of actions to be displayed on the right
|
|
@@ -20,4 +21,8 @@ export type AISummaryBlockProps = {
|
|
|
20
21
|
* Minimum height requirement for the AISummary component to prevent fluctuations in a card size on the summary action.
|
|
21
22
|
*/
|
|
22
23
|
aiSummaryMinHeight?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Placeholder to show when summary is not available
|
|
26
|
+
*/
|
|
27
|
+
placeholder?: ReactNode;
|
|
23
28
|
} & BlockProps;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ActionItem, type BlockProps, type ElementItem } from '../types';
|
|
3
|
+
import { type OnActionMenuOpenChangeOptions } from '../types';
|
|
3
4
|
export type AISummaryBlockProps = {
|
|
4
5
|
/**
|
|
5
6
|
* An array of actions to be displayed on the right
|
|
@@ -20,4 +21,8 @@ export type AISummaryBlockProps = {
|
|
|
20
21
|
* Minimum height requirement for the AISummary component to prevent fluctuations in a card size on the summary action.
|
|
21
22
|
*/
|
|
22
23
|
aiSummaryMinHeight?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Placeholder to show when summary is not available
|
|
26
|
+
*/
|
|
27
|
+
placeholder?: ReactNode;
|
|
23
28
|
} & BlockProps;
|