@atlaskit/smart-card 17.3.0 → 17.4.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 (67) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/constants.js +16 -1
  3. package/dist/cjs/extractors/flexible/icon/extract-document-type-icon.js +28 -7
  4. package/dist/cjs/extractors/flexible/icon/extract-file-formatIcon.js +88 -22
  5. package/dist/cjs/extractors/flexible/icon/extract-jira-task-icon.js +36 -9
  6. package/dist/cjs/extractors/flexible/icon/extract-jsonld-data-icon.js +33 -9
  7. package/dist/cjs/extractors/flexible/icon/extract-provider-icon.js +20 -3
  8. package/dist/cjs/extractors/flexible/icon/extract-url-icon.js +4 -1
  9. package/dist/cjs/extractors/flexible/icon/index.js +11 -20
  10. package/dist/cjs/extractors/flexible/index.js +5 -0
  11. package/dist/cjs/utils/flexible.js +2 -2
  12. package/dist/cjs/version.json +1 -1
  13. package/dist/cjs/view/CardWithUrl/component.js +1 -1
  14. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +27 -7
  15. package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -0
  16. package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +2 -4
  17. package/dist/cjs/view/FlexibleCard/components/elements/index.js +6 -2
  18. package/dist/cjs/view/FlexibleCard/components/elements/text/index.js +6 -2
  19. package/dist/cjs/view/FlexibleCard/components/elements/utils.js +64 -39
  20. package/dist/es2019/constants.js +15 -1
  21. package/dist/es2019/extractors/flexible/icon/extract-document-type-icon.js +28 -7
  22. package/dist/es2019/extractors/flexible/icon/extract-file-formatIcon.js +88 -22
  23. package/dist/es2019/extractors/flexible/icon/extract-jira-task-icon.js +36 -9
  24. package/dist/es2019/extractors/flexible/icon/extract-jsonld-data-icon.js +33 -9
  25. package/dist/es2019/extractors/flexible/icon/extract-provider-icon.js +19 -3
  26. package/dist/es2019/extractors/flexible/icon/extract-url-icon.js +4 -1
  27. package/dist/es2019/extractors/flexible/icon/index.js +6 -9
  28. package/dist/es2019/extractors/flexible/index.js +5 -1
  29. package/dist/es2019/utils/flexible.js +2 -2
  30. package/dist/es2019/version.json +1 -1
  31. package/dist/es2019/view/CardWithUrl/component.js +1 -1
  32. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +38 -6
  33. package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -0
  34. package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +2 -4
  35. package/dist/es2019/view/FlexibleCard/components/elements/index.js +3 -1
  36. package/dist/es2019/view/FlexibleCard/components/elements/text/index.js +5 -3
  37. package/dist/es2019/view/FlexibleCard/components/elements/utils.js +66 -37
  38. package/dist/esm/constants.js +15 -1
  39. package/dist/esm/extractors/flexible/icon/extract-document-type-icon.js +28 -7
  40. package/dist/esm/extractors/flexible/icon/extract-file-formatIcon.js +88 -22
  41. package/dist/esm/extractors/flexible/icon/extract-jira-task-icon.js +36 -9
  42. package/dist/esm/extractors/flexible/icon/extract-jsonld-data-icon.js +33 -9
  43. package/dist/esm/extractors/flexible/icon/extract-provider-icon.js +19 -3
  44. package/dist/esm/extractors/flexible/icon/extract-url-icon.js +4 -1
  45. package/dist/esm/extractors/flexible/icon/index.js +12 -20
  46. package/dist/esm/extractors/flexible/index.js +5 -1
  47. package/dist/esm/utils/flexible.js +2 -2
  48. package/dist/esm/version.json +1 -1
  49. package/dist/esm/view/CardWithUrl/component.js +1 -1
  50. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +25 -7
  51. package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -0
  52. package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +2 -4
  53. package/dist/esm/view/FlexibleCard/components/elements/index.js +3 -1
  54. package/dist/esm/view/FlexibleCard/components/elements/text/index.js +7 -2
  55. package/dist/esm/view/FlexibleCard/components/elements/utils.js +64 -39
  56. package/dist/types/__fixtures__/flexible-ui-data-context.d.ts +3 -0
  57. package/dist/types/constants.d.ts +3 -1
  58. package/dist/types/extractors/flexible/icon/extract-provider-icon.d.ts +1 -1
  59. package/dist/types/extractors/flexible/icon/index.d.ts +3 -3
  60. package/dist/types/extractors/flexible/icon/types.d.ts +5 -1
  61. package/dist/types/state/flexible-ui-context/types.d.ts +4 -2
  62. package/dist/types/utils/flexible.d.ts +1 -2
  63. package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +4 -2
  64. package/dist/types/view/FlexibleCard/components/elements/avatar-group/types.d.ts +1 -2
  65. package/dist/types/view/FlexibleCard/components/elements/index.d.ts +2 -0
  66. package/dist/types/view/FlexibleCard/components/elements/text/types.d.ts +1 -0
  67. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 17.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`ecf130ca7d8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ecf130ca7d8) - Flexible UI: Remove check on Smart Links appearance
8
+
9
+ ## 17.4.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`392b7d2b98f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/392b7d2b98f) - Add Provider element
14
+
15
+ ## 17.3.2
16
+
17
+ ### Patch Changes
18
+
19
+ - [`02ed34221ef`](https://bitbucket.org/atlassian/atlassian-frontend/commits/02ed34221ef) - Flexible UI: Add Snippet element
20
+
21
+ ## 17.3.1
22
+
23
+ ### Patch Changes
24
+
25
+ - [`66dc86e0331`](https://bitbucket.org/atlassian/atlassian-frontend/commits/66dc86e0331) - Flexible UI: Check for null element
26
+
3
27
  ## 17.3.0
4
28
 
5
29
  ### Minor Changes
@@ -60,7 +60,20 @@ exports.SmartLinkTheme = SmartLinkTheme;
60
60
  SmartLinkTheme["Link"] = "link";
61
61
  })(SmartLinkTheme || (exports.SmartLinkTheme = SmartLinkTheme = {}));
