@atlaskit/smart-card 19.1.18 → 19.1.19

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 (29) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/constants.js +2 -1
  3. package/dist/cjs/extractors/flexible/index.js +3 -0
  4. package/dist/cjs/extractors/flexible/latest-commit/index.js +21 -0
  5. package/dist/cjs/version.json +1 -1
  6. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +1 -1
  7. package/dist/cjs/view/FlexibleCard/components/elements/index.js +8 -2
  8. package/dist/cjs/view/FlexibleCard/components/elements/utils.js +6 -0
  9. package/dist/es2019/constants.js +2 -1
  10. package/dist/es2019/extractors/flexible/index.js +2 -0
  11. package/dist/es2019/extractors/flexible/latest-commit/index.js +12 -0
  12. package/dist/es2019/version.json +1 -1
  13. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +2 -1
  14. package/dist/es2019/view/FlexibleCard/components/elements/index.js +5 -0
  15. package/dist/es2019/view/FlexibleCard/components/elements/utils.js +7 -0
  16. package/dist/esm/constants.js +2 -1
  17. package/dist/esm/extractors/flexible/index.js +2 -0
  18. package/dist/esm/extractors/flexible/latest-commit/index.js +12 -0
  19. package/dist/esm/version.json +1 -1
  20. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +1 -1
  21. package/dist/esm/view/FlexibleCard/components/elements/index.js +5 -0
  22. package/dist/esm/view/FlexibleCard/components/elements/utils.js +6 -0
  23. package/dist/types/constants.d.ts +3 -2
  24. package/dist/types/extractors/common/__mocks__/jsonld.d.ts +91 -0
  25. package/dist/types/extractors/flexible/latest-commit/index.d.ts +2 -0
  26. package/dist/types/state/flexible-ui-context/types.d.ts +4 -0
  27. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +1 -1
  28. package/dist/types/view/FlexibleCard/components/elements/index.d.ts +4 -0
  29. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 19.1.19
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f7aedc6cf7d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f7aedc6cf7d) - [ux] A new element 'LatestCommit' was added in FlexibleUI for Smart Links. It displays the latest commit of a repository. Version of package 'json-ld-types' was upgraded to 2.4.2
8
+ - Updated dependencies
9
+
3
10
  ## 19.1.18
4
11
 
5
12
  ### Patch Changes
