@atlaskit/smart-card 17.3.1 → 17.4.2

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 (90) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/constants.js +63 -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 +5 -0
  11. package/dist/cjs/index.js +6 -0
  12. package/dist/cjs/utils/flexible.js +2 -2
  13. package/dist/cjs/utils/token.js +1 -0
  14. package/dist/cjs/version.json +1 -1
  15. package/dist/cjs/view/CardWithUrl/component.js +1 -1
  16. package/dist/cjs/view/FlexibleCard/components/blocks/index.js +10 -2
  17. package/dist/cjs/view/FlexibleCard/components/blocks/snippet-block/index.js +51 -0
  18. package/dist/cjs/view/FlexibleCard/components/blocks/snippet-block/types.js +5 -0
  19. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +15 -3
  20. package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -0
  21. package/dist/cjs/view/FlexibleCard/components/elements/badge/index.js +2 -4
  22. package/dist/cjs/view/FlexibleCard/components/elements/index.js +6 -2
  23. package/dist/cjs/view/FlexibleCard/components/elements/text/index.js +9 -3
  24. package/dist/cjs/view/FlexibleCard/components/elements/utils.js +20 -0
  25. package/dist/cjs/view/FlexibleCard/components/utils.js +15 -1
  26. package/dist/es2019/constants.js +53 -0
  27. package/dist/es2019/extractors/flexible/icon/extract-document-type-icon.js +28 -7
  28. package/dist/es2019/extractors/flexible/icon/extract-file-formatIcon.js +88 -22
  29. package/dist/es2019/extractors/flexible/icon/extract-jira-task-icon.js +36 -9
  30. package/dist/es2019/extractors/flexible/icon/extract-jsonld-data-icon.js +33 -9
  31. package/dist/es2019/extractors/flexible/icon/extract-provider-icon.js +19 -3
  32. package/dist/es2019/extractors/flexible/icon/extract-url-icon.js +4 -1
  33. package/dist/es2019/extractors/flexible/icon/index.js +6 -9
  34. package/dist/es2019/extractors/flexible/index.js +5 -1
  35. package/dist/es2019/index.js +1 -1
  36. package/dist/es2019/utils/flexible.js +2 -2
  37. package/dist/es2019/utils/token.js +1 -0
  38. package/dist/es2019/version.json +1 -1
  39. package/dist/es2019/view/CardWithUrl/component.js +1 -1
  40. package/dist/es2019/view/FlexibleCard/components/blocks/index.js +3 -2
  41. package/dist/es2019/view/FlexibleCard/components/blocks/snippet-block/index.js +29 -0
  42. package/dist/es2019/view/FlexibleCard/components/blocks/snippet-block/types.js +1 -0
  43. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +28 -4
  44. package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -0
  45. package/dist/es2019/view/FlexibleCard/components/elements/badge/index.js +2 -4
  46. package/dist/es2019/view/FlexibleCard/components/elements/index.js +3 -1
  47. package/dist/es2019/view/FlexibleCard/components/elements/text/index.js +7 -4
  48. package/dist/es2019/view/FlexibleCard/components/elements/utils.js +21 -0
  49. package/dist/es2019/view/FlexibleCard/components/utils.js +11 -0
  50. package/dist/esm/constants.js +53 -0
  51. package/dist/esm/extractors/flexible/icon/extract-document-type-icon.js +28 -7
  52. package/dist/esm/extractors/flexible/icon/extract-file-formatIcon.js +88 -22
  53. package/dist/esm/extractors/flexible/icon/extract-jira-task-icon.js +36 -9
  54. package/dist/esm/extractors/flexible/icon/extract-jsonld-data-icon.js +33 -9
  55. package/dist/esm/extractors/flexible/icon/extract-provider-icon.js +19 -3
  56. package/dist/esm/extractors/flexible/icon/extract-url-icon.js +4 -1
  57. package/dist/esm/extractors/flexible/icon/index.js +12 -20
  58. package/dist/esm/extractors/flexible/index.js +5 -1
  59. package/dist/esm/index.js +1 -1
  60. package/dist/esm/utils/flexible.js +2 -2
  61. package/dist/esm/utils/token.js +1 -0
  62. package/dist/esm/version.json +1 -1
  63. package/dist/esm/view/CardWithUrl/component.js +1 -1
  64. package/dist/esm/view/FlexibleCard/components/blocks/index.js +3 -2
  65. package/dist/esm/view/FlexibleCard/components/blocks/snippet-block/index.js +34 -0
  66. package/dist/esm/view/FlexibleCard/components/blocks/snippet-block/types.js +1 -0
  67. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +14 -4
  68. package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -0
  69. package/dist/esm/view/FlexibleCard/components/elements/badge/index.js +2 -4
  70. package/dist/esm/view/FlexibleCard/components/elements/index.js +3 -1
  71. package/dist/esm/view/FlexibleCard/components/elements/text/index.js +10 -3
  72. package/dist/esm/view/FlexibleCard/components/elements/utils.js +19 -0
  73. package/dist/esm/view/FlexibleCard/components/utils.js +11 -0
  74. package/dist/types/__fixtures__/flexible-ui-data-context.d.ts +3 -0
  75. package/dist/types/constants.d.ts +54 -1
  76. package/dist/types/extractors/flexible/icon/extract-provider-icon.d.ts +1 -1
  77. package/dist/types/extractors/flexible/icon/index.d.ts +3 -3
  78. package/dist/types/extractors/flexible/icon/types.d.ts +5 -1
  79. package/dist/types/index.d.ts +1 -1
  80. package/dist/types/state/flexible-ui-context/types.d.ts +4 -2
  81. package/dist/types/utils/flexible.d.ts +1 -2
  82. package/dist/types/utils/token.d.ts +1 -0
  83. package/dist/types/view/FlexibleCard/components/blocks/index.d.ts +2 -1
  84. package/dist/types/view/FlexibleCard/components/blocks/snippet-block/index.d.ts +4 -0
  85. package/dist/types/view/FlexibleCard/components/blocks/snippet-block/types.d.ts +4 -0
  86. package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +4 -2
  87. package/dist/types/view/FlexibleCard/components/elements/index.d.ts +2 -0
  88. package/dist/types/view/FlexibleCard/components/elements/text/types.d.ts +2 -0
  89. package/dist/types/view/FlexibleCard/components/utils.d.ts +1 -0
  90. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 17.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c8285bdcde4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c8285bdcde4) - Flexible UI: Add SnippetBlock
