@atlaskit/smart-card 36.9.0 → 36.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/extractors/common/context/index.js +41 -1
  3. package/dist/cjs/extractors/common/icon/extractIconFromDocument.js +7 -61
  4. package/dist/cjs/extractors/embed/index.js +3 -35
  5. package/dist/cjs/extractors/flexible/extract-preview.js +24 -2
  6. package/dist/cjs/extractors/flexible/icon/extract-provider-icon.js +40 -2
  7. package/dist/cjs/extractors/flexible/icon/index.js +15 -1
  8. package/dist/cjs/extractors/flexible/index.js +77 -3
  9. package/dist/cjs/extractors/inline/index.js +5 -1
  10. package/dist/cjs/utils/analytics/analytics.js +1 -1
  11. package/dist/cjs/utils/index.js +2 -256
  12. package/dist/cjs/utils/mocks.js +12 -2
  13. package/dist/cjs/view/BlockCard/views/ErroredView.js +1 -12
  14. package/dist/cjs/view/BlockCard/views/ForbiddenView.js +2 -11
  15. package/dist/cjs/view/BlockCard/views/NotFoundView.js +5 -15
  16. package/dist/cjs/view/BlockCard/views/UnauthorisedView.js +3 -3
  17. package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/index.js +3 -5
  18. package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/index.js +12 -36
  19. package/dist/cjs/view/FlexibleCard/components/common/image-icon/index.js +4 -17
  20. package/dist/cjs/view/FlexibleCard/components/common/loading-skeleton/index.js +2 -10
  21. package/dist/cjs/view/FlexibleCard/utils.js +21 -10
  22. package/dist/cjs/view/HoverCard/components/ImagePreview.js +16 -3
  23. package/dist/cjs/view/HoverCard/components/views/forbidden/index.js +2 -2
  24. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +2 -2
  25. package/dist/cjs/view/HoverCard/components/views/resolving/index.js +5 -18
  26. package/dist/cjs/view/HoverCard/components/views/unauthorised/index.js +2 -2
  27. package/dist/cjs/view/InlineCard/ErroredView/index.js +5 -15
  28. package/dist/cjs/view/InlineCard/ForbiddenView/index.js +1 -7
  29. package/dist/cjs/view/InlineCard/Icon.compiled.css +0 -1
  30. package/dist/cjs/view/InlineCard/Icon.js +4 -24
  31. package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +7 -15
  32. package/dist/cjs/view/LinkUrl/index.js +1 -1
  33. package/dist/es2019/extractors/common/context/index.js +36 -1
  34. package/dist/es2019/extractors/common/icon/extractIconFromDocument.js +6 -61
  35. package/dist/es2019/extractors/embed/index.js +2 -35
  36. package/dist/es2019/extractors/flexible/extract-preview.js +25 -2
  37. package/dist/es2019/extractors/flexible/icon/extract-provider-icon.js +42 -2
  38. package/dist/es2019/extractors/flexible/icon/index.js +14 -0
  39. package/dist/es2019/extractors/flexible/index.js +75 -5
  40. package/dist/es2019/extractors/inline/index.js +5 -1
  41. package/dist/es2019/utils/analytics/analytics.js +1 -1
  42. package/dist/es2019/utils/index.js +2 -56
  43. package/dist/es2019/utils/mocks.js +13 -2
  44. package/dist/es2019/view/BlockCard/views/ErroredView.js +1 -12
  45. package/dist/es2019/view/BlockCard/views/ForbiddenView.js +3 -12
  46. package/dist/es2019/view/BlockCard/views/NotFoundView.js +8 -16
  47. package/dist/es2019/view/BlockCard/views/UnauthorisedView.js +4 -4
  48. package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/index.js +4 -6
  49. package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.js +11 -33
  50. package/dist/es2019/view/FlexibleCard/components/common/image-icon/index.js +5 -18
  51. package/dist/es2019/view/FlexibleCard/components/common/loading-skeleton/index.js +2 -10
  52. package/dist/es2019/view/FlexibleCard/utils.js +19 -11
  53. package/dist/es2019/view/HoverCard/components/ImagePreview.js +16 -3
  54. package/dist/es2019/view/HoverCard/components/views/forbidden/index.js +3 -3
  55. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +2 -2
  56. package/dist/es2019/view/HoverCard/components/views/resolving/index.js +5 -18
  57. package/dist/es2019/view/HoverCard/components/views/unauthorised/index.js +3 -3
  58. package/dist/es2019/view/InlineCard/ErroredView/index.js +5 -15
  59. package/dist/es2019/view/InlineCard/ForbiddenView/index.js +2 -8
  60. package/dist/es2019/view/InlineCard/Icon.compiled.css +0 -1
  61. package/dist/es2019/view/InlineCard/Icon.js +0 -19
  62. package/dist/es2019/view/InlineCard/UnauthorisedView/index.js +8 -16
  63. package/dist/es2019/view/LinkUrl/index.js +1 -1
  64. package/dist/esm/extractors/common/context/index.js +38 -1
  65. package/dist/esm/extractors/common/icon/extractIconFromDocument.js +6 -61
  66. package/dist/esm/extractors/embed/index.js +2 -34
  67. package/dist/esm/extractors/flexible/extract-preview.js +25 -2
  68. package/dist/esm/extractors/flexible/icon/extract-provider-icon.js +41 -2
  69. package/dist/esm/extractors/flexible/icon/index.js +14 -0
  70. package/dist/esm/extractors/flexible/index.js +76 -5
  71. package/dist/esm/extractors/inline/index.js +5 -1
  72. package/dist/esm/utils/analytics/analytics.js +1 -1
  73. package/dist/esm/utils/index.js +2 -156
  74. package/dist/esm/utils/mocks.js +12 -2
  75. package/dist/esm/view/BlockCard/views/ErroredView.js +1 -12
  76. package/dist/esm/view/BlockCard/views/ForbiddenView.js +3 -12
  77. package/dist/esm/view/BlockCard/views/NotFoundView.js +6 -16
  78. package/dist/esm/view/BlockCard/views/UnauthorisedView.js +4 -4
  79. package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.js +3 -5
  80. package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.js +11 -33
  81. package/dist/esm/view/FlexibleCard/components/common/image-icon/index.js +5 -18
  82. package/dist/esm/view/FlexibleCard/components/common/loading-skeleton/index.js +2 -10
  83. package/dist/esm/view/FlexibleCard/utils.js +19 -11
  84. package/dist/esm/view/HoverCard/components/ImagePreview.js +16 -3
  85. package/dist/esm/view/HoverCard/components/views/forbidden/index.js +3 -3
  86. package/dist/esm/view/HoverCard/components/views/resolved/index.js +2 -2
  87. package/dist/esm/view/HoverCard/components/views/resolving/index.js +5 -18
  88. package/dist/esm/view/HoverCard/components/views/unauthorised/index.js +3 -3
  89. package/dist/esm/view/InlineCard/ErroredView/index.js +5 -15
  90. package/dist/esm/view/InlineCard/ForbiddenView/index.js +2 -8
  91. package/dist/esm/view/InlineCard/Icon.compiled.css +0 -1
  92. package/dist/esm/view/InlineCard/Icon.js +3 -23
  93. package/dist/esm/view/InlineCard/UnauthorisedView/index.js +8 -16
  94. package/dist/esm/view/LinkUrl/index.js +1 -1
  95. package/dist/types/__fixtures__/figma-entity.d.ts +58 -0
  96. package/dist/types/extractors/common/context/index.d.ts +8 -0
  97. package/dist/types/extractors/flexible/extract-preview.d.ts +5 -0
  98. package/dist/types/extractors/flexible/icon/extract-provider-icon.d.ts +5 -0
  99. package/dist/types/extractors/flexible/icon/index.d.ts +13 -0
  100. package/dist/types/extractors/flexible/index.d.ts +1 -1
  101. package/dist/types/view/FlexibleCard/components/blocks/title-block/resolving/index.d.ts +2 -6
  102. package/dist/types/view/FlexibleCard/components/common/loading-skeleton/index.d.ts +2 -4
  103. package/dist/types/view/FlexibleCard/components/common/loading-skeleton/types.d.ts +1 -17
  104. package/dist/types/view/FlexibleCard/types.d.ts +2 -2
  105. package/dist/types/view/FlexibleCard/utils.d.ts +2 -2
  106. package/dist/types/view/HoverCard/components/ImagePreview.d.ts +1 -1
  107. package/dist/types/view/HoverCard/types.d.ts +2 -2
  108. package/dist/types/view/InlineCard/Icon.d.ts +0 -1
  109. package/dist/types-ts4.5/__fixtures__/figma-entity.d.ts +58 -0
  110. package/dist/types-ts4.5/extractors/common/context/index.d.ts +8 -0
  111. package/dist/types-ts4.5/extractors/flexible/extract-preview.d.ts +5 -0
  112. package/dist/types-ts4.5/extractors/flexible/icon/extract-provider-icon.d.ts +5 -0
  113. package/dist/types-ts4.5/extractors/flexible/icon/index.d.ts +13 -0
  114. package/dist/types-ts4.5/extractors/flexible/index.d.ts +1 -1
  115. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/resolving/index.d.ts +2 -6
  116. package/dist/types-ts4.5/view/FlexibleCard/components/common/loading-skeleton/index.d.ts +2 -4
  117. package/dist/types-ts4.5/view/FlexibleCard/components/common/loading-skeleton/types.d.ts +1 -17
  118. package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +2 -2
  119. package/dist/types-ts4.5/view/FlexibleCard/utils.d.ts +2 -2
  120. package/dist/types-ts4.5/view/HoverCard/components/ImagePreview.d.ts +1 -1
  121. package/dist/types-ts4.5/view/HoverCard/types.d.ts +2 -2
  122. package/dist/types-ts4.5/view/InlineCard/Icon.d.ts +0 -1
  123. package/package.json +8 -8
  124. package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/index.compiled.css +0 -55
  125. package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.compiled.css +0 -55
  126. package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.compiled.css +0 -55