@@ -100,7 +100,7 @@ var SmartLinkWidth;
100
100
  /**
101
101
  * Flexible UI element name - each reflecting the link data its represented.
102
102
  * When adding an element...
103
- * 1) Create base element if it doesn't already existed.
103
+ * 1) Create base element if it doesn't already exist.
104
104
  * Base element are inside src/view/FlexibleCard/components/elements.
105
105
  * E.g. Badge,DateTime, Icon, Lozenge, etc.
106
106
  * 2) Update FlexibleUiContext with the new prop for data representing
@@ -148,6 +148,7 @@ exports.ElementName = ElementName;
148
148
  ElementName["Title"] = "Title";
149
149
  ElementName["ViewCount"] = "ViewCount";
150
150
  ElementName["VoteCount"] = "VoteCount";
151
+ ElementName["LatestCommit"] = "LatestCommit";
151
152
  })(ElementName || (exports.ElementName = ElementName = {}));
152
153
 
153
154
  var ActionName;
@@ -29,6 +29,8 @@ var _extractProviderIcon = _interopRequireDefault(require("./icon/extract-provid
29
29
 
30
30
  var _extractPreview = _interopRequireDefault(require("./extract-preview"));
31
31
 
32
+ var _latestCommit = require("./latest-commit");
33
+
32
34
  var extractFlexibleUiContext = function extractFlexibleUiContext(response, renderers) {
33
35
  if (!response) {
34
36
  return undefined;
@@ -57,6 +59,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext(response, rende
57
59
  subscriberCount: (0, _utils.extractSubscriberCount)(data),
58
60
  title: (0, _primitives.extractTitle)(data) || url,
59
61
  provider: (0, _extractProviderIcon.default)(data),
62
+ latestCommit: (0, _latestCommit.extractLatestCommit)(data),
60
63
  url: url
61
64
  };
62
65
  };
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.extractLatestCommit = void 0;
7
+
8
+ var extractLatestCommit = function extractLatestCommit(jsonLd) {
9
+ var latestCommit = jsonLd['atlassian:latestCommit'];
10
+
11
+ if (typeof latestCommit === 'string') {
12
+ return latestCommit;
13
+ }
14
+
15
+ if (latestCommit) {
16
+ //todo: change the properties to latestCommit.hash when BE is ready
17
+ return latestCommit ? latestCommit.name : undefined;
18
+ }
19
+ };
20
+
21
+ exports.extractLatestCommit = extractLatestCommit;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.18",
3
+ "version": "19.1.19",
4
4
  "sideEffects": false
5
5
  }
@@ -48,7 +48,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
48
48
 
49
49
  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; }
50
50
 
51
- 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.ViewCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ReactCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.VoteCount, ['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.Preview, ['block']), (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);
51
+ 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.ViewCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ReactCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.VoteCount, ['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.Preview, ['block']), (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']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LatestCommit, ['inline']), _ElementDisplaySchema);
52
52
  exports.ElementDisplaySchema = ElementDisplaySchema;
53
53
 
54
54
  var getDirectionStyles = function getDirectionStyles(direction) {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.VoteCount = exports.ViewCount = exports.Title = exports.SubscriberCount = exports.State = exports.Snippet = exports.ReactCount = exports.Provider = exports.ProgrammingLanguage = exports.Priority = exports.Preview = exports.ModifiedOn = exports.ModifiedBy = exports.LinkIcon = exports.CreatedOn = exports.CreatedBy = exports.CommentCount = exports.CollaboratorGroup = exports.AuthorGroup = void 0;
6
+ exports.VoteCount = exports.ViewCount = exports.Title = exports.SubscriberCount = exports.State = exports.Snippet = exports.ReactCount = exports.Provider = exports.ProgrammingLanguage = exports.Priority = exports.Preview = exports.ModifiedOn = exports.ModifiedBy = exports.LinkIcon = exports.LatestCommit = exports.CreatedOn = exports.CreatedBy = exports.CommentCount = exports.CollaboratorGroup = exports.AuthorGroup = void 0;
7
7
 
8
8
  var _utils = require("./utils");
9
9
 
@@ -67,12 +67,18 @@ var CreatedBy = (0, _utils.createElement)(_constants.ElementName.CreatedBy);
67
67
 
68
68
  exports.CreatedBy = CreatedBy;
69
69
  var CreatedOn = (0, _utils.createElement)(_constants.ElementName.CreatedOn);
70
+ /**
71
+ * Creates an element that contains Last Commit hash
72
+ */
73
+
74
+ exports.CreatedOn = CreatedOn;
75
+ var LatestCommit = (0, _utils.createElement)(_constants.ElementName.LatestCommit);
70
76
  /**
71
77
  * Creates a LinkIcon Icon element using the data from LinkIcon in the Flexible UI Context.
72
78
  * @see Icon
73
79
  */
74
80
 
75
- exports.CreatedOn = CreatedOn;
81
+ exports.LatestCommit = LatestCommit;
76
82
  var LinkIcon = (0, _utils.createElement)(_constants.ElementName.LinkIcon);