8
+
9
+ ## 17.4.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`ecf130ca7d8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ecf130ca7d8) - Flexible UI: Remove check on Smart Links appearance
14
+
15
+ ## 17.4.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [`392b7d2b98f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/392b7d2b98f) - Add Provider element
20
+
21
+ ## 17.3.2
22
+
23
+ ### Patch Changes
24
+
25
+ - [`02ed34221ef`](https://bitbucket.org/atlassian/atlassian-frontend/commits/02ed34221ef) - Flexible UI: Add Snippet element
26
+
3
27
  ## 17.3.1
4
28
 
5
29
  ### Patch Changes
@@ -4,7 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.SmartLinkWidth = exports.SmartLinkTheme = exports.SmartLinkStatus = exports.SmartLinkSize = exports.SmartLinkPosition = exports.SmartLinkDirection = exports.SmartLinkAlignment = exports.IconType = exports.ElementName = exports.ActionName = void 0;
7
+
8
+ /**
9
+ * The alignment of Flexible UI component.
10
+ */
7
11
  var SmartLinkAlignment;
12
+ /**
13
+ * The direction of Flexible UI components. It establish the main-axis
14
+ * or how the child components laid out inside the parent component.
15
+ * Similar to flex's flex-direction concept.
16
+ */
17
+
8
18
  exports.SmartLinkAlignment = SmartLinkAlignment;
9
19
 
10
20
  (function (SmartLinkAlignment) {
@@ -13,6 +23,11 @@ exports.SmartLinkAlignment = SmartLinkAlignment;
13
23
  })(SmartLinkAlignment || (exports.SmartLinkAlignment = SmartLinkAlignment = {}));
14
24
 
15
25
  var SmartLinkDirection;
26
+ /**
27
+ * The positioning of the component within the parent component.
28
+ * Similar to flex's align-items or align-self concept.
29
+ */
30
+
16
31
  exports.SmartLinkDirection = SmartLinkDirection;
17
32
 
18
33
  (function (SmartLinkDirection) {
@@ -21,6 +36,12 @@ exports.SmartLinkDirection = SmartLinkDirection;
21
36
  })(SmartLinkDirection || (exports.SmartLinkDirection = SmartLinkDirection = {}));
22
37
 
23
38
  var SmartLinkPosition;
39
+ /**
40
+ * The sizing options of the Flexible UI component. Every component
41
+ * has or inherits the sizing props. Implementation varies
42
+ * as per component.
43
+ */
44
+
24
45
  exports.SmartLinkPosition = SmartLinkPosition;
25
46
 
26
47
  (function (SmartLinkPosition) {
@@ -29,6 +50,10 @@ exports.SmartLinkPosition = SmartLinkPosition;
29
50
  })(SmartLinkPosition || (exports.SmartLinkPosition = SmartLinkPosition = {}));
30
51
 
31
52
  var SmartLinkSize;
53
+ /**
54
+ * Smart Links link request status
55
+ */
56
+
32
57
  exports.SmartLinkSize = SmartLinkSize;
33
58
 
34
59
  (function (SmartLinkSize) {
@@ -39,6 +64,11 @@ exports.SmartLinkSize = SmartLinkSize;
39
64
  })(SmartLinkSize || (exports.SmartLinkSize = SmartLinkSize = {}));
40
65
 
41
66
  var SmartLinkStatus;
67
+ /**
68
+ * Flexible UI theme available on the Card level.
69
+ * This determine the styling of the link.
70
+ */
71
+
42
72
  exports.SmartLinkStatus = SmartLinkStatus;
43
73
 
44
74
  (function (SmartLinkStatus) {
@@ -53,6 +83,12 @@ exports.SmartLinkStatus = SmartLinkStatus;
53
83
  })(SmartLinkStatus || (exports.SmartLinkStatus = SmartLinkStatus = {}));
54
84
 
55
85
  var SmartLinkTheme;
86
+ /**
87
+ * Determines whether the container size will fit to the content
88
+ * or expand to the available width or the parent component.
89
+ * Similar to flex's flex-grow concept.
90
+ */
91
+
56
92
  exports.SmartLinkTheme = SmartLinkTheme;
57
93
 
58
94
  (function (SmartLinkTheme) {
@@ -61,6 +97,23 @@ exports.SmartLinkTheme = SmartLinkTheme;
61
97
  })(SmartLinkTheme || (exports.SmartLinkTheme = SmartLinkTheme = {}));
62
98
 
63
99
  var SmartLinkWidth;
100
+ /**
101
+ * Flexible UI element name - each reflecting the link data its represented.
102
+ * When adding an element...
103
+ * 1) Create base element if it doesn't already existed.
104
+ * Base element are inside src/view/FlexibleCard/components/elements.
105
+ * E.g. Badge,DateTime, Icon, Lozenge, etc.
106
+ * 2) Update FlexibleUiContext with the new prop for data representing
107
+ * the element, preferably with the same name as the element itself.
108
+ * (src/state/flexible-ui-context/types.ts)
109
+ * 3) Update Flexible UI extractor (src/extractors/flexible/index.ts)
110
+ * 4) Set base element and data mapping
111
+ * (src/view/FlexibleCard/components/elements/utils.tsx)
112
+ * 5) Create element. (src/view/FlexibleCard/components/elements/index.ts)
113
+ * 6) Update element ElementDisplaySchema for inline/block display
114
+ * (src/view/FlexibleCard/components/blocks/utils.tsx)
115
+ */
116
+
64
117
  exports.SmartLinkWidth = SmartLinkWidth;
65
118
 
66
119
  (function (SmartLinkWidth) {
@@ -69,6 +122,10 @@ exports.SmartLinkWidth = SmartLinkWidth;
69
122
  })(SmartLinkWidth || (exports.SmartLinkWidth = SmartLinkWidth = {}));
70
123
 
71
124
  var ElementName;
125
+ /**
126
+ * Flexible UI action (button)
127
+ */
128
+
72
129
  exports.ElementName = ElementName;
73
130
 
74
131
  (function (ElementName) {
@@ -82,12 +139,18 @@ exports.ElementName = ElementName;
82
139
  ElementName["ModifiedOn"] = "ModifiedOn";
83
140
  ElementName["Priority"] = "Priority";
84
141
  ElementName["ProgrammingLanguage"] = "ProgrammingLanguage";
142
+ ElementName["Snippet"] = "Snippet";
85
143
  ElementName["State"] = "State";
86
144
  ElementName["SubscriberCount"] = "SubscriberCount";
87
145
  ElementName["Title"] = "Title";
146
+ ElementName["Provider"] = "Provider";
88
147
  })(ElementName || (exports.ElementName = ElementName = {}));
89
148
 
90
149
  var ActionName;
150
+ /**
151
+ * Flexible UI icons - each mapped to AK icons.
152
+ */
153
+
91
154
  exports.ActionName = ActionName;
92
155
 
93
156
  (function (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
  };