@atlaskit/smart-card 26.48.3 → 26.48.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +37 -26
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/index.js +15 -2
- package/dist/cjs/view/CardWithUrl/component.js +2 -2
- package/dist/cjs/view/EmbedCard/components/ExpandedFrame.js +6 -11
- package/dist/cjs/view/EmbedCard/index.js +4 -3
- package/dist/cjs/view/EmbedCard/views/ResolvedView.js +0 -2
- package/dist/cjs/view/EmbedCard/views/unresolved-view/index.js +10 -2
- package/dist/cjs/view/FlexibleCard/components/actions/action/preview-action/index.js +1 -4
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +11 -5
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +6 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +13 -10
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/errored/index.js +2 -3
- package/dist/cjs/view/FlexibleCard/components/container/index.js +1 -2
- package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +2 -3
- package/dist/cjs/view/FlexibleCard/components/elements/date-time/index.js +1 -2
- package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +2 -3
- package/dist/cjs/view/FlexibleCard/components/elements/text/index.js +1 -2
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/common/ai-summary/index.js +23 -5
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +21 -14
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/utils/index.js +13 -0
- package/dist/es2019/view/CardWithUrl/component.js +3 -3
- package/dist/es2019/view/EmbedCard/components/ExpandedFrame.js +4 -6
- package/dist/es2019/view/EmbedCard/index.js +4 -3
- package/dist/es2019/view/EmbedCard/views/ResolvedView.js +0 -2
- package/dist/es2019/view/EmbedCard/views/unresolved-view/index.js +10 -2
- package/dist/es2019/view/FlexibleCard/components/actions/action/preview-action/index.js +1 -4
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +11 -10
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +6 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +18 -13
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/errored/index.js +3 -4
- package/dist/es2019/view/FlexibleCard/components/container/index.js +1 -2
- package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +2 -3
- package/dist/es2019/view/FlexibleCard/components/elements/date-time/index.js +1 -2
- package/dist/es2019/view/FlexibleCard/components/elements/link/index.js +6 -7
- package/dist/es2019/view/FlexibleCard/components/elements/text/index.js +1 -2
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/common/ai-summary/index.js +19 -9
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +37 -26
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/index.js +14 -1
- package/dist/esm/view/CardWithUrl/component.js +3 -3
- package/dist/esm/view/EmbedCard/components/ExpandedFrame.js +5 -8
- package/dist/esm/view/EmbedCard/index.js +4 -3
- package/dist/esm/view/EmbedCard/views/ResolvedView.js +0 -2
- package/dist/esm/view/EmbedCard/views/unresolved-view/index.js +10 -2
- package/dist/esm/view/FlexibleCard/components/actions/action/preview-action/index.js +1 -4
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +11 -5
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +6 -1
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +15 -12
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/errored/index.js +2 -3
- package/dist/esm/view/FlexibleCard/components/container/index.js +1 -2
- package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +2 -3
- package/dist/esm/view/FlexibleCard/components/elements/date-time/index.js +1 -2
- package/dist/esm/view/FlexibleCard/components/elements/link/index.js +2 -3
- package/dist/esm/view/FlexibleCard/components/elements/text/index.js +1 -2
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/common/ai-summary/index.js +22 -5
- package/dist/types/utils/index.d.ts +7 -1
- package/dist/types/view/EmbedCard/components/ExpandedFrame.d.ts +0 -2
- package/dist/types/view/EmbedCard/types.d.ts +0 -1
- package/dist/types/view/EmbedCard/views/ResolvedView.d.ts +0 -2
- package/dist/types/view/EmbedCard/views/forbidden-view/types.d.ts +4 -4
- package/dist/types/view/EmbedCard/views/not-found-view/types.d.ts +4 -4
- package/dist/types/view/EmbedCard/views/unauthorized-view/types.d.ts +3 -3
- package/dist/types/view/EmbedCard/views/unresolved-view/types.d.ts +5 -12
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +2 -0
- package/dist/types/view/common/ai-summary/index.d.ts +3 -1
- package/dist/types-ts4.5/utils/index.d.ts +7 -1
- package/dist/types-ts4.5/view/EmbedCard/components/ExpandedFrame.d.ts +0 -2
- package/dist/types-ts4.5/view/EmbedCard/types.d.ts +0 -1
- package/dist/types-ts4.5/view/EmbedCard/views/ResolvedView.d.ts +0 -2
- package/dist/types-ts4.5/view/EmbedCard/views/forbidden-view/types.d.ts +4 -4
- package/dist/types-ts4.5/view/EmbedCard/views/not-found-view/types.d.ts +4 -4
- package/dist/types-ts4.5/view/EmbedCard/views/unauthorized-view/types.d.ts +3 -3
- package/dist/types-ts4.5/view/EmbedCard/views/unresolved-view/types.d.ts +5 -12
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +2 -0
- package/dist/types-ts4.5/view/common/ai-summary/index.d.ts +3 -1
- package/package.json +4 -3
- package/dist/cjs/utils/token.js +0 -27
- package/dist/cjs/view/EmbedCard/views/UnresolvedView.js +0 -82
- package/dist/es2019/utils/token.js +0 -21
- package/dist/es2019/view/EmbedCard/views/UnresolvedView.js +0 -75
- package/dist/esm/utils/token.js +0 -21
- package/dist/esm/view/EmbedCard/views/UnresolvedView.js +0 -74
- package/dist/types/utils/token.d.ts +0 -21
- package/dist/types/view/EmbedCard/views/UnresolvedView.d.ts +0 -22
- package/dist/types-ts4.5/utils/token.d.ts +0 -21
- package/dist/types-ts4.5/view/EmbedCard/views/UnresolvedView.d.ts +0 -22
|
@@ -5,13 +5,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
8
|
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _markdownToJsx = _interopRequireDefault(require("markdown-to-jsx"));
|
|
11
10
|
var _react2 = require("@emotion/react");
|
|
12
|
-
var
|
|
11
|
+
var _aiStateIndicator = _interopRequireDefault(require("../../FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator"));
|
|
13
12
|
/** @jsx jsx */
|
|
14
|
-
|
|
13
|
+
|
|
14
|
+
var AITooltipIcon = function AITooltipIcon() {
|
|
15
|
+
return (0, _react2.jsx)(_aiStateIndicator.default, {
|
|
16
|
+
appearance: "icon-only",
|
|
17
|
+
state: "done",
|
|
18
|
+
testId: "ai-tooltip"
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var AISummaryCSS = (0, _react2.css)({
|
|
22
|
+
fontSize: '0.75rem',
|
|
23
|
+
lineHeight: '1rem',
|
|
24
|
+
wordWrap: 'break-word',
|
|
25
|
+
whiteSpace: 'normal'
|
|
26
|
+
});
|
|
15
27
|
/**
|
|
16
28
|
* A component to render a response from AI in markdown text.
|
|
17
29
|
* @internal
|
|
@@ -20,6 +32,9 @@ var AISummaryCSS = (0, _react2.css)(_templateObject || (_templateObject = (0, _t
|
|
|
20
32
|
|
|
21
33
|
var AISummary = function AISummary(_ref) {
|
|
22
34
|
var content = _ref.content,
|
|
35
|
+
_ref$showIcon = _ref.showIcon,
|
|
36
|
+
showIcon = _ref$showIcon === void 0 ? false : _ref$showIcon,
|
|
37
|
+
iconComponent = _ref.iconComponent,
|
|
23
38
|
overrideCss = _ref.overrideCss,
|
|
24
39
|
_ref$testId = _ref.testId,
|
|
25
40
|
testId = _ref$testId === void 0 ? 'ai-summary' : _ref$testId;
|
|
@@ -29,9 +44,12 @@ var AISummary = function AISummary(_ref) {
|
|
|
29
44
|
return (0, _react2.jsx)(_markdownToJsx.default, {
|
|
30
45
|
"data-testid": testId,
|
|
31
46
|
css: [AISummaryCSS, overrideCss],
|
|
32
|
-
children: content,
|
|
47
|
+
children: showIcon ? "".concat(content, " <Icon />") : content,
|
|
33
48
|
options: {
|
|
34
|
-
forceWrapper: true
|
|
49
|
+
forceWrapper: true,
|
|
50
|
+
overrides: {
|
|
51
|
+
Icon: iconComponent !== null && iconComponent !== void 0 ? iconComponent : AITooltipIcon
|
|
52
|
+
}
|
|
35
53
|
}
|
|
36
54
|
});
|
|
37
55
|
};
|
|
@@ -50,23 +50,30 @@ export class AISummaryService {
|
|
|
50
50
|
for (const subscriber of this.subscribedStateSetters) {
|
|
51
51
|
subscriber(this.state);
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
subscriber
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
try {
|
|
54
|
+
const stream = await this.fetchStream(summaryStyle);
|
|
55
|
+
let bufferContent = '';
|
|
56
|
+
for await (const chunk of stream) {
|
|
57
|
+
if (chunk.type === 'ANSWER_PART') {
|
|
58
|
+
bufferContent += chunk.message.content;
|
|
59
|
+
for (const subscriber of this.subscribedStateSetters) {
|
|
60
|
+
subscriber({
|
|
61
|
+
...this.state,
|
|
62
|
+
content: bufferContent
|
|
63
|
+
});
|
|
64
|
+
}
|
|
63
65
|
}
|
|
64
66
|
}
|
|
67
|
+
this.state = {
|
|
68
|
+
status: 'done',
|
|
69
|
+
content: bufferContent
|
|
70
|
+
};
|
|
71
|
+
} catch {
|
|
72
|
+
this.state = {
|
|
73
|
+
status: 'error',
|
|
74
|
+
content: ''
|
|
75
|
+
};
|
|
65
76
|
}
|
|
66
|
-
this.state = {
|
|
67
|
-
status: 'done',
|
|
68
|
-
content: bufferContent
|
|
69
|
-
};
|
|
70
77
|
for (const subscriber of this.subscribedStateSetters) {
|
|
71
78
|
subscriber(this.state);
|
|
72
79
|
}
|
|
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export const context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "26.48.
|
|
7
|
+
packageVersion: "26.48.5"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -154,4 +154,17 @@ export const openUrl = async url => {
|
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
156
|
window.open(url, '_blank', 'noopener=yes');
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Migrate internal usages of the deprecated isFrameVisible to frameStyle
|
|
161
|
+
* This function is to be removed on deprecation of isFrameVisible.
|
|
162
|
+
*/
|
|
163
|
+
export const combineFrameStyle = (frameStyle, isFrameVisible) => {
|
|
164
|
+
if (frameStyle !== undefined) {
|
|
165
|
+
return frameStyle;
|
|
166
|
+
}
|
|
167
|
+
if (isFrameVisible) {
|
|
168
|
+
return 'show';
|
|
169
|
+
}
|
|
157
170
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
3
3
|
import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
4
|
-
import { isSpecialEvent } from '../../utils';
|
|
4
|
+
import { combineFrameStyle, isSpecialEvent } from '../../utils';
|
|
5
5
|
import * as measure from '../../utils/performance';
|
|
6
6
|
import { getDefinitionId, getServices, isFinalState, getClickUrl, getResourceType, getExtensionKey, getSubproduct, getProduct, getCanBeDatasource } from '../../state/helpers';
|
|
7
7
|
import { useSmartLink } from '../../state';
|
|
@@ -20,7 +20,7 @@ function Component({
|
|
|
20
20
|
isSelected,
|
|
21
21
|
isHovered,
|
|
22
22
|
isFrameVisible,
|
|
23
|
-
frameStyle,
|
|
23
|
+
frameStyle: frameStyleProp,
|
|
24
24
|
platform,
|
|
25
25
|
onClick,
|
|
26
26
|
appearance,
|
|
@@ -66,6 +66,7 @@ function Component({
|
|
|
66
66
|
let isFlexibleUi = useMemo(() => isFlexibleUiCard(children), [children]);
|
|
67
67
|
const enableFlexibleBlockCardFlag = Boolean(useFeatureFlag('enableFlexibleBlockCard'));
|
|
68
68
|
const actionOptions = combineActionOptions(actionOptionsProp, showServerActions, showActions, platform);
|
|
69
|
+
const frameStyle = combineFrameStyle(frameStyleProp, isFrameVisible);
|
|
69
70
|
|
|
70
71
|
// Setup UI handlers.
|
|
71
72
|
const handleClickWrapper = useCallback(event => {
|
|
@@ -248,7 +249,6 @@ function Component({
|
|
|
248
249
|
handleInvoke: handleInvoke,
|
|
249
250
|
analytics: analytics,
|
|
250
251
|
isSelected: isSelected,
|
|
251
|
-
isFrameVisible: isFrameVisible,
|
|
252
252
|
frameStyle: frameStyle,
|
|
253
253
|
platform: platform,
|
|
254
254
|
onResolve: onResolve,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { className, LinkWrapper, Wrapper, Header, IconWrapper, TextWrapper, Content } from './styled';
|
|
3
3
|
import { handleClickCommon } from '../../BlockCard/utils/handlers';
|
|
4
4
|
import { useMouseDownEvent } from '../../../state/analytics/useLinkClicked';
|
|
@@ -9,8 +9,7 @@ export const ExpandedFrame = ({
|
|
|
9
9
|
icon,
|
|
10
10
|
text,
|
|
11
11
|
isSelected,
|
|
12
|
-
|
|
13
|
-
frameStyle,
|
|
12
|
+
frameStyle = 'showOnHover',
|
|
14
13
|
href,
|
|
15
14
|
minWidth,
|
|
16
15
|
maxWidth,
|
|
@@ -21,7 +20,6 @@ export const ExpandedFrame = ({
|
|
|
21
20
|
const isInteractive = () => !isPlaceholder && (Boolean(href) || Boolean(onClick));
|
|
22
21
|
const handleClick = event => handleClickCommon(event, onClick);
|
|
23
22
|
const handleMouseDown = useMouseDownEvent();
|
|
24
|
-
const calculatedFrameStyle = useMemo(() => frameStyle !== undefined ? frameStyle : isFrameVisible ? 'show' : 'showOnHover', [frameStyle, isFrameVisible]);
|
|
25
23
|
const renderHeader = () => /*#__PURE__*/React.createElement(Header, {
|
|
26
24
|
className: "embed-header",
|
|
27
25
|
frameStyle: frameStyle
|
|
@@ -45,7 +43,7 @@ export const ExpandedFrame = ({
|
|
|
45
43
|
className: className,
|
|
46
44
|
isInteractive: isInteractive(),
|
|
47
45
|
isSelected: isSelected,
|
|
48
|
-
frameStyle:
|
|
46
|
+
frameStyle: frameStyle,
|
|
49
47
|
minWidth: minWidth,
|
|
50
48
|
maxWidth: maxWidth,
|
|
51
49
|
"data-testid": testId,
|
|
@@ -61,7 +59,7 @@ export const ExpandedFrame = ({
|
|
|
61
59
|
isInteractive: isInteractive(),
|
|
62
60
|
isSelected: isSelected,
|
|
63
61
|
minWidth: minWidth,
|
|
64
|
-
frameStyle:
|
|
62
|
+
frameStyle: frameStyle,
|
|
65
63
|
maxWidth: maxWidth,
|
|
66
64
|
"data-testid": testId,
|
|
67
65
|
"data-trello-do-not-use-override": testId,
|
|
@@ -26,7 +26,6 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
|
|
|
26
26
|
analytics,
|
|
27
27
|
handleInvoke,
|
|
28
28
|
isSelected,
|
|
29
|
-
isFrameVisible,
|
|
30
29
|
frameStyle,
|
|
31
30
|
platform,
|
|
32
31
|
onResolve,
|
|
@@ -67,7 +66,6 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
|
|
|
67
66
|
if (resolvedViewProps.preview) {
|
|
68
67
|
return /*#__PURE__*/React.createElement(EmbedCardResolvedView, _extends({}, resolvedViewProps, {
|
|
69
68
|
isSelected: isSelected,
|
|
70
|
-
isFrameVisible: isFrameVisible,
|
|
71
69
|
frameStyle: frameStyle,
|
|
72
70
|
inheritDimensions: inheritDimensions,
|
|
73
71
|
onClick: handleFrameClick,
|
|
@@ -110,6 +108,7 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
|
|
|
110
108
|
analytics: analytics,
|
|
111
109
|
context: unauthorisedViewProps.context,
|
|
112
110
|
extensionKey: extensionKey,
|
|
111
|
+
frameStyle: frameStyle,
|
|
113
112
|
isProductIntegrationSupported: isProductIntegrationSupported,
|
|
114
113
|
inheritDimensions: inheritDimensions,
|
|
115
114
|
isSelected: isSelected,
|
|
@@ -130,8 +129,8 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
|
|
|
130
129
|
if (forbiddenViewProps.preview) {
|
|
131
130
|
return /*#__PURE__*/React.createElement(EmbedCardResolvedView, _extends({}, forbiddenViewProps, {
|
|
132
131
|
title: forbiddenViewProps.link,
|
|
132
|
+
frameStyle: frameStyle,
|
|
133
133
|
isSelected: isSelected,
|
|
134
|
-
isFrameVisible: isFrameVisible,
|
|
135
134
|
inheritDimensions: inheritDimensions,
|
|
136
135
|
onClick: handleFrameClick,
|
|
137
136
|
ref: iframeRef
|
|
@@ -145,6 +144,7 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
|
|
|
145
144
|
});
|
|
146
145
|
return /*#__PURE__*/React.createElement(ForbiddenView, {
|
|
147
146
|
context: forbiddenViewProps.context,
|
|
147
|
+
frameStyle: frameStyle,
|
|
148
148
|
inheritDimensions: inheritDimensions,
|
|
149
149
|
isSelected: isSelected,
|
|
150
150
|
onAuthorize: handleAuthorize,
|
|
@@ -168,6 +168,7 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
|
|
|
168
168
|
}) : undefined;
|
|
169
169
|
return /*#__PURE__*/React.createElement(NotFoundView, {
|
|
170
170
|
context: notFoundViewProps.context,
|
|
171
|
+
frameStyle: frameStyle,
|
|
171
172
|
inheritDimensions: inheritDimensions,
|
|
172
173
|
isSelected: isSelected,
|
|
173
174
|
onClick: handleFrameClick,
|
|
@@ -11,7 +11,6 @@ export const EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(({
|
|
|
11
11
|
context,
|
|
12
12
|
onClick,
|
|
13
13
|
isSelected,
|
|
14
|
-
isFrameVisible,
|
|
15
14
|
frameStyle,
|
|
16
15
|
preview,
|
|
17
16
|
title,
|
|
@@ -48,7 +47,6 @@ export const EmbedCardResolvedView = /*#__PURE__*/React.forwardRef(({
|
|
|
48
47
|
}
|
|
49
48
|
return jsx(ExpandedFrame, {
|
|
50
49
|
isSelected: isSelected,
|
|
51
|
-
isFrameVisible: isFrameVisible,
|
|
52
50
|
frameStyle: frameStyle,
|
|
53
51
|
href: link,
|
|
54
52
|
testId: testId,
|
|
@@ -8,6 +8,7 @@ import { containerStyles, contentStyles, descriptionStyles, imageStyles, titleSt
|
|
|
8
8
|
const UnresolvedView = ({
|
|
9
9
|
button,
|
|
10
10
|
description,
|
|
11
|
+
frameStyle,
|
|
11
12
|
icon: iconUrlOrElement,
|
|
12
13
|
image,
|
|
13
14
|
inheritDimensions,
|
|
@@ -32,8 +33,15 @@ const UnresolvedView = ({
|
|
|
32
33
|
});
|
|
33
34
|
}, [iconUrlOrElement]);
|
|
34
35
|
return jsx(ExpandedFrame, {
|
|
35
|
-
allowScrollBar: true
|
|
36
|
-
|
|
36
|
+
allowScrollBar: true
|
|
37
|
+
// EDM-9259: Fix embed frame showing on unresolved views when frameStyle is set to hide.
|
|
38
|
+
// Set fallback to 'show' here to maintain the current behaviour when platform.editor.show-embed-card-frame-renderer is OFF.
|
|
39
|
+
// Remove 'show' on platform.editor.show-embed-card-frame-renderer cleanup as frameStyle will be set to 'show' both in renderer and editor.
|
|
40
|
+
// We want all views to be consistent and respect frameStyle instead of
|
|
41
|
+
// having resolved view default to showOnHover and unresolved view default to show.
|
|
42
|
+
// Default frameStyle is set inside <ExpandedFrame />
|
|
43
|
+
,
|
|
44
|
+
frameStyle: frameStyle !== null && frameStyle !== void 0 ? frameStyle : 'show',
|
|
37
45
|
href: url,
|
|
38
46
|
icon: icon,
|
|
39
47
|
inheritDimensions: inheritDimensions,
|
|
@@ -2,8 +2,6 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import Action from '../index';
|
|
4
4
|
import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
|
|
5
|
-
import { FormattedMessage } from 'react-intl-next';
|
|
6
|
-
import { messages } from '../../../../../../messages';
|
|
7
5
|
import { openEmbedModalWithFlexibleUiIcon } from '../../../utils';
|
|
8
6
|
import useInvokeClientAction from '../../../../../../state/hooks/use-invoke-client-action';
|
|
9
7
|
import { ActionName } from '../../../../../../constants';
|
|
@@ -51,8 +49,7 @@ const PreviewAction = props => {
|
|
|
51
49
|
if (onClick) {
|
|
52
50
|
onClick();
|
|
53
51
|
}
|
|
54
|
-
}
|
|
55
|
-
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.preview_improved)
|
|
52
|
+
}
|
|
56
53
|
};
|
|
57
54
|
return /*#__PURE__*/React.createElement(Action, _extends({}, action, {
|
|
58
55
|
appearance: appearance,
|
|
@@ -3,27 +3,28 @@ import React from 'react';
|
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
4
|
import Tooltip, { TooltipPrimitive } from '@atlaskit/tooltip';
|
|
5
5
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
6
|
-
const AIIndicatorTooltipPrimitive = styled(TooltipPrimitive)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
padding:
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
const AIIndicatorTooltipPrimitive = styled(TooltipPrimitive)({
|
|
7
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
8
|
+
backgroundColor: "var(--ds-surface-raised, white)",
|
|
9
|
+
boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))",
|
|
10
|
+
boxSizing: 'content-box',
|
|
11
|
+
padding: "var(--ds-space-200, 16px)",
|
|
12
|
+
maxWidth: '350px'
|
|
13
|
+
});
|
|
14
14
|
const triggerStyles = xcss({
|
|
15
15
|
display: 'inline-flex'
|
|
16
16
|
});
|
|
17
17
|
const AIIndicatorTooltip = ({
|
|
18
18
|
content,
|
|
19
|
-
trigger
|
|
19
|
+
trigger,
|
|
20
|
+
xcss: overrideXcss
|
|
20
21
|
}) => {
|
|
21
22
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
22
23
|
component: AIIndicatorTooltipPrimitive,
|
|
23
24
|
content: content,
|
|
24
25
|
tag: "span"
|
|
25
26
|
}, tooltipProps => /*#__PURE__*/React.createElement(Box, _extends({
|
|
26
|
-
xcss: triggerStyles
|
|
27
|
+
xcss: [triggerStyles, overrideXcss]
|
|
27
28
|
}, tooltipProps), trigger));
|
|
28
29
|
};
|
|
29
30
|
export default AIIndicatorTooltip;
|
|
@@ -41,6 +41,10 @@ const iconTooltipDescStyles = xcss({
|
|
|
41
41
|
fontWeight: '400',
|
|
42
42
|
lineHeight: '14px'
|
|
43
43
|
});
|
|
44
|
+
const iconTooltipTriggerStyles = xcss({
|
|
45
|
+
position: 'relative',
|
|
46
|
+
bottom: 'space.negative.050'
|
|
47
|
+
});
|
|
44
48
|
const AIStateDone = ({
|
|
45
49
|
appearance,
|
|
46
50
|
testId
|
|
@@ -72,7 +76,8 @@ const AIStateDone = ({
|
|
|
72
76
|
}, chunks)
|
|
73
77
|
}
|
|
74
78
|
}))))),
|
|
75
|
-
trigger: icon
|
|
79
|
+
trigger: icon,
|
|
80
|
+
xcss: iconTooltipTriggerStyles
|
|
76
81
|
});
|
|
77
82
|
default:
|
|
78
83
|
return jsx(AIIndicatorContainer, {
|
|
@@ -2,25 +2,25 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
3
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
4
|
import { Box, Inline } from '@atlaskit/primitives';
|
|
5
|
-
import { ActionName, SmartLinkSize, SmartLinkWidth
|
|
5
|
+
import { ActionName, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
|
|
6
6
|
import ActionGroup from '../../action-group';
|
|
7
7
|
import Block from '../../block';
|
|
8
8
|
import ElementGroup from '../../element-group';
|
|
9
9
|
import AIStateIndicator from '../ai-state-indicator';
|
|
10
10
|
import { renderElementItems } from '../../utils';
|
|
11
11
|
import { messages } from '../../../../../../messages';
|
|
12
|
-
import AiIcon from '../../../../../common/ai-icon';
|
|
13
|
-
import AISummary from '../../../../../common/ai-summary';
|
|
14
12
|
import { useAISummary } from '../../../../../../state/hooks/use-ai-summary';
|
|
15
13
|
import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context';
|
|
14
|
+
import AIIcon from '../../../../../common/ai-icon';
|
|
15
|
+
import AISummary from '../../../../../common/ai-summary';
|
|
16
16
|
const AISummaryBlockResolvedView = props => {
|
|
17
17
|
const {
|
|
18
18
|
actions = [],
|
|
19
19
|
metadata,
|
|
20
|
-
testId,
|
|
21
20
|
onActionMenuOpenChange,
|
|
22
21
|
onAIActionChange,
|
|
23
|
-
size = SmartLinkSize.Medium
|
|
22
|
+
size = SmartLinkSize.Medium,
|
|
23
|
+
testId
|
|
24
24
|
} = props;
|
|
25
25
|
const [aiState, setAIState] = useState('ready');
|
|
26
26
|
const metadataElements = renderElementItems(metadata);
|
|
@@ -30,8 +30,11 @@ const AISummaryBlockResolvedView = props => {
|
|
|
30
30
|
url
|
|
31
31
|
});
|
|
32
32
|
const {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
state: {
|
|
34
|
+
content
|
|
35
|
+
},
|
|
36
|
+
isSummarisedOnMount
|
|
37
|
+
} = aiSummary;
|
|
35
38
|
const onAIActionClick = useCallback(() => {
|
|
36
39
|
setAIState('loading');
|
|
37
40
|
if (onAIActionChange) {
|
|
@@ -45,8 +48,8 @@ const AISummaryBlockResolvedView = props => {
|
|
|
45
48
|
name: ActionName.CustomAction,
|
|
46
49
|
onClick: onAIActionClick,
|
|
47
50
|
testId: `${testId}-ai-summary-action`,
|
|
48
|
-
icon: /*#__PURE__*/React.createElement(
|
|
49
|
-
label: "
|
|
51
|
+
icon: /*#__PURE__*/React.createElement(AIIcon, {
|
|
52
|
+
label: "AIIcon"
|
|
50
53
|
})
|
|
51
54
|
};
|
|
52
55
|
return [aiAction, ...actions];
|
|
@@ -64,17 +67,19 @@ const AISummaryBlockResolvedView = props => {
|
|
|
64
67
|
direction: SmartLinkDirection.Vertical,
|
|
65
68
|
testId: `${testId}-resolved-view`
|
|
66
69
|
}), /*#__PURE__*/React.createElement(AISummary, {
|
|
67
|
-
content: content
|
|
70
|
+
content: content,
|
|
71
|
+
showIcon: isSummarisedOnMount
|
|
68
72
|
}), /*#__PURE__*/React.createElement(Inline, {
|
|
69
73
|
alignBlock: "center",
|
|
70
74
|
alignInline: "end",
|
|
71
75
|
grow: "fill",
|
|
72
76
|
spread: "space-between"
|
|
73
|
-
}, /*#__PURE__*/React.createElement(Box, null, aiState === 'loading' || aiState === 'done' ? /*#__PURE__*/React.createElement(AIStateIndicator, {
|
|
77
|
+
}, /*#__PURE__*/React.createElement(Box, null, !isSummarisedOnMount && (aiState === 'loading' || aiState === 'done') ? /*#__PURE__*/React.createElement(AIStateIndicator, {
|
|
74
78
|
state: aiState,
|
|
75
|
-
testId: testId
|
|
79
|
+
testId: `${testId}-state-indicator`
|
|
76
80
|
}) : /*#__PURE__*/React.createElement(ElementGroup, {
|
|
77
|
-
width: SmartLinkWidth.FitToContent
|
|
81
|
+
width: SmartLinkWidth.FitToContent,
|
|
82
|
+
testId: `${testId}-metadata-group`
|
|
78
83
|
}, metadataElements)), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(ActionGroup, {
|
|
79
84
|
onDropdownOpenChange: onDropdownOpenChange,
|
|
80
85
|
items: combinedActions,
|
|
@@ -8,11 +8,10 @@ import Block from '../../block';
|
|
|
8
8
|
import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize } from '../../../../../../constants';
|
|
9
9
|
import { getLinkLineHeight, getLinkSizeStyles, getTruncateStyles } from '../../../utils';
|
|
10
10
|
import ElementGroup from '../../element-group';
|
|
11
|
-
import { tokens } from '../../../../../../utils/token';
|
|
12
11
|
const actionStyles = css`
|
|
13
12
|
cursor: pointer;
|
|
14
13
|
:hover {
|
|
15
|
-
color: ${
|
|
14
|
+
color: ${"var(--ds-text-subtle, #8993A4)"};
|
|
16
15
|
text-decoration: underline;
|
|
17
16
|
}
|
|
18
17
|
`;
|
|
@@ -24,9 +23,9 @@ const getMessageStyles = (size, hasAction) => {
|
|
|
24
23
|
${hasAction ? actionStyles : ''}
|
|
25
24
|
${sizeStyles}
|
|
26
25
|
${getTruncateStyles(1, getLinkLineHeight(size))}
|
|
27
|
-
color: ${
|
|
26
|
+
color: ${"var(--ds-text-disabled, #6B778C)"};
|
|
28
27
|
:focus {
|
|
29
|
-
outline: ${
|
|
28
|
+
outline: ${"var(--ds-border-focused, #388BFF)"} solid 2px;
|
|
30
29
|
}
|
|
31
30
|
`;
|
|
32
31
|
};
|
|
@@ -3,7 +3,6 @@ import React, { useContext } from 'react';
|
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { MediaPlacement, SmartLinkSize, SmartLinkTheme } from '../../../../constants';
|
|
5
5
|
import { isFlexibleUiBlock, isFlexibleUiPreviewBlock, isFlexibleUiTitleBlock } from '../../../../utils/flexible';
|
|
6
|
-
import { tokens } from '../../../../utils/token';
|
|
7
6
|
import { FlexibleUiContext } from '../../../../state/flexible-ui-context';
|
|
8
7
|
import LayeredLink from './layered-link';
|
|
9
8
|
import HoverCardControl from './hover-card-control';
|
|
@@ -99,7 +98,7 @@ export const getContainerStyles = (size, hideBackground, hideElevation, hidePadd
|
|
|
99
98
|
min-width: 0;
|
|
100
99
|
overflow-x: hidden;
|
|
101
100
|
position: relative;
|
|
102
|
-
${hideBackground ? '' : `background-color: ${
|
|
101
|
+
${hideBackground ? '' : `background-color: ${"var(--ds-surface-raised, #FFFFFF)"};`}
|
|
103
102
|
${paddingCss}
|
|
104
103
|
${hideElevation ? '' : elevationStyles}
|
|
105
104
|
${clickableContainer ? clickableContainerStyles : ''}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
|
-
import { tokens } from '../../../../../utils/token';
|
|
5
4
|
import { getFormattedMessage, getIconSizeStyles } from '../../utils';
|
|
6
5
|
import { IconType } from '../../../../../constants';
|
|
7
6
|
import { messages } from '../../../../../messages';
|
|
@@ -13,7 +12,7 @@ const badgeStyles = css`
|
|
|
13
12
|
min-width: fit-content;
|
|
14
13
|
`;
|
|
15
14
|
const iconStyles = css`
|
|
16
|
-
color: ${
|
|
15
|
+
color: ${"var(--ds-icon-subtle, #626F86)"};
|
|
17
16
|
line-height: 0;
|
|
18
17
|
vertical-align: middle;
|
|
19
18
|
${getIconSizeStyles('1rem')}
|
|
@@ -25,7 +24,7 @@ const iconStyles = css`
|
|
|
25
24
|
}
|
|
26
25
|
`;
|
|
27
26
|
const labelStyles = css`
|
|
28
|
-
color: ${
|
|
27
|
+
color: ${"var(--ds-text-subtlest, #626F86)"};
|
|
29
28
|
font-size: 0.75rem;
|
|
30
29
|
line-height: 1rem;
|
|
31
30
|
padding-left: 0.125rem;
|
|
@@ -4,11 +4,10 @@ import React from 'react';
|
|
|
4
4
|
import { useIntl, FormattedMessage } from 'react-intl-next';
|
|
5
5
|
import { css, jsx } from '@emotion/react';
|
|
6
6
|
import { getTruncateStyles } from '../../utils';
|
|
7
|
-
import { tokens } from '../../../../../utils/token';
|
|
8
7
|
import { selectUnit } from '@formatjs/intl-utils';
|
|
9
8
|
import { messages } from '../../../../../messages';
|
|
10
9
|
const styles = css`
|
|
11
|
-
color: ${
|
|
10
|
+
color: ${"var(--ds-text-subtlest, #626F86)"};
|
|
12
11
|
font-size: 0.75rem;
|
|
13
12
|
line-height: 1rem;
|
|
14
13
|
${getTruncateStyles(1)}
|
|
@@ -5,7 +5,6 @@ import { css, jsx } from '@emotion/react';
|
|
|
5
5
|
import Tooltip from '@atlaskit/tooltip';
|
|
6
6
|
import { SmartLinkInternalTheme, SmartLinkSize, SmartLinkTheme } from '../../../../../constants';
|
|
7
7
|
import { getLinkLineHeight, getLinkSizeStyles, getTruncateStyles, hasWhiteSpace } from '../../utils';
|
|
8
|
-
import { tokens } from '../../../../../utils/token';
|
|
9
8
|
import { useMouseDownEvent } from '../../../../../state/analytics/useLinkClicked';
|
|
10
9
|
const DEFAULT_MAX_LINES = 2;
|
|
11
10
|
const MAXIMUM_MAX_LINES = 2;
|
|
@@ -34,24 +33,24 @@ const getThemeStyles = theme => {
|
|
|
34
33
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
35
34
|
case SmartLinkTheme.Black:
|
|
36
35
|
return css`
|
|
37
|
-
color: ${
|
|
36
|
+
color: ${"var(--ds-text-subtle, #44546F)"};
|
|
38
37
|
:active {
|
|
39
|
-
color: ${
|
|
38
|
+
color: ${"var(--ds-text, #172B4D)"};
|
|
40
39
|
}
|
|
41
40
|
:hover {
|
|
42
|
-
color: ${
|
|
41
|
+
color: ${"var(--ds-text-subtle, #44546F)"};
|
|
43
42
|
text-decoration: underline;
|
|
44
43
|
}
|
|
45
44
|
`;
|
|
46
45
|
case SmartLinkTheme.Link:
|
|
47
46
|
default:
|
|
48
47
|
return css`
|
|
49
|
-
color: ${
|
|
48
|
+
color: ${"var(--ds-link, #0C66E4)"};
|
|
50
49
|
:active {
|
|
51
|
-
color: ${
|
|
50
|
+
color: ${"var(--ds-link-pressed, #0055CC)"};
|
|
52
51
|
}
|
|
53
52
|
:hover {
|
|
54
|
-
color: ${
|
|
53
|
+
color: ${"var(--ds-link, #0C66E4)"};
|
|
55
54
|
text-decoration: underline;
|
|
56
55
|
}
|
|
57
56
|
`;
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { getFormattedMessage, getTruncateStyles } from '../../utils';
|
|
5
|
-
import { tokens } from '../../../../../utils/token';
|
|
6
5
|
const getStyles = maxLines => css`
|
|
7
|
-
color: ${
|
|
6
|
+
color: ${"var(--ds-text-subtlest, #626F86)"};
|
|
8
7
|
font-size: 0.75rem;
|
|
9
8
|
line-height: 1rem;
|
|
10
9
|
white-space: normal;
|
|
@@ -7,7 +7,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
|
|
|
7
7
|
import LinkWarningModal from './LinkWarningModal';
|
|
8
8
|
const PACKAGE_DATA = {
|
|
9
9
|
packageName: "@atlaskit/smart-card",
|
|
10
|
-
packageVersion: "26.48.
|
|
10
|
+
packageVersion: "26.48.5",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
const Link = withLinkClickedEvent('a');
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import Markdown from 'markdown-to-jsx';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
import AIStateIndicator from '../../FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator';
|
|
6
|
+
const AITooltipIcon = () => jsx(AIStateIndicator, {
|
|
7
|
+
appearance: "icon-only",
|
|
8
|
+
state: "done",
|
|
9
|
+
testId: "ai-tooltip"
|
|
10
|
+
});
|
|
11
|
+
const AISummaryCSS = css({
|
|
12
|
+
fontSize: '0.75rem',
|
|
13
|
+
lineHeight: '1rem',
|
|
14
|
+
wordWrap: 'break-word',
|
|
15
|
+
whiteSpace: 'normal'
|
|
16
|
+
});
|
|
12
17
|
/**
|
|
13
18
|
* A component to render a response from AI in markdown text.
|
|
14
19
|
* @internal
|
|
@@ -17,6 +22,8 @@ const AISummaryCSS = css`
|
|
|
17
22
|
|
|
18
23
|
const AISummary = ({
|
|
19
24
|
content,
|
|
25
|
+
showIcon = false,
|
|
26
|
+
iconComponent,
|
|
20
27
|
overrideCss,
|
|
21
28
|
testId = 'ai-summary'
|
|
22
29
|
}) => {
|
|
@@ -26,9 +33,12 @@ const AISummary = ({
|
|
|
26
33
|
return jsx(Markdown, {
|
|
27
34
|
"data-testid": testId,
|
|
28
35
|
css: [AISummaryCSS, overrideCss],
|
|
29
|
-
children: content,
|
|
36
|
+
children: showIcon ? `${content} <Icon />` : content,
|
|
30
37
|
options: {
|
|
31
|
-
forceWrapper: true
|
|
38
|
+
forceWrapper: true,
|
|
39
|
+
overrides: {
|
|
40
|
+
Icon: iconComponent !== null && iconComponent !== void 0 ? iconComponent : AITooltipIcon
|
|
41
|
+
}
|
|
32
42
|
}
|
|
33
43
|
});
|
|
34
44
|
};
|