77
83
  /**
78
84
  * Creates a ModifiedBy Text element using the data from ModifiedBy in the Flexible UI Context.
@@ -110,6 +110,11 @@ var elementMappings = (_elementMappings = {}, (0, _defineProperty2.default)(_ele
110
110
  component: _dateTime.default
111
111
  }), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.Provider, {
112
112
  component: _badge.default
113
+ }), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.LatestCommit, {
114
+ component: _badge.default,
115
+ props: {
116
+ icon: _constants.IconType.Commit
117
+ }
113
118
  }), _elementMappings);
114
119
 
115
120
  var getContextKey = function getContextKey(name) {
@@ -136,6 +141,7 @@ var getData = function getData(elementName, contextKey, context) {
136
141
  case _constants.ElementName.VoteCount:
137
142
  case _constants.ElementName.ProgrammingLanguage:
138
143
  case _constants.ElementName.SubscriberCount:
144
+ case _constants.ElementName.LatestCommit:
139
145
  return toBadgeProps(data);
140
146
 
141
147
  case _constants.ElementName.CreatedBy:
@@ -81,7 +81,7 @@ export let SmartLinkWidth;
81
81
  /**
82
82
  * Flexible UI element name - each reflecting the link data its represented.
83
83
  * When adding an element...
84
- * 1) Create base element if it doesn't already existed.
84
+ * 1) Create base element if it doesn't already exist.
85
85
  * Base element are inside src/view/FlexibleCard/components/elements.
86
86
  * E.g. Badge,DateTime, Icon, Lozenge, etc.
87
87
  * 2) Update FlexibleUiContext with the new prop for data representing
@@ -125,6 +125,7 @@ export let ElementName;
125
125
  ElementName["Title"] = "Title";
126
126
  ElementName["ViewCount"] = "ViewCount";
127
127
  ElementName["VoteCount"] = "VoteCount";
128
+ ElementName["LatestCommit"] = "LatestCommit";
128
129
  })(ElementName || (ElementName = {}));
129
130
 
130
131
  export let ActionName;
@@ -9,6 +9,7 @@ import { extractDateCreated } from '../common/date/extractDateCreated';
9
9
  import extractPriority from './extract-priority';
10
10
  import extractProviderIcon from './icon/extract-provider-icon';
11
11
  import extractPreview from './extract-preview';
12
+ import { extractLatestCommit } from './latest-commit';
12
13
 
13
14
  const extractFlexibleUiContext = (response, renderers) => {
14
15
  if (!response) {
@@ -38,6 +39,7 @@ const extractFlexibleUiContext = (response, renderers) => {
38
39
  subscriberCount: extractSubscriberCount(data),
39
40
  title: extractTitle(data) || url,
40
41
  provider: extractProviderIcon(data),
42
+ latestCommit: extractLatestCommit(data),
41
43
  url
42
44
  };
43
45
  };
@@ -0,0 +1,12 @@
1
+ export const extractLatestCommit = jsonLd => {
2
+ const latestCommit = jsonLd['atlassian:latestCommit'];
3
+
4
+ if (typeof latestCommit === 'string') {
5
+ return latestCommit;
6
+ }
7
+
8
+ if (latestCommit) {
9
+ //todo: change the properties to latestCommit.hash when BE is ready
10
+ return latestCommit ? latestCommit.name : undefined;
11
+ }
12
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.18",
3
+ "version": "19.1.19",
4
4
  "sideEffects": false
5
5
  }
@@ -26,7 +26,8 @@ export const ElementDisplaySchema = {
26
26
  [ElementName.State]: ['inline'],
27
27
  [ElementName.SubscriberCount]: ['inline'],
28
28
  [ElementName.Title]: ['inline'],
29
- [ElementName.Provider]: ['inline']
29
+ [ElementName.Provider]: ['inline'],
30
+ [ElementName.LatestCommit]: ['inline']
30
31
  };
31
32
 
32
33
  const getDirectionStyles = direction => {
@@ -51,6 +51,11 @@ export const CreatedBy = createElement(ElementName.CreatedBy);
51
51
  */
52
52
 
53
53
  export const CreatedOn = createElement(ElementName.CreatedOn);