62
62
 
63
- var SmartLinkWidth;
63
+ var SmartLinkWidth; // When adding an element...
64
+ // 1) Create base element if it doesn't already existed.
65
+ // Base element are inside src/view/FlexibleCard/components/elements.
66
+ // E.g. Badge,DateTime, Icon, Lozenge, etc.
67
+ // 2) Update FlexibleUiContext with the new prop for data representing
68
+ // the element, preferably with the same name as the element itself.
69
+ // (src/state/flexible-ui-context/types.ts)
70
+ // 3) Update Flexible UI extractor (src/extractors/flexible/index.ts)
71
+ // 4) Set base element and data mapping.
72
+ // (src/view/FlexibleCard/components/elements/utils.tsx)
73
+ // 5) Create element. (src/view/FlexibleCard/components/elements/index.ts)
74
+ // 6) Update element ElementDisplaySchema for inline/block display
75
+ // (src/view/FlexibleCard/components/blocks/utils.tsx)
76
+
64
77
  exports.SmartLinkWidth = SmartLinkWidth;
65
78
 
66
79
  (function (SmartLinkWidth) {
@@ -82,9 +95,11 @@ exports.ElementName = ElementName;
82
95
  ElementName["ModifiedOn"] = "ModifiedOn";
83
96
  ElementName["Priority"] = "Priority";
84
97
  ElementName["ProgrammingLanguage"] = "ProgrammingLanguage";
98
+ ElementName["Snippet"] = "Snippet";
85
99
  ElementName["State"] = "State";
86
100
  ElementName["SubscriberCount"] = "SubscriberCount";
87
101
  ElementName["Title"] = "Title";
102
+ ElementName["Provider"] = "Provider";
88
103
  })(ElementName || (exports.ElementName = ElementName = {}));
89
104
 
90
105
  var ActionName;
