@atlaskit/smart-card 26.57.0 → 26.57.2

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/utils/analytics/analytics.js +1 -1
  3. package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/index.js +3 -2
  4. package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +3 -1
  5. package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +2 -1
  6. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +2 -3
  7. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +8 -14
  8. package/dist/cjs/view/HoverCard/utils.js +58 -162
  9. package/dist/cjs/view/LinkUrl/index.js +1 -1
  10. package/dist/es2019/utils/analytics/analytics.js +1 -1
  11. package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/index.js +3 -2
  12. package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +3 -1
  13. package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +2 -1
  14. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +2 -3
  15. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +9 -15
  16. package/dist/es2019/view/HoverCard/utils.js +43 -152
  17. package/dist/es2019/view/LinkUrl/index.js +1 -1
  18. package/dist/esm/utils/analytics/analytics.js +1 -1
  19. package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/index.js +3 -2
  20. package/dist/esm/view/FlexibleCard/components/actions/action/index.js +3 -1
  21. package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +2 -1
  22. package/dist/esm/view/HoverCard/components/HoverCardContent.js +3 -4
  23. package/dist/esm/view/HoverCard/components/views/resolved/index.js +9 -15
  24. package/dist/esm/view/HoverCard/utils.js +57 -161
  25. package/dist/esm/view/LinkUrl/index.js +1 -1
  26. package/dist/types/view/FlexibleCard/components/actions/action/action-stack-item/types.d.ts +1 -0
  27. package/dist/types/view/FlexibleCard/components/actions/action/types.d.ts +4 -0
  28. package/dist/types/view/HoverCard/types.d.ts +0 -6
  29. package/dist/types/view/HoverCard/utils.d.ts +7 -2
  30. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-stack-item/types.d.ts +1 -0
  31. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/types.d.ts +4 -0
  32. package/dist/types-ts4.5/view/HoverCard/types.d.ts +0 -6
  33. package/dist/types-ts4.5/view/HoverCard/utils.d.ts +7 -2
  34. package/package.json +2 -2
  35. package/dist/cjs/extractors/hover/extractMetadata.js +0 -33
  36. package/dist/es2019/extractors/hover/extractMetadata.js +0 -20
  37. package/dist/esm/extractors/hover/extractMetadata.js +0 -26
  38. package/dist/types/extractors/hover/extractMetadata.d.ts +0 -5
  39. package/dist/types-ts4.5/extractors/hover/extractMetadata.d.ts +0 -5