54
+ /**
55
+ * Creates an element that contains Last Commit hash
56
+ */
57
+
58
+ export const LatestCommit = createElement(ElementName.LatestCommit);
54
59
  /**
55
60
  * Creates a LinkIcon Icon element using the data from LinkIcon in the Flexible UI Context.
56
61
  * @see Icon
@@ -95,6 +95,12 @@ const elementMappings = {
95
95
  },
96
96
  [ElementName.Provider]: {
97
97
  component: Badge
98
+ },
99
+ [ElementName.LatestCommit]: {
100
+ component: Badge,
101
+ props: {
102
+ icon: IconType.Commit
103
+ }
98
104
  }
99
105
  };
100
106
 
@@ -122,6 +128,7 @@ const getData = (elementName, contextKey, context) => {
122
128
  case ElementName.VoteCount:
123
129
  case ElementName.ProgrammingLanguage:
124
130
  case ElementName.SubscriberCount:
131
+ case ElementName.LatestCommit:
125
132
  return toBadgeProps(data);
126
133
 
127
134
  case ElementName.CreatedBy:
@@ -81,7 +81,7 @@ export var SmartLinkWidth;
81
81
  /**
82
82
  * Flexible UI element name - each reflecting the link data its represented.
83
83
  * When adding an element...
84
- * 1) Create base element if it doesn't already existed.
84
+ * 1) Create base element if it doesn't already exist.
85
85
  * Base element are inside src/view/FlexibleCard/components/elements.
86
86
  * E.g. Badge,DateTime, Icon, Lozenge, etc.
87
87
  * 2) Update FlexibleUiContext with the new prop for data representing
@@ -125,6 +125,7 @@ export var ElementName;
125
125
  ElementName["Title"] = "Title";
126
126
  ElementName["ViewCount"] = "ViewCount";
127
127
  ElementName["VoteCount"] = "VoteCount";
128
+ ElementName["LatestCommit"] = "LatestCommit";
128
129
  })(ElementName || (ElementName = {}));
129
130
 
130
131
  export var ActionName;
@@ -9,6 +9,7 @@ import { extractDateCreated } from '../common/date/extractDateCreated';
9
9
  import extractPriority from './extract-priority';
10
10
  import extractProviderIcon from './icon/extract-provider-icon';
11
11
  import extractPreview from './extract-preview';
12
+ import { extractLatestCommit } from './latest-commit';
12
13
 
13
14
  var extractFlexibleUiContext = function extractFlexibleUiContext(response, renderers) {
14
15
  if (!response) {
@@ -38,6 +39,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext(response, rende
38
39
  subscriberCount: extractSubscriberCount(data),
39
40
  title: extractTitle(data) || url,
40
41
  provider: extractProviderIcon(data),
42
+ latestCommit: extractLatestCommit(data),
41
43
  url: url
42
44
  };
43
45
  };
@@ -0,0 +1,12 @@
1
+ export var extractLatestCommit = function extractLatestCommit(jsonLd) {
2
+ var latestCommit = jsonLd['atlassian:latestCommit'];
3
+
4
+ if (typeof latestCommit === 'string') {
5
+ return latestCommit;
6
+ }
7
+
8
+ if (latestCommit) {
9
+ //todo: change the properties to latestCommit.hash when BE is ready
10
+ return latestCommit ? latestCommit.name : undefined;
11
+ }
12
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.18",
3
+ "version": "19.1.19",
4
4
  "sideEffects": false
5
5
  }
@@ -20,7 +20,7 @@ import * as Actions from '../actions';
20
20
  import { isFlexibleUiElement } from '../../../../utils/flexible';
21
21
  import ActionGroup from './action-group';
22
22
  import ElementGroup from './element-group';
23
- export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ViewCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ReactCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.VoteCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LinkIcon, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Preview, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.Priority, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ProgrammingLanguage, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _ElementDisplaySchema);
23
+ export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CollaboratorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CommentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ViewCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ReactCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.VoteCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.CreatedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LinkIcon, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Preview, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.Priority, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ProgrammingLanguage, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LatestCommit, ['inline']), _ElementDisplaySchema);
24
24
 
25
25
  var getDirectionStyles = function getDirectionStyles(direction) {
26
26
  switch (direction) {
@@ -51,6 +51,11 @@ export var CreatedBy = createElement(ElementName.CreatedBy);
51
51
  */
52
52
 
53
53
  export var CreatedOn = createElement(ElementName.CreatedOn);
