@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.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/index.js +3 -2
- package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +2 -1
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +2 -3
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +8 -14
- package/dist/cjs/view/HoverCard/utils.js +58 -162
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/index.js +3 -2
- package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +3 -1
- package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +2 -1
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +2 -3
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +9 -15
- package/dist/es2019/view/HoverCard/utils.js +43 -152
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/index.js +3 -2
- package/dist/esm/view/FlexibleCard/components/actions/action/index.js +3 -1
- package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +2 -1
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +3 -4
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +9 -15
- package/dist/esm/view/HoverCard/utils.js +57 -161
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/view/FlexibleCard/components/actions/action/action-stack-item/types.d.ts +1 -0
- package/dist/types/view/FlexibleCard/components/actions/action/types.d.ts +4 -0
- 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/FlexibleCard/components/actions/action/action-stack-item/types.d.ts +1 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/types.d.ts +4 -0
- 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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 26.57.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#92944](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/92944) [`1d66db78c1c9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1d66db78c1c9) - Refactor hover card metadata function
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 26.57.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#92926](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/92926) [`9bc2cc714add`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9bc2cc714add) - [ux] Hide ActionBlock Tooltip on MouseDown for PreviewAction
|
|
15
|
+
|
|
3
16
|
## 26.57.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -22,7 +22,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
22
22
|
var context = exports.context = {
|
|
23
23
|
componentName: 'smart-cards',
|
|
24
24
|
packageName: "@atlaskit/smart-card",
|
|
25
|
-
packageVersion: "26.57.
|
|
25
|
+
packageVersion: "26.57.2"
|
|
26
26
|
};
|
|
27
27
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
28
28
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -57,7 +57,8 @@ var ActionStackItem = function ActionStackItem(_ref) {
|
|
|
57
57
|
testId = _ref.testId,
|
|
58
58
|
tooltipMessage = _ref.tooltipMessage,
|
|
59
59
|
xcss = _ref.xcss,
|
|
60
|
-
tooltipOnHide = _ref.tooltipOnHide
|
|
60
|
+
tooltipOnHide = _ref.tooltipOnHide,
|
|
61
|
+
hideTooltipOnMouseDown = _ref.hideTooltipOnMouseDown;
|
|
61
62
|
var space = spaceOption !== null && spaceOption !== void 0 ? spaceOption : (0, _utils.getPrimitivesInlineSpaceBySize)(size);
|
|
62
63
|
var onClick = (0, _react.useCallback)(function () {
|
|
63
64
|
if (!isDisabled && !isLoading && onClickCallback) {
|
|
@@ -76,7 +77,7 @@ var ActionStackItem = function ActionStackItem(_ref) {
|
|
|
76
77
|
return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
|
|
77
78
|
content: tooltipMessage || content,
|
|
78
79
|
onHide: tooltipOnHide,
|
|
79
|
-
hideTooltipOnMouseDown:
|
|
80
|
+
hideTooltipOnMouseDown: hideTooltipOnMouseDown
|
|
80
81
|
}, function (tooltipProps) {
|
|
81
82
|
return /*#__PURE__*/_react.default.createElement(_primitives.Box, (0, _extends2.default)({
|
|
82
83
|
as: "button",
|
|
@@ -36,6 +36,7 @@ var Action = function Action(_ref) {
|
|
|
36
36
|
spaceInline = _ref.spaceInline,
|
|
37
37
|
tooltipMessage = _ref.tooltipMessage,
|
|
38
38
|
tooltipOnHide = _ref.tooltipOnHide,
|
|
39
|
+
hideTooltipOnMouseDown = _ref.hideTooltipOnMouseDown,
|
|
39
40
|
xcss = _ref.xcss,
|
|
40
41
|
asDropDownItem = _ref.asDropDownItem,
|
|
41
42
|
overrideCss = _ref.overrideCss,
|
|
@@ -69,7 +70,8 @@ var Action = function Action(_ref) {
|
|
|
69
70
|
testId: testId,
|
|
70
71
|
tooltipMessage: tooltipMessage || content,
|
|
71
72
|
xcss: xcss,
|
|
72
|
-
tooltipOnHide: tooltipOnHide
|
|
73
|
+
tooltipOnHide: tooltipOnHide,
|
|
74
|
+
hideTooltipOnMouseDown: hideTooltipOnMouseDown
|
|
73
75
|
});
|
|
74
76
|
}
|
|
75
77
|
if (isDropdownItem) {
|
|
@@ -81,7 +81,8 @@ var PreviewAction = function PreviewAction(_ref) {
|
|
|
81
81
|
}),
|
|
82
82
|
onClick: onClick,
|
|
83
83
|
testId: "smart-action-preview-action",
|
|
84
|
-
tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, tooltipMessage)
|
|
84
|
+
tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, tooltipMessage),
|
|
85
|
+
hideTooltipOnMouseDown: true
|
|
85
86
|
}, data, props)) : null;
|
|
86
87
|
};
|
|
87
88
|
var _default = exports.default = PreviewAction;
|
|
@@ -15,7 +15,6 @@ var _copy = _interopRequireDefault(require("@atlaskit/icon/glyph/copy"));
|
|
|
15
15
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
16
16
|
var _linkProvider = require("@atlaskit/link-provider");
|
|
17
17
|
var _constants = require("../../../constants");
|
|
18
|
-
var _extractMetadata2 = require("../../../extractors/hover/extractMetadata");
|
|
19
18
|
var _analytics2 = require("../../../state/analytics");
|
|
20
19
|
var _helpers = require("../../../state/helpers");
|
|
21
20
|
var _utils = require("../../../utils");
|
|
@@ -144,8 +143,8 @@ var HoverCardContent = function HoverCardContent(_ref) {
|
|
|
144
143
|
return [getCopyAction(url)];
|
|
145
144
|
}, [url]);
|
|
146
145
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
147
|
-
var
|
|
148
|
-
subtitle =
|
|
146
|
+
var _getMetadata = (0, _utils2.getMetadata)(extensionKey, data),
|
|
147
|
+
subtitle = _getMetadata.subtitle;
|
|
149
148
|
var titleMaxLines = subtitle && subtitle.length > 0 ? 1 : 2;
|
|
150
149
|
var titleBlockProps = {
|
|
151
150
|
actions: (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.hover-card-action-redesign') ? undefined : titleActions,
|
|
@@ -15,7 +15,6 @@ var _styled = require("./styled");
|
|
|
15
15
|
var _FlexibleCard = _interopRequireDefault(require("../../../../FlexibleCard"));
|
|
16
16
|
var _utils = require("../../../utils");
|
|
17
17
|
var _ImagePreview = _interopRequireDefault(require("../../ImagePreview"));
|
|
18
|
-
var _extractMetadata = require("../../../../../extractors/hover/extractMetadata");
|
|
19
18
|
var _messages = require("../../../../../messages");
|
|
20
19
|
var _reactIntlNext = require("react-intl-next");
|
|
21
20
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
@@ -119,16 +118,11 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
119
118
|
}, [cardActions, onActionClick]);
|
|
120
119
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
121
120
|
var _useMemo = (0, _react.useMemo)(function () {
|
|
122
|
-
|
|
123
|
-
return {
|
|
124
|
-
topPrimary: (0, _extractMetadata.elementNamesToItems)(betterMetadata.topMetadataBlock.primary),
|
|
125
|
-
topSecondary: (0, _extractMetadata.elementNamesToItems)(betterMetadata.topMetadataBlock.secondary),
|
|
126
|
-
bottomPrimary: (0, _extractMetadata.elementNamesToItems)(betterMetadata.bottomMetadataBlock.primary)
|
|
127
|
-
};
|
|
121
|
+
return (0, _utils.getMetadata)(extensionKey, data);
|
|
128
122
|
}, [data, extensionKey]),
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
123
|
+
primary = _useMemo.primary,
|
|
124
|
+
secondary = _useMemo.secondary,
|
|
125
|
+
tertiary = _useMemo.tertiary;
|
|
132
126
|
var snippetHeight = _react.default.useRef(0);
|
|
133
127
|
var snippetBlockRef = (0, _react.useRef)(null);
|
|
134
128
|
var onSnippetRender = (0, _react.useCallback)(function () {
|
|
@@ -152,8 +146,8 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
152
146
|
return /*#__PURE__*/_react.default.createElement(_FlexibleCard.default, flexibleCardProps, imagePreview, /*#__PURE__*/_react.default.createElement(_blocks.TitleBlock, (0, _extends2.default)({}, titleBlockProps, {
|
|
153
147
|
metadataPosition: _constants.SmartLinkPosition.Top
|
|
154
148
|
})), /*#__PURE__*/_react.default.createElement(_blocks.MetadataBlock, {
|
|
155
|
-
primary:
|
|
156
|
-
secondary:
|
|
149
|
+
primary: primary,
|
|
150
|
+
secondary: secondary,
|
|
157
151
|
overrideCss: _styled.metadataBlockCss,
|
|
158
152
|
maxLines: 1,
|
|
159
153
|
size: _constants.SmartLinkSize.Medium
|
|
@@ -167,7 +161,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
167
161
|
blockRef: connectedAIBlockRef
|
|
168
162
|
}, /*#__PURE__*/_react.default.createElement(ConnectedAIBlock, {
|
|
169
163
|
imagePreview: !!imagePreview,
|
|
170
|
-
bottomPrimary:
|
|
164
|
+
bottomPrimary: tertiary,
|
|
171
165
|
data: data
|
|
172
166
|
})), !isAISummaryEnabled && !imagePreview && /*#__PURE__*/_react.default.createElement(_blocks.SnippetBlock, {
|
|
173
167
|
status: _constants.SmartLinkStatus.Resolved
|
|
@@ -177,7 +171,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref2) {
|
|
|
177
171
|
blockRef: snippetBlockRef,
|
|
178
172
|
overrideCss: _styled.hiddenSnippetStyles
|
|
179
173
|
}), !isAISummaryEnabled && /*#__PURE__*/_react.default.createElement(_blocks.MetadataBlock, {
|
|
180
|
-
primary:
|
|
174
|
+
primary: tertiary,
|
|
181
175
|
size: _constants.SmartLinkSize.Large,
|
|
182
176
|
overrideCss: _styled.metadataBlockCss,
|
|
183
177
|
maxLines: 1,
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.getMetadata = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _constants = require("../../constants");
|
|
10
10
|
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
@@ -12,197 +12,93 @@ var _utils = require("../../extractors/flexible/utils");
|
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
13
|
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; }
|
|
14
14
|
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) { (0, _defineProperty2.default)(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; }
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var data = arguments.length > 1 ? arguments[1] : undefined;
|
|
15
|
+
var getSimulatedBetterMetadata = function getSimulatedBetterMetadata(extensionKey, data) {
|
|
16
|
+
var _data$Type$includes, _data$Type;
|
|
18
17
|
var types = data ? (0, _linkExtractors.extractType)(data) : undefined;
|
|
18
|
+
var defaultMetadata = {
|
|
19
|
+
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.ModifiedOn]
|
|
20
|
+
};
|
|
19
21
|
switch (extensionKey) {
|
|
20
22
|
case 'bitbucket-object-provider':
|
|
21
23
|
case 'native-bitbucket-object-provider':
|
|
22
24
|
if (types !== null && types !== void 0 && types.includes('atlassian:SourceCodePullRequest')) {
|
|
23
25
|
return {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
secondary: [],
|
|
27
|
-
subtitle: [_constants.ElementName.SourceBranch, _constants.ElementName.TargetBranch]
|
|
28
|
-
}
|
|
26
|
+
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.ModifiedOn, _constants.ElementName.SubscriberCount, _constants.ElementName.State],
|
|
27
|
+
subtitle: [_constants.ElementName.SourceBranch, _constants.ElementName.TargetBranch]
|
|
29
28
|
};
|
|
30
29
|
}
|
|
31
|
-
|
|
32
|
-
metadata: {
|
|
33
|
-
primary: [_constants.ElementName.ModifiedOn, _constants.ElementName.CreatedBy],
|
|
34
|
-
secondary: [],
|
|
35
|
-
subtitle: []
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
case 'confluence-object-provider':
|
|
39
|
-
var primaryAttribution = data && (0, _utils.extractOwnedBy)(data) ? _constants.ElementName.OwnedBy : _constants.ElementName.CreatedBy;
|
|
40
|
-
return {
|
|
41
|
-
metadata: {
|
|
42
|
-
primary: [_constants.ElementName.AuthorGroup, primaryAttribution],
|
|
43
|
-
secondary: [_constants.ElementName.ReactCount, _constants.ElementName.CommentCount, _constants.ElementName.ViewCount],
|
|
44
|
-
subtitle: []
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
case 'jira-object-provider':
|
|
48
|
-
return {
|
|
49
|
-
metadata: {
|
|
50
|
-
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.State, _constants.ElementName.Priority],
|
|
51
|
-
secondary: [],
|
|
52
|
-
subtitle: []
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
case 'trello-object-provider':
|
|
56
|
-
return {
|
|
57
|
-
metadata: {
|
|
58
|
-
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.State, _constants.ElementName.DueOn],
|
|
59
|
-
secondary: [_constants.ElementName.ReactCount, _constants.ElementName.CommentCount, _constants.ElementName.AttachmentCount, _constants.ElementName.ChecklistProgress],
|
|
60
|
-
subtitle: [_constants.ElementName.Location]
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
case 'watermelon-object-provider':
|
|
64
|
-
if (types !== null && types !== void 0 && types.includes('atlassian:Project')) {
|
|
30
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.extractor.improve-bitbucket-file-links') && types !== null && types !== void 0 && types.includes('schema:DigitalDocument')) {
|
|
65
31
|
return {
|
|
66
|
-
|
|
67
|
-
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.ModifiedOn, _constants.ElementName.State, _constants.ElementName.DueOn],
|
|
68
|
-
secondary: [],
|
|
69
|
-
subtitle: []
|
|
70
|
-
}
|
|
32
|
+
primary: [_constants.ElementName.LatestCommit, _constants.ElementName.CollaboratorGroup, _constants.ElementName.ModifiedOn]
|
|
71
33
|
};
|
|
72
34
|
}
|
|
73
35
|
return {
|
|
74
|
-
|
|
75
|
-
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.State, _constants.ElementName.DueOn],
|
|
76
|
-
secondary: [],
|
|
77
|
-
subtitle: []
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
default:
|
|
81
|
-
return {
|
|
82
|
-
metadata: {
|
|
83
|
-
primary: [_constants.ElementName.ModifiedOn, _constants.ElementName.CreatedBy],
|
|
84
|
-
secondary: [],
|
|
85
|
-
subtitle: []
|
|
86
|
-
}
|
|
36
|
+
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.ModifiedOn]
|
|
87
37
|
};
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
var getSimulatedBetterMetadata = exports.getSimulatedBetterMetadata = function getSimulatedBetterMetadata() {
|
|
91
|
-
var _data$Type$includes, _data$Type;
|
|
92
|
-
var extensionKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
93
|
-
var data = arguments.length > 1 ? arguments[1] : undefined;
|
|
94
|
-
var types = data ? (0, _linkExtractors.extractType)(data) : undefined;
|
|
95
|
-
var defaultMetadata = {
|
|
96
|
-
topMetadataBlock: {
|
|
97
|
-
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.ModifiedOn],
|
|
98
|
-
secondary: [],
|
|
99
|
-
subtitle: []
|
|
100
|
-
},
|
|
101
|
-
bottomMetadataBlock: {
|
|
102
|
-
primary: [],
|
|
103
|
-
secondary: [],
|
|
104
|
-
subtitle: []
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
switch (extensionKey) {
|
|
108
|
-
case 'bitbucket-object-provider':
|
|
109
|
-
case 'native-bitbucket-object-provider':
|
|
110
|
-
if (types !== null && types !== void 0 && types.includes('atlassian:SourceCodePullRequest')) {
|
|
111
|
-
return _objectSpread(_objectSpread({}, defaultMetadata), {}, {
|
|
112
|
-
topMetadataBlock: {
|
|
113
|
-
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.ModifiedOn, _constants.ElementName.SubscriberCount, _constants.ElementName.State],
|
|
114
|
-
secondary: [],
|
|
115
|
-
subtitle: [_constants.ElementName.SourceBranch, _constants.ElementName.TargetBranch]
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.extractor.improve-bitbucket-file-links') && types !== null && types !== void 0 && types.includes('schema:DigitalDocument')) {
|
|
120
|
-
return _objectSpread(_objectSpread({}, defaultMetadata), {}, {
|
|
121
|
-
topMetadataBlock: {
|
|
122
|
-
primary: [_constants.ElementName.LatestCommit, _constants.ElementName.CollaboratorGroup, _constants.ElementName.ModifiedOn],
|
|
123
|
-
secondary: [],
|
|
124
|
-
subtitle: []
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
return _objectSpread(_objectSpread({}, defaultMetadata), {}, {
|
|
129
|
-
topMetadataBlock: {
|
|
130
|
-
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.ModifiedOn],
|
|
131
|
-
secondary: [],
|
|
132
|
-
subtitle: []
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
38
|
case 'confluence-object-provider':
|
|
136
39
|
var primaryAttribution = data && (0, _utils.extractOwnedBy)(data) ? _constants.ElementName.OwnedByGroup : _constants.ElementName.AuthorGroup;
|
|
137
40
|
return {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
secondary: [],
|
|
141
|
-
subtitle: []
|
|
142
|
-
},
|
|
143
|
-
bottomMetadataBlock: {
|
|
144
|
-
primary: [_constants.ElementName.ReactCount, _constants.ElementName.CommentCount, _constants.ElementName.ViewCount],
|
|
145
|
-
secondary: [],
|
|
146
|
-
subtitle: []
|
|
147
|
-
}
|
|
41
|
+
primary: [primaryAttribution, _constants.ElementName.ModifiedOn],
|
|
42
|
+
tertiary: [_constants.ElementName.ReactCount, _constants.ElementName.CommentCount, _constants.ElementName.ViewCount]
|
|
148
43
|
};
|
|
149
44
|
case 'jira-object-provider':
|
|
150
|
-
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;
|
|
45
|
+
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;
|
|
151
46
|
return _objectSpread(_objectSpread({}, defaultMetadata), isJiraTask && {
|
|
152
|
-
|
|
153
|
-
primary: [_constants.ElementName.AssignedToGroup, _constants.ElementName.State, _constants.ElementName.StoryPoints, _constants.ElementName.Priority],
|
|
154
|
-
secondary: [],
|
|
155
|
-
subtitle: []
|
|
156
|
-
}
|
|
47
|
+
primary: [_constants.ElementName.AssignedToGroup, _constants.ElementName.State, _constants.ElementName.StoryPoints, _constants.ElementName.Priority]
|
|
157
48
|
});
|
|
158
49
|
case 'trello-object-provider':
|
|
159
|
-
return
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
});
|
|
50
|
+
return {
|
|
51
|
+
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.State, _constants.ElementName.DueOn],
|
|
52
|
+
secondary: [_constants.ElementName.ReactCount, _constants.ElementName.CommentCount, _constants.ElementName.AttachmentCount, _constants.ElementName.ChecklistProgress],
|
|
53
|
+
subtitle: [_constants.ElementName.Location]
|
|
54
|
+
};
|
|
166
55
|
case 'watermelon-object-provider':
|
|
167
56
|
if (types !== null && types !== void 0 && types.includes('atlassian:Project')) {
|
|
168
|
-
return
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
secondary: [],
|
|
172
|
-
subtitle: []
|
|
173
|
-
}
|
|
174
|
-
});
|
|
57
|
+
return {
|
|
58
|
+
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.ModifiedOn, _constants.ElementName.State, _constants.ElementName.DueOn]
|
|
59
|
+
};
|
|
175
60
|
}
|
|
176
|
-
return
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
secondary: [],
|
|
180
|
-
subtitle: []
|
|
181
|
-
}
|
|
182
|
-
});
|
|
61
|
+
return {
|
|
62
|
+
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.State, _constants.ElementName.DueOn]
|
|
63
|
+
};
|
|
183
64
|
case 'slack-object-provider':
|
|
184
65
|
return {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
secondary: [],
|
|
188
|
-
subtitle: []
|
|
189
|
-
},
|
|
190
|
-
bottomMetadataBlock: {
|
|
191
|
-
primary: [_constants.ElementName.ReactCount, _constants.ElementName.CommentCount],
|
|
192
|
-
secondary: [],
|
|
193
|
-
subtitle: []
|
|
194
|
-
}
|
|
66
|
+
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.SentOn],
|
|
67
|
+
tertiary: [_constants.ElementName.ReactCount, _constants.ElementName.CommentCount]
|
|
195
68
|
};
|
|
196
69
|
case 'google-object-provider':
|
|
197
70
|
case 'figma-object-provider':
|
|
198
|
-
return
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
secondary: [],
|
|
202
|
-
subtitle: []
|
|
203
|
-
}
|
|
204
|
-
});
|
|
71
|
+
return {
|
|
72
|
+
primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.ModifiedOn]
|
|
73
|
+
};
|
|
205
74
|
default:
|
|
206
75
|
return defaultMetadata;
|
|
207
76
|
}
|
|
77
|
+
};
|
|
78
|
+
var AvatarGroupsWithNamePrefix = [_constants.ElementName.AssignedToGroup, _constants.ElementName.OwnedByGroup, _constants.ElementName.AuthorGroup];
|
|
79
|
+
var toElementItem = function toElementItem(name) {
|
|
80
|
+
var showNamePrefix = AvatarGroupsWithNamePrefix.indexOf(name) !== -1 ? true : undefined;
|
|
81
|
+
var testId = "".concat(name.toLowerCase(), "-metadata-element");
|
|
82
|
+
return {
|
|
83
|
+
name: name,
|
|
84
|
+
showNamePrefix: showNamePrefix,
|
|
85
|
+
testId: testId
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
var toElementItems = function toElementItems(elementNames) {
|
|
89
|
+
if (!(elementNames !== null && elementNames !== void 0 && elementNames.length)) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
return elementNames.filter(function (name) {
|
|
93
|
+
return name in _constants.ElementName;
|
|
94
|
+
}).map(toElementItem);
|
|
95
|
+
};
|
|
96
|
+
var getMetadata = exports.getMetadata = function getMetadata(extensionKey, data) {
|
|
97
|
+
var metadata = getSimulatedBetterMetadata(extensionKey, data);
|
|
98
|
+
return {
|
|
99
|
+
subtitle: toElementItems(metadata.subtitle),
|
|
100
|
+
primary: toElementItems(metadata.primary),
|
|
101
|
+
secondary: toElementItems(metadata.secondary),
|
|
102
|
+
tertiary: toElementItems(metadata.tertiary)
|
|
103
|
+
};
|
|
208
104
|
};
|
|
@@ -17,7 +17,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
|
|
|
17
17
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
18
18
|
var PACKAGE_DATA = {
|
|
19
19
|
packageName: "@atlaskit/smart-card",
|
|
20
|
-
packageVersion: "26.57.
|
|
20
|
+
packageVersion: "26.57.2",
|
|
21
21
|
componentName: 'linkUrl'
|
|
22
22
|
};
|
|
23
23
|
var Link = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export const context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "26.57.
|
|
7
|
+
packageVersion: "26.57.2"
|
|
8
8
|
};
|
|
9
9
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -47,7 +47,8 @@ const ActionStackItem = ({
|
|
|
47
47
|
testId,
|
|
48
48
|
tooltipMessage,
|
|
49
49
|
xcss,
|
|
50
|
-
tooltipOnHide
|
|
50
|
+
tooltipOnHide,
|
|
51
|
+
hideTooltipOnMouseDown
|
|
51
52
|
}) => {
|
|
52
53
|
const space = spaceOption !== null && spaceOption !== void 0 ? spaceOption : getPrimitivesInlineSpaceBySize(size);
|
|
53
54
|
const onClick = useCallback(() => {
|
|
@@ -67,7 +68,7 @@ const ActionStackItem = ({
|
|
|
67
68
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
68
69
|
content: tooltipMessage || content,
|
|
69
70
|
onHide: tooltipOnHide,
|
|
70
|
-
hideTooltipOnMouseDown:
|
|
71
|
+
hideTooltipOnMouseDown: hideTooltipOnMouseDown
|
|
71
72
|
}, tooltipProps => /*#__PURE__*/React.createElement(Box, _extends({
|
|
72
73
|
as: "button",
|
|
73
74
|
xcss: [buttonStyles, xcss]
|
|
@@ -25,6 +25,7 @@ const Action = ({
|
|
|
25
25
|
spaceInline,
|
|
26
26
|
tooltipMessage,
|
|
27
27
|
tooltipOnHide,
|
|
28
|
+
hideTooltipOnMouseDown,
|
|
28
29
|
xcss,
|
|
29
30
|
asDropDownItem,
|
|
30
31
|
overrideCss,
|
|
@@ -59,7 +60,8 @@ const Action = ({
|
|
|
59
60
|
testId: testId,
|
|
60
61
|
tooltipMessage: tooltipMessage || content,
|
|
61
62
|
xcss: xcss,
|
|
62
|
-
tooltipOnHide: tooltipOnHide
|
|
63
|
+
tooltipOnHide: tooltipOnHide,
|
|
64
|
+
hideTooltipOnMouseDown: hideTooltipOnMouseDown
|
|
63
65
|
});
|
|
64
66
|
}
|
|
65
67
|
if (isDropdownItem) {
|
|
@@ -50,7 +50,8 @@ const PreviewAction = ({
|
|
|
50
50
|
}),
|
|
51
51
|
onClick: onClick,
|
|
52
52
|
testId: "smart-action-preview-action",
|
|
53
|
-
tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, tooltipMessage)
|
|
53
|
+
tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, tooltipMessage),
|
|
54
|
+
hideTooltipOnMouseDown: true
|
|
54
55
|
}, data, props)) : null;
|
|
55
56
|
};
|
|
56
57
|
export default PreviewAction;
|
|
@@ -6,12 +6,11 @@ import CopyIcon from '@atlaskit/icon/glyph/copy';
|
|
|
6
6
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
7
7
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
8
8
|
import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../constants';
|
|
9
|
-
import { extractMetadata } from '../../../extractors/hover/extractMetadata';
|
|
10
9
|
import { useSmartLinkAnalytics } from '../../../state/analytics';
|
|
11
10
|
import { getExtensionKey, getServices } from '../../../state/helpers';
|
|
12
11
|
import { isSpecialEvent } from '../../../utils';
|
|
13
12
|
import { flexibleUiOptions, titleBlockCss } from '../styled';
|
|
14
|
-
import {
|
|
13
|
+
import { getMetadata } from '../utils';
|
|
15
14
|
import HoverCardLoadingView from './views/resolving';
|
|
16
15
|
import HoverCardUnauthorisedView from './views/unauthorised';
|
|
17
16
|
import HoverCardResolvedView from './views/resolved';
|
|
@@ -109,7 +108,7 @@ const HoverCardContent = ({
|
|
|
109
108
|
const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
110
109
|
const {
|
|
111
110
|
subtitle
|
|
112
|
-
} =
|
|
111
|
+
} = getMetadata(extensionKey, data);
|
|
113
112
|
const titleMaxLines = subtitle && subtitle.length > 0 ? 1 : 2;
|
|
114
113
|
const titleBlockProps = {
|
|
115
114
|
actions: getBooleanFF('platform.linking-platform.smart-card.hover-card-action-redesign') ? undefined : titleActions,
|
|
@@ -4,9 +4,8 @@ import { ActionName, CardDisplay, ElementName, SmartLinkPosition, SmartLinkSize,
|
|
|
4
4
|
import { FooterBlock, MetadataBlock, RelatedUrlsBlock, SnippetBlock, TitleBlock, AISummaryBlock, CustomBlock, ActionBlock } from '../../../../FlexibleCard/components/blocks';
|
|
5
5
|
import { footerBlockCss, hiddenSnippetStyles, metadataBlockCss } from './styled';
|
|
6
6
|
import FlexibleCard from '../../../../FlexibleCard';
|
|
7
|
-
import {
|
|
7
|
+
import { getMetadata } from '../../../utils';
|
|
8
8
|
import ImagePreview from '../../ImagePreview';
|
|
9
|
-
import { elementNamesToItems } from '../../../../../extractors/hover/extractMetadata';
|
|
10
9
|
import { messages } from '../../../../../messages';
|
|
11
10
|
import { FormattedMessage } from 'react-intl-next';
|
|
12
11
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
@@ -111,16 +110,11 @@ const HoverCardResolvedView = ({
|
|
|
111
110
|
const footerActions = useMemo(() => toFooterActions(cardActions, onActionClick), [cardActions, onActionClick]);
|
|
112
111
|
const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
113
112
|
const {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
primary,
|
|
114
|
+
secondary,
|
|
115
|
+
tertiary
|
|
117
116
|
} = useMemo(() => {
|
|
118
|
-
|
|
119
|
-
return {
|
|
120
|
-
topPrimary: elementNamesToItems(betterMetadata.topMetadataBlock.primary),
|
|
121
|
-
topSecondary: elementNamesToItems(betterMetadata.topMetadataBlock.secondary),
|
|
122
|
-
bottomPrimary: elementNamesToItems(betterMetadata.bottomMetadataBlock.primary)
|
|
123
|
-
};
|
|
117
|
+
return getMetadata(extensionKey, data);
|
|
124
118
|
}, [data, extensionKey]);
|
|
125
119
|
const snippetHeight = React.useRef(0);
|
|
126
120
|
const snippetBlockRef = useRef(null);
|
|
@@ -145,8 +139,8 @@ const HoverCardResolvedView = ({
|
|
|
145
139
|
return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps, imagePreview, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockProps, {
|
|
146
140
|
metadataPosition: SmartLinkPosition.Top
|
|
147
141
|
})), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
148
|
-
primary:
|
|
149
|
-
secondary:
|
|
142
|
+
primary: primary,
|
|
143
|
+
secondary: secondary,
|
|
150
144
|
overrideCss: metadataBlockCss,
|
|
151
145
|
maxLines: 1,
|
|
152
146
|
size: SmartLinkSize.Medium
|
|
@@ -160,7 +154,7 @@ const HoverCardResolvedView = ({
|
|
|
160
154
|
blockRef: connectedAIBlockRef
|
|
161
155
|
}, /*#__PURE__*/React.createElement(ConnectedAIBlock, {
|
|
162
156
|
imagePreview: !!imagePreview,
|
|
163
|
-
bottomPrimary:
|
|
157
|
+
bottomPrimary: tertiary,
|
|
164
158
|
data: data
|
|
165
159
|
})), !isAISummaryEnabled && !imagePreview && /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
166
160
|
status: SmartLinkStatus.Resolved
|
|
@@ -170,7 +164,7 @@ const HoverCardResolvedView = ({
|
|
|
170
164
|
blockRef: snippetBlockRef,
|
|
171
165
|
overrideCss: hiddenSnippetStyles
|
|
172
166
|
}), !isAISummaryEnabled && /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
173
|
-
primary:
|
|
167
|
+
primary: tertiary,
|
|
174
168
|
size: SmartLinkSize.Large,
|
|
175
169
|
overrideCss: metadataBlockCss,
|
|
176
170
|
maxLines: 1,
|