@atlaskit/smart-card 26.48.8 → 26.49.1
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/__tests_external__/page-objects/BaseCard.js +1 -1
- package/dist/cjs/__tests_external__/page-objects/BlockCard.js +1 -1
- package/dist/cjs/__tests_external__/page-objects/EmbedCard.js +1 -1
- package/dist/cjs/__tests_external__/page-objects/InlineCard.js +1 -1
- package/dist/cjs/ssr.js +2 -2
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +39 -27
- package/dist/cjs/state/hooks/use-ai-summary/index.js +16 -38
- package/dist/cjs/state/hooks/use-invoke-client-action/index.js +2 -2
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/flexible.js +2 -2
- package/dist/cjs/utils/index.js +2 -2
- package/dist/cjs/utils/mocks.js +1 -1
- package/dist/cjs/view/BlockCard/components/ActionList.js +2 -2
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleErroredView.js +2 -2
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleForbiddenView.js +2 -2
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleNotFoundView.js +2 -2
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +2 -2
- package/dist/cjs/view/Card/index.js +1 -1
- package/dist/cjs/view/CardWithData/component.js +1 -1
- package/dist/cjs/view/CardWithData/loader.js +3 -3
- package/dist/cjs/view/CardWithUrl/component-lazy/LazyIntersectionObserverCard.js +2 -2
- package/dist/cjs/view/CardWithUrl/component-lazy/LazyLazilyRenderCard.js +2 -2
- package/dist/cjs/view/CardWithUrl/component.js +2 -2
- package/dist/cjs/view/CardWithUrl/loader.js +2 -2
- package/dist/cjs/view/EmbedCard/EmbedResizeMessageListener.js +1 -1
- package/dist/cjs/view/EmbedCard/components/ExpandedFrame.js +22 -3
- package/dist/cjs/view/EmbedCard/components/Frame.js +2 -2
- package/dist/cjs/view/EmbedCard/components/styled.js +103 -23
- package/dist/cjs/view/EmbedCard/views/forbidden-view/index.js +2 -2
- package/dist/cjs/view/EmbedCard/views/not-found-view/index.js +2 -2
- package/dist/cjs/view/EmbedCard/views/unauthorized-view/index.js +2 -2
- package/dist/cjs/view/EmbedCard/views/unresolved-view/index.js +2 -2
- package/dist/cjs/view/EmbedModal/components/analytics/index.js +2 -2
- package/dist/cjs/view/EmbedModal/components/error-boundary/index.js +2 -2
- package/dist/cjs/view/EmbedModal/components/link-info/index.js +2 -2
- package/dist/cjs/view/EmbedModal/index.js +2 -2
- package/dist/cjs/view/EmbedModal/utils.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-button/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/actions/action/server-action/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/actions/follow-action/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/actions/utils.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +39 -31
- package/dist/cjs/view/FlexibleCard/components/blocks/block/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/resolved/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/related-urls-block/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/related-urls-block/resolved/related-url-list/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/related-urls-block/resolved/related-url-list/related-url-item/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/related-urls-block/resolved/related-url-list/resolved-result-stack/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -5
- package/dist/cjs/view/FlexibleCard/components/container/hover-card-control/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/container/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/elements/avatar-group/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/elements/icon/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/error-boundary/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-item/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/elements/preview/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/elements/snippet-element/index.js +2 -2
- package/dist/cjs/view/FlexibleCard/components/elements/utils.js +2 -2
- package/dist/cjs/view/FlexibleCard/index.js +2 -2
- package/dist/cjs/view/HoverCard/components/ContentContainer.js +42 -13
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +2 -2
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +3 -12
- package/dist/cjs/view/HoverCard/components/ImagePreview.js +2 -2
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +65 -18
- package/dist/cjs/view/HoverCard/components/views/unauthorised/index.js +2 -2
- package/dist/cjs/view/InlineCard/ErroredView/index.js +1 -1
- package/dist/cjs/view/InlineCard/ForbiddenView/index.js +1 -1
- package/dist/cjs/view/InlineCard/Frame/index.js +2 -2
- package/dist/cjs/view/InlineCard/IconAndTitleLayout/index.js +1 -1
- package/dist/cjs/view/InlineCard/ResolvedView/index.js +1 -1
- package/dist/cjs/view/InlineCard/ResolvingView/index.js +1 -1
- package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +1 -1
- package/dist/cjs/view/InlineCard/index.js +2 -2
- package/dist/cjs/view/LinkUrl/LinkWarningModal/index.js +2 -2
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/LinkView/index.js +1 -1
- package/dist/cjs/view/common/UnauthorisedViewContent.js +2 -2
- package/dist/cjs/view/common/ai-prism/ai-glowing-border/animated-svg-container.js +2 -2
- package/dist/cjs/view/common/ai-summary/index.js +9 -3
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +14 -5
- package/dist/es2019/state/hooks/use-ai-summary/index.js +17 -35
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/EmbedCard/components/ExpandedFrame.js +21 -4
- package/dist/es2019/view/EmbedCard/components/styled.js +99 -111
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +33 -26
- package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +0 -3
- package/dist/es2019/view/HoverCard/components/ContentContainer.js +35 -10
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +2 -7
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +56 -7
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/common/ai-summary/index.js +7 -3
- package/dist/esm/__tests_external__/page-objects/BaseCard.js +1 -1
- package/dist/esm/__tests_external__/page-objects/BlockCard.js +1 -1
- package/dist/esm/__tests_external__/page-objects/EmbedCard.js +1 -1
- package/dist/esm/__tests_external__/page-objects/InlineCard.js +1 -1
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +39 -27
- package/dist/esm/state/hooks/use-ai-summary/index.js +17 -39
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/mocks.js +1 -1
- package/dist/esm/view/Card/index.js +1 -1
- package/dist/esm/view/CardWithData/component.js +1 -1
- package/dist/esm/view/CardWithData/loader.js +1 -1
- package/dist/esm/view/EmbedCard/EmbedResizeMessageListener.js +1 -1
- package/dist/esm/view/EmbedCard/components/ExpandedFrame.js +23 -4
- package/dist/esm/view/EmbedCard/components/styled.js +100 -20
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +38 -30
- package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +0 -3
- package/dist/esm/view/HoverCard/components/ContentContainer.js +39 -13
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +2 -11
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +66 -18
- package/dist/esm/view/InlineCard/ErroredView/index.js +1 -1
- package/dist/esm/view/InlineCard/ForbiddenView/index.js +1 -1
- package/dist/esm/view/InlineCard/IconAndTitleLayout/index.js +1 -1
- package/dist/esm/view/InlineCard/ResolvedView/index.js +1 -1
- package/dist/esm/view/InlineCard/ResolvingView/index.js +1 -1
- package/dist/esm/view/InlineCard/UnauthorisedView/index.js +1 -1
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/LinkView/index.js +1 -1
- package/dist/esm/view/common/ai-summary/index.js +9 -3
- package/dist/types/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +3 -1
- package/dist/types/state/hooks/use-ai-summary/index.d.ts +0 -1
- package/dist/types/view/EmbedCard/components/styled.d.ts +5 -1
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +2 -2
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +2 -3
- package/dist/types/view/HoverCard/components/views/resolved/types.d.ts +0 -2
- package/dist/types/view/HoverCard/types.d.ts +1 -1
- package/dist/types/view/common/ai-summary/index.d.ts +4 -0
- package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +3 -1
- package/dist/types-ts4.5/state/hooks/use-ai-summary/index.d.ts +0 -1
- package/dist/types-ts4.5/view/EmbedCard/components/styled.d.ts +5 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +2 -2
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +2 -3
- package/dist/types-ts4.5/view/HoverCard/components/views/resolved/types.d.ts +0 -2
- package/dist/types-ts4.5/view/HoverCard/types.d.ts +1 -1
- package/dist/types-ts4.5/view/common/ai-summary/index.d.ts +4 -0
- package/package.json +5 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState, useEffect
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
2
|
import { AISummariesStore } from './ai-summary-service/store';
|
|
3
3
|
import { AISummaryService } from './ai-summary-service';
|
|
4
4
|
export const useAISummary = props => {
|
|
@@ -6,50 +6,32 @@ export const useAISummary = props => {
|
|
|
6
6
|
const {
|
|
7
7
|
url,
|
|
8
8
|
baseUrl,
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
headers,
|
|
10
|
+
product
|
|
11
11
|
} = props;
|
|
12
12
|
const [state, setState] = useState(((_AISummariesStore$get = AISummariesStore.get(url)) === null || _AISummariesStore$get === void 0 ? void 0 : _AISummariesStore$get.state) || {
|
|
13
13
|
status: 'ready',
|
|
14
14
|
content: ''
|
|
15
15
|
});
|
|
16
|
-
|
|
17
|
-
// Can be used to know the summary status upon mounting a component (HoverCard UI state for example).
|
|
18
|
-
// For other scenarios, opt for dynamic status updates via state.status.
|
|
19
|
-
const isSummarisedOnMount = useMemo(() => {
|
|
20
|
-
var _AISummariesStore$get2;
|
|
21
|
-
return ((_AISummariesStore$get2 = AISummariesStore.get(url)) === null || _AISummariesStore$get2 === void 0 ? void 0 : _AISummariesStore$get2.state.status) === 'done';
|
|
22
|
-
}, [url]);
|
|
23
16
|
useEffect(() => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return () => unsubscribe();
|
|
33
|
-
} else {
|
|
34
|
-
var _AISummariesStore$get3;
|
|
35
|
-
//if we want to create a new AI service and wish to subscribe for updates
|
|
36
|
-
AISummariesStore.set(url, new AISummaryService({
|
|
37
|
-
url,
|
|
38
|
-
baseUrl,
|
|
39
|
-
product,
|
|
40
|
-
headers
|
|
41
|
-
}));
|
|
42
|
-
const unsubscribe = (_AISummariesStore$get3 = AISummariesStore.get(url)) === null || _AISummariesStore$get3 === void 0 ? void 0 : _AISummariesStore$get3.subscribe(setState);
|
|
43
|
-
return () => unsubscribe && unsubscribe();
|
|
44
|
-
}
|
|
17
|
+
var _AISummariesStore$get2;
|
|
18
|
+
if (!AISummariesStore.get(url)) {
|
|
19
|
+
AISummariesStore.set(url, new AISummaryService({
|
|
20
|
+
url,
|
|
21
|
+
baseUrl,
|
|
22
|
+
headers,
|
|
23
|
+
product
|
|
24
|
+
}));
|
|
45
25
|
}
|
|
46
|
-
|
|
26
|
+
|
|
27
|
+
//returns function that calls unsubscribe method
|
|
28
|
+
return (_AISummariesStore$get2 = AISummariesStore.get(url)) === null || _AISummariesStore$get2 === void 0 ? void 0 : _AISummariesStore$get2.subscribe(setState);
|
|
29
|
+
}, [url, baseUrl, headers, product]);
|
|
47
30
|
const summariseUrl = () => {
|
|
48
|
-
var _AISummariesStore$
|
|
49
|
-
return (_AISummariesStore$
|
|
31
|
+
var _AISummariesStore$get3;
|
|
32
|
+
return (_AISummariesStore$get3 = AISummariesStore.get(url)) === null || _AISummariesStore$get3 === void 0 ? void 0 : _AISummariesStore$get3.summariseUrl();
|
|
50
33
|
};
|
|
51
34
|
return {
|
|
52
|
-
isSummarisedOnMount,
|
|
53
35
|
summariseUrl,
|
|
54
36
|
state
|
|
55
37
|
};
|
|
@@ -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.49.1"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { className, LinkWrapper, Wrapper, Header, IconWrapper, TextWrapper, Content } from './styled';
|
|
2
|
+
import { className, LinkWrapper, Wrapper, Header, IconWrapper, TextWrapper, TooltipWrapper, Content } from './styled';
|
|
3
3
|
import { handleClickCommon } from '../../BlockCard/utils/handlers';
|
|
4
4
|
import { useMouseDownEvent } from '../../../state/analytics/useLinkClicked';
|
|
5
|
+
import Tooltip from '@atlaskit/tooltip';
|
|
6
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
7
|
export const ExpandedFrame = ({
|
|
6
8
|
isPlaceholder = false,
|
|
7
9
|
children,
|
|
@@ -20,7 +22,7 @@ export const ExpandedFrame = ({
|
|
|
20
22
|
const isInteractive = () => !isPlaceholder && (Boolean(href) || Boolean(onClick));
|
|
21
23
|
const handleClick = event => handleClickCommon(event, onClick);
|
|
22
24
|
const handleMouseDown = useMouseDownEvent();
|
|
23
|
-
const
|
|
25
|
+
const renderHeaderOld = () => /*#__PURE__*/React.createElement(Header, {
|
|
24
26
|
className: "embed-header",
|
|
25
27
|
frameStyle: frameStyle
|
|
26
28
|
}, /*#__PURE__*/React.createElement(IconWrapper, {
|
|
@@ -32,6 +34,21 @@ export const ExpandedFrame = ({
|
|
|
32
34
|
onClick: handleClick,
|
|
33
35
|
onMouseDown: handleMouseDown
|
|
34
36
|
}, text)));
|
|
37
|
+
const renderHeader = () => /*#__PURE__*/React.createElement(Header, {
|
|
38
|
+
className: "embed-header",
|
|
39
|
+
frameStyle: frameStyle
|
|
40
|
+
}, /*#__PURE__*/React.createElement(IconWrapper, {
|
|
41
|
+
isPlaceholder: isPlaceholder
|
|
42
|
+
}, !isPlaceholder && icon), /*#__PURE__*/React.createElement(TooltipWrapper, null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
43
|
+
content: text,
|
|
44
|
+
hideTooltipOnMouseDown: true
|
|
45
|
+
}, /*#__PURE__*/React.createElement(TextWrapper, {
|
|
46
|
+
isPlaceholder: isPlaceholder
|
|
47
|
+
}, !isPlaceholder && /*#__PURE__*/React.createElement("a", {
|
|
48
|
+
href: href,
|
|
49
|
+
onClick: handleClick,
|
|
50
|
+
onMouseDown: handleMouseDown
|
|
51
|
+
}, text)))));
|
|
35
52
|
const renderContent = () => /*#__PURE__*/React.createElement(Content, {
|
|
36
53
|
"data-testid": "embed-content-wrapper",
|
|
37
54
|
allowScrollBar: allowScrollBar,
|
|
@@ -52,7 +69,7 @@ export const ExpandedFrame = ({
|
|
|
52
69
|
,
|
|
53
70
|
"data-is-selected": isSelected,
|
|
54
71
|
inheritDimensions: inheritDimensions
|
|
55
|
-
}, renderHeader(), renderContent());
|
|
72
|
+
}, getBooleanFF('platform.linking-platform.smart-card.embed-card-header-tooltip') ? renderHeader() : renderHeaderOld(), renderContent());
|
|
56
73
|
} else {
|
|
57
74
|
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
58
75
|
className: className,
|
|
@@ -66,6 +83,6 @@ export const ExpandedFrame = ({
|
|
|
66
83
|
"data-is-selected": isSelected,
|
|
67
84
|
"data-wrapper-type": "default",
|
|
68
85
|
"data-is-interactive": isInteractive()
|
|
69
|
-
}, renderHeader(), renderContent());
|
|
86
|
+
}, getBooleanFF('platform.linking-platform.smart-card.embed-card-header-tooltip') ? renderHeader() : renderHeaderOld(), renderContent());
|
|
70
87
|
}
|
|
71
88
|
};
|
|
@@ -136,6 +136,8 @@ function visible({
|
|
|
136
136
|
}) {
|
|
137
137
|
return frameStyle === 'show' ? visibleStyles : '';
|
|
138
138
|
}
|
|
139
|
+
|
|
140
|
+
// eslint-disable-next-line @atlaskit/design-system/no-styled-tagged-template-expression
|
|
139
141
|
export const LinkWrapper = styled.div`
|
|
140
142
|
${props => wrapperStyles(props)} &:hover {
|
|
141
143
|
text-decoration: none;
|
|
@@ -143,33 +145,27 @@ export const LinkWrapper = styled.div`
|
|
|
143
145
|
`;
|
|
144
146
|
|
|
145
147
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
146
|
-
export const Wrapper = styled.div
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
`;
|
|
148
|
+
export const Wrapper = styled.div(props => wrapperStyles(props), {
|
|
149
|
+
marginTop: '10px'
|
|
150
|
+
});
|
|
150
151
|
export const embedHeaderHeight = 32;
|
|
151
|
-
export const Header = styled.div
|
|
152
|
-
height:
|
|
153
|
-
position: absolute
|
|
154
|
-
|
|
155
|
-
width: 100
|
|
156
|
-
display: flex
|
|
157
|
-
|
|
158
|
-
color:
|
|
159
|
-
opacity: 0
|
|
160
|
-
transition: 300ms opacity cubic-bezier(0.15, 1, 0.3, 1)
|
|
161
|
-
|
|
162
|
-
${({
|
|
152
|
+
export const Header = styled.div({
|
|
153
|
+
height: `${embedHeaderHeight}px`,
|
|
154
|
+
position: 'absolute',
|
|
155
|
+
zIndex: 1,
|
|
156
|
+
width: '100%',
|
|
157
|
+
display: 'flex',
|
|
158
|
+
alignItems: 'center',
|
|
159
|
+
color: `var(--ds-icon, ${colors.N300})`,
|
|
160
|
+
opacity: 0,
|
|
161
|
+
transition: '300ms opacity cubic-bezier(0.15, 1, 0.3, 1)'
|
|
162
|
+
}, ({
|
|
163
163
|
frameStyle
|
|
164
164
|
}) => getBooleanFF('platform.editor.show-embed-card-frame-renderer') && frameStyle === 'show' ? `
|
|
165
165
|
box-sizing: border-box;
|
|
166
166
|
padding: 0 ${"var(--ds-space-100, 8px)"};
|
|
167
|
-
` : ''
|
|
168
|
-
|
|
169
|
-
export const IconWrapper = styled.div`
|
|
170
|
-
${borderRadius}
|
|
171
|
-
${csssize(16)}
|
|
172
|
-
${({
|
|
167
|
+
` : '');
|
|
168
|
+
export const IconWrapper = styled.div(borderRadius, csssize(16), ({
|
|
173
169
|
isPlaceholder
|
|
174
170
|
}) => {
|
|
175
171
|
if (isPlaceholder) {
|
|
@@ -179,10 +175,10 @@ export const IconWrapper = styled.div`
|
|
|
179
175
|
} else {
|
|
180
176
|
return '';
|
|
181
177
|
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
178
|
+
}, {
|
|
179
|
+
marginRight: "var(--ds-space-050, 4px)"
|
|
180
|
+
});
|
|
181
|
+
export const TextWrapper = styled.div(({
|
|
186
182
|
isPlaceholder
|
|
187
183
|
}) => {
|
|
188
184
|
if (isPlaceholder) {
|
|
@@ -195,14 +191,18 @@ export const TextWrapper = styled.div`
|
|
|
195
191
|
} else {
|
|
196
192
|
return '';
|
|
197
193
|
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
194
|
+
}, {
|
|
195
|
+
color: `var(--ds-text-subtlest, ${colors.N300})`,
|
|
196
|
+
fontSize: '12px',
|
|
197
|
+
lineHeight: '16px'
|
|
198
|
+
}, ellipsis('none'));
|
|
199
|
+
export const TooltipWrapper = styled.div({
|
|
200
|
+
overflow: 'hidden'
|
|
201
|
+
});
|
|
203
202
|
// NB: `overflow` is kept as `hidden` since
|
|
204
203
|
// the internal contents of the `iframe` should
|
|
205
204
|
// manage scrolling behaviour.
|
|
205
|
+
// eslint-disable-next-line @atlaskit/design-system/no-styled-tagged-template-expression
|
|
206
206
|
export const Content = styled.div`
|
|
207
207
|
${contentBorderRadius};
|
|
208
208
|
border: 1px solid ${`var(--ds-border, ${N40})`};
|
|
@@ -241,88 +241,76 @@ export const Content = styled.div`
|
|
|
241
241
|
top: ${"var(--ds-space-400, 32px)"};
|
|
242
242
|
`}
|
|
243
243
|
`;
|
|
244
|
-
export const Image = styled.img
|
|
245
|
-
${({
|
|
244
|
+
export const Image = styled.img(({
|
|
246
245
|
size
|
|
247
|
-
}) => csssize(size)
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
/* hide the alt text when the image cannot be found */
|
|
251
|
-
overflow: hidden;
|
|
252
|
-
`;
|
|
246
|
+
}) => csssize(size), borderRadius, {
|
|
247
|
+
overflow: 'hidden'
|
|
248
|
+
});
|
|
253
249
|
export const maxAvatarCount = 6;
|
|
254
|
-
export const ContentWrapper = styled.div
|
|
255
|
-
display: flex
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
padding:
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
${ellipsis('100%')};
|
|
276
|
-
`;
|
|
250
|
+
export const ContentWrapper = styled.div({
|
|
251
|
+
display: 'flex',
|
|
252
|
+
flexDirection: 'row',
|
|
253
|
+
boxSizing: 'border-box',
|
|
254
|
+
padding: `${"var(--ds-space-100, 8px)"} ${"var(--ds-space-150, 12px)"} ${"var(--ds-space-150, 12px)"} ${"var(--ds-space-150, 12px)"}`
|
|
255
|
+
});
|
|
256
|
+
export const Title = styled.div({
|
|
257
|
+
color: `var(--ds-text, ${colors.N900})`,
|
|
258
|
+
fontSize: '16px',
|
|
259
|
+
fontWeight: 500,
|
|
260
|
+
lineHeight: 20 / 16,
|
|
261
|
+
maxHeight: `${20 * 4}px`,
|
|
262
|
+
overflow: 'hidden'
|
|
263
|
+
});
|
|
264
|
+
export const Byline = styled.div({
|
|
265
|
+
marginTop: "var(--ds-space-050, 4px)",
|
|
266
|
+
color: `var(--ds-text-subtlest, ${colors.N300})`,
|
|
267
|
+
fontSize: '12px',
|
|
268
|
+
fontWeight: 'normal',
|
|
269
|
+
lineHeight: 16 / 12
|
|
270
|
+
}, ellipsis('100%'));
|
|
277
271
|
|
|
278
272
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
279
|
-
export const Description = styled.div
|
|
280
|
-
|
|
281
|
-
color:
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
overflow: hidden
|
|
287
|
-
|
|
288
|
-
export const ResolvedViewIconWrapper = styled.div
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
export const Thumbnail = styled.div
|
|
292
|
-
|
|
293
|
-
${
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
export const
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
margin-top: ${"var(--ds-space-050, 4px)"};
|
|
273
|
+
export const Description = styled.div({
|
|
274
|
+
marginTop: '7px',
|
|
275
|
+
color: `var(--ds-text, ${colors.N800})`,
|
|
276
|
+
fontSize: '12px',
|
|
277
|
+
fontWeight: 'normal',
|
|
278
|
+
lineHeight: 18 / 12,
|
|
279
|
+
maxHeight: `${18 * 3}px`,
|
|
280
|
+
overflow: 'hidden'
|
|
281
|
+
});
|
|
282
|
+
export const ResolvedViewIconWrapper = styled.div({
|
|
283
|
+
marginTop: "var(--ds-space-050, 4px)"
|
|
284
|
+
});
|
|
285
|
+
export const Thumbnail = styled.div(borderRadius, csssize(48), {
|
|
286
|
+
float: 'right',
|
|
287
|
+
margin: `${"var(--ds-space-050, 4px)"} 0 ${"var(--ds-space-150, 12px)"} ${"var(--ds-space-150, 12px)"}`,
|
|
288
|
+
backgroundColor: `var(--ds-skeleton, ${colors.N30})`,
|
|
289
|
+
backgroundImage: `url(${({
|
|
290
|
+
src
|
|
291
|
+
}) => src})`,
|
|
292
|
+
backgroundSize: 'cover'
|
|
293
|
+
});
|
|
294
|
+
export const UsersWrapper = styled.div({
|
|
295
|
+
marginTop: "var(--ds-space-100, 8px)"
|
|
296
|
+
});
|
|
297
|
+
export const ActionsWrapper = styled.div({
|
|
298
|
+
marginTop: "var(--ds-space-100, 8px)",
|
|
299
|
+
textAlign: 'right',
|
|
300
|
+
'> *': {
|
|
301
|
+
marginTop: "var(--ds-space-050, 4px)"
|
|
302
|
+
},
|
|
303
|
+
'> * + *': {
|
|
304
|
+
marginLeft: "var(--ds-space-050, 4px)"
|
|
312
305
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
overflow: hidden;
|
|
325
|
-
pointer-events: none;
|
|
326
|
-
/* z-index has to be 1 higher than the number of avatars in the avatar stack */
|
|
327
|
-
z-index: ${maxAvatarCount + 1};
|
|
328
|
-
`;
|
|
306
|
+
});
|
|
307
|
+
export const AlertWrapper = styled.div({
|
|
308
|
+
position: 'absolute',
|
|
309
|
+
top: 0,
|
|
310
|
+
right: 0,
|
|
311
|
+
bottom: 0,
|
|
312
|
+
left: 0,
|
|
313
|
+
overflow: 'hidden',
|
|
314
|
+
pointerEvents: 'none',
|
|
315
|
+
zIndex: maxAvatarCount + 1
|
|
316
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { useCallback, useMemo, useState } from 'react';
|
|
2
|
+
import React, { useCallback, useMemo, useRef, useState, useEffect } from 'react';
|
|
3
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
4
|
import { Box, Inline } from '@atlaskit/primitives';
|
|
5
5
|
import { ActionName, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
|
|
@@ -21,40 +21,46 @@ const AISummaryBlockResolvedView = props => {
|
|
|
21
21
|
actions = [],
|
|
22
22
|
metadata,
|
|
23
23
|
onActionMenuOpenChange,
|
|
24
|
-
onAIActionChange,
|
|
25
24
|
size = SmartLinkSize.Medium,
|
|
26
|
-
testId
|
|
25
|
+
testId,
|
|
26
|
+
aiSummaryMinHeight
|
|
27
27
|
} = props;
|
|
28
|
-
const
|
|
28
|
+
const metadataElements = renderElementItems(metadata);
|
|
29
29
|
const {
|
|
30
30
|
fireEvent
|
|
31
31
|
} = useAnalyticsEvents();
|
|
32
|
-
const metadataElements = renderElementItems(metadata);
|
|
33
32
|
const context = useFlexibleUiContext();
|
|
34
33
|
const url = (context === null || context === void 0 ? void 0 : context.url) || '';
|
|
35
|
-
const aiSummary = useAISummary({
|
|
36
|
-
url
|
|
37
|
-
});
|
|
38
34
|
const {
|
|
35
|
+
summariseUrl,
|
|
39
36
|
state: {
|
|
40
37
|
content,
|
|
41
38
|
status
|
|
42
|
-
},
|
|
43
|
-
isSummarisedOnMount
|
|
44
|
-
} = aiSummary;
|
|
45
|
-
const onAIActionClick = useCallback(() => {
|
|
46
|
-
fireEvent('ui.button.clicked.aiSummary', {});
|
|
47
|
-
setAIState('loading');
|
|
48
|
-
if (onAIActionChange) {
|
|
49
|
-
onAIActionChange('loading');
|
|
50
39
|
}
|
|
51
|
-
}
|
|
40
|
+
} = useAISummary({
|
|
41
|
+
url
|
|
42
|
+
});
|
|
43
|
+
const showAISummary = status !== 'ready' && status !== 'error';
|
|
44
|
+
const isSummarisedOnMountRef = useRef(status === 'done');
|
|
45
|
+
let isErroredOnMountRef = useRef(status === 'error');
|
|
46
|
+
const [showAISummaryErrorMessage, setShowAISummaryErrorMessage] = useState(false);
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (isErroredOnMountRef.current && status === 'loading') {
|
|
49
|
+
isErroredOnMountRef.current = false;
|
|
50
|
+
setShowAISummaryErrorMessage(true);
|
|
51
|
+
} else {
|
|
52
|
+
setShowAISummaryErrorMessage(!isErroredOnMountRef.current && status === 'error');
|
|
53
|
+
}
|
|
54
|
+
}, [status]);
|
|
52
55
|
const combinedActions = useMemo(() => {
|
|
53
|
-
if (
|
|
56
|
+
if (status === 'ready' || status === 'error') {
|
|
54
57
|
const aiAction = {
|
|
55
58
|
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summarize),
|
|
56
59
|
name: ActionName.CustomAction,
|
|
57
|
-
onClick:
|
|
60
|
+
onClick: () => {
|
|
61
|
+
fireEvent('ui.button.clicked.aiSummary', {});
|
|
62
|
+
summariseUrl();
|
|
63
|
+
},
|
|
58
64
|
testId: `${testId}-ai-summary-action`,
|
|
59
65
|
icon: /*#__PURE__*/React.createElement(AIIcon, {
|
|
60
66
|
label: "AIIcon"
|
|
@@ -63,7 +69,7 @@ const AISummaryBlockResolvedView = props => {
|
|
|
63
69
|
return [aiAction, ...actions];
|
|
64
70
|
}
|
|
65
71
|
return actions;
|
|
66
|
-
}, [actions,
|
|
72
|
+
}, [actions, status, testId, summariseUrl, fireEvent]);
|
|
67
73
|
const onDropdownOpenChange = useCallback(isOpen => {
|
|
68
74
|
if (onActionMenuOpenChange) {
|
|
69
75
|
onActionMenuOpenChange({
|
|
@@ -75,17 +81,18 @@ const AISummaryBlockResolvedView = props => {
|
|
|
75
81
|
direction: SmartLinkDirection.Vertical,
|
|
76
82
|
testId: `${testId}-resolved-view`
|
|
77
83
|
}), status === 'done' && /*#__PURE__*/React.createElement(AIEventSummaryViewed, {
|
|
78
|
-
fromCache:
|
|
79
|
-
}), /*#__PURE__*/React.createElement(AISummary, {
|
|
84
|
+
fromCache: isSummarisedOnMountRef.current
|
|
85
|
+
}), showAISummary && /*#__PURE__*/React.createElement(AISummary, {
|
|
86
|
+
minHeight: aiSummaryMinHeight,
|
|
80
87
|
content: content,
|
|
81
|
-
showIcon:
|
|
88
|
+
showIcon: isSummarisedOnMountRef.current
|
|
82
89
|
}), /*#__PURE__*/React.createElement(Inline, {
|
|
83
90
|
alignBlock: "center",
|
|
84
91
|
alignInline: "end",
|
|
85
92
|
grow: "fill",
|
|
86
93
|
spread: "space-between"
|
|
87
|
-
}, /*#__PURE__*/React.createElement(Box, null, !
|
|
88
|
-
state:
|
|
94
|
+
}, /*#__PURE__*/React.createElement(Box, null, !isSummarisedOnMountRef.current && (status === 'loading' || status === 'done') ? /*#__PURE__*/React.createElement(AIStateIndicator, {
|
|
95
|
+
state: status,
|
|
89
96
|
testId: `${testId}-state-indicator`
|
|
90
97
|
}) : /*#__PURE__*/React.createElement(ElementGroup, {
|
|
91
98
|
width: SmartLinkWidth.FitToContent,
|
|
@@ -95,7 +102,7 @@ const AISummaryBlockResolvedView = props => {
|
|
|
95
102
|
items: combinedActions,
|
|
96
103
|
appearance: "default",
|
|
97
104
|
size: size
|
|
98
|
-
}))),
|
|
105
|
+
}))), showAISummaryErrorMessage && /*#__PURE__*/React.createElement(Inline, {
|
|
99
106
|
grow: "fill"
|
|
100
107
|
}, /*#__PURE__*/React.createElement(AIEventErrorViewed, null), /*#__PURE__*/React.createElement(AIStateIndicator, {
|
|
101
108
|
state: status,
|
|
@@ -88,7 +88,6 @@ const importIcon = importFn => {
|
|
|
88
88
|
loading: () => null
|
|
89
89
|
}); // Because we're using dynamic loading here, TS will not be able to infer the type.
|
|
90
90
|
};
|
|
91
|
-
|
|
92
91
|
const AtlaskitIcon = ({
|
|
93
92
|
icon,
|
|
94
93
|
label,
|
|
@@ -123,7 +122,6 @@ const AtlaskitIcon = ({
|
|
|
123
122
|
iconGradientStop: B200
|
|
124
123
|
/* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
|
|
125
124
|
});
|
|
126
|
-
|
|
127
125
|
case IconType.Jira:
|
|
128
126
|
// Logo component has a different prop set from other icon components
|
|
129
127
|
return /*#__PURE__*/React.createElement(ImportedIcon, {
|
|
@@ -135,7 +133,6 @@ const AtlaskitIcon = ({
|
|
|
135
133
|
iconGradientStop: B200
|
|
136
134
|
/* eslint-enable @atlaskit/design-system/ensure-design-token-usage */
|
|
137
135
|
});
|
|
138
|
-
|
|
139
136
|
case IconType.Error:
|
|
140
137
|
case IconType.Forbidden:
|
|
141
138
|
return /*#__PURE__*/React.createElement(ImportedIcon, {
|
|
@@ -1,28 +1,53 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { jsx } from '@emotion/react';
|
|
4
|
-
import React from 'react';
|
|
4
|
+
import React, { useState, useEffect } from 'react';
|
|
5
5
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
6
|
import { HoverCardContainer, popupContainerStyles } from '../styled';
|
|
7
7
|
import AIPrism from '../../common/ai-prism';
|
|
8
8
|
import { hoverCardClassName } from './HoverCardContent';
|
|
9
|
+
import { useAISummary } from '../../../state/hooks/use-ai-summary';
|
|
10
|
+
const ConnectedAIPrismContainer = ({
|
|
11
|
+
children,
|
|
12
|
+
isAIEnabled = false,
|
|
13
|
+
testId,
|
|
14
|
+
url,
|
|
15
|
+
...props
|
|
16
|
+
}) => {
|
|
17
|
+
const {
|
|
18
|
+
state: {
|
|
19
|
+
status
|
|
20
|
+
}
|
|
21
|
+
} = useAISummary({
|
|
22
|
+
url
|
|
23
|
+
});
|
|
24
|
+
const [showPrism, setShowPrism] = useState(status === 'loading');
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setShowPrism(status === 'loading');
|
|
27
|
+
}, [status]);
|
|
28
|
+
const container = jsx("div", _extends({
|
|
29
|
+
className: hoverCardClassName,
|
|
30
|
+
css: [HoverCardContainer, isAIEnabled && showPrism ? undefined : popupContainerStyles],
|
|
31
|
+
"data-testid": testId
|
|
32
|
+
}, props), children);
|
|
33
|
+
return isAIEnabled ? jsx(AIPrism, {
|
|
34
|
+
isVisible: showPrism,
|
|
35
|
+
testId: `${testId}-prism`
|
|
36
|
+
}, container) : container;
|
|
37
|
+
};
|
|
9
38
|
const ContentContainer = ({
|
|
10
39
|
children,
|
|
11
40
|
isAIEnabled = false,
|
|
12
|
-
showPrism = false,
|
|
13
41
|
testId,
|
|
42
|
+
url,
|
|
14
43
|
...props
|
|
15
44
|
}) => {
|
|
16
45
|
if (getBooleanFF('platform.linking-platform.smart-card.hover-card-ai-summaries')) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
46
|
+
return jsx(ConnectedAIPrismContainer, _extends({
|
|
47
|
+
isAIEnabled: isAIEnabled,
|
|
48
|
+
url: url,
|
|
49
|
+
testId: testId
|
|
21
50
|
}, props), children);
|
|
22
|
-
return isAIEnabled ? jsx(AIPrism, {
|
|
23
|
-
isVisible: showPrism,
|
|
24
|
-
testId: `${testId}-prism`
|
|
25
|
-
}, container) : container;
|
|
26
51
|
}
|
|
27
52
|
return jsx("div", _extends({
|
|
28
53
|
className: hoverCardClassName,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx } from '@emotion/react';
|
|
3
3
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
4
|
import CopyIcon from '@atlaskit/icon/glyph/copy';
|
|
5
|
-
import React, { useCallback, useEffect, useMemo, useRef
|
|
5
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
6
6
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
7
7
|
import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../constants';
|
|
8
8
|
import { extractMetadata } from '../../../extractors/hover/extractMetadata';
|
|
@@ -61,7 +61,6 @@ const HoverCardContent = ({
|
|
|
61
61
|
const services = getServices(linkState.details);
|
|
62
62
|
const statusRef = useRef(linkStatus);
|
|
63
63
|
const analyticsRef = useRef(analytics);
|
|
64
|
-
const [showPrism, setShowPrism] = useState(false);
|
|
65
64
|
useEffect(() => {
|
|
66
65
|
/**
|
|
67
66
|
* Must access current analytics object value via ref because its not stable
|
|
@@ -131,9 +130,6 @@ const HoverCardContent = ({
|
|
|
131
130
|
analytics
|
|
132
131
|
};
|
|
133
132
|
const onClickStopPropagation = useCallback(e => e.stopPropagation(), []);
|
|
134
|
-
const onAIActionChange = useCallback(state => {
|
|
135
|
-
setShowPrism(state === 'loading');
|
|
136
|
-
}, []);
|
|
137
133
|
const getCardView = cardState => {
|
|
138
134
|
if (cardState.metadataStatus === 'pending') {
|
|
139
135
|
return jsx(HoverCardLoadingView, {
|
|
@@ -166,7 +162,6 @@ const HoverCardContent = ({
|
|
|
166
162
|
flexibleCardProps: flexibleCardProps,
|
|
167
163
|
isAISummaryEnabled: isAISummaryEnabled,
|
|
168
164
|
onActionClick: onActionClick,
|
|
169
|
-
onAIActionChange: onAIActionChange,
|
|
170
165
|
titleBlockProps: titleBlockProps
|
|
171
166
|
});
|
|
172
167
|
}
|
|
@@ -178,7 +173,7 @@ const HoverCardContent = ({
|
|
|
178
173
|
onMouseLeave: onMouseLeave,
|
|
179
174
|
onClick: onClickStopPropagation,
|
|
180
175
|
isAIEnabled: isAISummaryEnabled,
|
|
181
|
-
|
|
176
|
+
url: url
|
|
182
177
|
}, cardView) : null;
|
|
183
178
|
};
|
|
184
179
|
export default HoverCardContent;
|