@@ -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
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';
12
- const extractFlexibleUiContext = ({
13
+ const extractFlexibleUiContextFromJsonLd = ({
13
14
  appearance,
14
15
  fireEvent,
15
16
  id,
@@ -77,4 +78,73 @@ const extractFlexibleUiContext = ({
77
78
  ari: extractAri(data)
78
79
  };
79
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
+ };
80
150
  export default extractFlexibleUiContext;
@@ -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),
@@ -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.9.0"
5
+ packageVersion: "36.10.1"
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 = fg('platform-smart-card-icon-migration') ? getTypeToIconMap(fileMimeType.toLowerCase()) : typeToIcon[fileMimeType.toLowerCase()];
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 = fg('platform-smart-card-icon-migration') ? getTypeToIconMap(fileMimeType.toLowerCase()) : typeToIcon[fileMimeType.toLowerCase()];
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 {
@@ -101,7 +101,17 @@ export const mocks = {
101
101
  },
102
102
  nounDataSuccess: {
103
103
  ...jsonLdResponse,
104
- ...nounDataResponse,
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
- }), fg('platform-smart-card-icon-migration') ? /*#__PURE__*/React.createElement(WarningIcon, {
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
- }), fg('platform-smart-card-icon-migration') ? /*#__PURE__*/React.createElement(LockLockedIcon, {
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 _cardState$details, _provider$text;
36
- const provider = extractProvider(cardState === null || cardState === void 0 ? void 0 : (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data);
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
- }, [cardState === null || cardState === void 0 ? void 0 : (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data]);
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
- }), fg('platform-smart-card-icon-migration') ? /*#__PURE__*/React.createElement(LockLockedIcon, {
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`,
@@ -5,7 +5,7 @@ import * as React from 'react';
5
5
  import { ax, ix } from "@compiled/react/runtime";
6
6
  import { useCallback, useMemo } from 'react';
7
7
  import { FormattedMessage } from 'react-intl-next';
8
- import { extractProvider } from '@atlaskit/link-extractors';
8
+ import { extractProvider, extractSmartLinkProvider } from '@atlaskit/link-extractors';
9
9
  import { fg } from '@atlaskit/platform-feature-flags';
10
10
  import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
11
11
  import { messages } from '../../../messages';
@@ -28,14 +28,14 @@ const UnauthorisedView = ({
28
28
  testId = 'smart-block-unauthorized-view',
29
29
  ...props
30
30
  }) => {
31
- var _cardState$details, _extractProvider;
31
+ var _cardState$details, _extractSmartLinkProv, _extractProvider;
32
32
  const {
33
33
  cardState,
34
34
  onAuthorize
35
35
  } = props;
36
36
  const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
37
- const providerName = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
38
- const isProductIntegrationSupported = hasAuthScopeOverrides(cardState === null || cardState === void 0 ? void 0 : cardState.details);
37
+ const providerName = fg('smart_links_noun_support') ? (_extractSmartLinkProv = extractSmartLinkProvider(cardState.details)) === null || _extractSmartLinkProv === void 0 ? void 0 : _extractSmartLinkProv.text : (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
38
+ const isProductIntegrationSupported = hasAuthScopeOverrides(cardState.details);
39
39
  const {
40
40
  fireEvent
41
41
  } = useAnalyticsEvents();
@@ -3,7 +3,6 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./index.compiled.css";
4
4
  import * as React from 'react';
5
5
  import { ax, ix } from "@compiled/react/runtime";
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
6
  import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkWidth } from '../../../../../../constants';
8
7
  import { LinkIcon } from '../../../elements';
9
8
  import Block from '../../block';
@@ -36,12 +35,11 @@ const TitleBlockResolvedView = ({
36
35
  const subtitleElements = renderElementItems(subtitle);
37
36
  return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
38
37
  testId: `${testId}-resolved-view`
39
- }), !hideIcon && /*#__PURE__*/React.createElement(LinkIcon, _extends({
38
+ }), !hideIcon && /*#__PURE__*/React.createElement(LinkIcon, {
40
39
  overrideIcon: icon,
41
- position: position
42
- }, fg('platform-smart-card-icon-migration') && {
43
- size
44
- })), /*#__PURE__*/React.createElement(ElementGroup, {
40
+ position: position,
41
+ size: size
42
+ }), /*#__PURE__*/React.createElement(ElementGroup, {
45
43
  direction: SmartLinkDirection.Vertical,
46
44
  width: SmartLinkWidth.Flexible,
47
45
  size: blockProps.size,
@@ -1,22 +1,10 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
2
1
  import _extends from "@babel/runtime/helpers/extends";
3
- import "./index.compiled.css";
4
- import * as React from 'react';
5
- import { ax, ix } from "@compiled/react/runtime";
6
2
  /* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */
7
-
8
- import { fg } from '@atlaskit/platform-feature-flags';
3
+ import React from 'react';
9
4
  import { SmartLinkSize } from '../../../../../../constants';
10
- import { LoadingSkeletonNew, LoadingSkeletonOld } from '../../../common/loading-skeleton';
5
+ import { LoadingSkeleton } from '../../../common/loading-skeleton';
11
6
  import { getIconWidthNew } from '../../../utils';
12
7
  import Block from '../../block';
13
- const iconStyle = {
14
- xlarge: "_16jlidpf _1o9zidpf _i0dl1wug _4t3iviql _1tkeviql _c71lviql _1bsbviql _1ul9viql _p12fviql _i2i3idpf _uhasidpf _5jw9idpf _7wy9idpf _bna7viql _1xjxviql _1752viql _qci8viql _15izviql _erubviql _19l3viql _1pr2viql _1u5tviql _mezjviql _e2ooviql _w8l5viql _1rg2viql _q7cvviql _xwbjviql _rtysviql _b8nkviql _4x20viql",
15
- large: "_16jlidpf _1o9zidpf _i0dl1wug _4t3i1k8s _1tke1k8s _c71l1k8s _1bsb1k8s _1ul91k8s _p12f1k8s _i2i3idpf _uhasidpf _5jw9idpf _7wy9idpf _bna71k8s _1xjx1k8s _17521k8s _qci81k8s _15iz1k8s _erub1k8s _19l31k8s _1pr21k8s _1u5t1k8s _mezj1k8s _e2oo1k8s _w8l51k8s _1rg21k8s _q7cv1k8s _xwbj1k8s _rtys1k8s _b8nk1k8s _4x201k8s",
16
- medium: "_16jlidpf _1o9zidpf _i0dl1wug _4t3i1j6v _1tke1j6v _c71l1j6v _1bsb1j6v _1ul91j6v _p12f1j6v _i2i3idpf _uhasidpf _5jw9idpf _7wy9idpf _bna71j6v _1xjx1j6v _17521j6v _qci81j6v _15iz1j6v _erub1j6v _19l31j6v _1pr21j6v _1u5t1j6v _mezj1j6v _e2oo1j6v _w8l51j6v _1rg21j6v _q7cv1j6v _xwbj1j6v _rtys1j6v _b8nk1j6v _4x201j6v",
17
- small: "_16jlidpf _1o9zidpf _i0dl1wug _4t3ioqnp _1tkeoqnp _c71loqnp _1bsboqnp _1ul9oqnp _p12foqnp _i2i3idpf _uhasidpf _5jw9idpf _7wy9idpf _bna7oqnp _1xjxoqnp _1752oqnp _qci8oqnp _15izoqnp _eruboqnp _19l3oqnp _1pr2oqnp _1u5toqnp _mezjoqnp _e2oooqnp _w8l5oqnp _1rg2oqnp _q7cvoqnp _xwbjoqnp _rtysoqnp _b8nkoqnp _4x20oqnp"
18
- };
19
-
20
8
  /**
21
9
  * This represents a TitleBlock for a Smart Link that is currently waiting
22
10
  * for a request to finish.
@@ -33,28 +21,18 @@ const TitleBlockResolvingView = ({
33
21
  const {
34
22
  size = SmartLinkSize.Medium
35
23
  } = blockProps;
36
- if (fg('platform-smart-card-icon-migration')) {
37
- const iconWidth = getIconWidthNew(size);
38
- return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
39
- testId: `${testId}-resolving-view`
40
- }), !hideIcon && /*#__PURE__*/React.createElement("span", {
41
- style: {
42
- width: iconWidth,
43
- height: iconWidth
44
- },
45
- "data-testid": `${testId}-icon`
46
- }, /*#__PURE__*/React.createElement(LoadingSkeletonNew, {
47
- width: iconWidth,
48
- height: iconWidth,
49
- testId: `${testId}-icon-loading`
50
- })), title, actionGroup);
51
- }
24
+ const iconWidth = getIconWidthNew(size);
52
25
  return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
53
26
  testId: `${testId}-resolving-view`
54
27
  }), !hideIcon && /*#__PURE__*/React.createElement("span", {
55
- "data-testid": `${testId}-icon`,
56
- className: ax([iconStyle[size]])
57
- }, /*#__PURE__*/React.createElement(LoadingSkeletonOld, {
28
+ style: {
29
+ width: iconWidth,
30
+ height: iconWidth
31
+ },
32
+ "data-testid": `${testId}-icon`
33
+ }, /*#__PURE__*/React.createElement(LoadingSkeleton, {
34
+ width: iconWidth,
35
+ height: iconWidth,
58
36
  testId: `${testId}-icon-loading`
59
37
  })), title, actionGroup);
60
38
  };
@@ -1,8 +1,6 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
1
  import React from 'react';
3
2
  import ImageLoader from 'react-render-image';
4
- import { fg } from '@atlaskit/platform-feature-flags';
5
- import { LoadingSkeletonNew, LoadingSkeletonOld } from '../loading-skeleton';
3
+ import { LoadingSkeleton } from '../loading-skeleton';
6
4
  const ImageIcon = ({
7
5
  defaultIcon,
8
6
  testId,
@@ -11,10 +9,9 @@ const ImageIcon = ({
11
9
  height,
12
10
  onError,
13
11
  onLoad
14
- }) => /*#__PURE__*/React.createElement(ImageLoader, _extends({
15
- src: url
16
- }, fg('platform-smart-card-icon-migration') ? {
17
- loading: /*#__PURE__*/React.createElement(LoadingSkeletonNew, {
12
+ }) => /*#__PURE__*/React.createElement(ImageLoader, {
13
+ src: url,
14
+ loading: /*#__PURE__*/React.createElement(LoadingSkeleton, {
18
15
  testId: `${testId}-loading`,
19
16
  width: width,
20
17
  height: height
@@ -27,19 +24,9 @@ const ImageIcon = ({
27
24
  width,
28
25
  height
29
26
  }
30
- })
31
- } : {
32
- loading: /*#__PURE__*/React.createElement(LoadingSkeletonOld, {
33
- testId: `${testId}-loading`
34
27
  }),
35
- loaded: /*#__PURE__*/React.createElement("img", {
36
- src: url,
37
- "data-testid": `${testId}-image`,
38
- alt: ""
39
- })
40
- }, {
41
28
  errored: defaultIcon,
42
29
  onError: onError,
43
30
  onLoad: onLoad
44
- }));
31
+ });
45
32
  export default ImageIcon;
@@ -1,11 +1,10 @@
1
1
  /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
2
- import _extends from "@babel/runtime/helpers/extends";
3
2
  import "./index.compiled.css";
4
3
  import * as React from 'react';
5
4
  import { ax, ix } from "@compiled/react/runtime";
6
5
  const animationNameStyles = null;
7
6
  const loadingSkeletonStyle = null;
8
- const LoadingSkeletonNew = ({
7
+ export const LoadingSkeleton = ({
9
8
  testId,
10
9
  width,
11
10
  height
@@ -18,11 +17,4 @@ const LoadingSkeletonNew = ({
18
17
  },
19
18
  className: ax(["_2rkoyh40 _uiztglyw _bfhk178v _1itkvl7m _12vemgnk _1lrw6rms _1e0c1o8l _5sag9cwz _1o51q7pw _tip812c5 _j7hqqkar _1pglp3kn"])
20
19
  });
21
- };
22
- const LoadingSkeletonOld = props => {
23
- return /*#__PURE__*/React.createElement(LoadingSkeletonNew, _extends({}, props, {
24
- width: `${props.width}rem`,
25
- height: `${props.height}rem`
26
- }));
27
- };
28
- export { LoadingSkeletonOld, LoadingSkeletonNew };
20
+ };