@@ -10,25 +10,46 @@ var _constants = require("../../../constants");
10
10
  var extractDocumentTypeIcon = function extractDocumentTypeIcon(documentType, label) {
11
11
  switch (documentType) {
12
12
  case 'schema:BlogPosting':
13
- return [_constants.IconType.Blog, label || 'Blog'];
13
+ return {
14
+ icon: _constants.IconType.Blog,
15
+ label: label || 'Blog'
16
+ };
14
17
 
15
18
  case 'schema:DigitalDocument':
16
- return [_constants.IconType.File, label || 'File'];
19
+ return {
20
+ icon: _constants.IconType.File,
21
+ label: label || 'File'
22
+ };
17
23
 
18
24
  case 'schema:TextDigitalDocument':
19
- return [_constants.IconType.Document, label || 'Document'];
25
+ return {
26
+ icon: _constants.IconType.Document,
27
+ label: label || 'Document'
28
+ };
20
29
 
21
30
  case 'schema:PresentationDigitalDocument':
22
- return [_constants.IconType.Presentation, label || 'Presentation'];
31
+ return {
32
+ icon: _constants.IconType.Presentation,
33
+ label: label || 'Presentation'
34
+ };
23
35
 
24
36
  case 'schema:SpreadsheetDigitalDocument':
25
- return [_constants.IconType.Spreadsheet, label || 'Spreadsheet'];
37
+ return {
38
+ icon: _constants.IconType.Spreadsheet,
39
+ label: label || 'Spreadsheet'
40
+ };
26
41
 
27
42
  case 'atlassian:Template':
28
- return [_constants.IconType.Template, label || 'Template'];
43
+ return {
44
+ icon: _constants.IconType.Template,
45
+ label: label || 'Template'
46
+ };
29
47
 
30
48
  case 'atlassian:UndefinedLink':
31
- return [_constants.IconType.Document, label || 'Undefined link'];
49
+ return {
50
+ icon: _constants.IconType.Document,
51
+ label: label || 'Undefined link'
52
+ };
32
53
 
33
54
  default:
34
55
  return undefined;
@@ -11,66 +11,111 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
11
11
  switch (fileFormat) {
12
12
  // Generic documents
13
13
  case 'folder':
14
- return [_constants.IconType.Folder, 'Folder'];
14
+ return {
15
+ icon: _constants.IconType.Folder,
16
+ label: 'Folder'
17
+ };
15
18
 
16
19
  case 'text/plain':
17
20
  case 'application/vnd.oasis.opendocument.text':
18
21
  case 'application/vnd.apple.pages':
19
- return [_constants.IconType.Document, 'Document'];
22
+ return {
23
+ icon: _constants.IconType.Document,
24
+ label: 'Document'
25
+ };
20
26
 
21
27
  case 'application/pdf':
22
- return [_constants.IconType.PDF, 'PDF document'];
28
+ return {
29
+ icon: _constants.IconType.PDF,
30
+ label: 'PDF document'
31
+ };
23
32
 
24
33
  case 'application/vnd.oasis.opendocument.presentation':
25
34
  case 'application/vnd.apple.keynote':
26
- return [_constants.IconType.Presentation, 'Presentation'];
35
+ return {
36
+ icon: _constants.IconType.Presentation,
37
+ label: 'Presentation'
38
+ };
27
39
 
28
40
  case 'application/vnd.oasis.opendocument.spreadsheet':
29
41
  case 'application/vnd.apple.numbers':
30
- return [_constants.IconType.Spreadsheet, 'Spreadsheet'];
42
+ return {
43
+ icon: _constants.IconType.Spreadsheet,
44
+ label: 'Spreadsheet'
45
+ };
31
46
  // Google Drive
32
47
 
33
48
  case 'application/vnd.google-apps.document':
34
- return [_constants.IconType.GoogleDocs, 'Google Docs'];
49
+ return {
50
+ icon: _constants.IconType.GoogleDocs,
51
+ label: 'Google Docs'
52
+ };
35
53
 
36
54
  case 'application/vnd.google-apps.form':
37
- return [_constants.IconType.GoogleForms, 'Google Form'];
55
+ return {
56
+ icon: _constants.IconType.GoogleForms,
57
+ label: 'Google Form'
58
+ };
38
59
 
39
60
  case 'application/vnd.google-apps.spreadsheet':
40
- return [_constants.IconType.GoogleSheets, 'Google Sheets'];
61
+ return {
62
+ icon: _constants.IconType.GoogleSheets,
63
+ label: 'Google Sheets'
64
+ };
41
65
 
42
66
  case 'application/vnd.google-apps.presentation':
43
- return [_constants.IconType.GoogleSlides, 'Google Slides'];
67
+ return {
68
+ icon: _constants.IconType.GoogleSlides,
69
+ label: 'Google Slides'
70
+ };
44
71
  // Microsoft
45
72
 
46
73
  case 'application/vnd.ms-excel':
47
74
  case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
48
- return [_constants.IconType.MSExcel, 'Excel spreadsheet'];
75
+ return {
76
+ icon: _constants.IconType.MSExcel,
77
+ label: 'Excel spreadsheet'
78
+ };
49
79
 
50
80
  case 'application/vnd.ms-powerpoint':
51
81
  case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
52
- return [_constants.IconType.MSPowerpoint, 'PowerPoint presentation'];
82
+ return {
83
+ icon: _constants.IconType.MSPowerpoint,
84
+ label: 'PowerPoint presentation'
85
+ };
53
86
 
54
87
  case 'application/msword':
55
88
  case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
56
- return [_constants.IconType.MSWord, 'Word document'];
89
+ return {
90
+ icon: _constants.IconType.MSWord,
91
+ label: 'Word document'
92
+ };
57
93
 
58
94
  case 'image/png':
59
95
  case 'image/jpeg':
60
96
  case 'image/bmp':
61
97
  case 'image/webp':
62
98
  case 'image/svg+xml':
63
- return [_constants.IconType.Image, 'Image'];
99
+ return {
100
+ icon: _constants.IconType.Image,
101
+ label: 'Image'
102
+ };
64
103
 
65
104
  case 'image/gif':
66
- return [_constants.IconType.GIF, 'GIF'];
105
+ return {
106
+ icon: _constants.IconType.GIF,
107
+ label: 'GIF'
108
+ };
67
109
 
68
110
  case 'audio/midi':
69
111
  case 'audio/mpeg':
70
112
  case 'audio/webm':
71
113
  case 'audio/ogg':
72
114
  case 'audio/wav':
73
- return [_constants.IconType.Audio, 'Audio'];
115
+ return {
116
+ icon: _constants.IconType.Audio,
117
+ label: 'Audio'
118
+ };
74
119
 
75
120
  case 'video/mp4':
76
121
  case 'video/quicktime':
@@ -79,13 +124,19 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
79
124
  case 'video/ogg':
80
125
  case 'video/x-ms-wmv':
81
126
  case 'video/x-msvideo':
82
- return [_constants.IconType.Video, 'Video'];
127
+ return {
128
+ icon: _constants.IconType.Video,
129
+ label: 'Video'
130
+ };
83
131
  // Others
84
132
 
85
133
  case 'text/css':
86
134
  case 'text/html':
87
135
  case 'application/javascript':
88
- return [_constants.IconType.Code, 'Source Code'];
136
+ return {
137
+ icon: _constants.IconType.Code,
138
+ label: 'Source Code'
139
+ };
89
140
 
90
141
  case 'application/zip':
91
142
  case 'application/x-tar':
@@ -93,19 +144,34 @@ var extractFileFormatIcon = function extractFileFormatIcon(fileFormat) {
93
144
  case 'application/x-7z-compressed':
94
145
  case 'application/x-apple-diskimage':
95
146
  case 'application/vnd.rar':
96
- return [_constants.IconType.Archive, 'Archive'];
147
+ return {
148
+ icon: _constants.IconType.Archive,
149
+ label: 'Archive'
150
+ };
97
151
 
98
152
  case 'application/dmg':
99
- return [_constants.IconType.Executable, 'Executable'];
153
+ return {
154
+ icon: _constants.IconType.Executable,
155
+ label: 'Executable'
156
+ };
100
157
 
101
158
  case 'application/sketch':
102
- return [_constants.IconType.Sketch, 'Sketch'];
159
+ return {
160
+ icon: _constants.IconType.Sketch,
161
+ label: 'Sketch'
162
+ };
103
163
 
104
164
  case 'application/octet-stream':
105
- return [_constants.IconType.Generic, 'Binary file'];
165
+ return {
166
+ icon: _constants.IconType.Generic,
167
+ label: 'Binary file'
168
+ };
106
169
 
107
170
  case 'application/invision.prototype':
108
- return [_constants.IconType.Generic, 'Prototype'];
171
+ return {
172
+ icon: _constants.IconType.Generic,
173
+ label: 'Prototype'
174
+ };
109
175
 
110
176
  default:
111
177
  return undefined;
@@ -12,32 +12,59 @@ var extractJiraTaskIcon = function extractJiraTaskIcon(taskType) {
12
12
 
13
13
  switch (taskType) {
14
14
  case 'JiraBug':
15
- return [_constants.IconType.Bug, label];
15
+ return {
16
+ icon: _constants.IconType.Bug,
17
+ label: label
18
+ };
16
19
 
17
20
  case 'JiraChange':
18
- return [_constants.IconType.Change, label];
21
+ return {
22
+ icon: _constants.IconType.Change,
23
+ label: label
24
+ };
19
25
 
20
26
  case 'JiraEpic':
21
- return [_constants.IconType.Epic, label];
27
+ return {
28
+ icon: _constants.IconType.Epic,
29
+ label: label
30
+ };
22
31
 
23
32
  case 'JiraIncident':
24
- return [_constants.IconType.Incident, label];
33
+ return {
34
+ icon: _constants.IconType.Incident,
35
+ label: label
36
+ };
25
37
 
26
38
  case 'JiraProblem':
27
- return [_constants.IconType.Problem, label];
39
+ return {
40
+ icon: _constants.IconType.Problem,
41
+ label: label
42
+ };
28
43
 
29
44
  case 'JiraServiceRequest':
30
- return [_constants.IconType.ServiceRequest, label];
45
+ return {
46
+ icon: _constants.IconType.ServiceRequest,
47
+ label: label
48
+ };
31
49
 
32
50
  case 'JiraStory':
33
- return [_constants.IconType.Story, label];
51
+ return {
52
+ icon: _constants.IconType.Story,
53
+ label: label
54
+ };
34
55
 
35
56
  case 'JiraSubTask':
36
- return [_constants.IconType.SubTask, label];
57
+ return {
58
+ icon: _constants.IconType.SubTask,
59
+ label: label
60
+ };
37
61
 
38
62
  case 'JiraTask':
39
63
  default:
40
- return [_constants.IconType.Task, label];
64
+ return {
65
+ icon: _constants.IconType.Task,
66
+ label: label
67
+ };
41
68
  }
42
69
  };
43
70
 
@@ -33,7 +33,10 @@ var extractTask = function extractTask(data, label) {
33
33
  url = _ref.icon;
34
34
 
35
35
  var taskType = id === null || id === void 0 ? void 0 : id.split('#').pop();
36
- var taskIcon = url ? [undefined, label, url] : undefined;
36
+ var taskIcon = url ? {
37
+ label: label,
38
+ url: url
39
+ } : undefined;
37
40
  return {
38
41
  taskType: taskType,
39
42
  taskIcon: taskIcon
@@ -65,7 +68,7 @@ var extractJsonldDataIcon = function extractJsonldDataIcon(data) {
65
68
  var type = extractType(data);
66
69
  var urlIcon = (0, _extractUrlIcon.default)(data.icon, label);
67
70
  var provider = generator === null || generator === void 0 ? void 0 : generator['@id'];
68
- var providerIcon = (0, _extractProviderIcon.default)(provider, generator === null || generator === void 0 ? void 0 : generator.icon, label);
71
+ var providerIcon = (0, _extractProviderIcon.default)(data);
69
72
 
70
73
  switch (type) {
71
74
  case 'Document':
@@ -94,25 +97,46 @@ var extractJsonldDataIcon = function extractJsonldDataIcon(data) {
94
97
  taskType = _extractTask.taskType,
95
98
  taskIcon = _extractTask.taskIcon;
96
99
 
97
- return taskType === 'JiraCustomTaskType' ? taskIcon || urlIcon || providerIcon || [_constants2.IconType.Task, taskLabel] : (0, _extractJiraTaskIcon.default)(taskType, taskLabel);
100
+ return taskType === 'JiraCustomTaskType' ? taskIcon || urlIcon || providerIcon || {
101
+ icon: _constants2.IconType.Task,
102
+ label: taskLabel
103
+ } : (0, _extractJiraTaskIcon.default)(taskType, taskLabel);
98
104
  }
99
105
 
100
- return [_constants2.IconType.Task, taskLabel];
106
+ return {
107
+ icon: _constants2.IconType.Task,
108
+ label: taskLabel
109
+ };
101
110
 
102
111
  case 'atlassian:Project':
103
- return urlIcon || [_constants2.IconType.Project, label || 'Project'];
112
+ return urlIcon || {
113
+ icon: _constants2.IconType.Project,
114
+ label: label || 'Project'
115
+ };
104
116
 
105
117
  case 'atlassian:SourceCodeCommit':
106
- return [_constants2.IconType.Commit, label || 'Commit'];
118
+ return {
119
+ icon: _constants2.IconType.Commit,
120
+ label: label || 'Commit'
121
+ };
107
122
 
108
123
  case 'atlassian:SourceCodePullRequest':
109
- return [_constants2.IconType.PullRequest, label || 'Pull request'];
124
+ return {
125
+ icon: _constants2.IconType.PullRequest,
126
+ label: label || 'Pull request'
127
+ };
110
128
 
111
129
  case 'atlassian:SourceCodeReference':
112
- return [_constants2.IconType.Branch, label || 'Reference'];
130
+ return {
131
+ icon: _constants2.IconType.Branch,
132
+ label: label || 'Reference'
133
+ };
113
134
 
114
135
  case 'atlassian:SourceCodeRepository':
115
- return [_constants2.IconType.Repo, label || 'Repository'];
136
+ return {
137
+ icon: _constants2.IconType.Repo,
138
+ label: label || 'Repository'
139
+ };
116
140
 
117
141
  default:
118
142
  return providerIcon;
@@ -13,13 +13,30 @@ var _constants2 = require("../../../constants");
13
13
 
14
14
  var _extractUrlIcon = _interopRequireDefault(require("./extract-url-icon"));
15
15
 
16
- var extractProviderIcon = function extractProviderIcon(provider, icon, label) {
16
+ var _primitives = require("../../common/primitives");
17
+
18
+ var extractProviderIcon = function extractProviderIcon(data) {
19
+ if (!data) {
20
+ return undefined;
21
+ }
22
+
23
+ var generator = data.generator;
24
+ var provider = generator === null || generator === void 0 ? void 0 : generator['@id'];
25
+ var icon = generator === null || generator === void 0 ? void 0 : generator.icon;
26
+ var label = (generator === null || generator === void 0 ? void 0 : generator.name) || (0, _primitives.extractTitle)(data);
27
+
17
28
  if (provider === _constants.CONFLUENCE_GENERATOR_ID) {
18
- return [_constants2.IconType.Confluence, label || 'Confluence'];
29
+ return {
30
+ icon: _constants2.IconType.Confluence,
31
+ label: label || 'Confluence'
32
+ };
19
33
  }
20
34
 
21
35
  if (provider === _constants.JIRA_GENERATOR_ID) {
22
- return [_constants2.IconType.Jira, label || 'Jira'];
36
+ return {
37
+ icon: _constants2.IconType.Jira,
38
+ label: label || 'Jira'
39
+ };
23
40
  }
24
41
 
25
42
  return (0, _extractUrlIcon.default)(icon, label);
@@ -9,7 +9,10 @@ var _utils = require("../../common/utils");
9
9
 
10
10
  var extractUrlIcon = function extractUrlIcon(icon, label) {
11
11
  var url = icon && (0, _utils.extractUrlFromIconJsonLd)(icon);
12
- return url ? [undefined, label, url] : undefined;
12
+ return url ? {
13
+ label: label,
14
+ url: url
15
+ } : undefined;
13
16
  };
14
17
 
15
18
  var _default = extractUrlIcon;
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.extractLinkIcon = exports.extractErrorIcon = void 0;
9
9
 
10
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
12
12
  var _extractJsonldDataIcon = _interopRequireDefault(require("./extract-jsonld-data-icon"));
13
13
 
@@ -17,22 +17,16 @@ var _constants = require("../../../constants");
17
17
 
18
18
  var _extractIconRenderer = _interopRequireDefault(require("./extract-icon-renderer"));
19
19
 
20
- var extractLinkIcon = function extractLinkIcon(response, renderers) {
21
- var data = response.data;
20
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
22
21
 
23
- var _ref = (0, _extractJsonldDataIcon.default)(data) || [],
24
- _ref2 = (0, _slicedToArray2.default)(_ref, 3),
25
- icon = _ref2[0],
26
- label = _ref2[1],
27
- url = _ref2[2];
22
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
28
23
 
24
+ var extractLinkIcon = function extractLinkIcon(response, renderers) {
25
+ var data = response.data;
29
26
  var render = (0, _extractIconRenderer.default)(data, renderers);
30
- return {
31
- icon: icon,
32
- label: label,
33
- render: render,
34
- url: url
35
- };
27
+ return _objectSpread(_objectSpread({}, (0, _extractJsonldDataIcon.default)(data)), {}, {
28
+ render: render
29
+ });
36
30
  };
37
31
 
38
32
  exports.extractLinkIcon = extractLinkIcon;
@@ -41,13 +35,10 @@ var extractErrorIcon = function extractErrorIcon(response, status) {
41
35
  // Try to get provider icon first.
42
36
  if (response) {
43
37
  var data = response.data;
44
- var generator = data.generator;
45
- var provider = generator === null || generator === void 0 ? void 0 : generator['@id'];
46
38
 
47
- var _ref3 = (0, _extractProviderIcon.default)(provider, generator === null || generator === void 0 ? void 0 : generator.icon) || [],
48
- _ref4 = (0, _slicedToArray2.default)(_ref3, 3),
49
- icon = _ref4[0],
50
- url = _ref4[2];
39
+ var _ref = (0, _extractProviderIcon.default)(data) || {},
40
+ icon = _ref.icon,
41
+ url = _ref.url;
51
42
 
52
43
  if (icon || url) {
53
44
  return {
@@ -25,6 +25,8 @@ var _extractDateCreated = require("../common/date/extractDateCreated");
25
25
 
26
26
  var _extractPriority = _interopRequireDefault(require("./extract-priority"));
27
27
 
28
+ var _extractProviderIcon = _interopRequireDefault(require("./icon/extract-provider-icon"));
29
+
28
30
  var extractFlexibleUiContext = function extractFlexibleUiContext(response, renderers) {
29
31
  if (!response) {
30
32
  return undefined;
@@ -43,9 +45,12 @@ var extractFlexibleUiContext = function extractFlexibleUiContext(response, rende
43
45
  modifiedOn: (0, _extractDateUpdated.extractDateUpdated)(data),
44
46
  priority: (0, _extractPriority.default)(data),
45
47
  programmingLanguage: (0, _utils.extractProgrammingLanguage)(data),
48
+ snippet: (0, _primitives.extractSummary)(data) || undefined,
49
+ // Explicitly set here to remove an empty string
46
50
  state: (0, _lozenge.extractLozenge)(data),
47
51
  subscriberCount: (0, _utils.extractSubscriberCount)(data),
48
52
  title: (0, _primitives.extractTitle)(data) || url,
53
+ provider: (0, _extractProviderIcon.default)(data),
49
54
  url: url
50
55
  };
51
56
  };
@@ -19,8 +19,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
19
19
 
20
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
21
 
22
- var isFlexibleUiCard = function isFlexibleUiCard(appearance, children) {
23
- if ((appearance === 'inline' || appearance === 'block') && children && _react.default.Children.toArray(children).some(function (child) {
22
+ var isFlexibleUiCard = function isFlexibleUiCard(children) {
23
+ if (children && _react.default.Children.toArray(children).some(function (child) {
24
24
  return isFlexibleUiBlock(child);
25
25
  })) {
26
26
  return true;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "17.3.0",
3
+ "version": "17.4.1",
4
4
  "sideEffects": false
5
5
  }
@@ -109,7 +109,7 @@ function CardWithUrlContent(_ref) {
109
109
  throw error;
110
110
  }
111
111
 
112
- if ((0, _flexible.isFlexibleUiCard)(appearance, children)) {
112
+ if ((0, _flexible.isFlexibleUiCard)(children)) {
113
113
  return /*#__PURE__*/_react.default.createElement(_FlexibleCard.default, {
114
114
  cardState: state,
115
115
  onAuthorize: services.length && handleAuthorize || undefined,