@atlaskit/smart-card 17.3.2 → 17.4.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 (54) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/constants.js +1 -0
  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 +3 -0
  11. package/dist/cjs/version.json +1 -1
  12. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +1 -1
  13. package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -0
  14. package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +2 -4
  15. package/dist/cjs/view/FlexibleCard/components/elements/index.js +4 -2
  16. package/dist/cjs/view/FlexibleCard/components/elements/utils.js +2 -0
  17. package/dist/es2019/constants.js +1 -0
  18. package/dist/es2019/extractors/flexible/icon/extract-document-type-icon.js +28 -7
  19. package/dist/es2019/extractors/flexible/icon/extract-file-formatIcon.js +88 -22
  20. package/dist/es2019/extractors/flexible/icon/extract-jira-task-icon.js +36 -9
  21. package/dist/es2019/extractors/flexible/icon/extract-jsonld-data-icon.js +33 -9
  22. package/dist/es2019/extractors/flexible/icon/extract-provider-icon.js +19 -3
  23. package/dist/es2019/extractors/flexible/icon/extract-url-icon.js +4 -1
  24. package/dist/es2019/extractors/flexible/icon/index.js +6 -9
  25. package/dist/es2019/extractors/flexible/index.js +2 -0
  26. package/dist/es2019/version.json +1 -1
  27. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +2 -1
  28. package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -0
  29. package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +2 -4
  30. package/dist/es2019/view/FlexibleCard/components/elements/index.js +2 -1
  31. package/dist/es2019/view/FlexibleCard/components/elements/utils.js +3 -0
  32. package/dist/esm/constants.js +1 -0
  33. package/dist/esm/extractors/flexible/icon/extract-document-type-icon.js +28 -7
  34. package/dist/esm/extractors/flexible/icon/extract-file-formatIcon.js +88 -22
  35. package/dist/esm/extractors/flexible/icon/extract-jira-task-icon.js +36 -9
  36. package/dist/esm/extractors/flexible/icon/extract-jsonld-data-icon.js +33 -9
  37. package/dist/esm/extractors/flexible/icon/extract-provider-icon.js +19 -3
  38. package/dist/esm/extractors/flexible/icon/extract-url-icon.js +4 -1
  39. package/dist/esm/extractors/flexible/icon/index.js +12 -20
  40. package/dist/esm/extractors/flexible/index.js +2 -0
  41. package/dist/esm/version.json +1 -1
  42. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +1 -1
  43. package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -0
  44. package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +2 -4
  45. package/dist/esm/view/FlexibleCard/components/elements/index.js +2 -1
  46. package/dist/esm/view/FlexibleCard/components/elements/utils.js +2 -0
  47. package/dist/types/__fixtures__/flexible-ui-data-context.d.ts +3 -0
  48. package/dist/types/constants.d.ts +2 -1
  49. package/dist/types/extractors/flexible/icon/extract-provider-icon.d.ts +1 -1
  50. package/dist/types/extractors/flexible/icon/index.d.ts +3 -3
  51. package/dist/types/extractors/flexible/icon/types.d.ts +5 -1
  52. package/dist/types/state/flexible-ui-context/types.d.ts +1 -0
  53. package/dist/types/view/FlexibleCard/components/elements/index.d.ts +1 -0
  54. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 17.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`392b7d2b98f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/392b7d2b98f) - Add Provider element
8
+
3
9
  ## 17.3.2
4
10
 
5
11
  ### Patch Changes
@@ -99,6 +99,7 @@ exports.ElementName = ElementName;
99
99
  ElementName["State"] = "State";
100
100
  ElementName["SubscriberCount"] = "SubscriberCount";
101
101
  ElementName["Title"] = "Title";
102
+ ElementName["Provider"] = "Provider";
102
103
  })(ElementName || (exports.ElementName = ElementName = {}));
103
104
 
104
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;
@@ -48,6 +50,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext(response, rende
48
50
  state: (0, _lozenge.extractLozenge)(data),
49
51
  subscriberCount: (0, _utils.extractSubscriberCount)(data),
50
52
  title: (0, _primitives.extractTitle)(data) || url,
53
+ provider: (0, _extractProviderIcon.default)(data),
51
54
  url: url
52
55
  };
53
56
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "17.3.2",
3
+ "version": "17.4.0",
4
4
  "sideEffects": false
5
5
  }
@@ -44,7 +44,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
44
44
 
45
45
  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; }
46
46
 
47
- var ElementDisplaySchema = (_ElementDisplaySchema = {}, (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AuthorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CollaboratorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CommentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LinkIcon, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Priority, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ProgrammingLanguage, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Snippet, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.State, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SubscriberCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Title, ['inline']), _ElementDisplaySchema);
47
+ var ElementDisplaySchema = (_ElementDisplaySchema = {}, (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AuthorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CollaboratorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CommentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.CreatedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LinkIcon, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedBy, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ModifiedOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Priority, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ProgrammingLanguage, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Snippet, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.State, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SubscriberCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Title, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Provider, ['inline']), _ElementDisplaySchema);
48
48
  exports.ElementDisplaySchema = ElementDisplaySchema;
49
49
 
50
50
  var getDirectionStyles = function getDirectionStyles(direction) {
@@ -300,6 +300,8 @@ var AtlaskitIcon = function AtlaskitIcon(_ref3) {
300
300
  case _constants.IconType.Jira:
301
301
  // Logo component has a different prop set from other icon components
302
302
  return /*#__PURE__*/_react.default.createElement(ImportedIcon, {
303
+ "data-testId": testId // Confluence and Jira imports don't have native testId prop
304
+ ,
303
305
  textColor: _colors.N700,
304
306
  iconColor: _colors.B200,
305
307
  iconGradientStart: _colors.B400,
@@ -34,7 +34,7 @@ var iconStyles = (0, _core.css)(_templateObject2 || (_templateObject2 = (0, _tag
34
34
  var labelStyles = (0, _core.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n font-size: 0.75rem;\n line-height: 1rem;\n padding-left: 0.125rem;\n"])), _token.tokens.badgeText);
35
35
  var messageMapper = (_messageMapper = {}, (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityBlocker, _messages.messages.priority_blocker), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityCritical, _messages.messages.priority_critical), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityHigh, _messages.messages.priority_high), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityHighest, _messages.messages.priority_highest), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityLow, _messages.messages.priority_low), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityLowest, _messages.messages.priority_lowest), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityMajor, _messages.messages.priority_major), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityMedium, _messages.messages.priority_medium), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityMinor, _messages.messages.priority_minor), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityTrivial, _messages.messages.priority_trivial), (0, _defineProperty2.default)(_messageMapper, _constants.IconType.PriorityUndefined, _messages.messages.priority_undefined), _messageMapper);
36
36
 
37
- var getFormattedMessageOrLabel = function getFormattedMessageOrLabel(icon, content) {
37
+ var getFormattedMessageFromIcon = function getFormattedMessageFromIcon(icon) {
38
38
  if (icon) {
39
39
  var descriptor = messageMapper[icon];
40
40
 
@@ -44,8 +44,6 @@ var getFormattedMessageOrLabel = function getFormattedMessageOrLabel(icon, conte
44
44
  });
45
45
  }
46
46
  }
47
-
48
- return content;
49
47
  };
50
48
 
51
49
  var renderAtlaskitIcon = function renderAtlaskitIcon(icon, testId) {
@@ -73,7 +71,7 @@ var Badge = function Badge(_ref) {
73
71
  label = _ref.label,
74
72
  _ref$testId = _ref.testId,
75
73
  testId = _ref$testId === void 0 ? 'smart-element-badge' : _ref$testId;
76
- var formattedMessageOrLabel = getFormattedMessageOrLabel(icon, label);
74
+ var formattedMessageOrLabel = getFormattedMessageFromIcon(icon) || label;
77
75
  var badgeIcon = renderAtlaskitIcon(icon, testId) || renderImageIcon(url, testId);
78
76
 
79
77
  if (!formattedMessageOrLabel || !badgeIcon) {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Title = exports.SubscriberCount = exports.State = exports.Snippet = exports.ProgrammingLanguage = exports.Priority = exports.ModifiedOn = exports.ModifiedBy = exports.LinkIcon = exports.CreatedOn = exports.CreatedBy = exports.CommentCount = exports.CollaboratorGroup = exports.AuthorGroup = void 0;
6
+ exports.Title = exports.SubscriberCount = exports.State = exports.Snippet = exports.Provider = exports.ProgrammingLanguage = exports.Priority = exports.ModifiedOn = exports.ModifiedBy = exports.LinkIcon = exports.CreatedOn = exports.CreatedBy = exports.CommentCount = exports.CollaboratorGroup = exports.AuthorGroup = void 0;
7
7
 
8
8
  var _utils = require("./utils");
9
9
 
@@ -39,4 +39,6 @@ exports.State = State;
39
39
  var SubscriberCount = (0, _utils.createElement)(_constants.ElementName.SubscriberCount);
40
40
  exports.SubscriberCount = SubscriberCount;
41
41
  var Title = (0, _utils.createElement)(_constants.ElementName.Title);
42
- exports.Title = Title;
42
+ exports.Title = Title;
43
+ var Provider = (0, _utils.createElement)(_constants.ElementName.Provider);
44
+ exports.Provider = Provider;
@@ -81,6 +81,8 @@ var elementMappings = (_elementMappings = {}, (0, _defineProperty2.default)(_ele
81
81
  component: _dateTime.default
82
82
  }), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.ModifiedOn, {
83
83
  component: _dateTime.default
84
+ }), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.Provider, {
85
+ component: _badge.default
84
86
  }), _elementMappings);
85
87
 
86
88
  var getContextKey = function getContextKey(name) {
@@ -84,6 +84,7 @@ export let ElementName;
84
84
  ElementName["State"] = "State";
85
85
  ElementName["SubscriberCount"] = "SubscriberCount";
86
86
  ElementName["Title"] = "Title";
87
+ ElementName["Provider"] = "Provider";
87
88
  })(ElementName || (ElementName = {}));
88
89
 
89
90
  export let ActionName;