@atlaskit/smart-card 36.8.2 → 36.10.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 +30 -0
- package/dist/cjs/constants.js +2 -0
- package/dist/cjs/extractors/common/context/index.js +41 -1
- package/dist/cjs/extractors/common/icon/extractIconFromDocument.js +7 -61
- package/dist/cjs/extractors/embed/index.js +3 -35
- package/dist/cjs/extractors/flexible/extract-preview.js +24 -2
- package/dist/cjs/extractors/flexible/icon/extract-provider-icon.js +40 -2
- package/dist/cjs/extractors/flexible/icon/index.js +15 -1
- package/dist/cjs/extractors/flexible/index.js +78 -3
- package/dist/cjs/extractors/flexible/utils.js +4 -1
- package/dist/cjs/extractors/inline/index.js +5 -1
- package/dist/cjs/messages.js +4 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/index.js +12 -260
- package/dist/cjs/utils/mocks.js +12 -2
- package/dist/cjs/view/BlockCard/views/ErroredView.js +1 -12
- package/dist/cjs/view/BlockCard/views/ForbiddenView.js +2 -11
- package/dist/cjs/view/BlockCard/views/NotFoundView.js +5 -15
- package/dist/cjs/view/BlockCard/views/UnauthorisedView.js +3 -3
- package/dist/cjs/view/BlockCard/views/utils/index.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/index.js +3 -5
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/index.js +12 -36
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/common/image-icon/index.js +4 -17
- package/dist/cjs/view/FlexibleCard/components/common/loading-skeleton/index.js +2 -10
- package/dist/cjs/view/FlexibleCard/components/elements/applied-to-components-count/index.js +35 -0
- package/dist/cjs/view/FlexibleCard/components/elements/index.js +7 -0
- package/dist/cjs/view/FlexibleCard/components/elements/utils.js +14 -7
- package/dist/cjs/view/FlexibleCard/utils.js +21 -10
- package/dist/cjs/view/HoverCard/components/views/resolving/index.js +5 -18
- package/dist/cjs/view/InlineCard/ErroredView/index.js +5 -15
- package/dist/cjs/view/InlineCard/ForbiddenView/index.js +1 -7
- package/dist/cjs/view/InlineCard/Icon.compiled.css +0 -1
- package/dist/cjs/view/InlineCard/Icon.js +4 -24
- package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +7 -15
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/common/UnauthorisedViewContent.js +2 -2
- package/dist/es2019/constants.js +2 -0
- package/dist/es2019/extractors/common/context/index.js +36 -1
- package/dist/es2019/extractors/common/icon/extractIconFromDocument.js +6 -61
- package/dist/es2019/extractors/embed/index.js +2 -35
- package/dist/es2019/extractors/flexible/extract-preview.js +25 -2
- package/dist/es2019/extractors/flexible/icon/extract-provider-icon.js +42 -2
- package/dist/es2019/extractors/flexible/icon/index.js +14 -0
- package/dist/es2019/extractors/flexible/index.js +77 -6
- package/dist/es2019/extractors/flexible/utils.js +1 -0
- package/dist/es2019/extractors/inline/index.js +5 -1
- package/dist/es2019/messages.js +4 -0
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/utils/index.js +5 -56
- package/dist/es2019/utils/mocks.js +13 -2
- package/dist/es2019/view/BlockCard/views/ErroredView.js +1 -12
- package/dist/es2019/view/BlockCard/views/ForbiddenView.js +3 -12
- package/dist/es2019/view/BlockCard/views/NotFoundView.js +8 -16
- package/dist/es2019/view/BlockCard/views/UnauthorisedView.js +4 -4
- package/dist/es2019/view/BlockCard/views/utils/index.js +3 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/index.js +4 -6
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.js +11 -33
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +1 -0
- package/dist/es2019/view/FlexibleCard/components/common/image-icon/index.js +5 -18
- package/dist/es2019/view/FlexibleCard/components/common/loading-skeleton/index.js +2 -10
- package/dist/es2019/view/FlexibleCard/components/elements/applied-to-components-count/index.js +26 -0
- package/dist/es2019/view/FlexibleCard/components/elements/index.js +2 -1
- package/dist/es2019/view/FlexibleCard/components/elements/utils.js +8 -0
- package/dist/es2019/view/FlexibleCard/utils.js +19 -11
- package/dist/es2019/view/HoverCard/components/views/resolving/index.js +5 -18
- package/dist/es2019/view/InlineCard/ErroredView/index.js +5 -15
- package/dist/es2019/view/InlineCard/ForbiddenView/index.js +2 -8
- package/dist/es2019/view/InlineCard/Icon.compiled.css +0 -1
- package/dist/es2019/view/InlineCard/Icon.js +0 -19
- package/dist/es2019/view/InlineCard/UnauthorisedView/index.js +8 -16
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/common/UnauthorisedViewContent.js +1 -1
- package/dist/esm/constants.js +2 -0
- package/dist/esm/extractors/common/context/index.js +38 -1
- package/dist/esm/extractors/common/icon/extractIconFromDocument.js +6 -61
- package/dist/esm/extractors/embed/index.js +2 -34
- package/dist/esm/extractors/flexible/extract-preview.js +25 -2
- package/dist/esm/extractors/flexible/icon/extract-provider-icon.js +41 -2
- package/dist/esm/extractors/flexible/icon/index.js +14 -0
- package/dist/esm/extractors/flexible/index.js +78 -6
- package/dist/esm/extractors/flexible/utils.js +3 -0
- package/dist/esm/extractors/inline/index.js +5 -1
- package/dist/esm/messages.js +4 -0
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/index.js +10 -160
- package/dist/esm/utils/mocks.js +12 -2
- package/dist/esm/view/BlockCard/views/ErroredView.js +1 -12
- package/dist/esm/view/BlockCard/views/ForbiddenView.js +3 -12
- package/dist/esm/view/BlockCard/views/NotFoundView.js +6 -16
- package/dist/esm/view/BlockCard/views/UnauthorisedView.js +4 -4
- package/dist/esm/view/BlockCard/views/utils/index.js +3 -1
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.js +3 -5
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.js +11 -33
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +1 -1
- package/dist/esm/view/FlexibleCard/components/common/image-icon/index.js +5 -18
- package/dist/esm/view/FlexibleCard/components/common/loading-skeleton/index.js +2 -10
- package/dist/esm/view/FlexibleCard/components/elements/applied-to-components-count/index.js +25 -0
- package/dist/esm/view/FlexibleCard/components/elements/index.js +2 -1
- package/dist/esm/view/FlexibleCard/components/elements/utils.js +14 -7
- package/dist/esm/view/FlexibleCard/utils.js +19 -11
- package/dist/esm/view/HoverCard/components/views/resolving/index.js +5 -18
- package/dist/esm/view/InlineCard/ErroredView/index.js +5 -15
- package/dist/esm/view/InlineCard/ForbiddenView/index.js +2 -8
- package/dist/esm/view/InlineCard/Icon.compiled.css +0 -1
- package/dist/esm/view/InlineCard/Icon.js +3 -23
- package/dist/esm/view/InlineCard/UnauthorisedView/index.js +8 -16
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/common/UnauthorisedViewContent.js +1 -1
- package/dist/types/__fixtures__/compass-scorecard.d.ts +44 -0
- package/dist/types/__fixtures__/figma-entity.d.ts +58 -0
- package/dist/types/constants.d.ts +2 -0
- package/dist/types/extractors/common/context/index.d.ts +8 -0
- package/dist/types/extractors/flexible/extract-preview.d.ts +5 -0
- package/dist/types/extractors/flexible/icon/extract-provider-icon.d.ts +5 -0
- package/dist/types/extractors/flexible/icon/index.d.ts +13 -0
- package/dist/types/extractors/flexible/index.d.ts +1 -1
- package/dist/types/extractors/flexible/utils.d.ts +1 -0
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/state/flexible-ui-context/types.d.ts +6 -0
- package/dist/types/view/FlexibleCard/components/blocks/title-block/resolving/index.d.ts +2 -6
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +8 -1
- package/dist/types/view/FlexibleCard/components/common/loading-skeleton/index.d.ts +2 -4
- package/dist/types/view/FlexibleCard/components/common/loading-skeleton/types.d.ts +1 -17
- package/dist/types/view/FlexibleCard/components/elements/applied-to-components-count/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/elements/index.d.ts +1 -0
- package/dist/types/view/FlexibleCard/types.d.ts +2 -2
- package/dist/types/view/FlexibleCard/utils.d.ts +2 -2
- package/dist/types/view/InlineCard/Icon.d.ts +0 -1
- package/dist/types-ts4.5/__fixtures__/compass-scorecard.d.ts +44 -0
- package/dist/types-ts4.5/__fixtures__/figma-entity.d.ts +58 -0
- package/dist/types-ts4.5/constants.d.ts +2 -0
- package/dist/types-ts4.5/extractors/common/context/index.d.ts +8 -0
- package/dist/types-ts4.5/extractors/flexible/extract-preview.d.ts +5 -0
- package/dist/types-ts4.5/extractors/flexible/icon/extract-provider-icon.d.ts +5 -0
- package/dist/types-ts4.5/extractors/flexible/icon/index.d.ts +13 -0
- package/dist/types-ts4.5/extractors/flexible/index.d.ts +1 -1
- package/dist/types-ts4.5/extractors/flexible/utils.d.ts +1 -0
- package/dist/types-ts4.5/messages.d.ts +1 -1
- package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +6 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/resolving/index.d.ts +2 -6
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +8 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/common/loading-skeleton/index.d.ts +2 -4
- package/dist/types-ts4.5/view/FlexibleCard/components/common/loading-skeleton/types.d.ts +1 -17
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/applied-to-components-count/index.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/elements/index.d.ts +1 -0
- package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +2 -2
- package/dist/types-ts4.5/view/FlexibleCard/utils.d.ts +2 -2
- package/dist/types-ts4.5/view/InlineCard/Icon.d.ts +0 -1
- package/package.json +6 -6
- package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/index.compiled.css +0 -55
- package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.compiled.css +0 -55
- package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.compiled.css +0 -55
|
@@ -1,69 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import FileIconOld from '@atlaskit/icon-file-type/glyph/generic/16';
|
|
4
|
-
import PresentationIconOld from '@atlaskit/icon-file-type/glyph/presentation/16';
|
|
5
|
-
import SpreadsheetIconOld from '@atlaskit/icon-file-type/glyph/spreadsheet/16';
|
|
6
|
-
import BlogIconOld from '@atlaskit/icon-object/glyph/blog/16';
|
|
7
|
-
import DocumentFilledIconNew from '@atlaskit/icon/core/migration/file--document-filled';
|
|
8
|
-
import DocumentFilledIconOld from '@atlaskit/icon/core/migration/page--document-filled';
|
|
2
|
+
import DocumentFilledIcon from '@atlaskit/icon/core/migration/file--document-filled';
|
|
9
3
|
import { isConfluenceGenerator } from '@atlaskit/link-extractors';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import SpreadsheetIconNew from '../../../common/ui/icons/list-bullet-icon';
|
|
4
|
+
import BlogIcon from '../../../common/ui/icons/blog-icon';
|
|
5
|
+
import PresentationIcon from '../../../common/ui/icons/chart-bar-icon';
|
|
6
|
+
import FileIcon from '../../../common/ui/icons/file-icon';
|
|
7
|
+
import SpreadsheetIcon from '../../../common/ui/icons/list-bullet-icon';
|
|
15
8
|
import LiveDocumentIcon from '../../../common/ui/icons/live-document-icon';
|
|
16
|
-
import
|
|
9
|
+
import DocumentIcon from '../../../common/ui/icons/page-icon';
|
|
17
10
|
import { getIconForFileType } from '../../../utils';
|
|
18
11
|
import { prioritiseIcon } from './prioritiseIcon';
|
|
19
|
-
|
|
20
|
-
// TODO Delete this and rename BlogIconNew to BlogIcon when cleaning platform-smart-card-icon-migration
|
|
21
|
-
const BlogIcon = props => {
|
|
22
|
-
if (fg('platform-smart-card-icon-migration')) {
|
|
23
|
-
return /*#__PURE__*/React.createElement(BlogIconNew, props);
|
|
24
|
-
}
|
|
25
|
-
return /*#__PURE__*/React.createElement(BlogIconOld, props);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// TODO Delete this and rename FileIconNew to FileIcon when cleaning platform-smart-card-icon-migration
|
|
29
|
-
const FileIcon = props => {
|
|
30
|
-
if (fg('platform-smart-card-icon-migration')) {
|
|
31
|
-
return /*#__PURE__*/React.createElement(FileIconNew, props);
|
|
32
|
-
}
|
|
33
|
-
return /*#__PURE__*/React.createElement(FileIconOld, props);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
// TODO Delete this and rename DocumentIconNew to DocumentIcon when cleaning platform-smart-card-icon-migration
|
|
37
|
-
const DocumentIcon = props => {
|
|
38
|
-
if (fg('platform-smart-card-icon-migration')) {
|
|
39
|
-
return /*#__PURE__*/React.createElement(DocumentIconNew, props);
|
|
40
|
-
}
|
|
41
|
-
return /*#__PURE__*/React.createElement(DocumentIconOld, props);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// TODO Delete this and rename PresentationIconNew to PresentationIcon when cleaning platform-smart-card-icon-migration
|
|
45
|
-
const PresentationIcon = props => {
|
|
46
|
-
if (fg('platform-smart-card-icon-migration')) {
|
|
47
|
-
return /*#__PURE__*/React.createElement(PresentationIconNew, props);
|
|
48
|
-
}
|
|
49
|
-
return /*#__PURE__*/React.createElement(PresentationIconOld, props);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// TODO Delete this and rename SpreadsheetIconNew to SpreadsheetIcon when cleaning platform-smart-card-icon-migration
|
|
53
|
-
const SpreadsheetIcon = props => {
|
|
54
|
-
if (fg('platform-smart-card-icon-migration')) {
|
|
55
|
-
return /*#__PURE__*/React.createElement(SpreadsheetIconNew, props);
|
|
56
|
-
}
|
|
57
|
-
return /*#__PURE__*/React.createElement(SpreadsheetIconOld, props);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// TODO Delete this and rename DocumentFilledIconNew to DocumentFilledIcon when cleaning platform-smart-card-icon-migration
|
|
61
|
-
const DocumentFilledIcon = props => {
|
|
62
|
-
if (fg('platform-smart-card-icon-migration')) {
|
|
63
|
-
return /*#__PURE__*/React.createElement(DocumentFilledIconNew, props);
|
|
64
|
-
}
|
|
65
|
-
return /*#__PURE__*/React.createElement(DocumentFilledIconOld, props);
|
|
66
|
-
};
|
|
67
12
|
/**
|
|
68
13
|
* Extracts an icon for a document pbject
|
|
69
14
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { extractLink, extractPreview, extractSmartLinkEmbed, extractSmartLinkTitle, extractSmartLinkUrl, extractTitle } from '@atlaskit/link-extractors';
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
3
|
import { getEmptyJsonLd } from '../../utils/jsonld';
|
|
4
|
-
import {
|
|
4
|
+
import { extractSmartLinkContext, generateContext } from '../common/context';
|
|
5
5
|
import { extractIsSupportTheming } from '../common/meta/extractIsSupportTheming';
|
|
6
6
|
import { extractIsTrusted } from '../common/meta/extractIsTrusted';
|
|
7
7
|
const extractEmbedPreview = (jsonLd, platform, iframeUrlType) => {
|
|
@@ -13,39 +13,6 @@ const extractEmbedPreview = (jsonLd, platform, iframeUrlType) => {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
function generateContext(jsonLd) {
|
|
17
|
-
const provider = extractProvider(jsonLd);
|
|
18
|
-
if (!provider) {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// If no icon is supplied, return existing context
|
|
23
|
-
if (!jsonLd.icon) {
|
|
24
|
-
return provider;
|
|
25
|
-
}
|
|
26
|
-
const generator = jsonLd.generator;
|
|
27
|
-
const icon = prioritiseIcon({
|
|
28
|
-
fileFormatIcon: undefined,
|
|
29
|
-
documentTypeIcon: undefined,
|
|
30
|
-
urlIcon: extractUrlFromIconJsonLd(jsonLd.icon),
|
|
31
|
-
// We still attempt to follow the icon priority function even if no generator (and therefore provider icon) is defined
|
|
32
|
-
providerIcon: generator && typeof generator !== 'string' && generator['@type'] !== 'Link' && extractProviderIcon(generator.icon)
|
|
33
|
-
});
|
|
34
|
-
return {
|
|
35
|
-
...provider,
|
|
36
|
-
icon: icon ? icon : provider.icon
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* We can migrate this to link extractors once we have deprecated JsonLd
|
|
42
|
-
*/
|
|
43
|
-
function extractSmartLinkContext(response) {
|
|
44
|
-
if (isEntityPresent(response)) {
|
|
45
|
-
return extractEntityProvider(response);
|
|
46
|
-
}
|
|
47
|
-
return generateContext(response === null || response === void 0 ? void 0 : response.data);
|
|
48
|
-
}
|
|
49
16
|
export const extractEmbedProps = (response, platform, iframeUrlType) => {
|
|
50
17
|
const meta = response === null || response === void 0 ? void 0 : response.meta;
|
|
51
18
|
const jsonLd = (response === null || response === void 0 ? void 0 : response.data) || getEmptyJsonLd();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extractImage } from '@atlaskit/link-extractors';
|
|
1
|
+
import { extractEntity, extractEntityProvider, extractImage, isEntityPresent } from '@atlaskit/link-extractors';
|
|
2
2
|
import { MediaType } from '../../constants';
|
|
3
3
|
const extractPreview = data => {
|
|
4
4
|
if (!data) {
|
|
@@ -10,4 +10,27 @@ const extractPreview = data => {
|
|
|
10
10
|
url
|
|
11
11
|
} : undefined;
|
|
12
12
|
};
|
|
13
|
-
export default extractPreview;
|
|
13
|
+
export default extractPreview;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Should be moved to link-extractors when jsonLd is deprecated
|
|
17
|
+
*/
|
|
18
|
+
export const extractSmartLinkPreviewImage = response => {
|
|
19
|
+
if (!response || !(response !== null && response !== void 0 && response.data)) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
if (isEntityPresent(response)) {
|
|
23
|
+
var _entity$thumbnail;
|
|
24
|
+
const entity = extractEntity(response);
|
|
25
|
+
let url = entity === null || entity === void 0 ? void 0 : (_entity$thumbnail = entity.thumbnail) === null || _entity$thumbnail === void 0 ? void 0 : _entity$thumbnail.externalUrl;
|
|
26
|
+
if (!url) {
|
|
27
|
+
const provider = extractEntityProvider(response);
|
|
28
|
+
url = provider === null || provider === void 0 ? void 0 : provider.image;
|
|
29
|
+
}
|
|
30
|
+
return url ? {
|
|
31
|
+
type: MediaType.Image,
|
|
32
|
+
url
|
|
33
|
+
} : undefined;
|
|
34
|
+
}
|
|
35
|
+
return extractPreview(response.data);
|
|
36
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extractTitle } from '@atlaskit/link-extractors';
|
|
1
|
+
import { extractEntity, extractEntityProvider, extractTitle, isEntityPresent } from '@atlaskit/link-extractors';
|
|
2
2
|
import { IconType } from '../../../constants';
|
|
3
3
|
import { CONFLUENCE_GENERATOR_ID, JIRA_GENERATOR_ID } from '../../constants';
|
|
4
4
|
import extractUrlIcon from './extract-url-icon';
|
|
@@ -34,4 +34,44 @@ const extractProviderIcon = data => {
|
|
|
34
34
|
}
|
|
35
35
|
return extractUrlIcon(icon, label);
|
|
36
36
|
};
|
|
37
|
-
export default extractProviderIcon;
|
|
37
|
+
export default extractProviderIcon;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Should be moved to link-extractors when jsonLd is deprecated
|
|
41
|
+
*/
|
|
42
|
+
export const extractSmartLinkProviderIcon = response => {
|
|
43
|
+
var _extractEntity, _generator$icon;
|
|
44
|
+
if (!response || !(response !== null && response !== void 0 && response.data)) {
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
if (isEntityPresent(response)) {
|
|
48
|
+
const provider = extractEntityProvider(response);
|
|
49
|
+
if (!provider) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
switch (provider.id) {
|
|
53
|
+
case CONFLUENCE_GENERATOR_ID:
|
|
54
|
+
return {
|
|
55
|
+
icon: IconType.Confluence,
|
|
56
|
+
label: provider.text || 'Confluence'
|
|
57
|
+
};
|
|
58
|
+
case JIRA_GENERATOR_ID:
|
|
59
|
+
return {
|
|
60
|
+
icon: IconType.Jira,
|
|
61
|
+
label: provider.text || 'Jira'
|
|
62
|
+
};
|
|
63
|
+
default:
|
|
64
|
+
const {
|
|
65
|
+
generator
|
|
66
|
+
} = response.meta;
|
|
67
|
+
if (!generator) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
label: generator.name || ((_extractEntity = extractEntity(response)) === null || _extractEntity === void 0 ? void 0 : _extractEntity.displayName),
|
|
72
|
+
url: (_generator$icon = generator.icon) === null || _generator$icon === void 0 ? void 0 : _generator$icon.url
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return extractProviderIcon(response.data);
|
|
77
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { extractEntityIcon, isEntityPresent } from '@atlaskit/link-extractors';
|
|
1
2
|
import { IconType, SmartLinkStatus } from '../../../constants';
|
|
2
3
|
import extractIconRenderer from './extract-icon-renderer';
|
|
3
4
|
import extractJsonldDataIcon from './extract-jsonld-data-icon';
|
|
@@ -44,4 +45,17 @@ export const extractErrorIcon = (response, status) => {
|
|
|
44
45
|
icon: IconType.Default
|
|
45
46
|
};
|
|
46
47
|
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Should be moved to link-extractors when jsonLd is deprecated
|
|
52
|
+
*/
|
|
53
|
+
export const extractSmartLinkIcon = (response, renderers) => {
|
|
54
|
+
if (!response || !(response !== null && response !== void 0 && response.data)) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
if (isEntityPresent(response)) {
|
|
58
|
+
return extractEntityIcon(response);
|
|
59
|
+
}
|
|
60
|
+
return extractLinkIcon(response, renderers);
|
|
47
61
|
};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { extractAri, extractDateCreated, extractDateUpdated, extractLink, extractPersonCreatedBy, extractPersonOwnedBy, extractTitle } from '@atlaskit/link-extractors';
|
|
1
|
+
import { extractAri, extractDateCreated, extractDateUpdated, extractLink, extractPersonCreatedBy, extractPersonOwnedBy, extractSmartLinkAri, extractSmartLinkCreatedBy, extractSmartLinkCreatedOn, extractSmartLinkModifiedBy, extractSmartLinkModifiedOn, extractSmartLinkTitle, extractSmartLinkUrl, extractTitle } from '@atlaskit/link-extractors';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { extractSummary } from '../common/primitives';
|
|
3
4
|
import { extractFlexibleCardActions } from './actions';
|
|
4
5
|
import { extractPersonsUpdatedBy } from './collaboratorGroup';
|
|
5
|
-
import extractPreview from './extract-preview';
|
|
6
|
+
import extractPreview, { extractSmartLinkPreviewImage } from './extract-preview';
|
|
6
7
|
import extractPriority from './extract-priority';
|
|
7
8
|
import extractState from './extract-state';
|
|
8
|
-
import { extractLinkIcon } from './icon';
|
|
9
|
-
import extractProviderIcon from './icon/extract-provider-icon';
|
|
9
|
+
import { extractLinkIcon, extractSmartLinkIcon } from './icon';
|
|
10
|
+
import extractProviderIcon, { extractSmartLinkProviderIcon } from './icon/extract-provider-icon';
|
|
10
11
|
import { extractLatestCommit } from './latest-commit';
|
|
11
|
-
import { extractAssignedTo, extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractDueOn, extractLocation, extractModifiedBy, extractOwnedBy, extractPersonAssignedToAsArray, extractProgrammingLanguage, extractReactCount, extractReadTime, extractSentOn, extractSourceBranch, extractStoryPoints, extractSubscriberCount, extractSubTasksProgress, extractTargetBranch, extractViewCount, extractVoteCount } from './utils';
|
|
12
|
-
const
|
|
12
|
+
import { extractAppliedToComponentsCount, extractAssignedTo, extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractDueOn, extractLocation, extractModifiedBy, extractOwnedBy, extractPersonAssignedToAsArray, extractProgrammingLanguage, extractReactCount, extractReadTime, extractSentOn, extractSourceBranch, extractStoryPoints, extractSubscriberCount, extractSubTasksProgress, extractTargetBranch, extractViewCount, extractVoteCount } from './utils';
|
|
13
|
+
const extractFlexibleUiContextFromJsonLd = ({
|
|
13
14
|
appearance,
|
|
14
15
|
fireEvent,
|
|
15
16
|
id,
|
|
@@ -37,6 +38,7 @@ const extractFlexibleUiContext = ({
|
|
|
37
38
|
response,
|
|
38
39
|
url: props.url // Use the original URL in edge cases, such as short links for AI summary and copy link actions.
|
|
39
40
|
}),
|
|
41
|
+
appliedToComponentsCount: extractAppliedToComponentsCount(data),
|
|
40
42
|
assignedToGroup: extractPersonAssignedToAsArray(data),
|
|
41
43
|
attachmentCount: extractAttachmentCount(data),
|
|
42
44
|
authorGroup: extractPersonCreatedBy(data),
|
|
@@ -76,4 +78,73 @@ const extractFlexibleUiContext = ({
|
|
|
76
78
|
ari: extractAri(data)
|
|
77
79
|
};
|
|
78
80
|
};
|
|
81
|
+
const extractFlexibleUiContextFromEntity = ({
|
|
82
|
+
actionOptions,
|
|
83
|
+
appearance,
|
|
84
|
+
fireEvent,
|
|
85
|
+
id,
|
|
86
|
+
origin,
|
|
87
|
+
resolve,
|
|
88
|
+
response
|
|
89
|
+
} = {}) => {
|
|
90
|
+
if (!response) {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
const data = response.data;
|
|
94
|
+
const url = extractSmartLinkUrl(response);
|
|
95
|
+
return {
|
|
96
|
+
actions: extractFlexibleCardActions({
|
|
97
|
+
response,
|
|
98
|
+
actionOptions,
|
|
99
|
+
id,
|
|
100
|
+
appearance,
|
|
101
|
+
fireEvent
|
|
102
|
+
}),
|
|
103
|
+
url,
|
|
104
|
+
ari: extractSmartLinkAri(response),
|
|
105
|
+
title: extractSmartLinkTitle(response) || url,
|
|
106
|
+
linkIcon: extractSmartLinkIcon(response),
|
|
107
|
+
preview: extractSmartLinkPreviewImage(response),
|
|
108
|
+
provider: extractSmartLinkProviderIcon(response),
|
|
109
|
+
modifiedOn: extractSmartLinkModifiedOn(response),
|
|
110
|
+
createdOn: extractSmartLinkCreatedOn(response),
|
|
111
|
+
createdBy: extractSmartLinkCreatedBy(response),
|
|
112
|
+
modifiedBy: extractSmartLinkModifiedBy(response),
|
|
113
|
+
// We need to add/remove these as we support new entity types
|
|
114
|
+
assignedToGroup: extractPersonAssignedToAsArray(data),
|
|
115
|
+
appliedToComponentsCount: extractAppliedToComponentsCount(data),
|
|
116
|
+
attachmentCount: extractAttachmentCount(data),
|
|
117
|
+
authorGroup: extractPersonCreatedBy(data),
|
|
118
|
+
ownedByGroup: extractPersonOwnedBy(data),
|
|
119
|
+
collaboratorGroup: extractPersonsUpdatedBy(data),
|
|
120
|
+
commentCount: extractCommentCount(data),
|
|
121
|
+
viewCount: extractViewCount(data),
|
|
122
|
+
reactCount: extractReactCount(data),
|
|
123
|
+
voteCount: extractVoteCount(data),
|
|
124
|
+
checklistProgress: extractChecklistProgress(data),
|
|
125
|
+
ownedBy: extractOwnedBy(data),
|
|
126
|
+
assignedTo: extractAssignedTo(data),
|
|
127
|
+
dueOn: extractDueOn(data),
|
|
128
|
+
latestCommit: extractLatestCommit(data),
|
|
129
|
+
location: extractLocation(data),
|
|
130
|
+
priority: extractPriority(data),
|
|
131
|
+
programmingLanguage: extractProgrammingLanguage(data),
|
|
132
|
+
readTime: extractReadTime(data),
|
|
133
|
+
sentOn: extractSentOn(data),
|
|
134
|
+
snippet: extractSummary(data) || undefined,
|
|
135
|
+
// Explicitly set here to remove an empty string
|
|
136
|
+
sourceBranch: extractSourceBranch(data),
|
|
137
|
+
state: extractState(response, actionOptions, id, appearance, origin, fireEvent, resolve),
|
|
138
|
+
subscriberCount: extractSubscriberCount(data),
|
|
139
|
+
subTasksProgress: extractSubTasksProgress(data),
|
|
140
|
+
storyPoints: extractStoryPoints(data),
|
|
141
|
+
targetBranch: extractTargetBranch(data)
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
const extractFlexibleUiContext = (props = {}) => {
|
|
145
|
+
if (fg('smart_links_noun_support')) {
|
|
146
|
+
return extractFlexibleUiContextFromEntity(props);
|
|
147
|
+
}
|
|
148
|
+
return extractFlexibleUiContextFromJsonLd(props);
|
|
149
|
+
};
|
|
79
150
|
export default extractFlexibleUiContext;
|
|
@@ -8,6 +8,7 @@ const extractValue = (data, key) => {
|
|
|
8
8
|
return data === null || data === void 0 ? void 0 : data[key];
|
|
9
9
|
};
|
|
10
10
|
export const extractCommentCount = data => extractValue(data, 'schema:commentCount');
|
|
11
|
+
export const extractAppliedToComponentsCount = data => extractValue(data, 'atlassian:appliedToComponentsCount');
|
|
11
12
|
export const extractDueOn = data => extractValue(data, 'endTime');
|
|
12
13
|
export const extractViewCount = data => extractValue(data, 'atlassian:viewCount');
|
|
13
14
|
export const extractReactCount = data => extractValue(data, 'atlassian:reactCount');
|
|
@@ -16,6 +16,10 @@ const extractInlineIcon = (jsonLd, showIconLabel = true) => {
|
|
|
16
16
|
}
|
|
17
17
|
return extractIcon(jsonLd, 'provider', showIconLabel);
|
|
18
18
|
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Should be moved to the smart link-extractor when jsonld is deprecated
|
|
22
|
+
*/
|
|
19
23
|
const extractSmartLinkInlineIcon = (response, showLabel = true) => {
|
|
20
24
|
if (isEntityPresent(response)) {
|
|
21
25
|
const provider = extractEntityProvider(response);
|
|
@@ -34,9 +38,9 @@ export const extractInlineProps = (response, renderers, removeTextHighlightingFr
|
|
|
34
38
|
const jsonLd = response === null || response === void 0 ? void 0 : response.data;
|
|
35
39
|
if (fg('smart_links_noun_support')) {
|
|
36
40
|
return {
|
|
37
|
-
icon: extractSmartLinkInlineIcon(response, showLabel),
|
|
38
41
|
link: extractSmartLinkUrl(response),
|
|
39
42
|
title: extractSmartLinkTitle(response, removeTextHighlightingFromTitle),
|
|
43
|
+
icon: extractSmartLinkInlineIcon(response, showLabel),
|
|
40
44
|
// As we migrate to support more nouns we can incorporate these fields
|
|
41
45
|
lozenge: extractLozenge(jsonLd),
|
|
42
46
|
titleTextColor: extractTitleTextColor(jsonLd),
|
package/dist/es2019/messages.js
CHANGED
|
@@ -130,6 +130,10 @@ export const messages = defineMessages({
|
|
|
130
130
|
defaultMessage: 'Check this link',
|
|
131
131
|
description: 'Link safety warning modal header'
|
|
132
132
|
},
|
|
133
|
+
compass_applied_components_count: {
|
|
134
|
+
id: 'compass.applied_components_count.non-final',
|
|
135
|
+
defaultMessage: 'Applied to {numberOfComponents, plural, one {{numberOfComponents, number} component} other {{numberOfComponents, number} components}}'
|
|
136
|
+
},
|
|
133
137
|
connect_to: {
|
|
134
138
|
id: 'fabric.linking.connect_to',
|
|
135
139
|
defaultMessage: 'Connect to {name}',
|
|
@@ -2,7 +2,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
2
2
|
export const context = {
|
|
3
3
|
componentName: 'smart-cards',
|
|
4
4
|
packageName: "@atlaskit/smart-card",
|
|
5
|
-
packageVersion: "36.
|
|
5
|
+
packageVersion: "36.10.0"
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -26,7 +26,7 @@ export const getIconForFileType = fileMimeType => {
|
|
|
26
26
|
if (!fileMimeType) {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
let icon =
|
|
29
|
+
let icon = getTypeToIconMap(fileMimeType.toLowerCase());
|
|
30
30
|
if (!icon) {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
@@ -45,67 +45,13 @@ export const getIconForFileType = fileMimeType => {
|
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
47
|
export const getLabelForFileType = fileMimeType => {
|
|
48
|
-
let icon =
|
|
48
|
+
let icon = getTypeToIconMap(fileMimeType.toLowerCase());
|
|
49
49
|
if (!icon) {
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
const [label] = icon;
|
|
53
53
|
return label;
|
|
54
54
|
};
|
|
55
|
-
const typeToIcon = {
|
|
56
|
-
'text/plain': ['Document', () => import('@atlaskit/icon-file-type/glyph/document/16')],
|
|
57
|
-
'application/vnd.oasis.opendocument.text': ['Document', () => import('@atlaskit/icon-file-type/glyph/document/16')],
|
|
58
|
-
'application/vnd.apple.pages': ['Document', () => import('@atlaskit/icon-file-type/glyph/document/16')],
|
|
59
|
-
'application/vnd.google-apps.document': ['Google Doc', () => import('@atlaskit/icon-file-type/glyph/google-doc/16')],
|
|
60
|
-
'application/msword': ['Word document', () => import('@atlaskit/icon-file-type/glyph/word-document/16')],
|
|
61
|
-
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': ['Word document', () => import('@atlaskit/icon-file-type/glyph/word-document/16')],
|
|
62
|
-
'application/pdf': ['PDF document', () => import('@atlaskit/icon-file-type/glyph/pdf-document/16')],
|
|
63
|
-
'application/vnd.oasis.opendocument.spreadsheet': ['Spreadsheet', () => import('@atlaskit/icon-file-type/glyph/spreadsheet/16')],
|
|
64
|
-
'application/vnd.apple.numbers': ['Spreadsheet', () => import('@atlaskit/icon-file-type/glyph/spreadsheet/16')],
|
|
65
|
-
'application/vnd.google-apps.spreadsheet': ['Google Sheet', () => import('@atlaskit/icon-file-type/glyph/google-sheet/16')],
|
|
66
|
-
'application/vnd.ms-excel': ['Excel spreadsheet', () => import('@atlaskit/icon-file-type/glyph/excel-spreadsheet/16')],
|
|
67
|
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['Excel spreadsheet', () => import('@atlaskit/icon-file-type/glyph/excel-spreadsheet/16')],
|
|
68
|
-
'application/vnd.oasis.opendocument.presentation': ['Presentation', () => import('@atlaskit/icon-file-type/glyph/presentation/16')],
|
|
69
|
-
'application/vnd.apple.keynote': ['Presentation', () => import('@atlaskit/icon-file-type/glyph/presentation/16')],
|
|
70
|
-
'application/vnd.google-apps.presentation': ['Google Slide', () => import('@atlaskit/icon-file-type/glyph/google-slide/16')],
|
|
71
|
-
'application/vnd.ms-powerpoint': ['PowerPoint presentation', () => import('@atlaskit/icon-file-type/glyph/powerpoint-presentation/16')],
|
|
72
|
-
'application/vnd.openxmlformats-officedocument.presentationml.presentation': ['PowerPoint presentation', () => import('@atlaskit/icon-file-type/glyph/powerpoint-presentation/16')],
|
|
73
|
-
'application/vnd.google-apps.form': ['Google Form', () => import('@atlaskit/icon-file-type/glyph/google-form/16')],
|
|
74
|
-
'image/png': ['Image', () => import('@atlaskit/icon-file-type/glyph/image/16')],
|
|
75
|
-
'image/jpeg': ['Image', () => import('@atlaskit/icon-file-type/glyph/image/16')],
|
|
76
|
-
'image/bmp': ['Image', () => import('@atlaskit/icon-file-type/glyph/image/16')],
|
|
77
|
-
'image/webp': ['Image', () => import('@atlaskit/icon-file-type/glyph/image/16')],
|
|
78
|
-
'image/svg+xml': ['Image', () => import('@atlaskit/icon-file-type/glyph/image/16')],
|
|
79
|
-
'image/gif': ['GIF', () => import('@atlaskit/icon-file-type/glyph/gif/16')],
|
|
80
|
-
'audio/midi': ['Audio', () => import('@atlaskit/icon-file-type/glyph/audio/16')],
|
|
81
|
-
'audio/mpeg': ['Audio', () => import('@atlaskit/icon-file-type/glyph/audio/16')],
|
|
82
|
-
'audio/webm': ['Audio', () => import('@atlaskit/icon-file-type/glyph/audio/16')],
|
|
83
|
-
'audio/ogg': ['Audio', () => import('@atlaskit/icon-file-type/glyph/audio/16')],
|
|
84
|
-
'audio/wav': ['Audio', () => import('@atlaskit/icon-file-type/glyph/audio/16')],
|
|
85
|
-
'video/mp4': ['Video', () => import('@atlaskit/icon-file-type/glyph/video/16')],
|
|
86
|
-
'video/quicktime': ['Video', () => import('@atlaskit/icon-file-type/glyph/video/16')],
|
|
87
|
-
'video/mov': ['Video', () => import('@atlaskit/icon-file-type/glyph/video/16')],
|
|
88
|
-
'video/webm': ['Video', () => import('@atlaskit/icon-file-type/glyph/video/16')],
|
|
89
|
-
'video/ogg': ['Video', () => import('@atlaskit/icon-file-type/glyph/video/16')],
|
|
90
|
-
'video/x-ms-wmv': ['Video', () => import('@atlaskit/icon-file-type/glyph/video/16')],
|
|
91
|
-
'video/x-msvideo': ['Video', () => import('@atlaskit/icon-file-type/glyph/video/16')],
|
|
92
|
-
'application/zip': ['Archive', () => import('@atlaskit/icon-file-type/glyph/archive/16')],
|
|
93
|
-
'application/x-tar': ['Archive', () => import('@atlaskit/icon-file-type/glyph/archive/16')],
|
|
94
|
-
'application/x-gtar': ['Archive', () => import('@atlaskit/icon-file-type/glyph/archive/16')],
|
|
95
|
-
'application/x-7z-compressed': ['Archive', () => import('@atlaskit/icon-file-type/glyph/archive/16')],
|
|
96
|
-
'application/x-apple-diskimage': ['Archive', () => import('@atlaskit/icon-file-type/glyph/archive/16')],
|
|
97
|
-
'application/vnd.rar': ['Archive', () => import('@atlaskit/icon-file-type/glyph/archive/16')],
|
|
98
|
-
'application/dmg': ['Executable', () => import('@atlaskit/icon-file-type/glyph/executable/16')],
|
|
99
|
-
'text/css': ['Source Code', () => import('@atlaskit/icon-file-type/glyph/source-code/16')],
|
|
100
|
-
'text/html': ['Source Code', () => import('@atlaskit/icon-file-type/glyph/source-code/16')],
|
|
101
|
-
'application/javascript': ['Source Code', () => import('@atlaskit/icon-file-type/glyph/source-code/16')],
|
|
102
|
-
'application/octet-stream': ['Binary file', () => import('@atlaskit/icon-file-type/glyph/generic/16')],
|
|
103
|
-
'application/invision.prototype': ['Prototype', () => import('@atlaskit/icon-file-type/glyph/generic/16')],
|
|
104
|
-
// TODO: Figure a way to detect those
|
|
105
|
-
'application/sketch': ['Sketch', () => import('@atlaskit/icon-file-type/glyph/sketch/16')],
|
|
106
|
-
folder: ['Folder', () => import('@atlaskit/icon-file-type/glyph/folder/16')]
|
|
107
|
-
};
|
|
108
|
-
|
|
109
55
|
// prettier-ignore
|
|
110
56
|
export const getLazyIcons = () => {
|
|
111
57
|
return {
|
|
@@ -283,6 +229,9 @@ export const getLazyIcons = () => {
|
|
|
283
229
|
[IconType.CheckItem]: {
|
|
284
230
|
default: () => import( /* webpackChunkName: "@atlaskit-internal_glyphAttachment" */'@atlaskit/icon/core/migration/task')
|
|
285
231
|
},
|
|
232
|
+
[IconType.Component]: {
|
|
233
|
+
default: () => import( /* webpackChunkName: "@atlaskit-internal_glyphComponent" */'@atlaskit/icon/core/migration/component')
|
|
234
|
+
},
|
|
286
235
|
[IconType.Comment]: {
|
|
287
236
|
default: () => import( /* webpackChunkName: "@atlaskit-internal_glyphComment" */'@atlaskit/icon/core/migration/comment')
|
|
288
237
|
},
|
|
@@ -101,7 +101,17 @@ export const mocks = {
|
|
|
101
101
|
},
|
|
102
102
|
nounDataSuccess: {
|
|
103
103
|
...jsonLdResponse,
|
|
104
|
-
|
|
104
|
+
data: {
|
|
105
|
+
...jsonLdResponse.data,
|
|
106
|
+
generator: {
|
|
107
|
+
'@type': 'Application',
|
|
108
|
+
icon: {
|
|
109
|
+
"@type": 'Image',
|
|
110
|
+
url: 'https://www.ilovecheese.com'
|
|
111
|
+
},
|
|
112
|
+
name: 'I love cheese'
|
|
113
|
+
}
|
|
114
|
+
},
|
|
105
115
|
meta: {
|
|
106
116
|
...jsonLdResponse.meta,
|
|
107
117
|
generator: {
|
|
@@ -110,7 +120,8 @@ export const mocks = {
|
|
|
110
120
|
url: 'https://www.ilovecheese.com'
|
|
111
121
|
}
|
|
112
122
|
}
|
|
113
|
-
}
|
|
123
|
+
},
|
|
124
|
+
...nounDataResponse
|
|
114
125
|
},
|
|
115
126
|
notFound: {
|
|
116
127
|
meta: {
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import WarningIcon from '@atlaskit/icon/core/migration/warning';
|
|
4
|
-
import LegacyWarningIcon from '@atlaskit/icon/glyph/warning';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
-
import { R300 } from '@atlaskit/theme/colors';
|
|
7
4
|
import { messages } from '../../../messages';
|
|
8
5
|
import Text from '../../FlexibleCard/components/elements/text';
|
|
9
6
|
import { RetryAction } from '../actions/RetryAction';
|
|
@@ -24,19 +21,11 @@ const ErroredView = ({
|
|
|
24
21
|
return /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, props, {
|
|
25
22
|
actions: actions,
|
|
26
23
|
testId: testId
|
|
27
|
-
}),
|
|
24
|
+
}), /*#__PURE__*/React.createElement(WarningIcon, {
|
|
28
25
|
label: "errored-warning-icon",
|
|
29
26
|
color: "var(--ds-icon-warning, #E56910)",
|
|
30
27
|
LEGACY_size: "small",
|
|
31
28
|
testId: `${testId}-warning-icon`
|
|
32
|
-
}) :
|
|
33
|
-
/*#__PURE__*/
|
|
34
|
-
// eslint-disable-next-line @atlaskit/design-system/no-legacy-icons -- TODO - https://product-fabric.atlassian.net/browse/DSP-19497
|
|
35
|
-
React.createElement(LegacyWarningIcon, {
|
|
36
|
-
label: "errored-warning-icon",
|
|
37
|
-
size: "small",
|
|
38
|
-
primaryColor: `var(--ds-icon-warning, ${R300})`,
|
|
39
|
-
testId: `${testId}-warning-icon`
|
|
40
29
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
41
30
|
maxLines: 3,
|
|
42
31
|
message: {
|
|
@@ -8,9 +8,8 @@ import { useIntl } from 'react-intl-next';
|
|
|
8
8
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
9
9
|
import LockLockedIcon from '@atlaskit/icon/core/lock-locked';
|
|
10
10
|
import LegacyLockIcon from '@atlaskit/icon/glyph/lock';
|
|
11
|
-
import { extractProvider } from '@atlaskit/link-extractors';
|
|
11
|
+
import { extractProvider, extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
-
import { R300 } from '@atlaskit/theme/colors';
|
|
14
13
|
import { extractRequestAccessContextImproved } from '../../../extractors/common/context/extractAccessContext';
|
|
15
14
|
import extractHostname from '../../../extractors/common/hostname/extractHostname';
|
|
16
15
|
import { messages } from '../../../messages';
|
|
@@ -45,7 +44,7 @@ const ForbiddenView = ({
|
|
|
45
44
|
} = props;
|
|
46
45
|
const details = cardState === null || cardState === void 0 ? void 0 : cardState.details;
|
|
47
46
|
const cardMetadata = (_details$meta = details === null || details === void 0 ? void 0 : details.meta) !== null && _details$meta !== void 0 ? _details$meta : getForbiddenJsonLd().meta;
|
|
48
|
-
const provider = extractProvider(details === null || details === void 0 ? void 0 : details.data);
|
|
47
|
+
const provider = fg('smart_links_noun_support') ? extractSmartLinkProvider(details) : extractProvider(details === null || details === void 0 ? void 0 : details.data);
|
|
49
48
|
const providerName = (provider === null || provider === void 0 ? void 0 : provider.text) || '';
|
|
50
49
|
const messageContext = useMemo(() => {
|
|
51
50
|
const hostname = /*#__PURE__*/React.createElement("b", null, extractHostname(url));
|
|
@@ -85,20 +84,12 @@ const ForbiddenView = ({
|
|
|
85
84
|
showPreview: true,
|
|
86
85
|
testId: testId,
|
|
87
86
|
title: title
|
|
88
|
-
}),
|
|
87
|
+
}), /*#__PURE__*/React.createElement(LockLockedIcon, {
|
|
89
88
|
label: "forbidden-lock-icon",
|
|
90
89
|
color: "var(--ds-icon-danger, #C9372C)",
|
|
91
90
|
LEGACY_fallbackIcon: LegacyLockIcon,
|
|
92
91
|
LEGACY_size: "small",
|
|
93
92
|
testId: `${testId}-lock-icon`
|
|
94
|
-
}) :
|
|
95
|
-
/*#__PURE__*/
|
|
96
|
-
// eslint-disable-next-line @atlaskit/design-system/no-legacy-icons -- TODO - https://product-fabric.atlassian.net/browse/DSP-19497
|
|
97
|
-
React.createElement(LegacyLockIcon, {
|
|
98
|
-
label: "forbidden-lock-icon",
|
|
99
|
-
size: "small",
|
|
100
|
-
primaryColor: `var(--ds-icon-danger, ${R300})`,
|
|
101
|
-
testId: `${testId}-lock-icon`
|
|
102
93
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
103
94
|
maxLines: 3,
|
|
104
95
|
message: {
|
|
@@ -7,9 +7,8 @@ import { useMemo } from 'react';
|
|
|
7
7
|
import { useIntl } from 'react-intl-next';
|
|
8
8
|
import LockLockedIcon from '@atlaskit/icon/core/lock-locked';
|
|
9
9
|
import LegacyLockIcon from '@atlaskit/icon/glyph/lock';
|
|
10
|
-
import { extractProvider } from '@atlaskit/link-extractors';
|
|
10
|
+
import { extractProvider, extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
|
-
import { R300 } from '@atlaskit/theme/colors';
|
|
13
12
|
import { messages } from '../../../messages';
|
|
14
13
|
import Text from '../../FlexibleCard/components/elements/text';
|
|
15
14
|
import UnresolvedView from './unresolved-view';
|
|
@@ -26,16 +25,17 @@ const NotFoundView = ({
|
|
|
26
25
|
testId = 'smart-block-not-found-view',
|
|
27
26
|
...props
|
|
28
27
|
}) => {
|
|
29
|
-
var _cardState$details2;
|
|
30
28
|
const intl = useIntl();
|
|
31
29
|
const {
|
|
32
|
-
cardState
|
|
30
|
+
cardState: {
|
|
31
|
+
details
|
|
32
|
+
}
|
|
33
33
|
} = props;
|
|
34
34
|
const product = useMemo(() => {
|
|
35
|
-
var
|
|
36
|
-
const provider =
|
|
35
|
+
var _provider$text;
|
|
36
|
+
const provider = fg('smart_links_noun_support') ? extractSmartLinkProvider(details) : extractProvider(details === null || details === void 0 ? void 0 : details.data);
|
|
37
37
|
return (_provider$text = provider === null || provider === void 0 ? void 0 : provider.text) !== null && _provider$text !== void 0 ? _provider$text : '';
|
|
38
|
-
}, [
|
|
38
|
+
}, [details]);
|
|
39
39
|
const title = useMemo(() => intl.formatMessage(messages.not_found_title, {
|
|
40
40
|
product
|
|
41
41
|
}), [intl, product]);
|
|
@@ -45,20 +45,12 @@ const NotFoundView = ({
|
|
|
45
45
|
return /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, props, {
|
|
46
46
|
testId: testId,
|
|
47
47
|
title: title
|
|
48
|
-
}),
|
|
48
|
+
}), /*#__PURE__*/React.createElement(LockLockedIcon, {
|
|
49
49
|
label: "not-found-lock-icon",
|
|
50
50
|
color: "var(--ds-icon-danger, #C9372C)",
|
|
51
51
|
LEGACY_fallbackIcon: LegacyLockIcon,
|
|
52
52
|
LEGACY_size: "small",
|
|
53
53
|
testId: `${testId}-lock-icon`
|
|
54
|
-
}) :
|
|
55
|
-
/*#__PURE__*/
|
|
56
|
-
// eslint-disable-next-line @atlaskit/design-system/no-legacy-icons -- TODO - https://product-fabric.atlassian.net/browse/DSP-19497
|
|
57
|
-
React.createElement(LegacyLockIcon, {
|
|
58
|
-
label: "not-found-lock-icon",
|
|
59
|
-
size: "small",
|
|
60
|
-
primaryColor: `var(--ds-icon-danger, ${R300})`,
|
|
61
|
-
testId: `${testId}-lock-icon`
|
|
62
54
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
63
55
|
message: description,
|
|
64
56
|
testId: `${testId}-message`,
|