@atlaskit/smart-card 27.19.0 → 27.20.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 +16 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/follow-action/index.js +2 -4
- package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +4 -5
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +3 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +6 -125
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +2 -16
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +5 -67
- package/dist/cjs/view/HoverCard/utils.js +2 -8
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/common/ai-icon/index.js +9 -69
- package/dist/cjs/view/common/ai-summary/index.js +1 -13
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/follow-action/index.js +3 -5
- package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +4 -5
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +3 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +6 -123
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +3 -15
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +5 -40
- package/dist/es2019/view/HoverCard/utils.js +2 -8
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/common/ai-icon/index.js +9 -69
- package/dist/es2019/view/common/ai-summary/index.js +1 -10
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/follow-action/index.js +3 -5
- package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +4 -5
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +3 -0
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +7 -126
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +3 -17
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +5 -66
- package/dist/esm/view/HoverCard/utils.js +2 -8
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/common/ai-icon/index.js +9 -69
- package/dist/esm/view/common/ai-summary/index.js +1 -13
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.d.ts +0 -10
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +1 -17
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +5 -1
- package/dist/types/view/HoverCard/components/HoverCardContent.d.ts +5 -3
- package/dist/types/view/HoverCard/types.d.ts +0 -2
- package/dist/types/view/HoverCard/utils.d.ts +0 -1
- package/dist/types/view/common/ai-summary/index.d.ts +1 -8
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.d.ts +0 -10
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +1 -17
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +5 -1
- package/dist/types-ts4.5/view/HoverCard/components/HoverCardContent.d.ts +5 -3
- package/dist/types-ts4.5/view/HoverCard/types.d.ts +0 -2
- package/dist/types-ts4.5/view/HoverCard/utils.d.ts +0 -1
- package/dist/types-ts4.5/view/common/ai-summary/index.d.ts +1 -8
- package/package.json +4 -17
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.js +0 -28
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +0 -52
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +0 -137
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.js +0 -71
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.js +0 -34
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +0 -46
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.js +0 -5
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +0 -181
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.js +0 -22
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +0 -39
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +0 -125
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.js +0 -63
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.js +0 -28
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +0 -37
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.js +0 -1
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +0 -173
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.js +0 -21
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +0 -41
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +0 -128
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.js +0 -64
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.js +0 -27
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +0 -38
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.js +0 -1
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +0 -172
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.d.ts +0 -4
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.d.ts +0 -4
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.d.ts +0 -4
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.d.ts +0 -4
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.d.ts +0 -4
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.d.ts +0 -8
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +0 -21
- package/dist/types/view/HoverCard/components/views/resolved/index.d.ts +0 -7
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.d.ts +0 -4
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.d.ts +0 -4
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.d.ts +0 -4
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.d.ts +0 -4
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.d.ts +0 -4
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.d.ts +0 -8
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +0 -21
- package/dist/types-ts4.5/view/HoverCard/components/views/resolved/index.d.ts +0 -7
|
@@ -1,127 +1,30 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { FormattedMessage } from 'react-intl-next';
|
|
5
|
-
import { Box, Inline } from '@atlaskit/primitives';
|
|
6
|
-
import { ActionName, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
|
|
7
|
-
import ActionGroup from '../../action-group';
|
|
2
|
+
import React, { useRef } from 'react';
|
|
3
|
+
import { SmartLinkDirection } from '../../../../../../constants';
|
|
8
4
|
import Block from '../../block';
|
|
9
|
-
import ElementGroup from '../../element-group';
|
|
10
5
|
import MotionWrapper from '../../../common/motion-wrapper';
|
|
11
|
-
import AIStateIndicator from '../ai-state-indicator';
|
|
12
|
-
import { renderElementItems } from '../../utils';
|
|
13
|
-
import { messages } from '../../../../../../messages';
|
|
14
6
|
import useAISummaryAction from '../../../../../../state/hooks/use-ai-summary-action';
|
|
15
|
-
import AIIcon from '../../../../../common/ai-icon';
|
|
16
7
|
import AISummary from '../../../../../common/ai-summary';
|
|
17
|
-
import { useAnalyticsEvents } from '../../../../../../common/analytics/generated/use-analytics-events';
|
|
18
8
|
import AIEventSummaryViewed from '../ai-event-summary-viewed';
|
|
19
|
-
import AIEventErrorViewed from '../../../common/ai-summary/ai-event-error-viewed';
|
|
20
9
|
import { di } from 'react-magnetic-di';
|
|
21
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
22
11
|
import { css } from '@emotion/react';
|
|
23
|
-
import FeatureDiscovery from '../feature-discovery';
|
|
24
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
25
|
-
export var AISummaryBlockErrorIndicator = function AISummaryBlockErrorIndicator(_ref) {
|
|
26
|
-
var showErrorIndicator = _ref.showErrorIndicator,
|
|
27
|
-
error = _ref.error,
|
|
28
|
-
showTransition = _ref.showTransition,
|
|
29
|
-
testId = _ref.testId;
|
|
30
|
-
return /*#__PURE__*/React.createElement(MotionWrapper, {
|
|
31
|
-
isFadeIn: true,
|
|
32
|
-
show: showErrorIndicator,
|
|
33
|
-
showTransition: showTransition
|
|
34
|
-
}, /*#__PURE__*/React.createElement(AIEventErrorViewed, {
|
|
35
|
-
reason: error
|
|
36
|
-
}), /*#__PURE__*/React.createElement(AIStateIndicator, {
|
|
37
|
-
error: error,
|
|
38
|
-
state: "error",
|
|
39
|
-
testId: testId
|
|
40
|
-
}));
|
|
41
|
-
};
|
|
42
|
-
export var AISummaryBlockStatusIndicator = function AISummaryBlockStatusIndicator(_ref2) {
|
|
43
|
-
var showStatusIndicator = _ref2.showStatusIndicator,
|
|
44
|
-
metadata = _ref2.metadata,
|
|
45
|
-
status = _ref2.status,
|
|
46
|
-
testId = _ref2.testId;
|
|
47
|
-
var metadataElements = renderElementItems(metadata);
|
|
48
|
-
return showStatusIndicator ? /*#__PURE__*/React.createElement(AIStateIndicator, {
|
|
49
|
-
state: status,
|
|
50
|
-
testId: "".concat(testId, "-state-indicator")
|
|
51
|
-
}) : /*#__PURE__*/React.createElement(ElementGroup, {
|
|
52
|
-
width: SmartLinkWidth.FitToContent,
|
|
53
|
-
testId: "".concat(testId, "-metadata-group")
|
|
54
|
-
}, metadataElements);
|
|
55
|
-
};
|
|
56
12
|
var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
57
|
-
var
|
|
58
|
-
actions = _props$actions === void 0 ? [] : _props$actions,
|
|
59
|
-
onActionMenuOpenChange = props.onActionMenuOpenChange,
|
|
60
|
-
_props$size = props.size,
|
|
61
|
-
size = _props$size === void 0 ? SmartLinkSize.Medium : _props$size,
|
|
62
|
-
testId = props.testId,
|
|
13
|
+
var testId = props.testId,
|
|
63
14
|
_props$aiSummaryMinHe = props.aiSummaryMinHeight,
|
|
64
15
|
aiSummaryMinHeight = _props$aiSummaryMinHe === void 0 ? 0 : _props$aiSummaryMinHe,
|
|
65
|
-
metadata = props.metadata,
|
|
66
16
|
placeholder = props.placeholder,
|
|
67
17
|
url = props.url;
|
|
68
|
-
var _useAnalyticsEvents = useAnalyticsEvents(),
|
|
69
|
-
fireEvent = _useAnalyticsEvents.fireEvent;
|
|
70
18
|
var _useAISummaryAction = useAISummaryAction(url),
|
|
71
|
-
summariseUrl = _useAISummaryAction.summariseUrl,
|
|
72
19
|
_useAISummaryAction$s = _useAISummaryAction.state,
|
|
73
20
|
content = _useAISummaryAction$s.content,
|
|
74
|
-
status = _useAISummaryAction$s.status
|
|
75
|
-
error = _useAISummaryAction$s.error;
|
|
21
|
+
status = _useAISummaryAction$s.status;
|
|
76
22
|
var showAISummary = status === 'done' ||
|
|
77
23
|
// We want to display the AI Summary component only when there is content available during the loading process.
|
|
78
24
|
status === 'loading' && !!content;
|
|
79
25
|
var isSummarisedOnMountRef = useRef(status === 'done');
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
useEffect(function () {
|
|
83
|
-
// if the error was apparent on mount and the status is changed to loading we can
|
|
84
|
-
// clear the initial error on mount state
|
|
85
|
-
if (isErroredOnMountRef.current && status === 'loading') {
|
|
86
|
-
isErroredOnMountRef.current = false;
|
|
87
|
-
}
|
|
88
|
-
}, [status]);
|
|
89
|
-
var combinedActions = useMemo(function () {
|
|
90
|
-
if (status === 'ready' || status === 'error') {
|
|
91
|
-
var aiAction = {
|
|
92
|
-
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summarize),
|
|
93
|
-
name: ActionName.CustomAction,
|
|
94
|
-
onClick: function onClick() {
|
|
95
|
-
fireEvent('ui.button.clicked.aiSummary', {});
|
|
96
|
-
fireEvent('track.aiInteraction.initiated', {
|
|
97
|
-
aiFeatureName: 'Smart Links Summary',
|
|
98
|
-
proactiveAIGenerated: 0,
|
|
99
|
-
userGeneratedAI: 1
|
|
100
|
-
});
|
|
101
|
-
summariseUrl();
|
|
102
|
-
},
|
|
103
|
-
testId: "".concat(testId, "-ai-summary-action"),
|
|
104
|
-
icon: /*#__PURE__*/React.createElement(AIIcon, {
|
|
105
|
-
label: "AIIcon"
|
|
106
|
-
}),
|
|
107
|
-
/**
|
|
108
|
-
* Enabling feature discovery pulse
|
|
109
|
-
* Cleanup: https://product-fabric.atlassian.net/browse/EDM-9693
|
|
110
|
-
*/
|
|
111
|
-
wrapper: FeatureDiscovery
|
|
112
|
-
};
|
|
113
|
-
return [aiAction].concat(_toConsumableArray(actions));
|
|
114
|
-
}
|
|
115
|
-
return actions;
|
|
116
|
-
}, [actions, status, testId, summariseUrl, fireEvent]);
|
|
117
|
-
var onDropdownOpenChange = useCallback(function (isOpen) {
|
|
118
|
-
if (onActionMenuOpenChange) {
|
|
119
|
-
onActionMenuOpenChange({
|
|
120
|
-
isOpen: isOpen
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
}, [onActionMenuOpenChange]);
|
|
124
|
-
if (!showAISummary && getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign')) {
|
|
26
|
+
var minHeight = isSummarisedOnMountRef.current ? 0 : aiSummaryMinHeight;
|
|
27
|
+
if (!showAISummary) {
|
|
125
28
|
return /*#__PURE__*/React.createElement(React.Fragment, null, placeholder);
|
|
126
29
|
}
|
|
127
30
|
return /*#__PURE__*/React.createElement(Block, _extends({}, props, {
|
|
@@ -145,29 +48,7 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
145
48
|
}, /*#__PURE__*/React.createElement(AISummary, {
|
|
146
49
|
testId: "".concat(testId, "-ai-summary"),
|
|
147
50
|
minHeight: minHeight,
|
|
148
|
-
content: content
|
|
149
|
-
showIcon: !getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') && isSummarisedOnMountRef.current
|
|
150
|
-
})), !getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Inline, {
|
|
151
|
-
alignBlock: "center",
|
|
152
|
-
alignInline: "end",
|
|
153
|
-
grow: "fill",
|
|
154
|
-
spread: "space-between",
|
|
155
|
-
testId: "".concat(testId, "-footer-metadata")
|
|
156
|
-
}, /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(AISummaryBlockStatusIndicator, {
|
|
157
|
-
metadata: metadata,
|
|
158
|
-
showStatusIndicator: !isSummarisedOnMountRef.current && (status === 'loading' || status === 'done'),
|
|
159
|
-
status: status,
|
|
160
|
-
testId: testId
|
|
161
|
-
})), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(ActionGroup, {
|
|
162
|
-
onDropdownOpenChange: onDropdownOpenChange,
|
|
163
|
-
items: combinedActions,
|
|
164
|
-
appearance: "default",
|
|
165
|
-
size: size
|
|
166
|
-
}))), /*#__PURE__*/React.createElement(AISummaryBlockErrorIndicator, {
|
|
167
|
-
showErrorIndicator: !isErroredOnMountRef.current && status === 'error',
|
|
168
|
-
showTransition: !isErroredOnMountRef.current,
|
|
169
|
-
error: error,
|
|
170
|
-
testId: "".concat(testId, "-error-indicator")
|
|
51
|
+
content: content
|
|
171
52
|
})));
|
|
172
53
|
};
|
|
173
54
|
export default AISummaryBlockResolvedView;
|
|
@@ -7,8 +7,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
7
7
|
import Popup from '@atlaskit/popup';
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { jsx } from '@emotion/react';
|
|
10
|
-
import React, { useCallback,
|
|
11
|
-
import { useSmartLinkActions } from '../../../state/hooks-external/useSmartLinkActions';
|
|
10
|
+
import React, { useCallback, useRef, useEffect } from 'react';
|
|
12
11
|
import { useSmartLinkRenderers } from '../../../state/renderers';
|
|
13
12
|
import { useSmartCardState as useLinkState } from '../../../state/store';
|
|
14
13
|
import HoverCardContent from '../components/HoverCardContent';
|
|
@@ -159,20 +158,8 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
159
158
|
}
|
|
160
159
|
}
|
|
161
160
|
}, [initResolve, isOpen, setMousePosition, noFadeDelay, fadeInDelay]);
|
|
162
|
-
var linkActions = useSmartLinkActions({
|
|
163
|
-
url: url,
|
|
164
|
-
appearance: CardDisplay.HoverCardPreview,
|
|
165
|
-
analyticsHandler: analyticsHandler,
|
|
166
|
-
origin: HOVER_CARD_SOURCE,
|
|
167
|
-
actionOptions: actionOptions
|
|
168
|
-
});
|
|
169
|
-
var filteredActions = useMemo(function () {
|
|
170
|
-
return hidePreviewButton ? linkActions.filter(function (action) {
|
|
171
|
-
return action.id !== 'preview-content';
|
|
172
|
-
}) : linkActions;
|
|
173
|
-
}, [hidePreviewButton, linkActions]);
|
|
174
161
|
var onActionClick = useCallback(function (actionId) {
|
|
175
|
-
if (actionId ===
|
|
162
|
+
if (actionId === ActionName.PreviewAction || actionId === ActionName.AutomationAction) {
|
|
176
163
|
hideCard();
|
|
177
164
|
}
|
|
178
165
|
}, [hideCard]);
|
|
@@ -197,7 +184,6 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
197
184
|
var hoverCardContentProps = {
|
|
198
185
|
onMouseEnter: initShowCard,
|
|
199
186
|
onMouseLeave: initHideCard,
|
|
200
|
-
cardActions: filteredActions,
|
|
201
187
|
cardState: linkState,
|
|
202
188
|
onActionClick: onActionClick,
|
|
203
189
|
onResolve: update,
|
|
@@ -212,7 +198,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
212
198
|
id: id,
|
|
213
199
|
source: HOVER_CARD_SOURCE
|
|
214
200
|
}, jsx(HoverCardContent, hoverCardContentProps));
|
|
215
|
-
}, [initShowCard, initHideCard,
|
|
201
|
+
}, [initShowCard, initHideCard, linkState, onActionClick, renderers, actionOptions, url, id]);
|
|
216
202
|
var trigger = useCallback(function (triggerProps) {
|
|
217
203
|
return jsx("span", {
|
|
218
204
|
ref: parentSpan
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
1
|
/**
|
|
4
2
|
* @jsxRuntime classic
|
|
5
3
|
* @jsx jsx
|
|
6
4
|
*/
|
|
7
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
6
|
import { jsx } from '@emotion/react';
|
|
10
7
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
11
|
-
import CopyIcon from '@atlaskit/icon/core/migration/copy';
|
|
12
8
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
13
9
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
14
|
-
import {
|
|
10
|
+
import { CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../constants';
|
|
15
11
|
import { useSmartLinkAnalytics } from '../../../state/analytics';
|
|
16
12
|
import { getExtensionKey, getServices } from '../../../state/helpers';
|
|
17
13
|
import { isSpecialEvent } from '../../../utils';
|
|
@@ -19,57 +15,18 @@ import { flexibleUiOptions, titleBlockCss } from '../styled';
|
|
|
19
15
|
import { getMetadata } from '../utils';
|
|
20
16
|
import HoverCardLoadingView from './views/resolving';
|
|
21
17
|
import HoverCardUnauthorisedView from './views/unauthorised';
|
|
22
|
-
import HoverCardResolvedView from './views/resolved';
|
|
23
18
|
import HoverCardRedesignedResolvedView from './views/resolved/redesign';
|
|
24
|
-
import { FormattedMessage } from 'react-intl-next';
|
|
25
|
-
import { messages } from '../../../messages';
|
|
26
19
|
import { fireLinkClickedEvent } from '../../../utils/analytics/click';
|
|
27
20
|
import { useSmartCardState } from '../../../state/store';
|
|
28
21
|
import HoverCardForbiddenView from './views/forbidden';
|
|
29
22
|
import ContentContainer from './ContentContainer';
|
|
30
23
|
import { getIsAISummaryEnabled } from '../../../utils/ai-summary';
|
|
31
24
|
export var hoverCardClassName = 'smart-links-hover-preview';
|
|
32
|
-
export var getCopyAction = function getCopyAction(url) {
|
|
33
|
-
return {
|
|
34
|
-
name: ActionName.CustomAction,
|
|
35
|
-
icon: jsx(CopyIcon, {
|
|
36
|
-
label: "copy url",
|
|
37
|
-
LEGACY_size: "medium",
|
|
38
|
-
spacing: "spacious",
|
|
39
|
-
color: "var(--ds-icon, #44546F)"
|
|
40
|
-
}),
|
|
41
|
-
iconPosition: 'before',
|
|
42
|
-
onClick: function () {
|
|
43
|
-
var _onClick = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
44
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
45
|
-
while (1) switch (_context.prev = _context.next) {
|
|
46
|
-
case 0:
|
|
47
|
-
_context.next = 2;
|
|
48
|
-
return navigator.clipboard.writeText(url);
|
|
49
|
-
case 2:
|
|
50
|
-
return _context.abrupt("return", _context.sent);
|
|
51
|
-
case 3:
|
|
52
|
-
case "end":
|
|
53
|
-
return _context.stop();
|
|
54
|
-
}
|
|
55
|
-
}, _callee);
|
|
56
|
-
}));
|
|
57
|
-
function onClick() {
|
|
58
|
-
return _onClick.apply(this, arguments);
|
|
59
|
-
}
|
|
60
|
-
return onClick;
|
|
61
|
-
}(),
|
|
62
|
-
tooltipMessage: jsx(FormattedMessage, messages.copy_url_to_clipboard),
|
|
63
|
-
testId: 'hover-card-copy-button'
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
25
|
var HoverCardContent = function HoverCardContent(_ref) {
|
|
67
26
|
var _linkState$status, _cardState$details;
|
|
68
27
|
var _ref$id = _ref.id,
|
|
69
28
|
id = _ref$id === void 0 ? '' : _ref$id,
|
|
70
29
|
_analytics = _ref.analytics,
|
|
71
|
-
_ref$cardActions = _ref.cardActions,
|
|
72
|
-
cardActions = _ref$cardActions === void 0 ? [] : _ref$cardActions,
|
|
73
30
|
cardState = _ref.cardState,
|
|
74
31
|
onActionClick = _ref.onActionClick,
|
|
75
32
|
onResolve = _ref.onResolve,
|
|
@@ -135,15 +92,11 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
135
92
|
});
|
|
136
93
|
fireLinkClickedEvent(createAnalyticsEvent)(event);
|
|
137
94
|
}, [createAnalyticsEvent, cardState.status, analytics.ui, id]);
|
|
138
|
-
var titleActions = useMemo(function () {
|
|
139
|
-
return [getCopyAction(url)];
|
|
140
|
-
}, [url]);
|
|
141
95
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
142
96
|
var _getMetadata = getMetadata(extensionKey, data),
|
|
143
97
|
subtitle = _getMetadata.subtitle;
|
|
144
98
|
var titleMaxLines = subtitle && subtitle.length > 0 ? 1 : 2;
|
|
145
99
|
var titleBlockProps = {
|
|
146
|
-
actions: getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') ? undefined : titleActions,
|
|
147
100
|
maxLines: titleMaxLines,
|
|
148
101
|
overrideCss: titleBlockCss,
|
|
149
102
|
size: SmartLinkSize.Large,
|
|
@@ -187,29 +140,15 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
187
140
|
});
|
|
188
141
|
}
|
|
189
142
|
if (cardState.status === 'resolved') {
|
|
190
|
-
|
|
191
|
-
return jsx(HoverCardRedesignedResolvedView, {
|
|
192
|
-
analytics: analytics,
|
|
193
|
-
cardState: cardState,
|
|
194
|
-
extensionKey: extensionKey,
|
|
195
|
-
flexibleCardProps: flexibleCardProps,
|
|
196
|
-
isAISummaryEnabled: isAISummaryEnabled,
|
|
197
|
-
onActionClick: onActionClick,
|
|
198
|
-
titleBlockProps: titleBlockProps,
|
|
199
|
-
url: url
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
return jsx(HoverCardResolvedView, {
|
|
203
|
-
id: id,
|
|
204
|
-
url: url,
|
|
205
|
-
extensionKey: extensionKey,
|
|
143
|
+
return jsx(HoverCardRedesignedResolvedView, {
|
|
206
144
|
analytics: analytics,
|
|
207
|
-
cardActions: cardActions,
|
|
208
145
|
cardState: cardState,
|
|
146
|
+
extensionKey: extensionKey,
|
|
209
147
|
flexibleCardProps: flexibleCardProps,
|
|
210
148
|
isAISummaryEnabled: isAISummaryEnabled,
|
|
211
149
|
onActionClick: onActionClick,
|
|
212
|
-
titleBlockProps: titleBlockProps
|
|
150
|
+
titleBlockProps: titleBlockProps,
|
|
151
|
+
url: url
|
|
213
152
|
});
|
|
214
153
|
}
|
|
215
154
|
return null;
|
|
@@ -4,7 +4,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { ElementName } from '../../constants';
|
|
5
5
|
import { extractType } from '@atlaskit/link-extractors';
|
|
6
6
|
import { extractOwnedBy } from '../../extractors/flexible/utils';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
var getSimulatedBetterMetadata = function getSimulatedBetterMetadata(extensionKey, data) {
|
|
9
8
|
var _data$Type$includes, _data$Type;
|
|
10
9
|
var types = data ? extractType(data) : undefined;
|
|
@@ -88,15 +87,10 @@ var toElementItems = function toElementItems(elementNames) {
|
|
|
88
87
|
};
|
|
89
88
|
export var getMetadata = function getMetadata(extensionKey, data) {
|
|
90
89
|
var metadata = getSimulatedBetterMetadata(extensionKey, data);
|
|
91
|
-
var primary =
|
|
92
|
-
|
|
93
|
-
// `tertiary` should be removed completely during cleanup:
|
|
94
|
-
// https://product-fabric.atlassian.net/browse/EDM-9556
|
|
95
|
-
var tertiary = fg('platform.linking-platform.smart-card.hover-card-action-redesign') ? undefined : metadata.tertiary;
|
|
90
|
+
var primary = [].concat(metadata.primary, metadata.tertiary);
|
|
96
91
|
return {
|
|
97
92
|
subtitle: toElementItems(metadata.subtitle),
|
|
98
93
|
primary: toElementItems(primary),
|
|
99
|
-
secondary: toElementItems(metadata.secondary)
|
|
100
|
-
tertiary: toElementItems(tertiary)
|
|
94
|
+
secondary: toElementItems(metadata.secondary)
|
|
101
95
|
};
|
|
102
96
|
};
|
|
@@ -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: "27.
|
|
13
|
+
packageVersion: "27.20.0",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
var Link = withLinkClickedEvent('a');
|
|
@@ -1,111 +1,51 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import SVG from '@atlaskit/icon/svg';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
-
import { B200, B400 } from '@atlaskit/theme/colors';
|
|
5
3
|
/**
|
|
6
4
|
* The bulk of this file is originally from
|
|
7
5
|
* https://bitbucket.org/atlassian/barrel/src/master/ui/platform/ui-kit/ai
|
|
8
6
|
* with modifications
|
|
9
7
|
*/
|
|
10
8
|
var AiIcon = function AiIcon(props) {
|
|
11
|
-
return /*#__PURE__*/React.createElement(SVG, props, /*#__PURE__*/React.createElement("
|
|
12
|
-
id: "ai_icon_lg0",
|
|
13
|
-
x1: "21",
|
|
14
|
-
y1: "12",
|
|
15
|
-
x2: "17.5",
|
|
16
|
-
y2: "12",
|
|
17
|
-
gradientUnits: "userSpaceOnUse"
|
|
18
|
-
}, /*#__PURE__*/React.createElement("stop", {
|
|
19
|
-
offset: "0.270833",
|
|
20
|
-
stopColor: "var(--ds-icon-accent-blue, ".concat(B200, ")"),
|
|
21
|
-
color: "var(--ds-icon-accent-blue, ".concat(B200, ")")
|
|
22
|
-
}), /*#__PURE__*/React.createElement("stop", {
|
|
23
|
-
offset: "1",
|
|
24
|
-
stopColor: "var(--ds-text-accent-blue, ".concat(B400, ")"),
|
|
25
|
-
color: "var(--ds-text-accent-blue, ".concat(B400, ")")
|
|
26
|
-
})), /*#__PURE__*/React.createElement("linearGradient", {
|
|
27
|
-
id: "ai_icon_lg1",
|
|
28
|
-
x1: "12.5",
|
|
29
|
-
y1: "3",
|
|
30
|
-
x2: "12.5",
|
|
31
|
-
y2: "6.5",
|
|
32
|
-
gradientUnits: "userSpaceOnUse"
|
|
33
|
-
}, /*#__PURE__*/React.createElement("stop", {
|
|
34
|
-
offset: "0.1875",
|
|
35
|
-
stopColor: "var(--ds-icon-accent-blue, ".concat(B200, ")"),
|
|
36
|
-
color: "var(--ds-icon-accent-blue, ".concat(B200, ")")
|
|
37
|
-
}), /*#__PURE__*/React.createElement("stop", {
|
|
38
|
-
offset: "1",
|
|
39
|
-
stopColor: "var(--ds-text-accent-blue, ".concat(B400, ")"),
|
|
40
|
-
color: "var(--ds-text-accent-blue, ".concat(B400, ")")
|
|
41
|
-
})), /*#__PURE__*/React.createElement("linearGradient", {
|
|
42
|
-
id: "ai_icon_lg2",
|
|
43
|
-
x1: "6.82996",
|
|
44
|
-
y1: "12",
|
|
45
|
-
x2: "3.32996",
|
|
46
|
-
y2: "12",
|
|
47
|
-
gradientUnits: "userSpaceOnUse"
|
|
48
|
-
}, /*#__PURE__*/React.createElement("stop", {
|
|
49
|
-
stopColor: "var(--ds-text-accent-blue, ".concat(B400, ")"),
|
|
50
|
-
color: "var(--ds-text-accent-blue, ".concat(B400, ")")
|
|
51
|
-
}), /*#__PURE__*/React.createElement("stop", {
|
|
52
|
-
offset: "0.791667",
|
|
53
|
-
stopColor: "var(--ds-icon-accent-blue, ".concat(B200, ")"),
|
|
54
|
-
color: "var(--ds-icon-accent-blue, ".concat(B200, ")")
|
|
55
|
-
})), /*#__PURE__*/React.createElement("linearGradient", {
|
|
56
|
-
id: "ai_icon_lg3",
|
|
57
|
-
x1: "12.5",
|
|
58
|
-
y1: "17",
|
|
59
|
-
x2: "12.5",
|
|
60
|
-
y2: "21",
|
|
61
|
-
gradientUnits: "userSpaceOnUse"
|
|
62
|
-
}, /*#__PURE__*/React.createElement("stop", {
|
|
63
|
-
stopColor: "var(--ds-text-accent-blue, ".concat(B400, ")"),
|
|
64
|
-
color: "var(--ds-text-accent-blue, ".concat(B400, ")")
|
|
65
|
-
}), /*#__PURE__*/React.createElement("stop", {
|
|
66
|
-
offset: "0.802083",
|
|
67
|
-
stopColor: "var(--ds-icon-accent-blue, ".concat(B200, ")"),
|
|
68
|
-
color: "var(--ds-icon-accent-blue, ".concat(B200, ")")
|
|
69
|
-
}))), /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
|
|
9
|
+
return /*#__PURE__*/React.createElement(SVG, props, /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
|
|
70
10
|
fillRule: "evenodd",
|
|
71
11
|
clipRule: "evenodd",
|
|
72
12
|
d: "M17.17 12C17.17 11.4477 17.6177 11 18.17 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H18.17C17.6177 13 17.17 12.5523 17.17 12Z",
|
|
73
|
-
fill:
|
|
13
|
+
fill: "var(--ds-icon, #44546F)"
|
|
74
14
|
}), /*#__PURE__*/React.createElement("path", {
|
|
75
15
|
fillRule: "evenodd",
|
|
76
16
|
clipRule: "evenodd",
|
|
77
17
|
d: "M12 3C12.5523 3 13 3.44772 13 4V5.83C13 6.38228 12.5523 6.83 12 6.83C11.4477 6.83 11 6.38228 11 5.83V4C11 3.44772 11.4477 3 12 3Z",
|
|
78
|
-
fill:
|
|
18
|
+
fill: "var(--ds-icon, #44546F)"
|
|
79
19
|
}), /*#__PURE__*/React.createElement("path", {
|
|
80
20
|
fillRule: "evenodd",
|
|
81
21
|
clipRule: "evenodd",
|
|
82
22
|
d: "M3 12C3 11.4477 3.44772 11 4 11H5.83C6.38228 11 6.83 11.4477 6.83 12C6.83 12.5523 6.38228 13 5.83 13H4C3.44772 13 3 12.5523 3 12Z",
|
|
83
|
-
fill:
|
|
23
|
+
fill: "var(--ds-icon, #44546F)"
|
|
84
24
|
}), /*#__PURE__*/React.createElement("path", {
|
|
85
25
|
fillRule: "evenodd",
|
|
86
26
|
clipRule: "evenodd",
|
|
87
27
|
d: "M12 17.17C12.5523 17.17 13 17.6177 13 18.17V20C13 20.5523 12.5523 21 12 21C11.4477 21 11 20.5523 11 20V18.17C11 17.6177 11.4477 17.17 12 17.17Z",
|
|
88
|
-
fill:
|
|
28
|
+
fill: "var(--ds-icon, #44546F)"
|
|
89
29
|
}), /*#__PURE__*/React.createElement("path", {
|
|
90
30
|
fillRule: "evenodd",
|
|
91
31
|
clipRule: "evenodd",
|
|
92
32
|
d: "M14.2929 14.2929C14.6835 13.9024 15.3166 13.9024 15.7071 14.2929L19.7071 18.2929C20.0977 18.6834 20.0977 19.3166 19.7071 19.7071C19.3166 20.0976 18.6835 20.0976 18.2929 19.7071L14.2929 15.7071C13.9024 15.3166 13.9024 14.6834 14.2929 14.2929Z",
|
|
93
|
-
fill:
|
|
33
|
+
fill: "var(--ds-icon, #44546F)"
|
|
94
34
|
}), /*#__PURE__*/React.createElement("path", {
|
|
95
35
|
fillRule: "evenodd",
|
|
96
36
|
clipRule: "evenodd",
|
|
97
37
|
d: "M19.7071 4.29289C20.0977 4.68342 20.0977 5.31658 19.7071 5.70711L15.7071 9.70711C15.3166 10.0976 14.6835 10.0976 14.2929 9.70711C13.9024 9.31658 13.9024 8.68342 14.2929 8.29289L18.2929 4.29289C18.6835 3.90237 19.3166 3.90237 19.7071 4.29289Z",
|
|
98
|
-
fill:
|
|
38
|
+
fill: "var(--ds-icon, #44546F)"
|
|
99
39
|
}), /*#__PURE__*/React.createElement("path", {
|
|
100
40
|
fillRule: "evenodd",
|
|
101
41
|
clipRule: "evenodd",
|
|
102
42
|
d: "M4.29289 4.29289C4.68342 3.90237 5.31658 3.90237 5.70711 4.29289L9.70711 8.29289C10.0976 8.68342 10.0976 9.31658 9.70711 9.70711C9.31658 10.0976 8.68342 10.0976 8.29289 9.70711L4.29289 5.70711C3.90237 5.31658 3.90237 4.68342 4.29289 4.29289Z",
|
|
103
|
-
fill:
|
|
43
|
+
fill: "var(--ds-icon, #44546F)"
|
|
104
44
|
}), /*#__PURE__*/React.createElement("path", {
|
|
105
45
|
fillRule: "evenodd",
|
|
106
46
|
clipRule: "evenodd",
|
|
107
47
|
d: "M9.70711 14.2929C10.0976 14.6834 10.0976 15.3166 9.70711 15.7071L5.70711 19.7071C5.31658 20.0976 4.68342 20.0976 4.29289 19.7071C3.90237 19.3166 3.90237 18.6834 4.29289 18.2929L8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929Z",
|
|
108
|
-
fill:
|
|
48
|
+
fill: "var(--ds-icon, #44546F)"
|
|
109
49
|
})));
|
|
110
50
|
};
|
|
111
51
|
export default AiIcon;
|
|
@@ -5,15 +5,7 @@
|
|
|
5
5
|
import Markdown from 'markdown-to-jsx';
|
|
6
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
7
|
import { css, jsx } from '@emotion/react';
|
|
8
|
-
import AIStateIndicator from '../../FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator';
|
|
9
8
|
import UList from './ulist';
|
|
10
|
-
var AITooltipIcon = function AITooltipIcon() {
|
|
11
|
-
return jsx(AIStateIndicator, {
|
|
12
|
-
appearance: "icon-only",
|
|
13
|
-
state: "done",
|
|
14
|
-
testId: "ai-tooltip"
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
9
|
var AISummaryCSSStyles = css({
|
|
18
10
|
fontSize: '0.75rem',
|
|
19
11
|
lineHeight: '1rem',
|
|
@@ -34,9 +26,6 @@ var AISummaryCSSStyles = css({
|
|
|
34
26
|
var AISummary = function AISummary(_ref) {
|
|
35
27
|
var _ref$content = _ref.content,
|
|
36
28
|
content = _ref$content === void 0 ? '' : _ref$content,
|
|
37
|
-
_ref$showIcon = _ref.showIcon,
|
|
38
|
-
showIcon = _ref$showIcon === void 0 ? false : _ref$showIcon,
|
|
39
|
-
iconComponent = _ref.iconComponent,
|
|
40
29
|
overrideCss = _ref.overrideCss,
|
|
41
30
|
_ref$testId = _ref.testId,
|
|
42
31
|
testId = _ref$testId === void 0 ? 'ai-summary' : _ref$testId,
|
|
@@ -48,11 +37,10 @@ var AISummary = function AISummary(_ref) {
|
|
|
48
37
|
return jsx(Markdown, {
|
|
49
38
|
"data-testid": testId,
|
|
50
39
|
css: [AISummaryCSSStyles, overrideCss],
|
|
51
|
-
children:
|
|
40
|
+
children: content,
|
|
52
41
|
options: {
|
|
53
42
|
forceWrapper: true,
|
|
54
43
|
overrides: {
|
|
55
|
-
Icon: iconComponent !== null && iconComponent !== void 0 ? iconComponent : AITooltipIcon,
|
|
56
44
|
ul: UList
|
|
57
45
|
}
|
|
58
46
|
},
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { AISummaryBlockProps } from '../types';
|
|
3
|
-
import type { AISummaryStatus, ErrorMessage } from '../../../../../../state/hooks/use-ai-summary/ai-summary-service/types';
|
|
4
|
-
export declare const AISummaryBlockErrorIndicator: ({ showErrorIndicator, error, showTransition, testId, }: {
|
|
5
|
-
showErrorIndicator: boolean;
|
|
6
|
-
error?: "NETWORK_ERROR" | "NO_ANSWER" | "RATE_LIMIT" | "NO_AGENT" | "PLUGIN_ERRORED" | "OPENAI_RATE_LIMIT_USER_ABUSE" | "ACCEPTABLE_USE_VIOLATIONS" | "AI_DISABLED" | "UNEXPECTED" | "HIPAA_CONTENT_DETECTED" | "EXCEEDING_CONTEXT_LENGTH_ERROR" | undefined;
|
|
7
|
-
showTransition: boolean;
|
|
8
|
-
} & Pick<AISummaryBlockProps, "testId">) => JSX.Element;
|
|
9
|
-
export declare const AISummaryBlockStatusIndicator: ({ showStatusIndicator, metadata, status, testId, }: {
|
|
10
|
-
showStatusIndicator: boolean;
|
|
11
|
-
status: AISummaryStatus;
|
|
12
|
-
} & Pick<AISummaryBlockProps, "metadata" | "testId">) => JSX.Element;
|
|
13
3
|
type AISummaryBlockResolvedViewProps = AISummaryBlockProps & {
|
|
14
4
|
/**
|
|
15
5
|
* URL to be summarised
|
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import { type
|
|
3
|
-
import { type OnActionMenuOpenChangeOptions } from '../types';
|
|
2
|
+
import { type BlockProps } from '../types';
|
|
4
3
|
export type AISummaryBlockProps = {
|
|
5
|
-
/**
|
|
6
|
-
* An array of actions to be displayed on the right
|
|
7
|
-
* after AI Summary button.
|
|
8
|
-
* @see ActionItem
|
|
9
|
-
*/
|
|
10
|
-
actions?: ActionItem[];
|
|
11
|
-
/**
|
|
12
|
-
* An array of metadata elements to display on the left.
|
|
13
|
-
* @see ElementItem
|
|
14
|
-
*/
|
|
15
|
-
metadata?: ElementItem[];
|
|
16
|
-
/**
|
|
17
|
-
* Function to be called when footer action dropdown open state is changed.
|
|
18
|
-
*/
|
|
19
|
-
onActionMenuOpenChange?: (options: OnActionMenuOpenChangeOptions) => void;
|
|
20
4
|
/**
|
|
21
5
|
* Minimum height requirement for the AISummary component to prevent fluctuations in a card size on the summary action.
|
|
22
6
|
*/
|
|
@@ -185,7 +185,11 @@ export type CustomActionItem = BaseActionItem & {
|
|
|
185
185
|
href?: string;
|
|
186
186
|
ariaLabel?: string;
|
|
187
187
|
} & ((Required<Pick<ActionProps, 'icon' | 'iconPosition'>> & Pick<ActionProps, 'content'>) | ((Required<Pick<ActionProps, 'content'>> & Pick<ActionProps, 'icon' | 'iconPosition'>) & Pick<ActionProps, 'tooltipMessage'>));
|
|
188
|
-
export type ActionItem = NamedActionItem | NamedDataActionItem | CustomActionItem
|
|
188
|
+
export type ActionItem = (NamedActionItem | NamedDataActionItem | CustomActionItem) & {
|
|
189
|
+
entryPointWrapper?: React.FC<{
|
|
190
|
+
children: React.ReactNode;
|
|
191
|
+
}>;
|
|
192
|
+
};
|
|
189
193
|
export type OnActionMenuOpenChangeOptions = {
|
|
190
194
|
isOpen: boolean;
|
|
191
195
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
1
5
|
import { jsx } from '@emotion/react';
|
|
2
|
-
import { type ActionItem } from '../../FlexibleCard/components/blocks/types';
|
|
3
6
|
import { type HoverCardContentProps } from '../types';
|
|
4
7
|
export declare const hoverCardClassName = "smart-links-hover-preview";
|
|
5
|
-
|
|
6
|
-
declare const HoverCardContent: ({ id, analytics: _analytics, cardActions, cardState, onActionClick, onResolve, renderers, url, onMouseEnter, onMouseLeave, actionOptions, }: HoverCardContentProps) => jsx.JSX.Element | null;
|
|
8
|
+
declare const HoverCardContent: ({ id, analytics: _analytics, cardState, onActionClick, onResolve, renderers, url, onMouseEnter, onMouseLeave, actionOptions, }: HoverCardContentProps) => jsx.JSX.Element | null;
|
|
7
9
|
export default HoverCardContent;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
2
2
|
import { type AnalyticsFacade } from '../../state/analytics';
|
|
3
|
-
import { type LinkAction } from '../../state/hooks-external/useSmartLinkActions';
|
|
4
3
|
import { type CardState } from '@atlaskit/linking-common';
|
|
5
4
|
import { type AnalyticsHandler } from '../../utils/types';
|
|
6
5
|
import { type CardProviderRenderers } from '@atlaskit/link-provider';
|
|
@@ -85,7 +84,6 @@ export type PreviewInvokeMethod = 'keyboard' | 'mouse_hover' | 'mouse_click';
|
|
|
85
84
|
export type HoverCardContentProps = {
|
|
86
85
|
id?: string;
|
|
87
86
|
analytics?: AnalyticsFacade;
|
|
88
|
-
cardActions?: LinkAction[];
|
|
89
87
|
cardState: CardState;
|
|
90
88
|
renderers?: CardProviderRenderers;
|
|
91
89
|
onActionClick: (actionId: string | ActionName) => void;
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import { type MarkdownToJSX } from 'markdown-to-jsx';
|
|
6
1
|
import { type SerializedStyles, jsx } from '@emotion/react';
|
|
7
2
|
type AISummaryProps = {
|
|
8
3
|
content?: string;
|
|
9
|
-
showIcon?: boolean;
|
|
10
|
-
iconComponent?: MarkdownToJSX.Override;
|
|
11
4
|
overrideCss?: SerializedStyles;
|
|
12
5
|
/**
|
|
13
6
|
* appears as a data attribute `data-testid` in the rendered code,
|
|
@@ -24,5 +17,5 @@ type AISummaryProps = {
|
|
|
24
17
|
* @internal
|
|
25
18
|
* @param {AISummaryProps} AISummaryProps
|
|
26
19
|
*/
|
|
27
|
-
declare const AISummary: ({ content,
|
|
20
|
+
declare const AISummary: ({ content, overrideCss, testId, minHeight, }: AISummaryProps) => jsx.JSX.Element | null;
|
|
28
21
|
export default AISummary;
|