@atlaskit/smart-card 26.13.0 → 26.14.0
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 +12 -0
- package/dist/cjs/constants.js +5 -0
- package/dist/cjs/extractors/flexible/index.js +5 -0
- package/dist/cjs/extractors/flexible/utils.js +23 -2
- package/dist/cjs/extractors/hover/extractMetadata.js +2 -1
- package/dist/cjs/messages.js +31 -1
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +21 -37
- package/dist/cjs/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +15 -5
- package/dist/cjs/view/BlockCard/views/flexible/styled.js +15 -0
- package/dist/cjs/view/BlockCard/views/flexible/utils.js +116 -0
- package/dist/cjs/view/EmbedCard/views/UnauthorisedView.js +31 -18
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/elements/index.js +33 -4
- package/dist/cjs/view/FlexibleCard/components/elements/utils.js +20 -0
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +28 -12
- package/dist/cjs/view/HoverCard/utils.js +102 -3
- package/dist/es2019/constants.js +6 -0
- package/dist/es2019/extractors/flexible/index.js +7 -2
- package/dist/es2019/extractors/flexible/utils.js +18 -1
- package/dist/es2019/extractors/hover/extractMetadata.js +1 -1
- package/dist/es2019/messages.js +31 -1
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +24 -38
- package/dist/es2019/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +13 -5
- package/dist/es2019/view/BlockCard/views/flexible/styled.js +14 -0
- package/dist/es2019/view/BlockCard/views/flexible/utils.js +108 -0
- package/dist/es2019/view/EmbedCard/views/UnauthorisedView.js +33 -20
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +5 -0
- package/dist/es2019/view/FlexibleCard/components/elements/index.js +24 -0
- package/dist/es2019/view/FlexibleCard/components/elements/utils.js +25 -0
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +30 -14
- package/dist/es2019/view/HoverCard/utils.js +100 -1
- package/dist/esm/constants.js +6 -0
- package/dist/esm/extractors/flexible/index.js +7 -2
- package/dist/esm/extractors/flexible/utils.js +18 -1
- package/dist/esm/extractors/hover/extractMetadata.js +1 -1
- package/dist/esm/messages.js +31 -1
- package/dist/esm/version.json +1 -1
- package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +23 -38
- package/dist/esm/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +15 -5
- package/dist/esm/view/BlockCard/views/flexible/styled.js +7 -0
- package/dist/esm/view/BlockCard/views/flexible/utils.js +108 -0
- package/dist/esm/view/EmbedCard/views/UnauthorisedView.js +33 -20
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +1 -1
- package/dist/esm/view/FlexibleCard/components/elements/index.js +24 -0
- package/dist/esm/view/FlexibleCard/components/elements/utils.js +20 -0
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +30 -14
- package/dist/esm/view/HoverCard/utils.js +98 -1
- package/dist/types/constants.d.ts +5 -0
- package/dist/types/extractors/flexible/utils.d.ts +5 -0
- package/dist/types/extractors/hover/extractMetadata.d.ts +2 -0
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/state/flexible-ui-context/types.d.ts +25 -0
- package/dist/types/view/BlockCard/views/flexible/styled.d.ts +2 -0
- package/dist/types/view/BlockCard/views/flexible/utils.d.ts +10 -0
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +35 -2
- package/dist/types/view/FlexibleCard/components/elements/index.d.ts +24 -0
- package/dist/types/view/HoverCard/utils.d.ts +1 -0
- package/dist/types-ts4.5/constants.d.ts +5 -0
- package/dist/types-ts4.5/extractors/flexible/utils.d.ts +5 -0
- package/dist/types-ts4.5/extractors/hover/extractMetadata.d.ts +2 -0
- package/dist/types-ts4.5/messages.d.ts +1 -1
- package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +25 -0
- package/dist/types-ts4.5/view/BlockCard/views/flexible/styled.d.ts +2 -0
- package/dist/types-ts4.5/view/BlockCard/views/flexible/utils.d.ts +10 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +35 -2
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/index.d.ts +24 -0
- package/dist/types-ts4.5/view/HoverCard/utils.d.ts +1 -0
- package/package.json +5 -2
- package/report.api.md +40 -0
- package/tmp/api-report-tmp.d.ts +36 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
-
import { extractPersonOwnedBy, extractPersonCreatedBy, extractPersonUpdatedBy } from '@atlaskit/link-extractors';
|
|
2
|
+
import { extractPersonOwnedBy, extractPersonCreatedBy, extractPersonUpdatedBy, extractPersonAssignedTo } from '@atlaskit/link-extractors';
|
|
3
3
|
var extractLinkName = function extractLinkName(link) {
|
|
4
4
|
if (link && _typeof(link) === 'object' && link['@type'] === 'Link') {
|
|
5
5
|
return link.name;
|
|
@@ -29,6 +29,16 @@ export var extractOwnedBy = function extractOwnedBy(data) {
|
|
|
29
29
|
return persons[0].name;
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
+
export var extractAssignedTo = function extractAssignedTo(data) {
|
|
33
|
+
var person = extractPersonAssignedTo(data);
|
|
34
|
+
if (person) {
|
|
35
|
+
return person.name;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
export var extractPersonAssignedToAsArray = function extractPersonAssignedToAsArray(data) {
|
|
39
|
+
var person = extractPersonAssignedTo(data);
|
|
40
|
+
return person ? [person] : undefined;
|
|
41
|
+
};
|
|
32
42
|
export var extractCreatedBy = function extractCreatedBy(data) {
|
|
33
43
|
var persons = extractPersonCreatedBy(data);
|
|
34
44
|
if (persons && persons.length) {
|
|
@@ -70,4 +80,11 @@ export var extractLocation = function extractLocation(data) {
|
|
|
70
80
|
url: url
|
|
71
81
|
};
|
|
72
82
|
}
|
|
83
|
+
};
|
|
84
|
+
export var extractSubTasksProgress = function extractSubTasksProgress(data) {
|
|
85
|
+
var subTasksObject = extractValue(data, 'atlassian:subTasks');
|
|
86
|
+
return subTasksObject && subTasksObject.totalCount ? "".concat(subTasksObject.resolvedCount, "/").concat(subTasksObject.totalCount) : undefined;
|
|
87
|
+
};
|
|
88
|
+
export var extractReadTime = function extractReadTime(data) {
|
|
89
|
+
return extractValue(data, 'atlassian:readTimeInMinutes');
|
|
73
90
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ElementName } from '../../constants';
|
|
2
|
-
var elementNamesToItems = function elementNamesToItems(elementNames) {
|
|
2
|
+
export var elementNamesToItems = function elementNamesToItems(elementNames) {
|
|
3
3
|
return elementNames.filter(function (element) {
|
|
4
4
|
return element in ElementName;
|
|
5
5
|
}).map(function (elementName) {
|
package/dist/esm/messages.js
CHANGED
|
@@ -10,6 +10,11 @@ export var messages = defineMessages({
|
|
|
10
10
|
defaultMessage: 'Add account',
|
|
11
11
|
description: 'Allows to add a new account'
|
|
12
12
|
},
|
|
13
|
+
assigned_to: {
|
|
14
|
+
id: 'fabric.linking.assigned_to',
|
|
15
|
+
defaultMessage: 'Assigned to {context}',
|
|
16
|
+
description: 'Indicates the person or entity that the resource is assigned to.'
|
|
17
|
+
},
|
|
13
18
|
cancel: {
|
|
14
19
|
id: 'fabric.linking.cancel',
|
|
15
20
|
defaultMessage: 'Cancel',
|
|
@@ -86,7 +91,7 @@ export var messages = defineMessages({
|
|
|
86
91
|
description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view.'
|
|
87
92
|
},
|
|
88
93
|
connect_unauthorised_account_description_no_provider: {
|
|
89
|
-
id: 'fabric.linking.
|
|
94
|
+
id: 'fabric.linking.connect_unauthorised_account_description_no_provider',
|
|
90
95
|
defaultMessage: 'Connect to Atlassian to view more details of your work and collaborate from one place.',
|
|
91
96
|
description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view and we do not have the providers name.'
|
|
92
97
|
},
|
|
@@ -306,6 +311,11 @@ export var messages = defineMessages({
|
|
|
306
311
|
defaultMessage: 'Your access request is pending',
|
|
307
312
|
description: 'Shown when a user has requested an access but status is pending.'
|
|
308
313
|
},
|
|
314
|
+
read_time: {
|
|
315
|
+
id: 'fabric.linking.read_time',
|
|
316
|
+
defaultMessage: '{context} min read',
|
|
317
|
+
description: 'Estimated time to read this resource'
|
|
318
|
+
},
|
|
309
319
|
restricted_link: {
|
|
310
320
|
id: 'fabric.linking.restricted_link',
|
|
311
321
|
defaultMessage: 'Restricted link, try another account',
|
|
@@ -386,6 +396,26 @@ export var messages = defineMessages({
|
|
|
386
396
|
defaultMessage: 'The link {unsafeLinkText} is taking you to a different site, <a>actual link here</a>',
|
|
387
397
|
description: 'Link safety check warning message'
|
|
388
398
|
},
|
|
399
|
+
unauthorised_account_description: {
|
|
400
|
+
id: 'fabric.linking.unauthorised_account_description',
|
|
401
|
+
defaultMessage: "You're trying to preview a link to a private {context} page. We recommend you review the URL or contact the page owner.",
|
|
402
|
+
description: 'Explains that user does not have access to a link.'
|
|
403
|
+
},
|
|
404
|
+
unauthorised_account_description_no_provider: {
|
|
405
|
+
id: 'fabric.linking.unauthorised_account_description_no_provider',
|
|
406
|
+
defaultMessage: "You're trying to preview a link to a private page. We recommend you review the URL or contact the page owner.",
|
|
407
|
+
description: 'Explains that user does not have access to a link.'
|
|
408
|
+
},
|
|
409
|
+
unauthorised_account_name: {
|
|
410
|
+
id: 'fabric.linking.unauthorised_account_name',
|
|
411
|
+
defaultMessage: "We can't display private pages from {context}",
|
|
412
|
+
description: 'Shown when a user does not have access to a link.'
|
|
413
|
+
},
|
|
414
|
+
unauthorised_account_name_no_provider: {
|
|
415
|
+
id: 'fabric.linking.unauthorised_account_name_no_provider',
|
|
416
|
+
defaultMessage: "We can't display private pages",
|
|
417
|
+
description: 'Shown when a user does not have access to a link.'
|
|
418
|
+
},
|
|
389
419
|
unlink_account: {
|
|
390
420
|
id: 'fabric.linking.unlink_account',
|
|
391
421
|
defaultMessage: 'Unlink Account',
|
package/dist/esm/version.json
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
import React, { useEffect, useState } from 'react';
|
|
3
4
|
import FlexibleCard from '../../../FlexibleCard';
|
|
4
5
|
import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
|
|
5
6
|
import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock } from '../../../FlexibleCard/components/blocks';
|
|
6
|
-
import {
|
|
7
|
+
import { metadataBlockCss, titleBlockCss } from './styled';
|
|
8
|
+
import { ActionName, CardDisplay, ElementName, MediaPlacement, SmartLinkPosition, SmartLinkSize } from '../../../../constants';
|
|
7
9
|
import uuid from 'uuid';
|
|
8
|
-
import {
|
|
10
|
+
import { getSimulatedMetadata, getSimulatedBetterMetadata } from './utils';
|
|
11
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
12
|
+
|
|
9
13
|
/**
|
|
10
14
|
* This view represents a Block card that has an 'Resolved' status.
|
|
11
15
|
* @see SmartLinkStatus
|
|
12
16
|
* @see FlexibleCardProps
|
|
13
17
|
*/
|
|
14
18
|
var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
15
|
-
var _cardState$details, _cardState$details2;
|
|
16
19
|
var id = _ref.id,
|
|
17
20
|
cardState = _ref.cardState,
|
|
18
21
|
onClick = _ref.onClick,
|
|
@@ -37,30 +40,10 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
37
40
|
}),
|
|
38
41
|
_useState4 = _slicedToArray(_useState3, 1),
|
|
39
42
|
analyticsId = _useState4[0];
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}, {
|
|
45
|
-
name: ElementName.CommentCount
|
|
46
|
-
}, {
|
|
47
|
-
name: ElementName.ReactCount
|
|
48
|
-
}, {
|
|
49
|
-
name: ElementName.SubscriberCount
|
|
50
|
-
}, {
|
|
51
|
-
name: ElementName.ViewCount
|
|
52
|
-
}, {
|
|
53
|
-
name: ElementName.VoteCount
|
|
54
|
-
}, {
|
|
55
|
-
name: ElementName.ChecklistProgress
|
|
56
|
-
}, {
|
|
57
|
-
name: ElementName.DueOn
|
|
58
|
-
}];
|
|
59
|
-
var metadata = cardState !== null && cardState !== void 0 && (_cardState$details = cardState.details) !== null && _cardState$details !== void 0 && _cardState$details.data && extractOwnedBy(cardState === null || cardState === void 0 ? void 0 : (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data) ? [{
|
|
60
|
-
name: ElementName.OwnedBy
|
|
61
|
-
}].concat(baseMetadata) : [{
|
|
62
|
-
name: ElementName.ModifiedBy
|
|
63
|
-
}].concat(baseMetadata);
|
|
43
|
+
var _ref2 = getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? getSimulatedBetterMetadata(cardState.details) : getSimulatedMetadata(cardState.details),
|
|
44
|
+
titleMetadata = _ref2.titleMetadata,
|
|
45
|
+
topMetadata = _ref2.topMetadata,
|
|
46
|
+
bottomMetadata = _ref2.bottomMetadata;
|
|
64
47
|
return /*#__PURE__*/React.createElement(FlexibleCard, {
|
|
65
48
|
analytics: analytics,
|
|
66
49
|
appearance: "block",
|
|
@@ -72,25 +55,27 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
|
|
|
72
55
|
testId: testId,
|
|
73
56
|
ui: ui,
|
|
74
57
|
url: url
|
|
75
|
-
}, /*#__PURE__*/React.createElement(TitleBlock, {
|
|
58
|
+
}, /*#__PURE__*/React.createElement(TitleBlock, _extends({
|
|
76
59
|
position: SmartLinkPosition.Center,
|
|
77
|
-
metadata:
|
|
78
|
-
name: ElementName.AuthorGroup
|
|
79
|
-
}, {
|
|
80
|
-
name: ElementName.Priority
|
|
81
|
-
}, {
|
|
82
|
-
name: ElementName.State
|
|
83
|
-
}],
|
|
60
|
+
metadata: titleMetadata,
|
|
84
61
|
hideRetry: true,
|
|
85
62
|
subtitle: [{
|
|
86
63
|
name: ElementName.Location
|
|
87
64
|
}],
|
|
88
65
|
metadataPosition: SmartLinkPosition.Top,
|
|
89
66
|
anchorTarget: anchorTarget
|
|
90
|
-
}
|
|
91
|
-
|
|
67
|
+
}, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
68
|
+
overrideCss: titleBlockCss,
|
|
69
|
+
size: SmartLinkSize.Large
|
|
70
|
+
})), /*#__PURE__*/React.createElement(MetadataBlock, _extends({
|
|
71
|
+
primary: topMetadata,
|
|
72
|
+
maxLines: 1
|
|
73
|
+
}, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
74
|
+
overrideCss: metadataBlockCss
|
|
75
|
+
})), /*#__PURE__*/React.createElement(SnippetBlock, null), getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
76
|
+
primary: bottomMetadata,
|
|
92
77
|
maxLines: 1
|
|
93
|
-
}),
|
|
78
|
+
}), !isPreviewBlockErrored ? /*#__PURE__*/React.createElement(PreviewBlock, {
|
|
94
79
|
placement: MediaPlacement.Right,
|
|
95
80
|
ignoreContainerPadding: true,
|
|
96
81
|
onError: function onError() {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
3
|
var _templateObject;
|
|
3
4
|
import React, { useCallback, useMemo } from 'react';
|
|
5
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
4
6
|
import FlexibleCard from '../../../FlexibleCard';
|
|
5
7
|
import { AuthorizeAction } from '../../actions/flexible/AuthorizeAction';
|
|
6
8
|
import BlockCardFooter from '../../components/flexible/footer';
|
|
@@ -10,6 +12,7 @@ import { extractProvider } from '@atlaskit/link-extractors';
|
|
|
10
12
|
import UnauthorisedViewContent from '../../../common/UnauthorisedViewContent';
|
|
11
13
|
import { css } from '@emotion/react';
|
|
12
14
|
import { tokens } from '../../../../utils/token';
|
|
15
|
+
import { messages } from '../../../../messages';
|
|
13
16
|
var contentStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n margin-top: 0.5rem;\n font-size: 0.75rem;\n"])), tokens.text);
|
|
14
17
|
|
|
15
18
|
/**
|
|
@@ -43,6 +46,17 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
|
|
|
43
46
|
onAuthorize();
|
|
44
47
|
}
|
|
45
48
|
}, [onAuthorize, extensionKey, analytics.track]);
|
|
49
|
+
var content = useMemo(function () {
|
|
50
|
+
return onAuthorize ? /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
|
|
51
|
+
providerName: providerName,
|
|
52
|
+
analytics: analytics,
|
|
53
|
+
testId: testId
|
|
54
|
+
}) : /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[providerName ? 'unauthorised_account_description' : 'unauthorised_account_description_no_provider'], {
|
|
55
|
+
values: {
|
|
56
|
+
context: providerName
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
}, [analytics, onAuthorize, providerName, testId]);
|
|
46
60
|
var actions = useMemo(function () {
|
|
47
61
|
return onAuthorize ? [AuthorizeAction(handleAuthorize, providerName)] : [];
|
|
48
62
|
}, [handleAuthorize, onAuthorize, providerName]);
|
|
@@ -61,11 +75,7 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
|
|
|
61
75
|
}), /*#__PURE__*/React.createElement(CustomBlock, {
|
|
62
76
|
overrideCss: contentStyles,
|
|
63
77
|
testId: "".concat(testId, "-content")
|
|
64
|
-
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(
|
|
65
|
-
providerName: providerName,
|
|
66
|
-
analytics: analytics,
|
|
67
|
-
testId: testId
|
|
68
|
-
}))), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
|
|
78
|
+
}, /*#__PURE__*/React.createElement("div", null, content)), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
|
|
69
79
|
actions: actions,
|
|
70
80
|
status: SmartLinkStatus.Unauthorized,
|
|
71
81
|
actionGroupAppearance: "primary"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2;
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
|
|
5
|
+
// in editor prosemirror adds padding-left so we need to overwrite it
|
|
6
|
+
export var metadataBlockCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* primary element group */\n [data-smart-element-avatar-group] {\n > ul {\n padding-left: 0px;\n }\n }\n"])));
|
|
7
|
+
export var titleBlockCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n gap: 0.5em;\n"])));
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { ElementName } from '../../../../constants';
|
|
2
|
+
import { extractOwnedBy, extractAssignedTo } from '../../../../extractors/flexible/utils';
|
|
3
|
+
import { getExtensionKey } from '../../../../state/helpers';
|
|
4
|
+
var baseTopMetadata = [{
|
|
5
|
+
name: ElementName.ModifiedOn
|
|
6
|
+
}, {
|
|
7
|
+
name: ElementName.AttachmentCount
|
|
8
|
+
}, {
|
|
9
|
+
name: ElementName.SubscriberCount
|
|
10
|
+
}, {
|
|
11
|
+
name: ElementName.VoteCount
|
|
12
|
+
}, {
|
|
13
|
+
name: ElementName.DueOn
|
|
14
|
+
}, {
|
|
15
|
+
name: ElementName.ReadTime
|
|
16
|
+
}];
|
|
17
|
+
var baseBottomMetaData = [{
|
|
18
|
+
name: ElementName.ReactCount
|
|
19
|
+
}, {
|
|
20
|
+
name: ElementName.CommentCount
|
|
21
|
+
}, {
|
|
22
|
+
name: ElementName.ViewCount
|
|
23
|
+
}, {
|
|
24
|
+
name: ElementName.Priority
|
|
25
|
+
}, {
|
|
26
|
+
name: ElementName.SubTasksProgress
|
|
27
|
+
}, {
|
|
28
|
+
name: ElementName.ChecklistProgress
|
|
29
|
+
}];
|
|
30
|
+
export var getSimulatedBetterMetadata = function getSimulatedBetterMetadata(cardDetails) {
|
|
31
|
+
var _getExtensionKey;
|
|
32
|
+
var extensionKey = (_getExtensionKey = getExtensionKey(cardDetails)) !== null && _getExtensionKey !== void 0 ? _getExtensionKey : '';
|
|
33
|
+
var data = cardDetails === null || cardDetails === void 0 ? void 0 : cardDetails.data;
|
|
34
|
+
var defaultTitleMetadata = [{
|
|
35
|
+
name: ElementName.State
|
|
36
|
+
}];
|
|
37
|
+
var defaultTopMetadata = [{
|
|
38
|
+
name: ElementName.AuthorGroup
|
|
39
|
+
}, {
|
|
40
|
+
name: ElementName.CreatedBy
|
|
41
|
+
}].concat(baseTopMetadata);
|
|
42
|
+
var defaultBottomMetadata = baseBottomMetaData;
|
|
43
|
+
switch (extensionKey) {
|
|
44
|
+
case 'confluence-object-provider':
|
|
45
|
+
return {
|
|
46
|
+
titleMetadata: defaultTitleMetadata,
|
|
47
|
+
topMetadata: extractOwnedBy(data) ? [{
|
|
48
|
+
name: ElementName.OwnedByGroup
|
|
49
|
+
}, {
|
|
50
|
+
name: ElementName.OwnedBy
|
|
51
|
+
}].concat(baseTopMetadata) : defaultTopMetadata,
|
|
52
|
+
bottomMetadata: defaultBottomMetadata
|
|
53
|
+
};
|
|
54
|
+
case 'jira-object-provider':
|
|
55
|
+
return {
|
|
56
|
+
titleMetadata: defaultTitleMetadata,
|
|
57
|
+
topMetadata: extractAssignedTo(data) ? [{
|
|
58
|
+
name: ElementName.AssignedToGroup
|
|
59
|
+
}, {
|
|
60
|
+
name: ElementName.AssignedTo
|
|
61
|
+
}].concat(baseTopMetadata) : defaultTopMetadata,
|
|
62
|
+
bottomMetadata: defaultBottomMetadata
|
|
63
|
+
};
|
|
64
|
+
default:
|
|
65
|
+
return {
|
|
66
|
+
titleMetadata: defaultTitleMetadata,
|
|
67
|
+
topMetadata: defaultTopMetadata,
|
|
68
|
+
bottomMetadata: defaultBottomMetadata
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
export var getSimulatedMetadata = function getSimulatedMetadata(cardDetails) {
|
|
73
|
+
var baseMetadata = [{
|
|
74
|
+
name: ElementName.ModifiedOn
|
|
75
|
+
}, {
|
|
76
|
+
name: ElementName.AttachmentCount
|
|
77
|
+
}, {
|
|
78
|
+
name: ElementName.CommentCount
|
|
79
|
+
}, {
|
|
80
|
+
name: ElementName.ReactCount
|
|
81
|
+
}, {
|
|
82
|
+
name: ElementName.SubscriberCount
|
|
83
|
+
}, {
|
|
84
|
+
name: ElementName.ViewCount
|
|
85
|
+
}, {
|
|
86
|
+
name: ElementName.VoteCount
|
|
87
|
+
}, {
|
|
88
|
+
name: ElementName.ChecklistProgress
|
|
89
|
+
}, {
|
|
90
|
+
name: ElementName.DueOn
|
|
91
|
+
}];
|
|
92
|
+
var topMetadata = cardDetails !== null && cardDetails !== void 0 && cardDetails.data && extractOwnedBy(cardDetails === null || cardDetails === void 0 ? void 0 : cardDetails.data) ? [{
|
|
93
|
+
name: ElementName.OwnedBy
|
|
94
|
+
}].concat(baseMetadata) : [{
|
|
95
|
+
name: ElementName.ModifiedBy
|
|
96
|
+
}].concat(baseMetadata);
|
|
97
|
+
var titleMetadata = [{
|
|
98
|
+
name: ElementName.AuthorGroup
|
|
99
|
+
}, {
|
|
100
|
+
name: ElementName.Priority
|
|
101
|
+
}, {
|
|
102
|
+
name: ElementName.State
|
|
103
|
+
}];
|
|
104
|
+
return {
|
|
105
|
+
titleMetadata: titleMetadata,
|
|
106
|
+
topMetadata: topMetadata
|
|
107
|
+
};
|
|
108
|
+
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
1
|
+
import React, { useCallback, useMemo } from 'react';
|
|
2
2
|
import { EmbedCardUnresolvedView } from './UnresolvedView';
|
|
3
|
-
import { UnauthorisedImage } from '../constants';
|
|
3
|
+
import { LockImage, UnauthorisedImage } from '../constants';
|
|
4
4
|
import { ExpandedFrame } from '../components/ExpandedFrame';
|
|
5
5
|
import { ImageIcon } from '../components/ImageIcon';
|
|
6
6
|
import UnauthorisedViewContent from '../../common/UnauthorisedViewContent';
|
|
7
7
|
export var EmbedCardUnauthorisedView = function EmbedCardUnauthorisedView(_ref) {
|
|
8
|
-
var _context$image;
|
|
9
8
|
var analytics = _ref.analytics,
|
|
10
9
|
link = _ref.link,
|
|
11
10
|
context = _ref.context,
|
|
@@ -27,6 +26,36 @@ export var EmbedCardUnauthorisedView = function EmbedCardUnauthorisedView(_ref)
|
|
|
27
26
|
onAuthorise();
|
|
28
27
|
}
|
|
29
28
|
}, [onAuthorise, analytics.track, extensionKey]);
|
|
29
|
+
var view = useMemo(function () {
|
|
30
|
+
var _context$image2;
|
|
31
|
+
if (onAuthorise) {
|
|
32
|
+
var _context$image;
|
|
33
|
+
return /*#__PURE__*/React.createElement(EmbedCardUnresolvedView, {
|
|
34
|
+
button: {
|
|
35
|
+
appearance: 'primary',
|
|
36
|
+
text: 'connect_unauthorised_account_action',
|
|
37
|
+
testId: 'connect-account'
|
|
38
|
+
},
|
|
39
|
+
context: context && context.text,
|
|
40
|
+
description: "connect_unauthorised_account_description",
|
|
41
|
+
image: (_context$image = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image !== void 0 ? _context$image : UnauthorisedImage,
|
|
42
|
+
onClick: handleOnAuthorizeClick,
|
|
43
|
+
testId: testId,
|
|
44
|
+
title: "connect_link_account_card_name"
|
|
45
|
+
}, /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
|
|
46
|
+
analytics: analytics,
|
|
47
|
+
providerName: context === null || context === void 0 ? void 0 : context.text,
|
|
48
|
+
testId: testId
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
return /*#__PURE__*/React.createElement(EmbedCardUnresolvedView, {
|
|
52
|
+
description: context !== null && context !== void 0 && context.text ? 'unauthorised_account_description' : 'unauthorised_account_description_no_provider',
|
|
53
|
+
image: (_context$image2 = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image2 !== void 0 ? _context$image2 : LockImage,
|
|
54
|
+
context: context === null || context === void 0 ? void 0 : context.text,
|
|
55
|
+
testId: testId,
|
|
56
|
+
title: context !== null && context !== void 0 && context.text ? 'unauthorised_account_name' : 'unauthorised_account_name_no_provider'
|
|
57
|
+
});
|
|
58
|
+
}, [analytics, context, handleOnAuthorizeClick, onAuthorise, testId]);
|
|
30
59
|
return /*#__PURE__*/React.createElement(ExpandedFrame, {
|
|
31
60
|
href: link,
|
|
32
61
|
icon: icon,
|
|
@@ -37,21 +66,5 @@ export var EmbedCardUnauthorisedView = function EmbedCardUnauthorisedView(_ref)
|
|
|
37
66
|
onClick: onClick,
|
|
38
67
|
testId: testId,
|
|
39
68
|
allowScrollBar: true
|
|
40
|
-
},
|
|
41
|
-
image: (_context$image = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image !== void 0 ? _context$image : UnauthorisedImage,
|
|
42
|
-
title: "connect_link_account_card_name",
|
|
43
|
-
description: "connect_unauthorised_account_description",
|
|
44
|
-
context: context && context.text,
|
|
45
|
-
button: onAuthorise ? {
|
|
46
|
-
appearance: 'primary',
|
|
47
|
-
text: 'connect_unauthorised_account_action',
|
|
48
|
-
testId: 'connect-account'
|
|
49
|
-
} : undefined,
|
|
50
|
-
onClick: onAuthorise ? handleOnAuthorizeClick : undefined,
|
|
51
|
-
testId: testId
|
|
52
|
-
}, /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
|
|
53
|
-
analytics: analytics,
|
|
54
|
-
providerName: context === null || context === void 0 ? void 0 : context.text,
|
|
55
|
-
testId: testId
|
|
56
|
-
})));
|
|
69
|
+
}, view);
|
|
57
70
|
};
|
|
@@ -15,7 +15,7 @@ import ElementGroup from './element-group';
|
|
|
15
15
|
|
|
16
16
|
// Determine whether the element can be display as inline/block.
|
|
17
17
|
|
|
18
|
-
export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AttachmentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ChecklistProgress, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.DueOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LatestCommit, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LinkIcon, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Location, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.OwnedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Preview, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.Priority, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ProgrammingLanguage, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ReactCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.SourceBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.TargetBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ViewCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.VoteCount, ['inline']), _ElementDisplaySchema);
|
|
18
|
+
export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AssignedTo, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.AssignedToGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.AttachmentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ChecklistProgress, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.DueOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LatestCommit, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LinkIcon, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Location, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.OwnedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.OwnedByGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Preview, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.Priority, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ProgrammingLanguage, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ReactCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ReadTime, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.SourceBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubTasksProgress, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.TargetBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ViewCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.VoteCount, ['inline']), _ElementDisplaySchema);
|
|
19
19
|
var getDirectionStyles = function getDirectionStyles(direction) {
|
|
20
20
|
switch (direction) {
|
|
21
21
|
case SmartLinkDirection.Vertical:
|
|
@@ -3,6 +3,16 @@ import { ElementName } from '../../../../constants';
|
|
|
3
3
|
// Attention: Keep the export name and element name the same.
|
|
4
4
|
// This will help reducing the code for mapping elements inside
|
|
5
5
|
// createElement and renderElementItems
|
|
6
|
+
/**
|
|
7
|
+
* Creates a AssignedTo text element using the data from AssignedTo in the Flexible UI Context.
|
|
8
|
+
* @see Text
|
|
9
|
+
*/
|
|
10
|
+
export var AssignedTo = createElement(ElementName.AssignedTo);
|
|
11
|
+
/**
|
|
12
|
+
* An AvatarGroup element using the data from AssignedToGroup in the Flexible UI Context.
|
|
13
|
+
* @see AvatarGroup
|
|
14
|
+
*/
|
|
15
|
+
export var AssignedToGroup = createElement(ElementName.AssignedToGroup);
|
|
6
16
|
/**
|
|
7
17
|
* Creates a AttachmentCount Badge element using the data from AttachmentCount in the Flexible UI Context.
|
|
8
18
|
* @see Badge
|
|
@@ -73,6 +83,11 @@ export var ModifiedOn = createElement(ElementName.ModifiedOn);
|
|
|
73
83
|
* @see Text
|
|
74
84
|
*/
|
|
75
85
|
export var OwnedBy = createElement(ElementName.OwnedBy);
|
|
86
|
+
/**
|
|
87
|
+
* An AvatarGroup element using the data from OwnedByGroup in the Flexible UI Context.
|
|
88
|
+
* @see AvatarGroup
|
|
89
|
+
*/
|
|
90
|
+
export var OwnedByGroup = createElement(ElementName.OwnedByGroup);
|
|
76
91
|
/**
|
|
77
92
|
* Creates a Preview element using the data from Preview in the Flexible UI Context.
|
|
78
93
|
* @see Preview
|
|
@@ -98,6 +113,10 @@ export var Provider = createElement(ElementName.Provider);
|
|
|
98
113
|
* @see Badge
|
|
99
114
|
*/
|
|
100
115
|
export var ReactCount = createElement(ElementName.ReactCount);
|
|
116
|
+
/**
|
|
117
|
+
* Creates a ReadTime Text element using the data from readTime in the Flexible UI Context
|
|
118
|
+
*/
|
|
119
|
+
export var ReadTime = createElement(ElementName.ReadTime);
|
|
101
120
|
/**
|
|
102
121
|
* Creates a Snippet element using the data from Snippet in the Flexible UI Context.
|
|
103
122
|
* @see Text
|
|
@@ -118,6 +137,11 @@ export var State = createElement(ElementName.State);
|
|
|
118
137
|
* @see Badge
|
|
119
138
|
*/
|
|
120
139
|
export var SubscriberCount = createElement(ElementName.SubscriberCount);
|
|
140
|
+
/**
|
|
141
|
+
* Create a SubTasks Badge element using the data from subTasks in the Flexible UI Context.
|
|
142
|
+
* @see Badge
|
|
143
|
+
*/
|
|
144
|
+
export var SubTasksProgress = createElement(ElementName.SubTasksProgress);
|
|
121
145
|
/**
|
|
122
146
|
* Creates a TargetBranch Text element using the data from targetBranch in the Flexible UI Context.
|
|
123
147
|
* @see Text
|
|
@@ -57,6 +57,12 @@ var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings,
|
|
|
57
57
|
component: Text
|
|
58
58
|
}), _defineProperty(_elementMappings, ElementName.OwnedBy, {
|
|
59
59
|
component: Text
|
|
60
|
+
}), _defineProperty(_elementMappings, ElementName.AssignedTo, {
|
|
61
|
+
component: Text
|
|
62
|
+
}), _defineProperty(_elementMappings, ElementName.AssignedToGroup, {
|
|
63
|
+
component: AvatarGroup
|
|
64
|
+
}), _defineProperty(_elementMappings, ElementName.OwnedByGroup, {
|
|
65
|
+
component: AvatarGroup
|
|
60
66
|
}), _defineProperty(_elementMappings, ElementName.CreatedOn, {
|
|
61
67
|
component: DateTime
|
|
62
68
|
}), _defineProperty(_elementMappings, ElementName.DueOn, {
|
|
@@ -83,6 +89,8 @@ var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings,
|
|
|
83
89
|
}
|
|
84
90
|
}), _defineProperty(_elementMappings, ElementName.Provider, {
|
|
85
91
|
component: Badge
|
|
92
|
+
}), _defineProperty(_elementMappings, ElementName.ReadTime, {
|
|
93
|
+
component: Text
|
|
86
94
|
}), _defineProperty(_elementMappings, ElementName.Snippet, {
|
|
87
95
|
component: Text,
|
|
88
96
|
props: {
|
|
@@ -98,6 +106,11 @@ var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings,
|
|
|
98
106
|
props: {
|
|
99
107
|
icon: IconType.Subscriber
|
|
100
108
|
}
|
|
109
|
+
}), _defineProperty(_elementMappings, ElementName.SubTasksProgress, {
|
|
110
|
+
component: Badge,
|
|
111
|
+
props: {
|
|
112
|
+
icon: IconType.CheckItem
|
|
113
|
+
}
|
|
101
114
|
}), _defineProperty(_elementMappings, ElementName.TargetBranch, {
|
|
102
115
|
component: Text
|
|
103
116
|
}), _defineProperty(_elementMappings, ElementName.Title, {
|
|
@@ -120,7 +133,9 @@ var getData = function getData(elementName, contextKey, context) {
|
|
|
120
133
|
var data = context[contextKey];
|
|
121
134
|
switch (elementName) {
|
|
122
135
|
case ElementName.AuthorGroup:
|
|
136
|
+
case ElementName.AssignedToGroup:
|
|
123
137
|
case ElementName.CollaboratorGroup:
|
|
138
|
+
case ElementName.OwnedByGroup:
|
|
124
139
|
return toAvatarGroupProps(data);
|
|
125
140
|
case ElementName.AttachmentCount:
|
|
126
141
|
case ElementName.ChecklistProgress:
|
|
@@ -131,9 +146,12 @@ var getData = function getData(elementName, contextKey, context) {
|
|
|
131
146
|
case ElementName.ProgrammingLanguage:
|
|
132
147
|
case ElementName.SubscriberCount:
|
|
133
148
|
case ElementName.LatestCommit:
|
|
149
|
+
case ElementName.SubTasksProgress:
|
|
134
150
|
return toBadgeProps(data);
|
|
135
151
|
case ElementName.CreatedBy:
|
|
136
152
|
return toFormattedTextProps(messages.created_by, context.createdBy);
|
|
153
|
+
case ElementName.AssignedTo:
|
|
154
|
+
return toFormattedTextProps(messages.assigned_to, context.assignedTo);
|
|
137
155
|
case ElementName.OwnedBy:
|
|
138
156
|
return toFormattedTextProps(messages.owned_by, context.ownedBy);
|
|
139
157
|
case ElementName.CreatedOn:
|
|
@@ -144,6 +162,8 @@ var getData = function getData(elementName, contextKey, context) {
|
|
|
144
162
|
return toFormattedTextProps(messages.modified_by, context.modifiedBy);
|
|
145
163
|
case ElementName.ModifiedOn:
|
|
146
164
|
return toDateTimeProps('modified', context.modifiedOn);
|
|
165
|
+
case ElementName.ReadTime:
|
|
166
|
+
return toFormattedTextProps(messages.read_time, data);
|
|
147
167
|
case ElementName.Snippet:
|
|
148
168
|
case ElementName.SourceBranch:
|
|
149
169
|
case ElementName.TargetBranch:
|
|
@@ -8,11 +8,12 @@ import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../..
|
|
|
8
8
|
import { FooterBlock, MetadataBlock, SnippetBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
|
|
9
9
|
import { footerBlockCss, hiddenSnippetStyles, metadataBlockCss } from './styled';
|
|
10
10
|
import FlexibleCard from '../../../../FlexibleCard';
|
|
11
|
-
import { getSimulatedMetadata } from '../../../utils';
|
|
11
|
+
import { getSimulatedMetadata, getSimulatedBetterMetadata } from '../../../utils';
|
|
12
12
|
import SnippetOrPreview from '../../SnippetOrPreview';
|
|
13
|
-
import { extractMetadata } from '../../../../../extractors/hover/extractMetadata';
|
|
13
|
+
import { extractMetadata, elementNamesToItems } from '../../../../../extractors/hover/extractMetadata';
|
|
14
14
|
import { messages } from '../../../../../messages';
|
|
15
15
|
import { FormattedMessage } from 'react-intl-next';
|
|
16
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
16
17
|
export var toFooterActions = function toFooterActions(cardActions, onActionClick, enableImprovedPreviewAction) {
|
|
17
18
|
var appearance = enableImprovedPreviewAction ? {
|
|
18
19
|
appearance: 'primary'
|
|
@@ -72,16 +73,24 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
72
73
|
}, [cardActions, onActionClick, enableImprovedPreviewAction]);
|
|
73
74
|
var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
|
|
74
75
|
var _useMemo = useMemo(function () {
|
|
75
|
-
|
|
76
|
+
if (getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg')) {
|
|
77
|
+
var betterMetadata = getSimulatedBetterMetadata(extensionKey, data);
|
|
78
|
+
return {
|
|
79
|
+
topPrimary: elementNamesToItems(betterMetadata.topMetadataBlock.primary),
|
|
80
|
+
topSecondary: elementNamesToItems(betterMetadata.topMetadataBlock.secondary),
|
|
81
|
+
bottomPrimary: elementNamesToItems(betterMetadata.bottomMetadataBlock.primary)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
76
84
|
var metadata = extractMetadata(getSimulatedMetadata(extensionKey, data));
|
|
77
85
|
return {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
86
|
+
topPrimary: metadata.primary,
|
|
87
|
+
topSecondary: metadata.secondary,
|
|
88
|
+
bottomPrimary: []
|
|
81
89
|
};
|
|
82
90
|
}, [data, extensionKey]),
|
|
83
|
-
|
|
84
|
-
|
|
91
|
+
topPrimary = _useMemo.topPrimary,
|
|
92
|
+
topSecondary = _useMemo.topSecondary,
|
|
93
|
+
bottomPrimary = _useMemo.bottomPrimary;
|
|
85
94
|
var snippetHeight = React.useRef(0);
|
|
86
95
|
var snippetBlockRef = useRef(null);
|
|
87
96
|
var onSnippetRender = useCallback(function () {
|
|
@@ -94,17 +103,24 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
94
103
|
});
|
|
95
104
|
return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockProps, {
|
|
96
105
|
metadataPosition: SmartLinkPosition.Top
|
|
97
|
-
})), /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
98
|
-
primary:
|
|
99
|
-
secondary:
|
|
100
|
-
size: SmartLinkSize.Large,
|
|
106
|
+
})), /*#__PURE__*/React.createElement(MetadataBlock, _extends({
|
|
107
|
+
primary: topPrimary,
|
|
108
|
+
secondary: topSecondary,
|
|
101
109
|
overrideCss: metadataBlockCss,
|
|
102
|
-
maxLines: 1
|
|
103
|
-
|
|
110
|
+
maxLines: 1,
|
|
111
|
+
size: SmartLinkSize.Large
|
|
112
|
+
}, getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && {
|
|
113
|
+
size: SmartLinkSize.Medium
|
|
114
|
+
})), body, /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
104
115
|
testId: 'hidden-snippet',
|
|
105
116
|
onRender: onSnippetRender,
|
|
106
117
|
blockRef: snippetBlockRef,
|
|
107
118
|
overrideCss: hiddenSnippetStyles
|
|
119
|
+
}), getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') && /*#__PURE__*/React.createElement(MetadataBlock, {
|
|
120
|
+
primary: bottomPrimary,
|
|
121
|
+
size: SmartLinkSize.Large,
|
|
122
|
+
overrideCss: metadataBlockCss,
|
|
123
|
+
maxLines: 1
|
|
108
124
|
}), /*#__PURE__*/React.createElement(FooterBlock, {
|
|
109
125
|
actions: footerActions,
|
|
110
126
|
size: SmartLinkSize.Large,
|