54
+ /**
55
+ * Creates an element that contains Last Commit hash
56
+ */
57
+
58
+ export var LatestCommit = createElement(ElementName.LatestCommit);
54
59
  /**
55
60
  * Creates a LinkIcon Icon element using the data from LinkIcon in the Flexible UI Context.
56
61
  * @see Icon
@@ -79,6 +79,11 @@ var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings,
79
79
  component: DateTime
80
80
  }), _defineProperty(_elementMappings, ElementName.Provider, {
81
81
  component: Badge
82
+ }), _defineProperty(_elementMappings, ElementName.LatestCommit, {
83
+ component: Badge,
84
+ props: {
85
+ icon: IconType.Commit
86
+ }
82
87
  }), _elementMappings);
83
88
 
84
89
  var getContextKey = function getContextKey(name) {
@@ -105,6 +110,7 @@ var getData = function getData(elementName, contextKey, context) {
105
110
  case ElementName.VoteCount:
106
111
  case ElementName.ProgrammingLanguage:
107
112
  case ElementName.SubscriberCount:
113
+ case ElementName.LatestCommit:
108
114
  return toBadgeProps(data);
109
115
 
110
116
  case ElementName.CreatedBy:
@@ -66,7 +66,7 @@ export declare enum SmartLinkWidth {
66
66
  /**
67
67
  * Flexible UI element name - each reflecting the link data its represented.
68
68
  * When adding an element...
69
- * 1) Create base element if it doesn't already existed.
69
+ * 1) Create base element if it doesn't already exist.
70
70
  * Base element are inside src/view/FlexibleCard/components/elements.
71
71
  * E.g. Badge,DateTime, Icon, Lozenge, etc.
72
72
  * 2) Update FlexibleUiContext with the new prop for data representing
@@ -98,7 +98,8 @@ export declare enum ElementName {
98
98
  SubscriberCount = "SubscriberCount",
99
99
  Title = "Title",
100
100
  ViewCount = "ViewCount",
101
- VoteCount = "VoteCount"
101
+ VoteCount = "VoteCount",
102
+ LatestCommit = "LatestCommit"
102
103
  }
103
104
  /**
104
105
  * Flexible UI action (button)
@@ -134,3 +134,94 @@ export declare const TEST_DOCUMENT_WITH_PREVIEW: {
134
134
  summaryMap?: Record<string, string> | undefined;
135
135
  updated?: string | undefined;
136
136
  };
137
+ export declare const TEST_DATA_WITH_LATEST_COMMIT_OBJ: {
138
+ 'atlassian:latestCommit': {
139
+ '@type': string;
140
+ name: string;
141
+ };
142
+ '@context': JsonLd.Primitives.Context;
143
+ '@type': JsonLd.Primitives.Property<JsonLd.Primitives.ObjectType>;
144
+ 'schema:potentialAction'?: import("schema-dts").DeleteAction | import("schema-dts").ViewAction | import("schema-dts").DownloadAction | import("schema-dts").WatchAction | import("schema-dts").AssignAction | import("schema-dts").CommentAction | import("schema-dts").ReplyAction | import("schema-dts").ShareAction | import("schema-dts").SubscribeAction | (import("schema-dts").DeleteAction | import("schema-dts").ViewAction | import("schema-dts").DownloadAction | import("schema-dts").WatchAction | import("schema-dts").AssignAction | import("schema-dts").CommentAction | import("schema-dts").ReplyAction | import("schema-dts").ShareAction | import("schema-dts").SubscribeAction)[] | undefined;
145
+ 'atlassian:downloadUrl'?: string | undefined;
146
+ 'atlassian:visitUrl'?: string | undefined;
147
+ 'atlassian:titlePrefix'?: JsonLd.Data.TitlePrefix | undefined;
148
+ '@id'?: string | undefined;
149
+ attachment?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
150
+ attributedTo?: JsonLd.Primitives.Property<(JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link) & {
151
+ actor?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
152
+ }> | undefined;
153
+ audience?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
154
+ bcc?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
155
+ bto?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
156
+ cc?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
157
+ context?: JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link | undefined;
158
+ generator?: JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link | undefined;
159
+ icon?: JsonLd.Primitives.Link | JsonLd.Primitives.Image | undefined;
160
+ image?: JsonLd.Primitives.Link | JsonLd.Primitives.Image | undefined;
161
+ inReplyTo?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
162
+ location?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
163
+ oneOf?: (JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link)[] | undefined;
164
+ anyOf?: (JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link)[] | undefined;
165
+ closed?: boolean | JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link | undefined;
166
+ preview?: string | ((JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel) & JsonLd.Primitives.PreviewExtension) | undefined;
167
+ replies?: JsonLd.Primitives.Collection<any> | undefined;
168
+ tag?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
169
+ to?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
170
+ url?: JsonLd.Primitives.Property<JsonLd.Primitives.Link> | undefined;
171
+ content?: string | undefined;
172
+ contentMap?: Record<string, string> | undefined;
173
+ name?: string | undefined;
174
+ nameMap?: Record<string, string> | undefined;
175
+ duration?: string | undefined;
176
+ mediaType?: string | undefined;
177
+ endTime?: string | undefined;
178
+ published?: string | undefined;
179
+ startTime?: string | undefined;
180
+ summary?: string | undefined;
181
+ summaryMap?: Record<string, string> | undefined;
182
+ updated?: string | undefined;
183
+ };
184
+ export declare const TEST_DATA_WITH_LATEST_COMMIT_TEXT: {
185
+ 'atlassian:latestCommit': string;
186
+ '@context': JsonLd.Primitives.Context;
187
+ '@type': JsonLd.Primitives.Property<JsonLd.Primitives.ObjectType>;
188
+ 'schema:potentialAction'?: import("schema-dts").DeleteAction | import("schema-dts").ViewAction | import("schema-dts").DownloadAction | import("schema-dts").WatchAction | import("schema-dts").AssignAction | import("schema-dts").CommentAction | import("schema-dts").ReplyAction | import("schema-dts").ShareAction | import("schema-dts").SubscribeAction | (import("schema-dts").DeleteAction | import("schema-dts").ViewAction | import("schema-dts").DownloadAction | import("schema-dts").WatchAction | import("schema-dts").AssignAction | import("schema-dts").CommentAction | import("schema-dts").ReplyAction | import("schema-dts").ShareAction | import("schema-dts").SubscribeAction)[] | undefined;
189
+ 'atlassian:downloadUrl'?: string | undefined;
190
+ 'atlassian:visitUrl'?: string | undefined;
191
+ 'atlassian:titlePrefix'?: JsonLd.Data.TitlePrefix | undefined;
192
+ '@id'?: string | undefined;
193
+ attachment?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
194
+ attributedTo?: JsonLd.Primitives.Property<(JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link) & {
195
+ actor?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
196
+ }> | undefined;
197
+ audience?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
198
+ bcc?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
199
+ bto?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
200
+ cc?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
201
+ context?: JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link | undefined;
202
+ generator?: JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link | undefined;
203
+ icon?: JsonLd.Primitives.Link | JsonLd.Primitives.Image | undefined;
204
+ image?: JsonLd.Primitives.Link | JsonLd.Primitives.Image | undefined;
205
+ inReplyTo?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
206
+ location?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
207
+ oneOf?: (JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link)[] | undefined;
208
+ anyOf?: (JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link)[] | undefined;
209
+ closed?: boolean | JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link | undefined;
210
+ preview?: string | ((JsonLd.Primitives.Object<any> | JsonLd.Primitives.LinkModel) & JsonLd.Primitives.PreviewExtension) | undefined;
211
+ replies?: JsonLd.Primitives.Collection<any> | undefined;
212
+ tag?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
213
+ to?: JsonLd.Primitives.Property<JsonLd.Primitives.Object<any> | JsonLd.Primitives.Link> | undefined;
214
+ url?: JsonLd.Primitives.Property<JsonLd.Primitives.Link> | undefined;
215
+ content?: string | undefined;
216
+ contentMap?: Record<string, string> | undefined;
217
+ name?: string | undefined;
218
+ nameMap?: Record<string, string> | undefined;
219
+ duration?: string | undefined;
220
+ mediaType?: string | undefined;
221
+ endTime?: string | undefined;
222
+ published?: string | undefined;
223
+ startTime?: string | undefined;
224
+ summary?: string | undefined;
225
+ summaryMap?: Record<string, string> | undefined;
226
+ updated?: string | undefined;
227
+ };
@@ -0,0 +1,2 @@
1
+ import { JsonLd } from 'json-ld-types';
2
+ export declare const extractLatestCommit: (jsonLd: JsonLd.Data.SourceCodeRepository) => string | undefined;
@@ -124,6 +124,10 @@ export declare type FlexibleUiDataContext = {
124
124
  * @see Provider
125
125
  */
