@atlaskit/smart-card 36.9.0 → 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.
Files changed (110) hide show
  1. package/CHANGELOG.md +15 -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/views/resolving/index.js +5 -18
  23. package/dist/cjs/view/InlineCard/ErroredView/index.js +5 -15
  24. package/dist/cjs/view/InlineCard/ForbiddenView/index.js +1 -7
  25. package/dist/cjs/view/InlineCard/Icon.compiled.css +0 -1
  26. package/dist/cjs/view/InlineCard/Icon.js +4 -24
  27. package/dist/cjs/view/InlineCard/UnauthorisedView/index.js +7 -15
  28. package/dist/cjs/view/LinkUrl/index.js +1 -1
  29. package/dist/es2019/extractors/common/context/index.js +36 -1
  30. package/dist/es2019/extractors/common/icon/extractIconFromDocument.js +6 -61
  31. package/dist/es2019/extractors/embed/index.js +2 -35
  32. package/dist/es2019/extractors/flexible/extract-preview.js +25 -2
  33. package/dist/es2019/extractors/flexible/icon/extract-provider-icon.js +42 -2
  34. package/dist/es2019/extractors/flexible/icon/index.js +14 -0
  35. package/dist/es2019/extractors/flexible/index.js +75 -5
  36. package/dist/es2019/extractors/inline/index.js +5 -1
  37. package/dist/es2019/utils/analytics/analytics.js +1 -1
  38. package/dist/es2019/utils/index.js +2 -56
  39. package/dist/es2019/utils/mocks.js +13 -2
  40. package/dist/es2019/view/BlockCard/views/ErroredView.js +1 -12
  41. package/dist/es2019/view/BlockCard/views/ForbiddenView.js +3 -12
  42. package/dist/es2019/view/BlockCard/views/NotFoundView.js +8 -16
  43. package/dist/es2019/view/BlockCard/views/UnauthorisedView.js +4 -4
  44. package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/index.js +4 -6
  45. package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.js +11 -33
  46. package/dist/es2019/view/FlexibleCard/components/common/image-icon/index.js +5 -18
  47. package/dist/es2019/view/FlexibleCard/components/common/loading-skeleton/index.js +2 -10
  48. package/dist/es2019/view/FlexibleCard/utils.js +19 -11
  49. package/dist/es2019/view/HoverCard/components/views/resolving/index.js +5 -18
  50. package/dist/es2019/view/InlineCard/ErroredView/index.js +5 -15
  51. package/dist/es2019/view/InlineCard/ForbiddenView/index.js +2 -8
  52. package/dist/es2019/view/InlineCard/Icon.compiled.css +0 -1
  53. package/dist/es2019/view/InlineCard/Icon.js +0 -19
  54. package/dist/es2019/view/InlineCard/UnauthorisedView/index.js +8 -16
  55. package/dist/es2019/view/LinkUrl/index.js +1 -1
  56. package/dist/esm/extractors/common/context/index.js +38 -1
  57. package/dist/esm/extractors/common/icon/extractIconFromDocument.js +6 -61
  58. package/dist/esm/extractors/embed/index.js +2 -34
  59. package/dist/esm/extractors/flexible/extract-preview.js +25 -2
  60. package/dist/esm/extractors/flexible/icon/extract-provider-icon.js +41 -2
  61. package/dist/esm/extractors/flexible/icon/index.js +14 -0
  62. package/dist/esm/extractors/flexible/index.js +76 -5
  63. package/dist/esm/extractors/inline/index.js +5 -1
  64. package/dist/esm/utils/analytics/analytics.js +1 -1
  65. package/dist/esm/utils/index.js +2 -156
  66. package/dist/esm/utils/mocks.js +12 -2
  67. package/dist/esm/view/BlockCard/views/ErroredView.js +1 -12
  68. package/dist/esm/view/BlockCard/views/ForbiddenView.js +3 -12
  69. package/dist/esm/view/BlockCard/views/NotFoundView.js +6 -16
  70. package/dist/esm/view/BlockCard/views/UnauthorisedView.js +4 -4
  71. package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.js +3 -5
  72. package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.js +11 -33
  73. package/dist/esm/view/FlexibleCard/components/common/image-icon/index.js +5 -18
  74. package/dist/esm/view/FlexibleCard/components/common/loading-skeleton/index.js +2 -10
  75. package/dist/esm/view/FlexibleCard/utils.js +19 -11
  76. package/dist/esm/view/HoverCard/components/views/resolving/index.js +5 -18
  77. package/dist/esm/view/InlineCard/ErroredView/index.js +5 -15
  78. package/dist/esm/view/InlineCard/ForbiddenView/index.js +2 -8
  79. package/dist/esm/view/InlineCard/Icon.compiled.css +0 -1
  80. package/dist/esm/view/InlineCard/Icon.js +3 -23
  81. package/dist/esm/view/InlineCard/UnauthorisedView/index.js +8 -16
  82. package/dist/esm/view/LinkUrl/index.js +1 -1
  83. package/dist/types/__fixtures__/figma-entity.d.ts +58 -0
  84. package/dist/types/extractors/common/context/index.d.ts +8 -0
  85. package/dist/types/extractors/flexible/extract-preview.d.ts +5 -0
  86. package/dist/types/extractors/flexible/icon/extract-provider-icon.d.ts +5 -0
  87. package/dist/types/extractors/flexible/icon/index.d.ts +13 -0
  88. package/dist/types/extractors/flexible/index.d.ts +1 -1
  89. package/dist/types/view/FlexibleCard/components/blocks/title-block/resolving/index.d.ts +2 -6
  90. package/dist/types/view/FlexibleCard/components/common/loading-skeleton/index.d.ts +2 -4
  91. package/dist/types/view/FlexibleCard/components/common/loading-skeleton/types.d.ts +1 -17
  92. package/dist/types/view/FlexibleCard/types.d.ts +2 -2
  93. package/dist/types/view/FlexibleCard/utils.d.ts +2 -2
  94. package/dist/types/view/InlineCard/Icon.d.ts +0 -1
  95. package/dist/types-ts4.5/__fixtures__/figma-entity.d.ts +58 -0
  96. package/dist/types-ts4.5/extractors/common/context/index.d.ts +8 -0
  97. package/dist/types-ts4.5/extractors/flexible/extract-preview.d.ts +5 -0
  98. package/dist/types-ts4.5/extractors/flexible/icon/extract-provider-icon.d.ts +5 -0
  99. package/dist/types-ts4.5/extractors/flexible/icon/index.d.ts +13 -0
  100. package/dist/types-ts4.5/extractors/flexible/index.d.ts +1 -1
  101. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/title-block/resolving/index.d.ts +2 -6
  102. package/dist/types-ts4.5/view/FlexibleCard/components/common/loading-skeleton/index.d.ts +2 -4
  103. package/dist/types-ts4.5/view/FlexibleCard/components/common/loading-skeleton/types.d.ts +1 -17
  104. package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +2 -2
  105. package/dist/types-ts4.5/view/FlexibleCard/utils.d.ts +2 -2
  106. package/dist/types-ts4.5/view/InlineCard/Icon.d.ts +0 -1
  107. package/package.json +2 -2
  108. package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/index.compiled.css +0 -55
  109. package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.compiled.css +0 -55
  110. package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.compiled.css +0 -55