@@ -2,203 +2,94 @@ 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
- export const getSimulatedMetadata = (extensionKey = '', data) => {
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
- topMetadataBlock: {
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
- ...defaultMetadata,
99
- topMetadataBlock: {
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
- ...defaultMetadata,
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
- ...defaultMetadata,
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
- topMetadataBlock: {
128
- primary: [primaryAttribution, ElementName.ModifiedOn],
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
- topMetadataBlock: {
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
- ...defaultMetadata,
153
- topMetadataBlock: {
154
- primary: [ElementName.AuthorGroup, ElementName.State, ElementName.DueOn],
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
- ...defaultMetadata,
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
- ...defaultMetadata,
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
- topMetadataBlock: {
181
- primary: [ElementName.AuthorGroup, ElementName.SentOn],
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
- ...defaultMetadata,
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
+ return {
90
+ subtitle: toElementItems(metadata.subtitle),
91
+ primary: toElementItems(metadata.primary),
92
+ secondary: toElementItems(metadata.secondary),
93
+ tertiary: toElementItems(metadata.tertiary)
94
+ };
204
95
  };
@@ -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.0",
10
+ packageVersion: "26.57.2",
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.0"
18
+ packageVersion: "26.57.2"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -47,7 +47,8 @@ var ActionStackItem = function ActionStackItem(_ref) {
47
47
  testId = _ref.testId,
48
48
  tooltipMessage = _ref.tooltipMessage,
49
49
  xcss = _ref.xcss,
50
- tooltipOnHide = _ref.tooltipOnHide;
50
+ tooltipOnHide = _ref.tooltipOnHide,
51
+ hideTooltipOnMouseDown = _ref.hideTooltipOnMouseDown;
51
52
  var space = spaceOption !== null && spaceOption !== void 0 ? spaceOption : getPrimitivesInlineSpaceBySize(size);
52
53
  var onClick = useCallback(function () {
53
54
  if (!isDisabled && !isLoading && onClickCallback) {
@@ -66,7 +67,7 @@ var ActionStackItem = function ActionStackItem(_ref) {
66
67
  return /*#__PURE__*/React.createElement(Tooltip, {
67
68
  content: tooltipMessage || content,
68
69
  onHide: tooltipOnHide,
69
- hideTooltipOnMouseDown: true
70
+ hideTooltipOnMouseDown: hideTooltipOnMouseDown
70
71
  }, function (tooltipProps) {
71
72
  return /*#__PURE__*/React.createElement(Box, _extends({
72
73
  as: "button",
@@ -30,6 +30,7 @@ var Action = function Action(_ref) {
30
30
  spaceInline = _ref.spaceInline,
31
31
  tooltipMessage = _ref.tooltipMessage,
32
32
  tooltipOnHide = _ref.tooltipOnHide,
33
+ hideTooltipOnMouseDown = _ref.hideTooltipOnMouseDown,
33
34
  xcss = _ref.xcss,
34
35
  asDropDownItem = _ref.asDropDownItem,
35
36
  overrideCss = _ref.overrideCss,
@@ -63,7 +64,8 @@ var Action = function Action(_ref) {
63
64
  testId: testId,
64
65
  tooltipMessage: tooltipMessage || content,
65
66
  xcss: xcss,
66
- tooltipOnHide: tooltipOnHide
67
+ tooltipOnHide: tooltipOnHide,
68
+ hideTooltipOnMouseDown: hideTooltipOnMouseDown
67
69
  });
68
70
  }
69
71
  if (isDropdownItem) {
@@ -71,7 +71,8 @@ var PreviewAction = function PreviewAction(_ref) {
71
71
  }),
72
72
  onClick: onClick,
73
73
  testId: "smart-action-preview-action",
74
- tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, tooltipMessage)
74
+ tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, tooltipMessage),
75
+ hideTooltipOnMouseDown: true
75
76
  }, data, props)) : null;
76
77
  };
77
78
  export default PreviewAction;
@@ -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 { getSimulatedMetadata } from '../utils';
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 _extractMetadata = extractMetadata(getSimulatedMetadata(extensionKey, data)),
137
- subtitle = _extractMetadata.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 { getSimulatedBetterMetadata } from '../../../utils';
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';
@@ -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
- var betterMetadata = getSimulatedBetterMetadata(extensionKey, data);
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
- topPrimary = _useMemo.topPrimary,
121
- topSecondary = _useMemo.topSecondary,
122
- bottomPrimary = _useMemo.bottomPrimary;
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: topPrimary,
147
- secondary: topSecondary,
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: bottomPrimary,
155
+ bottomPrimary: tertiary,
162
156
  data: data
163
157
  })), !isAISummaryEnabled && !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, {
164
158
  status: SmartLinkStatus.Resolved
@@ -168,7 +162,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
168
162
  blockRef: snippetBlockRef,
169
163
  overrideCss: hiddenSnippetStyles
170
164
  }), !isAISummaryEnabled && /*#__PURE__*/React.createElement(MetadataBlock, {
171
- primary: bottomPrimary,
165
+ primary: tertiary,
172
166
  size: SmartLinkSize.Large,
173
167
  overrideCss: metadataBlockCss,
174
168
  maxLines: 1,
@@ -5,197 +5,93 @@ 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
- export var getSimulatedMetadata = function getSimulatedMetadata() {
9
- var extensionKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
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
- metadata: {
18
- primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.SubscriberCount, ElementName.State],
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
- return {
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
- metadata: {
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
- metadata: {
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
- topMetadataBlock: {
132
- primary: [primaryAttribution, ElementName.ModifiedOn],
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
- topMetadataBlock: {
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 _objectSpread(_objectSpread({}, defaultMetadata), {}, {
153
- topMetadataBlock: {
154
- primary: [ElementName.AuthorGroup, ElementName.State, ElementName.DueOn],
155
- secondary: [ElementName.ReactCount, ElementName.CommentCount, ElementName.AttachmentCount, ElementName.ChecklistProgress],
156
- subtitle: [ElementName.Location]
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 _objectSpread(_objectSpread({}, defaultMetadata), {}, {
162
- topMetadataBlock: {
163
- primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.State, ElementName.DueOn],
164
- secondary: [],
165
- subtitle: []
166
- }
167
- });
50
+ return {
51
+ primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.State, ElementName.DueOn]
52
+ };
168
53
  }
169
- return _objectSpread(_objectSpread({}, defaultMetadata), {}, {
170
- topMetadataBlock: {
171
- primary: [ElementName.AuthorGroup, ElementName.State, ElementName.DueOn],
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
- topMetadataBlock: {
179
- primary: [ElementName.AuthorGroup, ElementName.SentOn],
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 _objectSpread(_objectSpread({}, defaultMetadata), {}, {
192
- topMetadataBlock: {
193
- primary: [ElementName.AuthorGroup, ElementName.ModifiedOn],
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
+ return {
92
+ subtitle: toElementItems(metadata.subtitle),
93
+ primary: toElementItems(metadata.primary),
94
+ secondary: toElementItems(metadata.secondary),
95
+ tertiary: toElementItems(metadata.tertiary)
96
+ };
201
97
  };
@@ -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.0",
13
+ packageVersion: "26.57.2",
14
14
  componentName: 'linkUrl'
15
15
  };
16
16
  var Link = withLinkClickedEvent('a');