126
126
  provider?: Icon;
127
+ /**
128
+ * Contains the information about the latest commit in the repository
129
+ */
130
+ latestCommit?: string;
127
131
  };
128
132
  export declare type Icon = {
129
133
  icon?: IconType;
@@ -38,7 +38,7 @@ export declare type ElementItem = {
38
38
  * The name of the metadata element, used by Flexible UI to determine which
39
39
  * element to render.
40
40
  */
41
- name: ElementName.AuthorGroup | ElementName.CollaboratorGroup | ElementName.CommentCount | ElementName.CreatedBy | ElementName.CreatedOn | ElementName.ModifiedBy | ElementName.ModifiedOn | ElementName.Priority | ElementName.ProgrammingLanguage | ElementName.Provider | ElementName.ReactCount | ElementName.State | ElementName.SubscriberCount | ElementName.ViewCount | ElementName.VoteCount;
41
+ name: ElementName.AuthorGroup | ElementName.CollaboratorGroup | ElementName.CommentCount | ElementName.CreatedBy | ElementName.CreatedOn | ElementName.ModifiedBy | ElementName.ModifiedOn | ElementName.Priority | ElementName.ProgrammingLanguage | ElementName.Provider | ElementName.ReactCount | ElementName.State | ElementName.SubscriberCount | ElementName.ViewCount | ElementName.VoteCount | ElementName.LatestCommit;
42
42
  /**
43
43
  * The size of the element to render.
44
44
  * The elements that support sizing are AuthorGroup and CollaboratorGroup.
@@ -47,6 +47,10 @@ export declare const CreatedBy: import("react").FC<TextProps>;
47
47
  * @see DateTime
48
48
  */
49
49
  export declare const CreatedOn: import("react").FC<DateTimeProps>;
50
+ /**
51
+ * Creates an element that contains Last Commit hash
52
+ */
53
+ export declare const LatestCommit: import("react").FC<BadgeProps>;
50
54
  /**
51
55
  * Creates a LinkIcon Icon element using the data from LinkIcon in the Flexible UI Context.
52
56
  * @see Icon
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "19.1.18",
3
+ "version": "19.1.19",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -50,7 +50,7 @@
50
50
  "@emotion/styled": "^10.0.7",
51
51
  "@formatjs/intl-utils": "^3.8.4",
52
52
  "facepaint": "^1.2.1",
53
- "json-ld-types": "2.4.1",
53
+ "json-ld-types": "2.4.2",
54
54
  "react-error-boundary": "^3.1.3",
55
55
  "react-lazily-render": "^1.2.0",
56
56
  "react-loadable": "^5.1.0",
@@ -58,7 +58,7 @@
58
58
  "uuid": "^3.1.0"
59
59
  },
60
60
  "peerDependencies": {
61
- "@atlaskit/link-provider": "^1.0.1",
61
+ "@atlaskit/link-provider": "^1.0.3",
62
62
  "react": "^16.8.0",
63
63
  "react-dom": "^16.8.0",
64
64
  "react-intl-next": "npm:react-intl@^5.18.1"