@@ -36,7 +36,7 @@ export var getIconForFileType = function getIconForFileType(fileMimeType) {
36
36
  if (!fileMimeType) {
37
37
  return;
38
38
  }
39
- var icon = fg('platform-smart-card-icon-migration') ? getTypeToIconMap(fileMimeType.toLowerCase()) : typeToIcon[fileMimeType.toLowerCase()];
39
+ var icon = getTypeToIconMap(fileMimeType.toLowerCase());
40
40
  if (!icon) {
41
41
  return;
42
42
  }
@@ -63,7 +63,7 @@ export var getIconForFileType = function getIconForFileType(fileMimeType) {
63
63
  });
64
64
  };
65
65
  export var getLabelForFileType = function getLabelForFileType(fileMimeType) {
66
- var icon = fg('platform-smart-card-icon-migration') ? getTypeToIconMap(fileMimeType.toLowerCase()) : typeToIcon[fileMimeType.toLowerCase()];
66
+ var icon = getTypeToIconMap(fileMimeType.toLowerCase());
67
67
  if (!icon) {
68
68
  return;
69
69
  }
@@ -71,160 +71,6 @@ export var getLabelForFileType = function getLabelForFileType(fileMimeType) {
71
71
  label = _icon2[0];
72
72
  return label;
73
73
  };
74
- var typeToIcon = {
75
- 'text/plain': ['Document', function () {
76
- return import('@atlaskit/icon-file-type/glyph/document/16');
77
- }],
78
- 'application/vnd.oasis.opendocument.text': ['Document', function () {
79
- return import('@atlaskit/icon-file-type/glyph/document/16');
80
- }],
81
- 'application/vnd.apple.pages': ['Document', function () {
82
- return import('@atlaskit/icon-file-type/glyph/document/16');
83
- }],
84
- 'application/vnd.google-apps.document': ['Google Doc', function () {
85
- return import('@atlaskit/icon-file-type/glyph/google-doc/16');
86
- }],
87
- 'application/msword': ['Word document', function () {
88
- return import('@atlaskit/icon-file-type/glyph/word-document/16');
89
- }],
90
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': ['Word document', function () {
91
- return import('@atlaskit/icon-file-type/glyph/word-document/16');
92
- }],
93
- 'application/pdf': ['PDF document', function () {
94
- return import('@atlaskit/icon-file-type/glyph/pdf-document/16');
95
- }],
96
- 'application/vnd.oasis.opendocument.spreadsheet': ['Spreadsheet', function () {
97
- return import('@atlaskit/icon-file-type/glyph/spreadsheet/16');
98
- }],
99
- 'application/vnd.apple.numbers': ['Spreadsheet', function () {
100
- return import('@atlaskit/icon-file-type/glyph/spreadsheet/16');
101
- }],
102
- 'application/vnd.google-apps.spreadsheet': ['Google Sheet', function () {
103
- return import('@atlaskit/icon-file-type/glyph/google-sheet/16');
104
- }],
105
- 'application/vnd.ms-excel': ['Excel spreadsheet', function () {
106
- return import('@atlaskit/icon-file-type/glyph/excel-spreadsheet/16');
107
- }],
108
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': ['Excel spreadsheet', function () {
109
- return import('@atlaskit/icon-file-type/glyph/excel-spreadsheet/16');
110
- }],
111
- 'application/vnd.oasis.opendocument.presentation': ['Presentation', function () {
112
- return import('@atlaskit/icon-file-type/glyph/presentation/16');
113
- }],
114
- 'application/vnd.apple.keynote': ['Presentation', function () {
115
- return import('@atlaskit/icon-file-type/glyph/presentation/16');
116
- }],
117
- 'application/vnd.google-apps.presentation': ['Google Slide', function () {
118
- return import('@atlaskit/icon-file-type/glyph/google-slide/16');
119
- }],
120
- 'application/vnd.ms-powerpoint': ['PowerPoint presentation', function () {
121
- return import('@atlaskit/icon-file-type/glyph/powerpoint-presentation/16');
122
- }],
123
- 'application/vnd.openxmlformats-officedocument.presentationml.presentation': ['PowerPoint presentation', function () {
124
- return import('@atlaskit/icon-file-type/glyph/powerpoint-presentation/16');
125
- }],
126
- 'application/vnd.google-apps.form': ['Google Form', function () {
127
- return import('@atlaskit/icon-file-type/glyph/google-form/16');
128
- }],
129
- 'image/png': ['Image', function () {
130
- return import('@atlaskit/icon-file-type/glyph/image/16');
131
- }],
132
- 'image/jpeg': ['Image', function () {
133
- return import('@atlaskit/icon-file-type/glyph/image/16');
134
- }],
135
- 'image/bmp': ['Image', function () {
136
- return import('@atlaskit/icon-file-type/glyph/image/16');
137
- }],
138
- 'image/webp': ['Image', function () {
139
- return import('@atlaskit/icon-file-type/glyph/image/16');
140
- }],
141
- 'image/svg+xml': ['Image', function () {
142
- return import('@atlaskit/icon-file-type/glyph/image/16');
143
- }],
144
- 'image/gif': ['GIF', function () {
145
- return import('@atlaskit/icon-file-type/glyph/gif/16');
146
- }],
147
- 'audio/midi': ['Audio', function () {
148
- return import('@atlaskit/icon-file-type/glyph/audio/16');
149
- }],
150
- 'audio/mpeg': ['Audio', function () {
151
- return import('@atlaskit/icon-file-type/glyph/audio/16');
152
- }],
153
- 'audio/webm': ['Audio', function () {
154
- return import('@atlaskit/icon-file-type/glyph/audio/16');
155
- }],
156
- 'audio/ogg': ['Audio', function () {
157
- return import('@atlaskit/icon-file-type/glyph/audio/16');
158
- }],
159
- 'audio/wav': ['Audio', function () {
160
- return import('@atlaskit/icon-file-type/glyph/audio/16');
161
- }],
162
- 'video/mp4': ['Video', function () {
163
- return import('@atlaskit/icon-file-type/glyph/video/16');
164
- }],
165
- 'video/quicktime': ['Video', function () {
166
- return import('@atlaskit/icon-file-type/glyph/video/16');
167
- }],
168
- 'video/mov': ['Video', function () {
169
- return import('@atlaskit/icon-file-type/glyph/video/16');
170
- }],
171
- 'video/webm': ['Video', function () {
172
- return import('@atlaskit/icon-file-type/glyph/video/16');
173
- }],
174
- 'video/ogg': ['Video', function () {
175
- return import('@atlaskit/icon-file-type/glyph/video/16');
176
- }],
177
- 'video/x-ms-wmv': ['Video', function () {
178
- return import('@atlaskit/icon-file-type/glyph/video/16');
179
- }],
180
- 'video/x-msvideo': ['Video', function () {
181
- return import('@atlaskit/icon-file-type/glyph/video/16');
182
- }],
183
- 'application/zip': ['Archive', function () {
184
- return import('@atlaskit/icon-file-type/glyph/archive/16');
185
- }],
186
- 'application/x-tar': ['Archive', function () {
187
- return import('@atlaskit/icon-file-type/glyph/archive/16');
188
- }],
189
- 'application/x-gtar': ['Archive', function () {
190
- return import('@atlaskit/icon-file-type/glyph/archive/16');
191
- }],
192
- 'application/x-7z-compressed': ['Archive', function () {
193
- return import('@atlaskit/icon-file-type/glyph/archive/16');
194
- }],
195
- 'application/x-apple-diskimage': ['Archive', function () {
196
- return import('@atlaskit/icon-file-type/glyph/archive/16');
197
- }],
198
- 'application/vnd.rar': ['Archive', function () {
199
- return import('@atlaskit/icon-file-type/glyph/archive/16');
200
- }],
201
- 'application/dmg': ['Executable', function () {
202
- return import('@atlaskit/icon-file-type/glyph/executable/16');
203
- }],
204
- 'text/css': ['Source Code', function () {
205
- return import('@atlaskit/icon-file-type/glyph/source-code/16');
206
- }],
207
- 'text/html': ['Source Code', function () {
208
- return import('@atlaskit/icon-file-type/glyph/source-code/16');
209
- }],
210
- 'application/javascript': ['Source Code', function () {
211
- return import('@atlaskit/icon-file-type/glyph/source-code/16');
212
- }],
213
- 'application/octet-stream': ['Binary file', function () {
214
- return import('@atlaskit/icon-file-type/glyph/generic/16');
215
- }],
216
- 'application/invision.prototype': ['Prototype', function () {
217
- return import('@atlaskit/icon-file-type/glyph/generic/16');
218
- }],
219
- // TODO: Figure a way to detect those
220
- 'application/sketch': ['Sketch', function () {
221
- return import('@atlaskit/icon-file-type/glyph/sketch/16');
222
- }],
223
- folder: ['Folder', function () {
224
- return import('@atlaskit/icon-file-type/glyph/folder/16');
225
- }]
226
- };
227
-
228
74
  // prettier-ignore
