@atlaskit/smart-card 26.42.6 → 26.42.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/extractors/hover/extractMetadata.js +1 -2
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +8 -10
- package/dist/cjs/view/BlockCard/views/flexible/styled.js +1 -1
- package/dist/cjs/view/BlockCard/views/flexible/unresolved-view/index.js +1 -1
- package/dist/cjs/view/BlockCard/views/flexible/utils/index.js +4 -46
- package/dist/cjs/view/HoverCard/components/ImagePreview.js +4 -8
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +8 -18
- package/dist/cjs/view/HoverCard/components/views/resolved/styled.js +2 -3
- package/dist/cjs/view/HoverCard/components/views/resolving/styled.js +1 -2
- package/dist/cjs/view/HoverCard/styled.js +3 -9
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/RedesignedInlineCard/index.js +28 -32
- package/dist/es2019/extractors/hover/extractMetadata.js +1 -2
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +6 -8
- package/dist/es2019/view/BlockCard/views/flexible/styled.js +1 -1
- package/dist/es2019/view/BlockCard/views/flexible/unresolved-view/index.js +2 -2
- package/dist/es2019/view/BlockCard/views/flexible/utils/index.js +4 -44
- package/dist/es2019/view/HoverCard/components/ImagePreview.js +4 -8
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +10 -20
- package/dist/es2019/view/HoverCard/components/views/resolved/styled.js +5 -5
- package/dist/es2019/view/HoverCard/components/views/resolving/styled.js +1 -2
- package/dist/es2019/view/HoverCard/styled.js +2 -7
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/RedesignedInlineCard/index.js +25 -32
- package/dist/esm/extractors/hover/extractMetadata.js +1 -2
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +9 -11
- package/dist/esm/view/BlockCard/views/flexible/styled.js +1 -1
- package/dist/esm/view/BlockCard/views/flexible/unresolved-view/index.js +2 -2
- package/dist/esm/view/BlockCard/views/flexible/utils/index.js +3 -45
- package/dist/esm/view/HoverCard/components/ImagePreview.js +4 -8
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +10 -20
- package/dist/esm/view/HoverCard/components/views/resolved/styled.js +2 -3
- package/dist/esm/view/HoverCard/components/views/resolving/styled.js +1 -2
- package/dist/esm/view/HoverCard/styled.js +4 -10
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/RedesignedInlineCard/index.js +25 -32
- package/dist/types/view/BlockCard/views/flexible/utils/index.d.ts +1 -2
- package/dist/types-ts4.5/view/BlockCard/views/flexible/utils/index.d.ts +1 -2
- package/package.json +6 -9
|
@@ -100,43 +100,6 @@ export const getSimulatedBetterMetadata = cardDetails => {
|
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
-
export const getSimulatedMetadata = cardDetails => {
|
|
104
|
-
const baseMetadata = [{
|
|
105
|
-
name: ElementName.ModifiedOn
|
|
106
|
-
}, {
|
|
107
|
-
name: ElementName.AttachmentCount
|
|
108
|
-
}, {
|
|
109
|
-
name: ElementName.CommentCount
|
|
110
|
-
}, {
|
|
111
|
-
name: ElementName.ReactCount
|
|
112
|
-
}, {
|
|
113
|
-
name: ElementName.SubscriberCount
|
|
114
|
-
}, {
|
|
115
|
-
name: ElementName.ViewCount
|
|
116
|
-
}, {
|
|
117
|
-
name: ElementName.VoteCount
|
|
118
|
-
}, {
|
|
119
|
-
name: ElementName.ChecklistProgress
|
|
120
|
-
}, {
|
|
121
|
-
name: ElementName.DueOn
|
|
122
|
-
}];
|
|
123
|
-
const topMetadata = cardDetails !== null && cardDetails !== void 0 && cardDetails.data && extractOwnedBy(cardDetails === null || cardDetails === void 0 ? void 0 : cardDetails.data) ? [{
|
|
124
|
-
name: ElementName.OwnedBy
|
|
125
|
-
}, ...baseMetadata] : [{
|
|
126
|
-
name: ElementName.ModifiedBy
|
|
127
|
-
}, ...baseMetadata];
|
|
128
|
-
const titleMetadata = [{
|
|
129
|
-
name: ElementName.AuthorGroup
|
|
130
|
-
}, {
|
|
131
|
-
name: ElementName.Priority
|
|
132
|
-
}, {
|
|
133
|
-
name: ElementName.State
|
|
134
|
-
}];
|
|
135
|
-
return {
|
|
136
|
-
titleMetadata,
|
|
137
|
-
topMetadata
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
103
|
export const FlexibleCardUiOptions = {
|
|
141
104
|
hideElevation: true
|
|
142
105
|
};
|
|
@@ -148,15 +111,12 @@ export const getTitleBlockOptions = () => ({
|
|
|
148
111
|
position: SmartLinkPosition.Center,
|
|
149
112
|
overrideCss: titleBlockCss,
|
|
150
113
|
hideRetry: true,
|
|
151
|
-
size:
|
|
114
|
+
size: SmartLinkSize.Large
|
|
152
115
|
});
|
|
153
116
|
export const PreviewBlockOptions = {
|
|
154
117
|
placement: MediaPlacement.Right,
|
|
155
118
|
ignoreContainerPadding: true
|
|
156
119
|
};
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
export const getFooterBlockOptions = () => ({
|
|
161
|
-
overrideCss: getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? footerBlockCss : undefined
|
|
162
|
-
});
|
|
120
|
+
export const FooterBlockOptions = {
|
|
121
|
+
overrideCss: footerBlockCss
|
|
122
|
+
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import React, { useCallback, useState, useRef } from 'react';
|
|
3
2
|
import extractPreview from '../../../extractors/flexible/extract-preview';
|
|
4
3
|
import { PreviewBlock } from '../../FlexibleCard/components/blocks';
|
|
5
4
|
import { getTransitionStyles, getPreviewBlockStyles } from '../styled';
|
|
6
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
5
|
const ImagePreview = ({
|
|
8
6
|
data,
|
|
9
7
|
fallbackElementHeight
|
|
@@ -29,15 +27,13 @@ const ImagePreview = ({
|
|
|
29
27
|
const onPreviewTransitionEnd = useCallback(() => {
|
|
30
28
|
setShowPreview(false);
|
|
31
29
|
}, []);
|
|
32
|
-
return showPreview && data && extractPreview(data) ? /*#__PURE__*/React.createElement(PreviewBlock,
|
|
33
|
-
onError: onPreviewError
|
|
34
|
-
|
|
35
|
-
ignoreContainerPadding: true
|
|
36
|
-
}, {
|
|
30
|
+
return showPreview && data && extractPreview(data) ? /*#__PURE__*/React.createElement(PreviewBlock, {
|
|
31
|
+
onError: onPreviewError,
|
|
32
|
+
ignoreContainerPadding: true,
|
|
37
33
|
overrideCss: previewCss,
|
|
38
34
|
onTransitionEnd: onPreviewTransitionEnd,
|
|
39
35
|
blockRef: previewBlockRef,
|
|
40
36
|
onRender: onPreviewRender
|
|
41
|
-
})
|
|
37
|
+
}) : null;
|
|
42
38
|
};
|
|
43
39
|
export default ImagePreview;
|
|
@@ -4,9 +4,9 @@ import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../..
|
|
|
4
4
|
import { FooterBlock, MetadataBlock, RelatedUrlsBlock, SnippetBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
|
|
5
5
|
import { footerBlockCss, hiddenSnippetStyles, metadataBlockCss } from './styled';
|
|
6
6
|
import FlexibleCard from '../../../../FlexibleCard';
|
|
7
|
-
import {
|
|
7
|
+
import { getSimulatedBetterMetadata } from '../../../utils';
|
|
8
8
|
import ImagePreview from '../../ImagePreview';
|
|
9
|
-
import {
|
|
9
|
+
import { elementNamesToItems } from '../../../../../extractors/hover/extractMetadata';
|
|
10
10
|
import { messages } from '../../../../../messages';
|
|
11
11
|
import { FormattedMessage } from 'react-intl-next';
|
|
12
12
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
@@ -73,19 +73,11 @@ const HoverCardResolvedView = ({
|
|
|
73
73
|
topSecondary,
|
|
74
74
|
bottomPrimary
|
|
75
75
|
} = useMemo(() => {
|
|
76
|
-
|
|
77
|
-
const betterMetadata = getSimulatedBetterMetadata(extensionKey, data);
|
|
78
|
-
return {
|
|
79
|
-
topPrimary: elementNamesToItems(betterMetadata.topMetadataBlock.primary),
|
|
80
|
-
topSecondary: elementNamesToItems(betterMetadata.topMetadataBlock.secondary),
|
|
81
|
-
bottomPrimary: elementNamesToItems(betterMetadata.bottomMetadataBlock.primary)
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
const metadata = extractMetadata(getSimulatedMetadata(extensionKey, data));
|
|
76
|
+
const betterMetadata = getSimulatedBetterMetadata(extensionKey, data);
|
|
85
77
|
return {
|
|
86
|
-
topPrimary:
|
|
87
|
-
topSecondary:
|
|
88
|
-
bottomPrimary:
|
|
78
|
+
topPrimary: elementNamesToItems(betterMetadata.topMetadataBlock.primary),
|
|
79
|
+
topSecondary: elementNamesToItems(betterMetadata.topMetadataBlock.secondary),
|
|
80
|
+
bottomPrimary: elementNamesToItems(betterMetadata.bottomMetadataBlock.primary)
|
|
89
81
|
};
|
|
90
82
|
}, [data, extensionKey]);
|
|
91
83
|
const snippetHeight = React.useRef(0);
|
|
@@ -98,22 +90,20 @@ const HoverCardResolvedView = ({
|
|
|
98
90
|
data: data,
|
|
99
91
|
fallbackElementHeight: snippetHeight.current
|
|
100
92
|
});
|
|
101
|
-
return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps,
|
|
93
|
+
return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps, imagePreview, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockProps, {
|
|
102
94
|
metadataPosition: SmartLinkPosition.Top
|
|
103
|
-
})), /*#__PURE__*/React.createElement(MetadataBlock,
|
|
95
|
+
})), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
104
96
|
primary: topPrimary,
|
|
105
97
|
secondary: topSecondary,
|
|
106
98
|
overrideCss: metadataBlockCss,
|
|
107
99
|
maxLines: 1,
|
|
108
|
-
size: SmartLinkSize.Large
|
|
109
|
-
}, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
110
100
|
size: SmartLinkSize.Medium
|
|
111
|
-
})
|
|
101
|
+
}), !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, null), /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
112
102
|
testId: 'hidden-snippet',
|
|
113
103
|
onRender: onSnippetRender,
|
|
114
104
|
blockRef: snippetBlockRef,
|
|
115
105
|
overrideCss: hiddenSnippetStyles
|
|
116
|
-
}),
|
|
106
|
+
}), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
117
107
|
primary: bottomPrimary,
|
|
118
108
|
size: SmartLinkSize.Large,
|
|
119
109
|
overrideCss: metadataBlockCss,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
import { separatorCss } from '../../../styled';
|
|
3
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
const elementGap = '0.5rem';
|
|
5
4
|
export const metadataBlockCss = css`
|
|
6
5
|
gap: 0px;
|
|
@@ -24,12 +23,13 @@ export const metadataBlockCss = css`
|
|
|
24
23
|
margin-left: ${elementGap};
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
|
|
27
|
+
[data-smart-element-group] {
|
|
28
|
+
line-height: 1rem;
|
|
29
|
+
}
|
|
30
30
|
`;
|
|
31
31
|
export const footerBlockCss = css`
|
|
32
|
-
|
|
32
|
+
height: 1.5rem;
|
|
33
33
|
`;
|
|
34
34
|
export const hiddenSnippetStyles = css`
|
|
35
35
|
visibility: hidden;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
export const loadingViewContainer = css`
|
|
4
3
|
display: flex;
|
|
5
4
|
flex-direction: column;
|
|
6
|
-
|
|
5
|
+
padding: 1rem;
|
|
7
6
|
`;
|
|
8
7
|
export const skeletonContainer = css`
|
|
9
8
|
display: flex;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
import { loadingPlaceholderClassName } from '../../index';
|
|
3
|
-
import { SmartLinkSize
|
|
3
|
+
import { SmartLinkSize } from '../../constants';
|
|
4
4
|
import { layers } from '@atlaskit/theme/constants';
|
|
5
5
|
import { themed } from '@atlaskit/theme/components';
|
|
6
6
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
@@ -12,11 +12,7 @@ export const flexibleUiOptions = {
|
|
|
12
12
|
hideElevation: true,
|
|
13
13
|
size: SmartLinkSize.Medium,
|
|
14
14
|
hideHoverCardPreviewButton: false,
|
|
15
|
-
zIndex: HOVER_CARD_Z_INDEX + 1
|
|
16
|
-
...(!getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
17
|
-
theme: SmartLinkTheme.Black,
|
|
18
|
-
hidePadding: true
|
|
19
|
-
})
|
|
15
|
+
zIndex: HOVER_CARD_Z_INDEX + 1
|
|
20
16
|
};
|
|
21
17
|
export const CARD_WIDTH_REM = 24;
|
|
22
18
|
// gap between mouse cursor and hover card
|
|
@@ -33,7 +29,6 @@ export const HoverCardContainer = css`
|
|
|
33
29
|
border-width: 0;
|
|
34
30
|
box-sizing: border-box;
|
|
35
31
|
width: ${CARD_WIDTH_REM}rem;
|
|
36
|
-
${!getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? `padding: 1rem;` : ``}
|
|
37
32
|
|
|
38
33
|
.${loadingPlaceholderClassName} {
|
|
39
34
|
display: none;
|
|
@@ -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.42.
|
|
10
|
+
packageVersion: "26.42.8",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
const Link = withLinkClickedEvent('a');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
3
|
import { getEmptyJsonLd, getForbiddenJsonLd } from '../../utils/jsonld';
|
|
4
4
|
import { extractInlineProps } from '../../extractors/inline';
|
|
5
5
|
import { extractRequestAccessContext } from '../../extractors/common/context';
|
|
@@ -15,6 +15,7 @@ import { useFeatureFlag } from '@atlaskit/link-provider';
|
|
|
15
15
|
import { getExtensionKey } from '../../state/helpers';
|
|
16
16
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
17
17
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
18
|
+
import { SmartLinkStatus } from '../../constants';
|
|
18
19
|
export { InlineCardResolvedView, InlineCardResolvingView, InlineCardErroredView, InlineCardForbiddenView, InlineCardUnauthorizedView };
|
|
19
20
|
export const InlineCard = ({
|
|
20
21
|
analytics,
|
|
@@ -48,6 +49,29 @@ export const InlineCard = ({
|
|
|
48
49
|
if (showHoverPreview === undefined && showHoverPreviewFlag !== undefined) {
|
|
49
50
|
showHoverPreview = Boolean(showHoverPreviewFlag);
|
|
50
51
|
}
|
|
52
|
+
const resolvedProps = status === SmartLinkStatus.Resolved ? extractInlineProps(cardDetails, renderers) : {};
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
switch (status) {
|
|
55
|
+
case SmartLinkStatus.Resolved:
|
|
56
|
+
onResolve === null || onResolve === void 0 ? void 0 : onResolve({
|
|
57
|
+
url,
|
|
58
|
+
title: resolvedProps.title
|
|
59
|
+
});
|
|
60
|
+
break;
|
|
61
|
+
case SmartLinkStatus.Errored:
|
|
62
|
+
case SmartLinkStatus.Fallback:
|
|
63
|
+
case SmartLinkStatus.Forbidden:
|
|
64
|
+
case SmartLinkStatus.NotFound:
|
|
65
|
+
case SmartLinkStatus.Unauthorized:
|
|
66
|
+
if (onError) {
|
|
67
|
+
onError({
|
|
68
|
+
status,
|
|
69
|
+
url
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}, [onError, onResolve, status, url, resolvedProps.title]);
|
|
51
75
|
switch (status) {
|
|
52
76
|
case 'pending':
|
|
53
77
|
case 'resolving':
|
|
@@ -59,13 +83,6 @@ export const InlineCard = ({
|
|
|
59
83
|
inlinePreloaderStyle: inlinePreloaderStyle
|
|
60
84
|
});
|
|
61
85
|
case 'resolved':
|
|
62
|
-
const resolvedProps = extractInlineProps(cardDetails, renderers);
|
|
63
|
-
if (onResolve) {
|
|
64
|
-
onResolve({
|
|
65
|
-
url,
|
|
66
|
-
title: resolvedProps.title
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
86
|
return /*#__PURE__*/React.createElement(InlineCardResolvedView, _extends({}, resolvedProps, {
|
|
70
87
|
id: id,
|
|
71
88
|
showHoverPreview: showHoverPreview,
|
|
@@ -76,12 +93,6 @@ export const InlineCard = ({
|
|
|
76
93
|
testId: testIdWithStatus
|
|
77
94
|
}));
|
|
78
95
|
case 'unauthorized':
|
|
79
|
-
if (onError) {
|
|
80
|
-
onError({
|
|
81
|
-
url,
|
|
82
|
-
status
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
96
|
const provider = extractProvider(cardDetails);
|
|
86
97
|
return /*#__PURE__*/React.createElement(InlineCardUnauthorizedView, {
|
|
87
98
|
icon: provider && provider.icon,
|
|
@@ -97,12 +108,6 @@ export const InlineCard = ({
|
|
|
97
108
|
extensionKey: extensionKey
|
|
98
109
|
});
|
|
99
110
|
case 'forbidden':
|
|
100
|
-
if (onError) {
|
|
101
|
-
onError({
|
|
102
|
-
url,
|
|
103
|
-
status
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
111
|
const providerForbidden = extractProvider(cardDetails);
|
|
107
112
|
const cardMetadata = (_details$meta = details === null || details === void 0 ? void 0 : details.meta) !== null && _details$meta !== void 0 ? _details$meta : getForbiddenJsonLd().meta;
|
|
108
113
|
const requestAccessContext = getBooleanFF('platform.linking-platform.smart-card.cross-join') ? extractRequestAccessContextImproved({
|
|
@@ -127,12 +132,6 @@ export const InlineCard = ({
|
|
|
127
132
|
showHoverPreview: showHoverPreview
|
|
128
133
|
});
|
|
129
134
|
case 'not_found':
|
|
130
|
-
if (onError) {
|
|
131
|
-
onError({
|
|
132
|
-
url,
|
|
133
|
-
status
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
135
|
const providerNotFound = extractProvider(cardDetails);
|
|
137
136
|
return /*#__PURE__*/React.createElement(InlineCardErroredView, {
|
|
138
137
|
url: url,
|
|
@@ -146,12 +145,6 @@ export const InlineCard = ({
|
|
|
146
145
|
case 'fallback':
|
|
147
146
|
case 'errored':
|
|
148
147
|
default:
|
|
149
|
-
if (onError) {
|
|
150
|
-
onError({
|
|
151
|
-
url,
|
|
152
|
-
status
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
148
|
return /*#__PURE__*/React.createElement(CardLinkView, {
|
|
156
149
|
link: url,
|
|
157
150
|
isSelected: isSelected,
|
|
@@ -2,7 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { ElementName } from '../../constants';
|
|
5
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
var AvatarGroupsWithNamePrefix = [ElementName.AssignedToGroup, ElementName.OwnedByGroup, ElementName.AuthorGroup];
|
|
7
6
|
export var elementNamesToItems = function elementNamesToItems(elementNames) {
|
|
8
7
|
return elementNames.filter(function (element) {
|
|
@@ -11,7 +10,7 @@ export var elementNamesToItems = function elementNamesToItems(elementNames) {
|
|
|
11
10
|
return _objectSpread({
|
|
12
11
|
name: elementName,
|
|
13
12
|
testId: "".concat(elementName.toLowerCase(), "-metadata-element")
|
|
14
|
-
},
|
|
13
|
+
}, AvatarGroupsWithNamePrefix.includes(elementName) && {
|
|
15
14
|
showNamePrefix: true
|
|
16
15
|
});
|
|
17
16
|
});
|
|
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
15
15
|
export var context = {
|
|
16
16
|
componentName: 'smart-cards',
|
|
17
17
|
packageName: "@atlaskit/smart-card",
|
|
18
|
-
packageVersion: "26.42.
|
|
18
|
+
packageVersion: "26.42.8"
|
|
19
19
|
};
|
|
20
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
21
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -5,8 +5,7 @@ import FlexibleCard from '../../../FlexibleCard';
|
|
|
5
5
|
import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock } from '../../../FlexibleCard/components/blocks';
|
|
6
6
|
import { metadataBlockCss } from './styled';
|
|
7
7
|
import { ActionName, ElementName, SmartLinkPosition } from '../../../../constants';
|
|
8
|
-
import {
|
|
9
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
import { getSimulatedBetterMetadata, getTitleBlockOptions, PreviewBlockOptions, FlexibleCardUiOptions, FooterBlockOptions } from './utils';
|
|
10
9
|
import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
|
|
11
10
|
/**
|
|
12
11
|
* This view represents a Block card that has an 'Resolved' status.
|
|
@@ -30,10 +29,10 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
30
29
|
useEffect(function () {
|
|
31
30
|
setIsPreviewBlockErrored(false);
|
|
32
31
|
}, [url, cardState]);
|
|
33
|
-
var
|
|
34
|
-
titleMetadata =
|
|
35
|
-
topMetadata =
|
|
36
|
-
bottomMetadata =
|
|
32
|
+
var _getSimulatedBetterMe = getSimulatedBetterMetadata(cardState.details),
|
|
33
|
+
titleMetadata = _getSimulatedBetterMe.titleMetadata,
|
|
34
|
+
topMetadata = _getSimulatedBetterMe.topMetadata,
|
|
35
|
+
bottomMetadata = _getSimulatedBetterMe.bottomMetadata;
|
|
37
36
|
var footerActions = useMemo(function () {
|
|
38
37
|
return [{
|
|
39
38
|
name: ActionName.FollowAction,
|
|
@@ -66,12 +65,11 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
66
65
|
name: ElementName.Location
|
|
67
66
|
}],
|
|
68
67
|
metadataPosition: SmartLinkPosition.Top
|
|
69
|
-
})), /*#__PURE__*/React.createElement(MetadataBlock,
|
|
68
|
+
})), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
70
69
|
primary: topMetadata,
|
|
71
|
-
maxLines: 1
|
|
72
|
-
}, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
70
|
+
maxLines: 1,
|
|
73
71
|
overrideCss: metadataBlockCss
|
|
74
|
-
})
|
|
72
|
+
}), /*#__PURE__*/React.createElement(SnippetBlock, null), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
75
73
|
primary: bottomMetadata,
|
|
76
74
|
maxLines: 1,
|
|
77
75
|
overrideCss: metadataBlockCss
|
|
@@ -79,7 +77,7 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
79
77
|
onError: function onError() {
|
|
80
78
|
setIsPreviewBlockErrored(true);
|
|
81
79
|
}
|
|
82
|
-
})) : null, /*#__PURE__*/React.createElement(FooterBlock, _extends({},
|
|
80
|
+
})) : null, /*#__PURE__*/React.createElement(FooterBlock, _extends({}, FooterBlockOptions, {
|
|
83
81
|
actions: footerActions
|
|
84
82
|
})));
|
|
85
83
|
};
|
|
@@ -8,7 +8,7 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
8
8
|
// in editor prosemirror adds padding-left so we need to overwrite it
|
|
9
9
|
// renderer overwrites the margin-right so we need to add it here
|
|
10
10
|
export var metadataBlockCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* primary element group */\n span[data-smart-element-avatar-group] {\n > ul {\n padding-left: 0px;\n margin-right: 0.5rem;\n }\n }\n [data-smart-element-group] {\n line-height: 1rem;\n }\n"])));
|
|
11
|
-
export var titleBlockCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n
|
|
11
|
+
export var titleBlockCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n gap: 0.5em;\n ", "\n"])), getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? "[data-smart-element=\"Title\"] {\n font-weight: 600;\n }" : "");
|
|
12
12
|
export var footerBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: 1.5rem;\n\n .actions-button-group {\n button,\n button:hover,\n button:focus,\n button:active {\n font-size: 0.875rem;\n }\n }\n"])));
|
|
13
13
|
var flexibleBlockCardElevationStyle = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-radius: 1.5px;\n box-shadow: ", ";\n margin: ", ";\n"])), tokens.elevation, "var(--ds-space-025, 2px)");
|
|
14
14
|
var refreshedFlexibleBlockCardStyle = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n & > div {\n border-radius: ", ";\n border: 1px solid ", ";\n }\n"])), "var(--ds-border-radius-200, 8px)", "var(--ds-border, ".concat(N40, ")"));
|
|
@@ -3,7 +3,7 @@ import { CustomBlock, PreviewBlock, TitleBlock } from '../../../../FlexibleCard/
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import FlexibleCard from '../../../../FlexibleCard';
|
|
5
5
|
import { InternalFooterBlock } from '../../../../FlexibleCard/components/blocks';
|
|
6
|
-
import { FlexibleCardUiOptions,
|
|
6
|
+
import { FlexibleCardUiOptions, PreviewBlockOptions, getTitleBlockOptions, FooterBlockOptions } from '../utils';
|
|
7
7
|
var UnresolvedView = function UnresolvedView(_ref) {
|
|
8
8
|
var actions = _ref.actions,
|
|
9
9
|
cardState = _ref.cardState,
|
|
@@ -28,7 +28,7 @@ var UnresolvedView = function UnresolvedView(_ref) {
|
|
|
28
28
|
}, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, getTitleBlockOptions(), {
|
|
29
29
|
hideIcon: !!title,
|
|
30
30
|
text: title
|
|
31
|
-
})), /*#__PURE__*/React.createElement(CustomBlock, null, children), showPreview && /*#__PURE__*/React.createElement(PreviewBlock, PreviewBlockOptions), /*#__PURE__*/React.createElement(InternalFooterBlock, _extends({},
|
|
31
|
+
})), /*#__PURE__*/React.createElement(CustomBlock, null, children), showPreview && /*#__PURE__*/React.createElement(PreviewBlock, PreviewBlockOptions), /*#__PURE__*/React.createElement(InternalFooterBlock, _extends({}, FooterBlockOptions, {
|
|
32
32
|
actions: actions,
|
|
33
33
|
testId: "smart-block-card-footer"
|
|
34
34
|
})));
|
|
@@ -100,43 +100,6 @@ export var getSimulatedBetterMetadata = function getSimulatedBetterMetadata(card
|
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
-
export var getSimulatedMetadata = function getSimulatedMetadata(cardDetails) {
|
|
104
|
-
var baseMetadata = [{
|
|
105
|
-
name: ElementName.ModifiedOn
|
|
106
|
-
}, {
|
|
107
|
-
name: ElementName.AttachmentCount
|
|
108
|
-
}, {
|
|
109
|
-
name: ElementName.CommentCount
|
|
110
|
-
}, {
|
|
111
|
-
name: ElementName.ReactCount
|
|
112
|
-
}, {
|
|
113
|
-
name: ElementName.SubscriberCount
|
|
114
|
-
}, {
|
|
115
|
-
name: ElementName.ViewCount
|
|
116
|
-
}, {
|
|
117
|
-
name: ElementName.VoteCount
|
|
118
|
-
}, {
|
|
119
|
-
name: ElementName.ChecklistProgress
|
|
120
|
-
}, {
|
|
121
|
-
name: ElementName.DueOn
|
|
122
|
-
}];
|
|
123
|
-
var topMetadata = cardDetails !== null && cardDetails !== void 0 && cardDetails.data && extractOwnedBy(cardDetails === null || cardDetails === void 0 ? void 0 : cardDetails.data) ? [{
|
|
124
|
-
name: ElementName.OwnedBy
|
|
125
|
-
}].concat(baseMetadata) : [{
|
|
126
|
-
name: ElementName.ModifiedBy
|
|
127
|
-
}].concat(baseMetadata);
|
|
128
|
-
var titleMetadata = [{
|
|
129
|
-
name: ElementName.AuthorGroup
|
|
130
|
-
}, {
|
|
131
|
-
name: ElementName.Priority
|
|
132
|
-
}, {
|
|
133
|
-
name: ElementName.State
|
|
134
|
-
}];
|
|
135
|
-
return {
|
|
136
|
-
titleMetadata: titleMetadata,
|
|
137
|
-
topMetadata: topMetadata
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
103
|
export var FlexibleCardUiOptions = {
|
|
141
104
|
hideElevation: true
|
|
142
105
|
};
|
|
@@ -149,18 +112,13 @@ export var getTitleBlockOptions = function getTitleBlockOptions() {
|
|
|
149
112
|
position: SmartLinkPosition.Center,
|
|
150
113
|
overrideCss: titleBlockCss,
|
|
151
114
|
hideRetry: true,
|
|
152
|
-
size:
|
|
115
|
+
size: SmartLinkSize.Large
|
|
153
116
|
};
|
|
154
117
|
};
|
|
155
118
|
export var PreviewBlockOptions = {
|
|
156
119
|
placement: MediaPlacement.Right,
|
|
157
120
|
ignoreContainerPadding: true
|
|
158
121
|
};
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
// Make this a const object after ff cleanup.
|
|
162
|
-
export var getFooterBlockOptions = function getFooterBlockOptions() {
|
|
163
|
-
return {
|
|
164
|
-
overrideCss: getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? footerBlockCss : undefined
|
|
165
|
-
};
|
|
122
|
+
export var FooterBlockOptions = {
|
|
123
|
+
overrideCss: footerBlockCss
|
|
166
124
|
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
2
|
import React, { useCallback, useState, useRef } from 'react';
|
|
4
3
|
import extractPreview from '../../../extractors/flexible/extract-preview';
|
|
5
4
|
import { PreviewBlock } from '../../FlexibleCard/components/blocks';
|
|
6
5
|
import { getTransitionStyles, getPreviewBlockStyles } from '../styled';
|
|
7
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
6
|
var ImagePreview = function ImagePreview(_ref) {
|
|
9
7
|
var data = _ref.data,
|
|
10
8
|
fallbackElementHeight = _ref.fallbackElementHeight;
|
|
@@ -35,15 +33,13 @@ var ImagePreview = function ImagePreview(_ref) {
|
|
|
35
33
|
var onPreviewTransitionEnd = useCallback(function () {
|
|
36
34
|
setShowPreview(false);
|
|
37
35
|
}, []);
|
|
38
|
-
return showPreview && data && extractPreview(data) ? /*#__PURE__*/React.createElement(PreviewBlock,
|
|
39
|
-
onError: onPreviewError
|
|
40
|
-
|
|
41
|
-
ignoreContainerPadding: true
|
|
42
|
-
}, {
|
|
36
|
+
return showPreview && data && extractPreview(data) ? /*#__PURE__*/React.createElement(PreviewBlock, {
|
|
37
|
+
onError: onPreviewError,
|
|
38
|
+
ignoreContainerPadding: true,
|
|
43
39
|
overrideCss: previewCss,
|
|
44
40
|
onTransitionEnd: onPreviewTransitionEnd,
|
|
45
41
|
blockRef: previewBlockRef,
|
|
46
42
|
onRender: onPreviewRender
|
|
47
|
-
})
|
|
43
|
+
}) : null;
|
|
48
44
|
};
|
|
49
45
|
export default ImagePreview;
|
|
@@ -5,9 +5,9 @@ import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../..
|
|
|
5
5
|
import { FooterBlock, MetadataBlock, RelatedUrlsBlock, SnippetBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
|
|
6
6
|
import { footerBlockCss, hiddenSnippetStyles, metadataBlockCss } from './styled';
|
|
7
7
|
import FlexibleCard from '../../../../FlexibleCard';
|
|
8
|
-
import {
|
|
8
|
+
import { getSimulatedBetterMetadata } from '../../../utils';
|
|
9
9
|
import ImagePreview from '../../ImagePreview';
|
|
10
|
-
import {
|
|
10
|
+
import { elementNamesToItems } from '../../../../../extractors/hover/extractMetadata';
|
|
11
11
|
import { messages } from '../../../../../messages';
|
|
12
12
|
import { FormattedMessage } from 'react-intl-next';
|
|
13
13
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
@@ -72,19 +72,11 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
72
72
|
}, [cardActions, onActionClick]);
|
|
73
73
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
74
74
|
var _useMemo = useMemo(function () {
|
|
75
|
-
|
|
76
|
-
var betterMetadata = getSimulatedBetterMetadata(extensionKey, data);
|
|
77
|
-
return {
|
|
78
|
-
topPrimary: elementNamesToItems(betterMetadata.topMetadataBlock.primary),
|
|
79
|
-
topSecondary: elementNamesToItems(betterMetadata.topMetadataBlock.secondary),
|
|
80
|
-
bottomPrimary: elementNamesToItems(betterMetadata.bottomMetadataBlock.primary)
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
var metadata = extractMetadata(getSimulatedMetadata(extensionKey, data));
|
|
75
|
+
var betterMetadata = getSimulatedBetterMetadata(extensionKey, data);
|
|
84
76
|
return {
|
|
85
|
-
topPrimary:
|
|
86
|
-
topSecondary:
|
|
87
|
-
bottomPrimary:
|
|
77
|
+
topPrimary: elementNamesToItems(betterMetadata.topMetadataBlock.primary),
|
|
78
|
+
topSecondary: elementNamesToItems(betterMetadata.topMetadataBlock.secondary),
|
|
79
|
+
bottomPrimary: elementNamesToItems(betterMetadata.bottomMetadataBlock.primary)
|
|
88
80
|
};
|
|
89
81
|
}, [data, extensionKey]),
|
|
90
82
|
topPrimary = _useMemo.topPrimary,
|
|
@@ -100,22 +92,20 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
100
92
|
data: data,
|
|
101
93
|
fallbackElementHeight: snippetHeight.current
|
|
102
94
|
});
|
|
103
|
-
return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps,
|
|
95
|
+
return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps, imagePreview, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockProps, {
|
|
104
96
|
metadataPosition: SmartLinkPosition.Top
|
|
105
|
-
})), /*#__PURE__*/React.createElement(MetadataBlock,
|
|
97
|
+
})), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
106
98
|
primary: topPrimary,
|
|
107
99
|
secondary: topSecondary,
|
|
108
100
|
overrideCss: metadataBlockCss,
|
|
109
101
|
maxLines: 1,
|
|
110
|
-
size: SmartLinkSize.Large
|
|
111
|
-
}, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
112
102
|
size: SmartLinkSize.Medium
|
|
113
|
-
})
|
|
103
|
+
}), !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, null), /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
114
104
|
testId: 'hidden-snippet',
|
|
115
105
|
onRender: onSnippetRender,
|
|
116
106
|
blockRef: snippetBlockRef,
|
|
117
107
|
overrideCss: hiddenSnippetStyles
|
|
118
|
-
}),
|
|
108
|
+
}), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
119
109
|
primary: bottomPrimary,
|
|
120
110
|
size: SmartLinkSize.Large,
|
|
121
111
|
overrideCss: metadataBlockCss,
|
|
@@ -2,8 +2,7 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { separatorCss } from '../../../styled';
|
|
5
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
var elementGap = '0.5rem';
|
|
7
|
-
export var metadataBlockCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n gap: 0px;\n /* primary element group */\n [data-smart-element-group]:nth-of-type(1) {\n flex-grow: 7;\n\n // a separator between text-based element\n ", "\n\n /* horizontal spacing between elements in group */\n > span {\n margin-right: ", ";\n }\n }\n /* secondary element group */\n [data-smart-element-group]:nth-of-type(2) {\n flex-grow: 3;\n /* horizontal spacing between elements in group */\n > span {\n margin-left: ", ";\n }\n }\n
|
|
8
|
-
export var footerBlockCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n
|
|
6
|
+
export var metadataBlockCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n gap: 0px;\n /* primary element group */\n [data-smart-element-group]:nth-of-type(1) {\n flex-grow: 7;\n\n // a separator between text-based element\n ", "\n\n /* horizontal spacing between elements in group */\n > span {\n margin-right: ", ";\n }\n }\n /* secondary element group */\n [data-smart-element-group]:nth-of-type(2) {\n flex-grow: 3;\n /* horizontal spacing between elements in group */\n > span {\n margin-left: ", ";\n }\n }\n\n [data-smart-element-group] {\n line-height: 1rem;\n }\n"])), separatorCss, elementGap, elementGap);
|
|
7
|
+
export var footerBlockCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n height: 1.5rem;\n"])));
|
|
9
8
|
export var hiddenSnippetStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n visibility: hidden;\n position: absolute;\n"])));
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
-
|
|
5
|
-
export var loadingViewContainer = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n ", "\n"])), getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "padding: 1rem;" : "");
|
|
4
|
+
export var loadingViewContainer = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n padding: 1rem;\n"])));
|
|
6
5
|
export var skeletonContainer = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n gap: 0.625rem;\n align-items: center;\n"])));
|
|
7
6
|
export var getTitleStyles = function getTitleStyles(height) {
|
|
8
7
|
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n flex: 1 0 auto;\n height: ", "rem;\n\n span {\n width: 100%;\n }\n "])), height);
|