@atlaskit/smart-card 26.57.1 → 26.57.3
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/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +2 -3
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +10 -16
- package/dist/cjs/view/HoverCard/utils.js +63 -162
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +2 -3
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +11 -17
- package/dist/es2019/view/HoverCard/utils.js +48 -152
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +3 -4
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +11 -17
- package/dist/esm/view/HoverCard/utils.js +62 -161
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/view/HoverCard/types.d.ts +0 -6
- package/dist/types/view/HoverCard/utils.d.ts +7 -2
- package/dist/types-ts4.5/view/HoverCard/types.d.ts +0 -6
- package/dist/types-ts4.5/view/HoverCard/utils.d.ts +7 -2
- package/package.json +2 -2
- package/dist/cjs/extractors/hover/extractMetadata.js +0 -33
- package/dist/es2019/extractors/hover/extractMetadata.js +0 -20
- package/dist/esm/extractors/hover/extractMetadata.js +0 -26
- package/dist/types/extractors/hover/extractMetadata.d.ts +0 -5
- package/dist/types-ts4.5/extractors/hover/extractMetadata.d.ts +0 -5
|
@@ -2,203 +2,99 @@ import { ElementName } from '../../constants';
|
|
|
2
2
|
import { extractType } from '@atlaskit/link-extractors';
|
|
3
3
|
import { extractOwnedBy } from '../../extractors/flexible/utils';
|
|
4
4
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
|
-
|
|
6
|
-
const types = data ? extractType(data) : undefined;
|
|
7
|
-
switch (extensionKey) {
|
|
8
|
-
case 'bitbucket-object-provider':
|
|
9
|
-
case 'native-bitbucket-object-provider':
|
|
10
|
-
if (types !== null && types !== void 0 && types.includes('atlassian:SourceCodePullRequest')) {
|
|
11
|
-
return {
|
|
12
|
-
metadata: {
|
|
13
|
-
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.SubscriberCount, ElementName.State],
|
|
14
|
-
secondary: [],
|
|
15
|
-
subtitle: [ElementName.SourceBranch, ElementName.TargetBranch]
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
return {
|
|
20
|
-
metadata: {
|
|
21
|
-
primary: [ElementName.ModifiedOn, ElementName.CreatedBy],
|
|
22
|
-
secondary: [],
|
|
23
|
-
subtitle: []
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
case 'confluence-object-provider':
|
|
27
|
-
const primaryAttribution = data && extractOwnedBy(data) ? ElementName.OwnedBy : ElementName.CreatedBy;
|
|
28
|
-
return {
|
|
29
|
-
metadata: {
|
|
30
|
-
primary: [ElementName.AuthorGroup, primaryAttribution],
|
|
31
|
-
secondary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.ViewCount],
|
|
32
|
-
subtitle: []
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
case 'jira-object-provider':
|
|
36
|
-
return {
|
|
37
|
-
metadata: {
|
|
38
|
-
primary: [ElementName.AuthorGroup, ElementName.State, ElementName.Priority],
|
|
39
|
-
secondary: [],
|
|
40
|
-
subtitle: []
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
case 'trello-object-provider':
|
|
44
|
-
return {
|
|
45
|
-
metadata: {
|
|
46
|
-
primary: [ElementName.AuthorGroup, ElementName.State, ElementName.DueOn],
|
|
47
|
-
secondary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.AttachmentCount, ElementName.ChecklistProgress],
|
|
48
|
-
subtitle: [ElementName.Location]
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
case 'watermelon-object-provider':
|
|
52
|
-
if (types !== null && types !== void 0 && types.includes('atlassian:Project')) {
|
|
53
|
-
return {
|
|
54
|
-
metadata: {
|
|
55
|
-
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.State, ElementName.DueOn],
|
|
56
|
-
secondary: [],
|
|
57
|
-
subtitle: []
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
metadata: {
|
|
63
|
-
primary: [ElementName.AuthorGroup, ElementName.State, ElementName.DueOn],
|
|
64
|
-
secondary: [],
|
|
65
|
-
subtitle: []
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
default:
|
|
69
|
-
return {
|
|
70
|
-
metadata: {
|
|
71
|
-
primary: [ElementName.ModifiedOn, ElementName.CreatedBy],
|
|
72
|
-
secondary: [],
|
|
73
|
-
subtitle: []
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
export const getSimulatedBetterMetadata = (extensionKey = '', data) => {
|
|
5
|
+
const getSimulatedBetterMetadata = (extensionKey, data) => {
|
|
79
6
|
var _data$Type$includes, _data$Type;
|
|
80
7
|
const types = data ? extractType(data) : undefined;
|
|
81
8
|
const defaultMetadata = {
|
|
82
|
-
|
|
83
|
-
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn],
|
|
84
|
-
secondary: [],
|
|
85
|
-
subtitle: []
|
|
86
|
-
},
|
|
87
|
-
bottomMetadataBlock: {
|
|
88
|
-
primary: [],
|
|
89
|
-
secondary: [],
|
|
90
|
-
subtitle: []
|
|
91
|
-
}
|
|
9
|
+
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn]
|
|
92
10
|
};
|
|
93
11
|
switch (extensionKey) {
|
|
94
12
|
case 'bitbucket-object-provider':
|
|
95
13
|
case 'native-bitbucket-object-provider':
|
|
96
14
|
if (types !== null && types !== void 0 && types.includes('atlassian:SourceCodePullRequest')) {
|
|
97
15
|
return {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.SubscriberCount, ElementName.State],
|
|
101
|
-
secondary: [],
|
|
102
|
-
subtitle: [ElementName.SourceBranch, ElementName.TargetBranch]
|
|
103
|
-
}
|
|
16
|
+
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.SubscriberCount, ElementName.State],
|
|
17
|
+
subtitle: [ElementName.SourceBranch, ElementName.TargetBranch]
|
|
104
18
|
};
|
|
105
19
|
}
|
|
106
20
|
if (getBooleanFF('platform.linking-platform.extractor.improve-bitbucket-file-links') && types !== null && types !== void 0 && types.includes('schema:DigitalDocument')) {
|
|
107
21
|
return {
|
|
108
|
-
|
|
109
|
-
topMetadataBlock: {
|
|
110
|
-
primary: [ElementName.LatestCommit, ElementName.CollaboratorGroup, ElementName.ModifiedOn],
|
|
111
|
-
secondary: [],
|
|
112
|
-
subtitle: []
|
|
113
|
-
}
|
|
22
|
+
primary: [ElementName.LatestCommit, ElementName.CollaboratorGroup, ElementName.ModifiedOn]
|
|
114
23
|
};
|
|
115
24
|
}
|
|
116
25
|
return {
|
|
117
|
-
|
|
118
|
-
topMetadataBlock: {
|
|
119
|
-
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn],
|
|
120
|
-
secondary: [],
|
|
121
|
-
subtitle: []
|
|
122
|
-
}
|
|
26
|
+
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn]
|
|
123
27
|
};
|
|
124
28
|
case 'confluence-object-provider':
|
|
125
29
|
const primaryAttribution = data && extractOwnedBy(data) ? ElementName.OwnedByGroup : ElementName.AuthorGroup;
|
|
126
30
|
return {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
secondary: [],
|
|
130
|
-
subtitle: []
|
|
131
|
-
},
|
|
132
|
-
bottomMetadataBlock: {
|
|
133
|
-
primary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.ViewCount],
|
|
134
|
-
secondary: [],
|
|
135
|
-
subtitle: []
|
|
136
|
-
}
|
|
31
|
+
primary: [primaryAttribution, ElementName.ModifiedOn],
|
|
32
|
+
tertiary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.ViewCount]
|
|
137
33
|
};
|
|
138
34
|
case 'jira-object-provider':
|
|
139
|
-
const isJiraTask = (_data$Type$includes = (_data$Type = data['@type']) === null || _data$Type === void 0 ? void 0 : _data$Type.includes('atlassian:Task')) !== null && _data$Type$includes !== void 0 ? _data$Type$includes : false;
|
|
35
|
+
const isJiraTask = (_data$Type$includes = data === null || data === void 0 ? void 0 : (_data$Type = data['@type']) === null || _data$Type === void 0 ? void 0 : _data$Type.includes('atlassian:Task')) !== null && _data$Type$includes !== void 0 ? _data$Type$includes : false;
|
|
140
36
|
return {
|
|
141
37
|
...defaultMetadata,
|
|
142
38
|
...(isJiraTask && {
|
|
143
|
-
|
|
144
|
-
primary: [ElementName.AssignedToGroup, ElementName.State, ElementName.StoryPoints, ElementName.Priority],
|
|
145
|
-
secondary: [],
|
|
146
|
-
subtitle: []
|
|
147
|
-
}
|
|
39
|
+
primary: [ElementName.AssignedToGroup, ElementName.State, ElementName.StoryPoints, ElementName.Priority]
|
|
148
40
|
})
|
|
149
41
|
};
|
|
150
42
|
case 'trello-object-provider':
|
|
151
43
|
return {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
secondary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.AttachmentCount, ElementName.ChecklistProgress],
|
|
156
|
-
subtitle: [ElementName.Location]
|
|
157
|
-
}
|
|
44
|
+
primary: [ElementName.AuthorGroup, ElementName.State, ElementName.DueOn],
|
|
45
|
+
secondary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.AttachmentCount, ElementName.ChecklistProgress],
|
|
46
|
+
subtitle: [ElementName.Location]
|
|
158
47
|
};
|
|
159
48
|
case 'watermelon-object-provider':
|
|
160
49
|
if (types !== null && types !== void 0 && types.includes('atlassian:Project')) {
|
|
161
50
|
return {
|
|
162
|
-
|
|
163
|
-
topMetadataBlock: {
|
|
164
|
-
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.State, ElementName.DueOn],
|
|
165
|
-
secondary: [],
|
|
166
|
-
subtitle: []
|
|
167
|
-
}
|
|
51
|
+
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.State, ElementName.DueOn]
|
|
168
52
|
};
|
|
169
53
|
}
|
|
170
54
|
return {
|
|
171
|
-
|
|
172
|
-
topMetadataBlock: {
|
|
173
|
-
primary: [ElementName.AuthorGroup, ElementName.State, ElementName.DueOn],
|
|
174
|
-
secondary: [],
|
|
175
|
-
subtitle: []
|
|
176
|
-
}
|
|
55
|
+
primary: [ElementName.AuthorGroup, ElementName.State, ElementName.DueOn]
|
|
177
56
|
};
|
|
178
57
|
case 'slack-object-provider':
|
|
179
58
|
return {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
secondary: [],
|
|
183
|
-
subtitle: []
|
|
184
|
-
},
|
|
185
|
-
bottomMetadataBlock: {
|
|
186
|
-
primary: [ElementName.ReactCount, ElementName.CommentCount],
|
|
187
|
-
secondary: [],
|
|
188
|
-
subtitle: []
|
|
189
|
-
}
|
|
59
|
+
primary: [ElementName.AuthorGroup, ElementName.SentOn],
|
|
60
|
+
tertiary: [ElementName.ReactCount, ElementName.CommentCount]
|
|
190
61
|
};
|
|
191
62
|
case 'google-object-provider':
|
|
192
63
|
case 'figma-object-provider':
|
|
193
64
|
return {
|
|
194
|
-
|
|
195
|
-
topMetadataBlock: {
|
|
196
|
-
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn],
|
|
197
|
-
secondary: [],
|
|
198
|
-
subtitle: []
|
|
199
|
-
}
|
|
65
|
+
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn]
|
|
200
66
|
};
|
|
201
67
|
default:
|
|
202
68
|
return defaultMetadata;
|
|
203
69
|
}
|
|
70
|
+
};
|
|
71
|
+
const AvatarGroupsWithNamePrefix = [ElementName.AssignedToGroup, ElementName.OwnedByGroup, ElementName.AuthorGroup];
|
|
72
|
+
const toElementItem = name => {
|
|
73
|
+
const showNamePrefix = AvatarGroupsWithNamePrefix.indexOf(name) !== -1 ? true : undefined;
|
|
74
|
+
const testId = `${name.toLowerCase()}-metadata-element`;
|
|
75
|
+
return {
|
|
76
|
+
name,
|
|
77
|
+
showNamePrefix,
|
|
78
|
+
testId
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
const toElementItems = elementNames => {
|
|
82
|
+
if (!(elementNames !== null && elementNames !== void 0 && elementNames.length)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
return elementNames.filter(name => name in ElementName).map(toElementItem);
|
|
86
|
+
};
|
|
87
|
+
export const getMetadata = (extensionKey, data) => {
|
|
88
|
+
const metadata = getSimulatedBetterMetadata(extensionKey, data);
|
|
89
|
+
const primary = getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') ? [].concat(metadata.primary, metadata.tertiary) : metadata.primary;
|
|
90
|
+
|
|
91
|
+
// `tertiary` should be removed completely during cleanup:
|
|
92
|
+
// https://product-fabric.atlassian.net/browse/EDM-9556
|
|
93
|
+
const tertiary = getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') ? undefined : metadata.tertiary;
|
|
94
|
+
return {
|
|
95
|
+
subtitle: toElementItems(metadata.subtitle),
|
|
96
|
+
primary: toElementItems(primary),
|
|
97
|
+
secondary: toElementItems(metadata.secondary),
|
|
98
|
+
tertiary: toElementItems(tertiary)
|
|
99
|
+
};
|
|
204
100
|
};
|
|
@@ -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.57.
|
|
10
|
+
packageVersion: "26.57.3",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
const Link = withLinkClickedEvent('a');
|
|
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
15
15
|
export var context = {
|
|
16
16
|
componentName: 'smart-cards',
|
|
17
17
|
packageName: "@atlaskit/smart-card",
|
|
18
|
-
packageVersion: "26.57.
|
|
18
|
+
packageVersion: "26.57.3"
|
|
19
19
|
};
|
|
20
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
21
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -8,12 +8,11 @@ import CopyIcon from '@atlaskit/icon/glyph/copy';
|
|
|
8
8
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
9
9
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
10
10
|
import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../constants';
|
|
11
|
-
import { extractMetadata } from '../../../extractors/hover/extractMetadata';
|
|
12
11
|
import { useSmartLinkAnalytics } from '../../../state/analytics';
|
|
13
12
|
import { getExtensionKey, getServices } from '../../../state/helpers';
|
|
14
13
|
import { isSpecialEvent } from '../../../utils';
|
|
15
14
|
import { flexibleUiOptions, titleBlockCss } from '../styled';
|
|
16
|
-
import {
|
|
15
|
+
import { getMetadata } from '../utils';
|
|
17
16
|
import HoverCardLoadingView from './views/resolving';
|
|
18
17
|
import HoverCardUnauthorisedView from './views/unauthorised';
|
|
19
18
|
import HoverCardResolvedView from './views/resolved';
|
|
@@ -133,8 +132,8 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
133
132
|
return [getCopyAction(url)];
|
|
134
133
|
}, [url]);
|
|
135
134
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
136
|
-
var
|
|
137
|
-
subtitle =
|
|
135
|
+
var _getMetadata = getMetadata(extensionKey, data),
|
|
136
|
+
subtitle = _getMetadata.subtitle;
|
|
138
137
|
var titleMaxLines = subtitle && subtitle.length > 0 ? 1 : 2;
|
|
139
138
|
var titleBlockProps = {
|
|
140
139
|
actions: getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') ? undefined : titleActions,
|
|
@@ -5,9 +5,8 @@ import { ActionName, CardDisplay, ElementName, SmartLinkPosition, SmartLinkSize,
|
|
|
5
5
|
import { FooterBlock, MetadataBlock, RelatedUrlsBlock, SnippetBlock, TitleBlock, AISummaryBlock, CustomBlock, ActionBlock } from '../../../../FlexibleCard/components/blocks';
|
|
6
6
|
import { footerBlockCss, hiddenSnippetStyles, metadataBlockCss } from './styled';
|
|
7
7
|
import FlexibleCard from '../../../../FlexibleCard';
|
|
8
|
-
import {
|
|
8
|
+
import { getMetadata } from '../../../utils';
|
|
9
9
|
import ImagePreview from '../../ImagePreview';
|
|
10
|
-
import { elementNamesToItems } from '../../../../../extractors/hover/extractMetadata';
|
|
11
10
|
import { messages } from '../../../../../messages';
|
|
12
11
|
import { FormattedMessage } from 'react-intl-next';
|
|
13
12
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
@@ -75,7 +74,7 @@ var ConnectedAIBlock = function ConnectedAIBlock(_ref) {
|
|
|
75
74
|
return showData ? /*#__PURE__*/React.createElement(React.Fragment, null, !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
76
75
|
testId: 'connected-AI',
|
|
77
76
|
status: SmartLinkStatus.Resolved
|
|
78
|
-
}), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
77
|
+
}), !getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') && /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
79
78
|
primary: bottomPrimary,
|
|
80
79
|
size: SmartLinkSize.Large,
|
|
81
80
|
overrideCss: metadataBlockCss,
|
|
@@ -110,16 +109,11 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
110
109
|
}, [cardActions, onActionClick]);
|
|
111
110
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
112
111
|
var _useMemo = useMemo(function () {
|
|
113
|
-
|
|
114
|
-
return {
|
|
115
|
-
topPrimary: elementNamesToItems(betterMetadata.topMetadataBlock.primary),
|
|
116
|
-
topSecondary: elementNamesToItems(betterMetadata.topMetadataBlock.secondary),
|
|
117
|
-
bottomPrimary: elementNamesToItems(betterMetadata.bottomMetadataBlock.primary)
|
|
118
|
-
};
|
|
112
|
+
return getMetadata(extensionKey, data);
|
|
119
113
|
}, [data, extensionKey]),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
114
|
+
primary = _useMemo.primary,
|
|
115
|
+
secondary = _useMemo.secondary,
|
|
116
|
+
tertiary = _useMemo.tertiary;
|
|
123
117
|
var snippetHeight = React.useRef(0);
|
|
124
118
|
var snippetBlockRef = useRef(null);
|
|
125
119
|
var onSnippetRender = useCallback(function () {
|
|
@@ -143,8 +137,8 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
143
137
|
return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps, imagePreview, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockProps, {
|
|
144
138
|
metadataPosition: SmartLinkPosition.Top
|
|
145
139
|
})), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
146
|
-
primary:
|
|
147
|
-
secondary:
|
|
140
|
+
primary: primary,
|
|
141
|
+
secondary: secondary,
|
|
148
142
|
overrideCss: metadataBlockCss,
|
|
149
143
|
maxLines: 1,
|
|
150
144
|
size: SmartLinkSize.Medium
|
|
@@ -158,7 +152,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
158
152
|
blockRef: connectedAIBlockRef
|
|
159
153
|
}, /*#__PURE__*/React.createElement(ConnectedAIBlock, {
|
|
160
154
|
imagePreview: !!imagePreview,
|
|
161
|
-
bottomPrimary:
|
|
155
|
+
bottomPrimary: tertiary,
|
|
162
156
|
data: data
|
|
163
157
|
})), !isAISummaryEnabled && !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
164
158
|
status: SmartLinkStatus.Resolved
|
|
@@ -167,8 +161,8 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
167
161
|
onRender: onSnippetRender,
|
|
168
162
|
blockRef: snippetBlockRef,
|
|
169
163
|
overrideCss: hiddenSnippetStyles
|
|
170
|
-
}), !isAISummaryEnabled && /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
171
|
-
primary:
|
|
164
|
+
}), !isAISummaryEnabled && !isActionBlockEnabled && /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
165
|
+
primary: tertiary,
|
|
172
166
|
size: SmartLinkSize.Large,
|
|
173
167
|
overrideCss: metadataBlockCss,
|
|
174
168
|
maxLines: 1,
|
|
@@ -5,197 +5,98 @@ import { ElementName } from '../../constants';
|
|
|
5
5
|
import { extractType } from '@atlaskit/link-extractors';
|
|
6
6
|
import { extractOwnedBy } from '../../extractors/flexible/utils';
|
|
7
7
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
var data = arguments.length > 1 ? arguments[1] : undefined;
|
|
8
|
+
var getSimulatedBetterMetadata = function getSimulatedBetterMetadata(extensionKey, data) {
|
|
9
|
+
var _data$Type$includes, _data$Type;
|
|
11
10
|
var types = data ? extractType(data) : undefined;
|
|
11
|
+
var defaultMetadata = {
|
|
12
|
+
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn]
|
|
13
|
+
};
|
|
12
14
|
switch (extensionKey) {
|
|
13
15
|
case 'bitbucket-object-provider':
|
|
14
16
|
case 'native-bitbucket-object-provider':
|
|
15
17
|
if (types !== null && types !== void 0 && types.includes('atlassian:SourceCodePullRequest')) {
|
|
16
18
|
return {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
secondary: [],
|
|
20
|
-
subtitle: [ElementName.SourceBranch, ElementName.TargetBranch]
|
|
21
|
-
}
|
|
19
|
+
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.SubscriberCount, ElementName.State],
|
|
20
|
+
subtitle: [ElementName.SourceBranch, ElementName.TargetBranch]
|
|
22
21
|
};
|
|
23
22
|
}
|
|
24
|
-
|
|
25
|
-
metadata: {
|
|
26
|
-
primary: [ElementName.ModifiedOn, ElementName.CreatedBy],
|
|
27
|
-
secondary: [],
|
|
28
|
-
subtitle: []
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
case 'confluence-object-provider':
|
|
32
|
-
var primaryAttribution = data && extractOwnedBy(data) ? ElementName.OwnedBy : ElementName.CreatedBy;
|
|
33
|
-
return {
|
|
34
|
-
metadata: {
|
|
35
|
-
primary: [ElementName.AuthorGroup, primaryAttribution],
|
|
36
|
-
secondary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.ViewCount],
|
|
37
|
-
subtitle: []
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
case 'jira-object-provider':
|
|
41
|
-
return {
|
|
42
|
-
metadata: {
|
|
43
|
-
primary: [ElementName.AuthorGroup, ElementName.State, ElementName.Priority],
|
|
44
|
-
secondary: [],
|
|
45
|
-
subtitle: []
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
case 'trello-object-provider':
|
|
49
|
-
return {
|
|
50
|
-
metadata: {
|
|
51
|
-
primary: [ElementName.AuthorGroup, ElementName.State, ElementName.DueOn],
|
|
52
|
-
secondary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.AttachmentCount, ElementName.ChecklistProgress],
|
|
53
|
-
subtitle: [ElementName.Location]
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
case 'watermelon-object-provider':
|
|
57
|
-
if (types !== null && types !== void 0 && types.includes('atlassian:Project')) {
|
|
23
|
+
if (getBooleanFF('platform.linking-platform.extractor.improve-bitbucket-file-links') && types !== null && types !== void 0 && types.includes('schema:DigitalDocument')) {
|
|
58
24
|
return {
|
|
59
|
-
|
|
60
|
-
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.State, ElementName.DueOn],
|
|
61
|
-
secondary: [],
|
|
62
|
-
subtitle: []
|
|
63
|
-
}
|
|
25
|
+
primary: [ElementName.LatestCommit, ElementName.CollaboratorGroup, ElementName.ModifiedOn]
|
|
64
26
|
};
|
|
65
27
|
}
|
|
66
28
|
return {
|
|
67
|
-
|
|
68
|
-
primary: [ElementName.AuthorGroup, ElementName.State, ElementName.DueOn],
|
|
69
|
-
secondary: [],
|
|
70
|
-
subtitle: []
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
default:
|
|
74
|
-
return {
|
|
75
|
-
metadata: {
|
|
76
|
-
primary: [ElementName.ModifiedOn, ElementName.CreatedBy],
|
|
77
|
-
secondary: [],
|
|
78
|
-
subtitle: []
|
|
79
|
-
}
|
|
29
|
+
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn]
|
|
80
30
|
};
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
export var getSimulatedBetterMetadata = function getSimulatedBetterMetadata() {
|
|
84
|
-
var _data$Type$includes, _data$Type;
|
|
85
|
-
var extensionKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
86
|
-
var data = arguments.length > 1 ? arguments[1] : undefined;
|
|
87
|
-
var types = data ? extractType(data) : undefined;
|
|
88
|
-
var defaultMetadata = {
|
|
89
|
-
topMetadataBlock: {
|
|
90
|
-
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn],
|
|
91
|
-
secondary: [],
|
|
92
|
-
subtitle: []
|
|
93
|
-
},
|
|
94
|
-
bottomMetadataBlock: {
|
|
95
|
-
primary: [],
|
|
96
|
-
secondary: [],
|
|
97
|
-
subtitle: []
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
switch (extensionKey) {
|
|
101
|
-
case 'bitbucket-object-provider':
|
|
102
|
-
case 'native-bitbucket-object-provider':
|
|
103
|
-
if (types !== null && types !== void 0 && types.includes('atlassian:SourceCodePullRequest')) {
|
|
104
|
-
return _objectSpread(_objectSpread({}, defaultMetadata), {}, {
|
|
105
|
-
topMetadataBlock: {
|
|
106
|
-
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.SubscriberCount, ElementName.State],
|
|
107
|
-
secondary: [],
|
|
108
|
-
subtitle: [ElementName.SourceBranch, ElementName.TargetBranch]
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
if (getBooleanFF('platform.linking-platform.extractor.improve-bitbucket-file-links') && types !== null && types !== void 0 && types.includes('schema:DigitalDocument')) {
|
|
113
|
-
return _objectSpread(_objectSpread({}, defaultMetadata), {}, {
|
|
114
|
-
topMetadataBlock: {
|
|
115
|
-
primary: [ElementName.LatestCommit, ElementName.CollaboratorGroup, ElementName.ModifiedOn],
|
|
116
|
-
secondary: [],
|
|
117
|
-
subtitle: []
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
return _objectSpread(_objectSpread({}, defaultMetadata), {}, {
|
|
122
|
-
topMetadataBlock: {
|
|
123
|
-
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn],
|
|
124
|
-
secondary: [],
|
|
125
|
-
subtitle: []
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
31
|
case 'confluence-object-provider':
|
|
129
32
|
var primaryAttribution = data && extractOwnedBy(data) ? ElementName.OwnedByGroup : ElementName.AuthorGroup;
|
|
130
33
|
return {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
secondary: [],
|
|
134
|
-
subtitle: []
|
|
135
|
-
},
|
|
136
|
-
bottomMetadataBlock: {
|
|
137
|
-
primary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.ViewCount],
|
|
138
|
-
secondary: [],
|
|
139
|
-
subtitle: []
|
|
140
|
-
}
|
|
34
|
+
primary: [primaryAttribution, ElementName.ModifiedOn],
|
|
35
|
+
tertiary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.ViewCount]
|
|
141
36
|
};
|
|
142
37
|
case 'jira-object-provider':
|
|
143
|
-
var isJiraTask = (_data$Type$includes = (_data$Type = data['@type']) === null || _data$Type === void 0 ? void 0 : _data$Type.includes('atlassian:Task')) !== null && _data$Type$includes !== void 0 ? _data$Type$includes : false;
|
|
38
|
+
var isJiraTask = (_data$Type$includes = data === null || data === void 0 || (_data$Type = data['@type']) === null || _data$Type === void 0 ? void 0 : _data$Type.includes('atlassian:Task')) !== null && _data$Type$includes !== void 0 ? _data$Type$includes : false;
|
|
144
39
|
return _objectSpread(_objectSpread({}, defaultMetadata), isJiraTask && {
|
|
145
|
-
|
|
146
|
-
primary: [ElementName.AssignedToGroup, ElementName.State, ElementName.StoryPoints, ElementName.Priority],
|
|
147
|
-
secondary: [],
|
|
148
|
-
subtitle: []
|
|
149
|
-
}
|
|
40
|
+
primary: [ElementName.AssignedToGroup, ElementName.State, ElementName.StoryPoints, ElementName.Priority]
|
|
150
41
|
});
|
|
151
42
|
case 'trello-object-provider':
|
|
152
|
-
return
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
});
|
|
43
|
+
return {
|
|
44
|
+
primary: [ElementName.AuthorGroup, ElementName.State, ElementName.DueOn],
|
|
45
|
+
secondary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.AttachmentCount, ElementName.ChecklistProgress],
|
|
46
|
+
subtitle: [ElementName.Location]
|
|
47
|
+
};
|
|
159
48
|
case 'watermelon-object-provider':
|
|
160
49
|
if (types !== null && types !== void 0 && types.includes('atlassian:Project')) {
|
|
161
|
-
return
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
secondary: [],
|
|
165
|
-
subtitle: []
|
|
166
|
-
}
|
|
167
|
-
});
|
|
50
|
+
return {
|
|
51
|
+
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.State, ElementName.DueOn]
|
|
52
|
+
};
|
|
168
53
|
}
|
|
169
|
-
return
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
secondary: [],
|
|
173
|
-
subtitle: []
|
|
174
|
-
}
|
|
175
|
-
});
|
|
54
|
+
return {
|
|
55
|
+
primary: [ElementName.AuthorGroup, ElementName.State, ElementName.DueOn]
|
|
56
|
+
};
|
|
176
57
|
case 'slack-object-provider':
|
|
177
58
|
return {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
secondary: [],
|
|
181
|
-
subtitle: []
|
|
182
|
-
},
|
|
183
|
-
bottomMetadataBlock: {
|
|
184
|
-
primary: [ElementName.ReactCount, ElementName.CommentCount],
|
|
185
|
-
secondary: [],
|
|
186
|
-
subtitle: []
|
|
187
|
-
}
|
|
59
|
+
primary: [ElementName.AuthorGroup, ElementName.SentOn],
|
|
60
|
+
tertiary: [ElementName.ReactCount, ElementName.CommentCount]
|
|
188
61
|
};
|
|
189
62
|
case 'google-object-provider':
|
|
190
63
|
case 'figma-object-provider':
|
|
191
|
-
return
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
secondary: [],
|
|
195
|
-
subtitle: []
|
|
196
|
-
}
|
|
197
|
-
});
|
|
64
|
+
return {
|
|
65
|
+
primary: [ElementName.AuthorGroup, ElementName.ModifiedOn]
|
|
66
|
+
};
|
|
198
67
|
default:
|
|
199
68
|
return defaultMetadata;
|
|
200
69
|
}
|
|
70
|
+
};
|
|
71
|
+
var AvatarGroupsWithNamePrefix = [ElementName.AssignedToGroup, ElementName.OwnedByGroup, ElementName.AuthorGroup];
|
|
72
|
+
var toElementItem = function toElementItem(name) {
|
|
73
|
+
var showNamePrefix = AvatarGroupsWithNamePrefix.indexOf(name) !== -1 ? true : undefined;
|
|
74
|
+
var testId = "".concat(name.toLowerCase(), "-metadata-element");
|
|
75
|
+
return {
|
|
76
|
+
name: name,
|
|
77
|
+
showNamePrefix: showNamePrefix,
|
|
78
|
+
testId: testId
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
var toElementItems = function toElementItems(elementNames) {
|
|
82
|
+
if (!(elementNames !== null && elementNames !== void 0 && elementNames.length)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
return elementNames.filter(function (name) {
|
|
86
|
+
return name in ElementName;
|
|
87
|
+
}).map(toElementItem);
|
|
88
|
+
};
|
|
89
|
+
export var getMetadata = function getMetadata(extensionKey, data) {
|
|
90
|
+
var metadata = getSimulatedBetterMetadata(extensionKey, data);
|
|
91
|
+
var primary = getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') ? [].concat(metadata.primary, metadata.tertiary) : metadata.primary;
|
|
92
|
+
|
|
93
|
+
// `tertiary` should be removed completely during cleanup:
|
|
94
|
+
// https://product-fabric.atlassian.net/browse/EDM-9556
|
|
95
|
+
var tertiary = getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') ? undefined : metadata.tertiary;
|
|
96
|
+
return {
|
|
97
|
+
subtitle: toElementItems(metadata.subtitle),
|
|
98
|
+
primary: toElementItems(primary),
|
|
99
|
+
secondary: toElementItems(metadata.secondary),
|
|
100
|
+
tertiary: toElementItems(tertiary)
|
|
101
|
+
};
|
|
201
102
|
};
|
|
@@ -10,7 +10,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
|
|
|
10
10
|
import LinkWarningModal from './LinkWarningModal';
|
|
11
11
|
var PACKAGE_DATA = {
|
|
12
12
|
packageName: "@atlaskit/smart-card",
|
|
13
|
-
packageVersion: "26.57.
|
|
13
|
+
packageVersion: "26.57.3",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
var Link = withLinkClickedEvent('a');
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
2
|
-
import { ElementItem } from '../FlexibleCard/components/blocks/types';
|
|
3
2
|
import { AnalyticsFacade } from '../../state/analytics';
|
|
4
3
|
import { LinkAction } from '../../state/hooks-external/useSmartLinkActions';
|
|
5
4
|
import { CardState } from '@atlaskit/linking-common';
|
|
@@ -82,11 +81,6 @@ export interface HoverCardComponentProps extends HoverCardProps, HoverCardIntern
|
|
|
82
81
|
}
|
|
83
82
|
export type PreviewDisplay = 'card' | 'embed';
|
|
84
83
|
export type PreviewInvokeMethod = 'keyboard' | 'mouse_hover' | 'mouse_click';
|
|
85
|
-
export interface MetadataOptions {
|
|
86
|
-
primary: Array<ElementItem>;
|
|
87
|
-
secondary: Array<ElementItem>;
|
|
88
|
-
subtitle: Array<ElementItem>;
|
|
89
|
-
}
|
|
90
84
|
export type HoverCardContentProps = {
|
|
91
85
|
id?: string;
|
|
92
86
|
analytics?: AnalyticsFacade;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { JsonLd } from 'json-ld-types';
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
2
|
+
import type { ElementItem } from '../FlexibleCard/components/blocks/types';
|
|
3
|
+
export declare const getMetadata: (extensionKey?: string, data?: JsonLd.Data.BaseData) => {
|
|
4
|
+
subtitle: ElementItem[] | undefined;
|
|
5
|
+
primary: ElementItem[] | undefined;
|
|
6
|
+
secondary: ElementItem[] | undefined;
|
|
7
|
+
tertiary: ElementItem[] | undefined;
|
|
8
|
+
};
|