229
75
  export var getLazyIcons = function getLazyIcons() {
230
76
  var _ref3;
@@ -108,7 +108,17 @@ var nounDataResponse = {
108
108
  };
109
109
  export var mocks = {
110
110
  success: _objectSpread({}, jsonLdResponse),
111
- nounDataSuccess: _objectSpread(_objectSpread(_objectSpread({}, jsonLdResponse), nounDataResponse), {}, {
111
+ nounDataSuccess: _objectSpread(_objectSpread({}, jsonLdResponse), {}, {
112
+ data: _objectSpread(_objectSpread({}, jsonLdResponse.data), {}, {
113
+ generator: {
114
+ '@type': 'Application',
115
+ icon: {
116
+ "@type": 'Image',
117
+ url: 'https://www.ilovecheese.com'
118
+ },
119
+ name: 'I love cheese'
120
+ }
121
+ }),
112
122
  meta: _objectSpread(_objectSpread({}, jsonLdResponse.meta), {}, {
113
123
  generator: {
114
124
  name: 'I love cheese',
@@ -117,7 +127,7 @@ export var mocks = {
117
127
  }
118
128
  }
119
129
  })
120
- }),
130
+ }, nounDataResponse),
121
131
  notFound: {
122
132
  meta: {
123
133
  visibility: 'not_found',
@@ -3,9 +3,6 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
3
3
  var _excluded = ["testId"];
4
4
  import React, { useMemo } from 'react';
5
5
  import WarningIcon from '@atlaskit/icon/core/migration/warning';
6
- import LegacyWarningIcon from '@atlaskit/icon/glyph/warning';
7
- import { fg } from '@atlaskit/platform-feature-flags';
8
- import { R300 } from '@atlaskit/theme/colors';
9
6
  import { messages } from '../../../messages';
10
7
  import Text from '../../FlexibleCard/components/elements/text';
11
8
  import { RetryAction } from '../actions/RetryAction';
@@ -28,19 +25,11 @@ var ErroredView = function ErroredView(_ref) {
28
25
  return /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, props, {
29
26
  actions: actions,
30
27
  testId: testId
31
- }), fg('platform-smart-card-icon-migration') ? /*#__PURE__*/React.createElement(WarningIcon, {
28
+ }), /*#__PURE__*/React.createElement(WarningIcon, {
32
29
  label: "errored-warning-icon",
33
30
  color: "var(--ds-icon-warning, #E56910)",
34
31
  LEGACY_size: "small",
35
32
  testId: "".concat(testId, "-warning-icon")
36
- }) :
37
- /*#__PURE__*/
38
- // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons -- TODO - https://product-fabric.atlassian.net/browse/DSP-19497
39
- React.createElement(LegacyWarningIcon, {
40
- label: "errored-warning-icon",
41
- size: "small",
42
- primaryColor: "var(--ds-icon-warning, ".concat(R300, ")"),
43
- testId: "".concat(testId, "-warning-icon")
44
33
  }), /*#__PURE__*/React.createElement(Text, {
45
34
  maxLines: 3,
46
35
  message: {
@@ -11,9 +11,8 @@ import { useIntl } from 'react-intl-next';
11
11
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
12
12
  import LockLockedIcon from '@atlaskit/icon/core/lock-locked';
13
13
  import LegacyLockIcon from '@atlaskit/icon/glyph/lock';
14
- import { extractProvider } from '@atlaskit/link-extractors';
14
+ import { extractProvider, extractSmartLinkProvider } from '@atlaskit/link-extractors';
15
15
  import { fg } from '@atlaskit/platform-feature-flags';
16
- import { R300 } from '@atlaskit/theme/colors';
17
16
  import { extractRequestAccessContextImproved } from '../../../extractors/common/context/extractAccessContext';
18
17
  import extractHostname from '../../../extractors/common/hostname/extractHostname';
19
18
  import { messages } from '../../../messages';
@@ -45,7 +44,7 @@ var ForbiddenView = function ForbiddenView(_ref) {
45
44
  url = props.url;
46
45
  var details = cardState === null || cardState === void 0 ? void 0 : cardState.details;
47
46
  var cardMetadata = (_details$meta = details === null || details === void 0 ? void 0 : details.meta) !== null && _details$meta !== void 0 ? _details$meta : getForbiddenJsonLd().meta;
48
- var provider = extractProvider(details === null || details === void 0 ? void 0 : details.data);
47
+ var provider = fg('smart_links_noun_support') ? extractSmartLinkProvider(details) : extractProvider(details === null || details === void 0 ? void 0 : details.data);
49
48
  var providerName = (provider === null || provider === void 0 ? void 0 : provider.text) || '';
50
49
  var messageContext = useMemo(function () {
51
50
  var hostname = /*#__PURE__*/React.createElement("b", null, extractHostname(url));
@@ -83,20 +82,12 @@ var ForbiddenView = function ForbiddenView(_ref) {
83
82
  showPreview: true,
84
83
  testId: testId,
85
84
  title: title
86
- }), fg('platform-smart-card-icon-migration') ? /*#__PURE__*/React.createElement(LockLockedIcon, {
85
+ }), /*#__PURE__*/React.createElement(LockLockedIcon, {
87
86
  label: "forbidden-lock-icon",
88
87
  color: "var(--ds-icon-danger, #C9372C)",
89
88
  LEGACY_fallbackIcon: LegacyLockIcon,
90
89
  LEGACY_size: "small",
91
90
  testId: "".concat(testId, "-lock-icon")
92
- }) :
93
- /*#__PURE__*/
94
- // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons -- TODO - https://product-fabric.atlassian.net/browse/DSP-19497
95
- React.createElement(LegacyLockIcon, {
96
- label: "forbidden-lock-icon",
97
- size: "small",
98
- primaryColor: "var(--ds-icon-danger, ".concat(R300, ")"),
99
- testId: "".concat(testId, "-lock-icon")
100
91
  }), /*#__PURE__*/React.createElement(Text, {
101
92
  maxLines: 3,
102
93
  message: {
@@ -9,9 +9,8 @@ import { useMemo } from 'react';
9
9
  import { useIntl } from 'react-intl-next';
10
10
  import LockLockedIcon from '@atlaskit/icon/core/lock-locked';
11
11
  import LegacyLockIcon from '@atlaskit/icon/glyph/lock';
12
- import { extractProvider } from '@atlaskit/link-extractors';
12
+ import { extractProvider, extractSmartLinkProvider } from '@atlaskit/link-extractors';
13
13
  import { fg } from '@atlaskit/platform-feature-flags';
14
- import { R300 } from '@atlaskit/theme/colors';
15
14
  import { messages } from '../../../messages';
16
15
  import Text from '../../FlexibleCard/components/elements/text';
17
16
  import UnresolvedView from './unresolved-view';
@@ -25,17 +24,16 @@ var textStyles = null;
25
24
  * @see FlexibleCardProps
26
25
  */
27
26
  var NotFoundView = function NotFoundView(_ref) {
28
- var _cardState$details2;
29
27
  var _ref$testId = _ref.testId,
30
28
  testId = _ref$testId === void 0 ? 'smart-block-not-found-view' : _ref$testId,
31
29
  props = _objectWithoutProperties(_ref, _excluded);
32
30
  var intl = useIntl();
33
- var cardState = props.cardState;
31
+ var details = props.cardState.details;
34
32
  var product = useMemo(function () {
35
- var _cardState$details, _provider$text;
36
- var provider = extractProvider(cardState === null || cardState === void 0 || (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data);
33
+ var _provider$text;
34
+ var provider = fg('smart_links_noun_support') ? extractSmartLinkProvider(details) : extractProvider(details === null || details === void 0 ? void 0 : details.data);
37
35
  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 || (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data]);
36
+ }, [details]);
39
37
  var title = useMemo(function () {
40
38
  return intl.formatMessage(messages.not_found_title, {
41
39
  product: product
@@ -49,20 +47,12 @@ var NotFoundView = function NotFoundView(_ref) {
49
47
  return /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, props, {
50
48
  testId: testId,
51
49
  title: title
52
- }), fg('platform-smart-card-icon-migration') ? /*#__PURE__*/React.createElement(LockLockedIcon, {
50
+ }), /*#__PURE__*/React.createElement(LockLockedIcon, {
53
51
  label: "not-found-lock-icon",
54
52
  color: "var(--ds-icon-danger, #C9372C)",
55
53
  LEGACY_fallbackIcon: LegacyLockIcon,
56
54
  LEGACY_size: "small",
57
55
  testId: "".concat(testId, "-lock-icon")
58
- }) :
59
- /*#__PURE__*/
60
- // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons -- TODO - https://product-fabric.atlassian.net/browse/DSP-19497
61
- React.createElement(LegacyLockIcon, {
62
- label: "not-found-lock-icon",
63
- size: "small",
64
- primaryColor: "var(--ds-icon-danger, ".concat(R300, ")"),
65
- testId: "".concat(testId, "-lock-icon")
66
56
  }), /*#__PURE__*/React.createElement(Text, {
67
57
  message: description,
68
58
  testId: "".concat(testId, "-message"),
@@ -7,7 +7,7 @@ import * as React from 'react';
7
7
  import { ax, ix } from "@compiled/react/runtime";
8
8
  import { useCallback, useMemo } from 'react';
9
9
  import { FormattedMessage } from 'react-intl-next';
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
12
  import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
13
13
  import { messages } from '../../../messages';
@@ -27,15 +27,15 @@ var contentStyles = null;
27
27
  * @see FlexibleCardProps
28
28
  */
29
29
  var UnauthorisedView = function UnauthorisedView(_ref) {
30
- var _cardState$details, _extractProvider;
30
+ var _cardState$details, _extractSmartLinkProv, _extractProvider;
31
31
  var _ref$testId = _ref.testId,
32
32
  testId = _ref$testId === void 0 ? 'smart-block-unauthorized-view' : _ref$testId,
33
33
  props = _objectWithoutProperties(_ref, _excluded);
34
34
  var cardState = props.cardState,
35
35
  onAuthorize = props.onAuthorize;
36
36
  var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
37
- var providerName = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
38
- var isProductIntegrationSupported = hasAuthScopeOverrides(cardState === null || cardState === void 0 ? void 0 : cardState.details);
37
+ var 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
+ var isProductIntegrationSupported = hasAuthScopeOverrides(cardState.details);
39
39
  var _useAnalyticsEvents = useAnalyticsEvents(),
40
40
  fireEvent = _useAnalyticsEvents.fireEvent;
41
41
  var handleAuthorize = useCallback(function () {
@@ -5,7 +5,6 @@ var _excluded = ["actionGroup", "metadata", "position", "subtitle", "testId", "t
5
5
  import "./index.compiled.css";
6
6
  import * as React from 'react';
7
7
  import { ax, ix } from "@compiled/react/runtime";
8
- import { fg } from '@atlaskit/platform-feature-flags';
9
8
  import { SmartLinkAlignment, SmartLinkDirection, SmartLinkPosition, SmartLinkWidth } from '../../../../../../constants';
10
9
  import { LinkIcon } from '../../../elements';
11
10
  import Block from '../../block';
@@ -37,12 +36,11 @@ var TitleBlockResolvedView = function TitleBlockResolvedView(_ref) {
37
36
  var subtitleElements = renderElementItems(subtitle);
38
37
  return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
39
38
  testId: "".concat(testId, "-resolved-view")
40
- }), !hideIcon && /*#__PURE__*/React.createElement(LinkIcon, _extends({
39
+ }), !hideIcon && /*#__PURE__*/React.createElement(LinkIcon, {
41
40
  overrideIcon: icon,
42
- position: position
43
- }, fg('platform-smart-card-icon-migration') && {
41
+ position: position,
44
42
  size: size
45
- })), /*#__PURE__*/React.createElement(ElementGroup, {
43
+ }), /*#__PURE__*/React.createElement(ElementGroup, {
46
44
  direction: SmartLinkDirection.Vertical,
47
45
  width: SmartLinkWidth.Flexible,
48
46
  size: blockProps.size,
@@ -1,24 +1,12 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
2
1
  import _extends from "@babel/runtime/helpers/extends";
3
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
3
  var _excluded = ["actionGroup", "testId", "title", "hideIcon"];
5
- import "./index.compiled.css";
6
- import * as React from 'react';
7
- import { ax, ix } from "@compiled/react/runtime";
8
4
  /* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */
9
-
10
- import { fg } from '@atlaskit/platform-feature-flags';
5
+ import React from 'react';
11
6
  import { SmartLinkSize } from '../../../../../../constants';
12
- import { LoadingSkeletonNew, LoadingSkeletonOld } from '../../../common/loading-skeleton';
7
+ import { LoadingSkeleton } from '../../../common/loading-skeleton';
13
8
  import { getIconWidthNew } from '../../../utils';
14
9
  import Block from '../../block';
15
- var iconStyle = {
16
- 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",
17
- 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",
18
- 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",
19
- 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"
20
- };
21
-
22
10
  /**
23
11
  * This represents a TitleBlock for a Smart Link that is currently waiting
24
12
  * for a request to finish.
@@ -33,28 +21,18 @@ var TitleBlockResolvingView = function TitleBlockResolvingView(_ref) {
33
21
  blockProps = _objectWithoutProperties(_ref, _excluded);
34
22
  var _blockProps$size = blockProps.size,
35
23
  size = _blockProps$size === void 0 ? SmartLinkSize.Medium : _blockProps$size;
36
- if (fg('platform-smart-card-icon-migration')) {
37
- var iconWidth = getIconWidthNew(size);
38
- return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
39
- testId: "".concat(testId, "-resolving-view")
40
- }), !hideIcon && /*#__PURE__*/React.createElement("span", {
41
- style: {
42
- width: iconWidth,
43
- height: iconWidth
44
- },
45
- "data-testid": "".concat(testId, "-icon")
46
- }, /*#__PURE__*/React.createElement(LoadingSkeletonNew, {
47
- width: iconWidth,
48
- height: iconWidth,
49
- testId: "".concat(testId, "-icon-loading")
50
- })), title, actionGroup);
51
- }
24
+ var iconWidth = getIconWidthNew(size);
52
25
  return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
53
26
  testId: "".concat(testId, "-resolving-view")
54
27
  }), !hideIcon && /*#__PURE__*/React.createElement("span", {
55
- "data-testid": "".concat(testId, "-icon"),
56
- className: ax([iconStyle[size]])
57
- }, /*#__PURE__*/React.createElement(LoadingSkeletonOld, {
28
+ style: {
29
+ width: iconWidth,
30
+ height: iconWidth
31
+ },
32
+ "data-testid": "".concat(testId, "-icon")
33
+ }, /*#__PURE__*/React.createElement(LoadingSkeleton, {
34
+ width: iconWidth,
35
+ height: iconWidth,
58
36
  testId: "".concat(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
  var ImageIcon = function ImageIcon(_ref) {
7
5
  var defaultIcon = _ref.defaultIcon,
8
6
  testId = _ref.testId,
@@ -11,10 +9,9 @@ var ImageIcon = function ImageIcon(_ref) {
11
9
  height = _ref.height,
12
10
  onError = _ref.onError,
13
11
  onLoad = _ref.onLoad;
14
- return /*#__PURE__*/React.createElement(ImageLoader, _extends({
15
- src: url
16
- }, fg('platform-smart-card-icon-migration') ? {
17
- loading: /*#__PURE__*/React.createElement(LoadingSkeletonNew, {
12
+ return /*#__PURE__*/React.createElement(ImageLoader, {
13
+ src: url,
14
+ loading: /*#__PURE__*/React.createElement(LoadingSkeleton, {
18
15
  testId: "".concat(testId, "-loading"),
19
16
  width: width,
20
17
  height: height
@@ -27,20 +24,10 @@ var ImageIcon = function ImageIcon(_ref) {
27
24
  width: width,
28
25
  height: height
29
26
  }
30
- })
31
- } : {
32
- loading: /*#__PURE__*/React.createElement(LoadingSkeletonOld, {
33
- testId: "".concat(testId, "-loading")
34
27
  }),
35
- loaded: /*#__PURE__*/React.createElement("img", {
36
- src: url,
37
- "data-testid": "".concat(testId, "-image"),
38
- alt: ""
39
- })
40
- }, {
41
28
  errored: defaultIcon,
42
29
  onError: onError,
43
30
  onLoad: onLoad
44
- }));
31
+ });
45
32
  };
46
33
  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
  var animationNameStyles = null;
7
6
  var loadingSkeletonStyle = null;
8
- var LoadingSkeletonNew = function LoadingSkeletonNew(_ref) {
7
+ export var LoadingSkeleton = function LoadingSkeleton(_ref) {
9
8
  var testId = _ref.testId,
10
9
  width = _ref.width,
11
10
  height = _ref.height;
@@ -18,11 +17,4 @@ var LoadingSkeletonNew = function LoadingSkeletonNew(_ref) {
18
17
  "--_16116mi": ix("linear-gradient( to right, transparent 0%, ".concat("var(--ds-skeleton, #edeef1)", " 20%, transparent 40%, transparent 100% )"))
19
18
  }
20
19
  });
21
- };
22
- var LoadingSkeletonOld = function LoadingSkeletonOld(props) {
23
- return /*#__PURE__*/React.createElement(LoadingSkeletonNew, _extends({}, props, {
24
- width: "".concat(props.width, "rem"),
25
- height: "".concat(props.height, "rem")
26
- }));
27
- };
28
- export { LoadingSkeletonOld, LoadingSkeletonNew };
20
+ };
@@ -1,11 +1,11 @@
1
- import { extractProvider } from '@atlaskit/link-extractors';
1
+ import { extractProvider, extractSmartLinkProvider, isEntityPresent } from '@atlaskit/link-extractors';
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
3
  import { SmartLinkStatus } from '../../constants';
4
4
  import { extractRequestAccessContextImproved } from '../../extractors/common/context';
5
5
  import extractFlexibleUiContext from '../../extractors/flexible';
6
- import extractPreview from '../../extractors/flexible/extract-preview';
6
+ import extractPreview, { extractSmartLinkPreviewImage } from '../../extractors/flexible/extract-preview';
7
7
  import { extractErrorIcon } from '../../extractors/flexible/icon';
8
- import extractProviderIcon from '../../extractors/flexible/icon/extract-provider-icon';
8
+ import extractProviderIcon, { extractSmartLinkProviderIcon } from '../../extractors/flexible/icon/extract-provider-icon';
9
9
  import { messages } from '../../messages';
10
10
  import { handleOnClick } from '../../utils';
11
11
  import { getEmptyJsonLd, getForbiddenJsonLd } from '../../utils/jsonld';
@@ -29,15 +29,23 @@ export var getContextByStatus = function getContextByStatus(params) {
29
29
  case SmartLinkStatus.Errored:
30
30
  case SmartLinkStatus.Fallback:
31
31
  default:
32
- var preview = extractPreview(response === null || response === void 0 ? void 0 : response.data);
33
- var linkIcon = extractErrorIcon(response, status);
34
- var provider = extractProviderIcon(response === null || response === void 0 ? void 0 : response.data);
32
+ if (fg('smart_links_noun_support')) {
33
+ if (isEntityPresent(response)) {
34
+ return {
35
+ url: url,
36
+ title: url,
37
+ linkIcon: extractErrorIcon(response, status),
38
+ preview: extractSmartLinkPreviewImage(response),
39
+ provider: extractSmartLinkProviderIcon(response)
40
+ };
41
+ }
42
+ }
35
43
  return {
36
- linkIcon: linkIcon,
37
- title: url,
38
44
  url: url,
39
- provider: provider,
40
- preview: preview
45
+ title: url,
46
+ linkIcon: extractErrorIcon(response, status),
47
+ preview: extractPreview(response === null || response === void 0 ? void 0 : response.data),
48
+ provider: extractProviderIcon(response === null || response === void 0 ? void 0 : response.data)
41
49
  };
42
50
  }
43
51
  };
@@ -62,7 +70,7 @@ var getForbiddenMessageKey = function getForbiddenMessageKey(meta) {
62
70
  export var getRetryOptions = function getRetryOptions(url, status, response, onAuthorize) {
63
71
  var _response$meta, _access$action, _access$buttonDisable;
64
72
  var data = response && response.data || getEmptyJsonLd();
65
- var provider = extractProvider(data);
73
+ var provider = fg('smart_links_noun_support') ? extractSmartLinkProvider(response) : extractProvider(data);
66
74
  var context = provider === null || provider === void 0 ? void 0 : provider.text;
67
75
  var values = context ? {
68
76
  context: context
@@ -3,10 +3,9 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./index.compiled.css";
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import React from 'react';
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
6
  import { CustomBlock } from '../../../../FlexibleCard/components/blocks';
8
7
  import ActionGroup from '../../../../FlexibleCard/components/blocks/action-group';
9
- import { LoadingSkeletonNew, LoadingSkeletonOld } from '../../../../FlexibleCard/components/common/loading-skeleton';
8
+ import { LoadingSkeleton } from '../../../../FlexibleCard/components/common/loading-skeleton';
10
9
  import Icon from '../../../../FlexibleCard/components/elements/icon';
11
10
  import { CARD_WIDTH_REM } from '../../../styled';
12
11
  var loadingViewContainer = null;
@@ -24,7 +23,6 @@ var HoverCardLoadingView = function HoverCardLoadingView(_ref) {
24
23
  items: actions,
25
24
  visibleButtonsNum: 2
26
25
  });
27
- var LoadingSkeleton = fg('platform-smart-card-icon-migration') ? LoadingSkeletonNew : LoadingSkeletonOld;
28
26
  return /*#__PURE__*/React.createElement("div", {
29
27
  "data-testid": testId,
30
28
  className: ax(["_1e0c1txw _2lx21bp4 _ca0q1e9d _u5f31e9d _n3td1e9d _19bv1e9d"])
@@ -41,28 +39,17 @@ var HoverCardLoadingView = function HoverCardLoadingView(_ref) {
41
39
  }), /*#__PURE__*/React.createElement("span", {
42
40
  "data-testid": "".concat(testId, "-title"),
43
41
  className: ax(["_16jlkb7n _1o9zidpf _i0dl1wug _4t3i1k92 _e2oo1osq"])
44
- }, fg('platform-smart-card-icon-migration') ? /*#__PURE__*/React.createElement(LoadingSkeletonNew, {
42
+ }, /*#__PURE__*/React.createElement(LoadingSkeleton, {
45
43
  height: "".concat(lineHeightRem, "rem")
46
- }) : /*#__PURE__*/React.createElement(LoadingSkeletonOld, {
47
- height: lineHeightRem
48
- })), actionGroup), fg('platform-smart-card-icon-migration') ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LoadingSkeletonNew, {
44
+ })), actionGroup), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LoadingSkeleton, {
49
45
  width: "".concat(skeletonWidth, "rem"),
50
46
  height: "".concat(lineHeightRem, "rem")
51
- }), /*#__PURE__*/React.createElement(LoadingSkeletonNew, {
47
+ }), /*#__PURE__*/React.createElement(LoadingSkeleton, {
52
48
  width: "".concat(skeletonWidth, "rem"),
53
49
  height: "".concat(lineHeightRem * 3, "rem")
54
- }), /*#__PURE__*/React.createElement(LoadingSkeletonNew, {
50
+ }), /*#__PURE__*/React.createElement(LoadingSkeleton, {
55
51
  width: "".concat(skeletonWidth, "rem"),
56
52
  height: "".concat(lineHeightRem, "rem")
57
- })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LoadingSkeletonOld, {
58
- width: skeletonWidth,
59
- height: lineHeightRem
60
- }), /*#__PURE__*/React.createElement(LoadingSkeletonOld, {
61
- width: skeletonWidth,
62
- height: lineHeightRem * 3
63
- }), /*#__PURE__*/React.createElement(LoadingSkeletonOld, {
64
- width: skeletonWidth,
65
- height: lineHeightRem
66
53
  }))));
67
54
  };
68
55
  export default HoverCardLoadingView;