@atlaskit/smart-card 25.5.6 → 25.6.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 (51) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/constants.js +1 -0
  3. package/dist/cjs/extractors/flexible/index.js +1 -0
  4. package/dist/cjs/extractors/flexible/utils.js +8 -1
  5. package/dist/cjs/messages.js +5 -0
  6. package/dist/cjs/version.json +1 -1
  7. package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +27 -21
  8. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +1 -1
  9. package/dist/cjs/view/FlexibleCard/components/elements/index.js +8 -2
  10. package/dist/cjs/view/FlexibleCard/components/elements/utils.js +4 -0
  11. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +1 -3
  12. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +1 -1
  13. package/dist/cjs/view/HoverCard/utils.js +8 -4
  14. package/dist/cjs/view/LinkUrl/LinkWarningModal/hooks/use-link-warning-modal.js +26 -3
  15. package/dist/es2019/constants.js +1 -0
  16. package/dist/es2019/extractors/flexible/index.js +2 -1
  17. package/dist/es2019/extractors/flexible/utils.js +7 -1
  18. package/dist/es2019/messages.js +5 -0
  19. package/dist/es2019/version.json +1 -1
  20. package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +27 -22
  21. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +1 -0
  22. package/dist/es2019/view/FlexibleCard/components/elements/index.js +5 -0
  23. package/dist/es2019/view/FlexibleCard/components/elements/utils.js +5 -0
  24. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +1 -3
  25. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +1 -1
  26. package/dist/es2019/view/HoverCard/utils.js +8 -4
  27. package/dist/es2019/view/LinkUrl/LinkWarningModal/hooks/use-link-warning-modal.js +26 -3
  28. package/dist/esm/constants.js +1 -0
  29. package/dist/esm/extractors/flexible/index.js +2 -1
  30. package/dist/esm/extractors/flexible/utils.js +7 -1
  31. package/dist/esm/messages.js +5 -0
  32. package/dist/esm/version.json +1 -1
  33. package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +27 -22
  34. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +1 -1
  35. package/dist/esm/view/FlexibleCard/components/elements/index.js +5 -0
  36. package/dist/esm/view/FlexibleCard/components/elements/utils.js +4 -0
  37. package/dist/esm/view/HoverCard/components/HoverCardContent.js +1 -3
  38. package/dist/esm/view/HoverCard/components/views/resolved/index.js +1 -1
  39. package/dist/esm/view/HoverCard/utils.js +8 -4
  40. package/dist/esm/view/LinkUrl/LinkWarningModal/hooks/use-link-warning-modal.js +26 -3
  41. package/dist/types/constants.d.ts +1 -0
  42. package/dist/types/extractors/flexible/utils.d.ts +1 -0
  43. package/dist/types/messages.d.ts +1 -1
  44. package/dist/types/state/flexible-ui-context/types.d.ts +6 -0
  45. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +8 -1
  46. package/dist/types/view/FlexibleCard/components/elements/index.d.ts +5 -0
  47. package/dist/types/view/HoverCard/utils.d.ts +1 -1
  48. package/dist/types/view/LinkUrl/LinkWarningModal/hooks/use-link-warning-modal.d.ts +1 -1
  49. package/package.json +5 -5
  50. package/report.api.md +9 -1
  51. package/tmp/api-report-tmp.d.ts +8 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 25.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`eceb32a564f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/eceb32a564f) - [ux] This adds a new Flexible UI attribute, `OwnedBy`, which represents who owns a resource.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
13
+ ## 25.5.7
14
+
15
+ ### Patch Changes
16
+
17
+ - [`4c046475c1b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4c046475c1b) - Fix LinkUrl component: it should not show warning for many cases when it does right now (like relative path comparasion)
18
+
3
19
  ## 25.5.6
4
20
 
5
21
  ### Patch Changes
@@ -119,6 +119,7 @@ exports.ElementName = ElementName;
119
119
  ElementName["LinkIcon"] = "LinkIcon";
120
120
  ElementName["ModifiedBy"] = "ModifiedBy";
121
121
  ElementName["ModifiedOn"] = "ModifiedOn";
122
+ ElementName["OwnedBy"] = "OwnedBy";
122
123
  ElementName["Preview"] = "Preview";
123
124
  ElementName["Priority"] = "Priority";
124
125
  ElementName["ProgrammingLanguage"] = "ProgrammingLanguage";
@@ -41,6 +41,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
41
41
  voteCount: (0, _utils.extractVoteCount)(data),
42
42
  checklistProgress: (0, _utils.extractChecklistProgress)(data),
43
43
  createdBy: (0, _utils.extractCreatedBy)(data),
44
+ ownedBy: (0, _utils.extractOwnedBy)(data),
44
45
  createdOn: (0, _extractors.extractDateCreated)(data),
45
46
  dueOn: (0, _utils.extractDueOn)(data),
46
47
  previewAction: (0, _extractPreviewAction.extractPreviewAction)(response),
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.extractVoteCount = exports.extractViewCount = exports.extractTargetBranch = exports.extractSubscriberCount = exports.extractSourceBranch = exports.extractReactCount = exports.extractProgrammingLanguage = exports.extractModifiedBy = exports.extractDueOn = exports.extractCreatedBy = exports.extractCommentCount = exports.extractChecklistProgress = exports.extractAttachmentCount = void 0;
7
+ exports.extractVoteCount = exports.extractViewCount = exports.extractTargetBranch = exports.extractSubscriberCount = exports.extractSourceBranch = exports.extractReactCount = exports.extractProgrammingLanguage = exports.extractOwnedBy = exports.extractModifiedBy = exports.extractDueOn = exports.extractCreatedBy = exports.extractCommentCount = exports.extractChecklistProgress = exports.extractAttachmentCount = void 0;
8
8
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
9
  var _extractors = require("@atlaskit/linking-common/extractors");
10
10
  var extractLinkName = function extractLinkName(link) {
@@ -35,6 +35,13 @@ var extractVoteCount = function extractVoteCount(data) {
35
35
  return extractValue(data, 'atlassian:voteCount');
36
36
  };
37
37
  exports.extractVoteCount = extractVoteCount;
38
+ var extractOwnedBy = function extractOwnedBy(data) {
39
+ var persons = (0, _extractors.extractPersonOwnedBy)(data);
40
+ if (persons && persons.length) {
41
+ return persons[0].name;
42
+ }
43
+ };
44
+ exports.extractOwnedBy = extractOwnedBy;
38
45
  var extractCreatedBy = function extractCreatedBy(data) {
39
46
  var persons = (0, _extractors.extractPersonCreatedBy)(data);
40
47
  if (persons && persons.length) {
@@ -211,6 +211,11 @@ var messages = (0, _reactIntlNext.defineMessages)({
211
211
  defaultMessage: 'Open link in a new tab',
212
212
  description: 'Click to open link in a new tab'
213
213
  },
214
+ owned_by: {
215
+ id: 'fabric.linking.owned_by',
216
+ defaultMessage: 'Owned by {context}',
217
+ description: 'Indicates the person or entity that owns or maintains the resource.'
218
+ },
214
219
  preview: {
215
220
  id: 'fabric.linking.preview',
216
221
  defaultMessage: 'Full screen view',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.5.6",
3
+ "version": "25.6.0",
4
4
  "sideEffects": false
5
5
  }
@@ -13,6 +13,7 @@ var _titleBlock = _interopRequireDefault(require("../../../FlexibleCard/componen
13
13
  var _blocks = require("../../../FlexibleCard/components/blocks");
14
14
  var _constants = require("../../../../constants");
15
15
  var _uuid = _interopRequireDefault(require("uuid"));
16
+ var _utils = require("../../../../extractors/flexible/utils");
16
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
18
  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; }
18
19
  /**
@@ -21,6 +22,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
21
22
  * @see FlexibleCardProps
22
23
  */
23
24
  var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
25
+ var _cardState$details, _cardState$details2;
24
26
  var id = _ref.id,
25
27
  cardState = _ref.cardState,
26
28
  onClick = _ref.onClick,
@@ -44,6 +46,30 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
44
46
  }),
45
47
  _useState4 = (0, _slicedToArray2.default)(_useState3, 1),
46
48
  analyticsId = _useState4[0];
49
+ var baseMetadata = [{
50
+ name: _constants.ElementName.ModifiedOn
51
+ }, {
52
+ name: _constants.ElementName.AttachmentCount
53
+ }, {
54
+ name: _constants.ElementName.CommentCount
55
+ }, {
56
+ name: _constants.ElementName.ReactCount
57
+ }, {
58
+ name: _constants.ElementName.SubscriberCount
59
+ }, {
60
+ name: _constants.ElementName.ViewCount
61
+ }, {
62
+ name: _constants.ElementName.VoteCount
63
+ }, {
64
+ name: _constants.ElementName.ChecklistProgress
65
+ }, {
66
+ name: _constants.ElementName.DueOn
67
+ }];
68
+ var metadata = cardState !== null && cardState !== void 0 && (_cardState$details = cardState.details) !== null && _cardState$details !== void 0 && _cardState$details.data && (0, _utils.extractOwnedBy)(cardState === null || cardState === void 0 ? void 0 : (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data) ? [{
69
+ name: _constants.ElementName.OwnedBy
70
+ }].concat(baseMetadata) : [{
71
+ name: _constants.ElementName.ModifiedBy
72
+ }].concat(baseMetadata);
47
73
  return /*#__PURE__*/_react.default.createElement(_FlexibleCard.default, {
48
74
  appearance: "block",
49
75
  cardState: cardState,
@@ -65,27 +91,7 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
65
91
  }],
66
92
  hideRetry: true
67
93
  }), /*#__PURE__*/_react.default.createElement(_blocks.MetadataBlock, {
68
- primary: [{
69
- name: _constants.ElementName.ModifiedBy
70
- }, {
71
- name: _constants.ElementName.ModifiedOn
72
- }, {
73
- name: _constants.ElementName.AttachmentCount
74
- }, {
75
- name: _constants.ElementName.CommentCount
76
- }, {
77
- name: _constants.ElementName.ReactCount
78
- }, {
79
- name: _constants.ElementName.SubscriberCount
80
- }, {
81
- name: _constants.ElementName.ViewCount
82
- }, {
83
- name: _constants.ElementName.VoteCount
84
- }, {
85
- name: _constants.ElementName.ChecklistProgress
86
- }, {
87
- name: _constants.ElementName.DueOn
88
- }],
94
+ primary: metadata,
89
95
  maxLines: 1
90
96
  }), /*#__PURE__*/_react.default.createElement(_blocks.SnippetBlock, null), !isPreviewBlockErrored ? /*#__PURE__*/_react.default.createElement(_blocks.PreviewBlock, {
91
97
  placement: _constants.MediaPlacement.Right,
@@ -24,7 +24,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
24
24
  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; }
25
25
  // Determine whether the element can be display as inline/block.
26
26
 
27
- var ElementDisplaySchema = (_ElementDisplaySchema = {}, (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AttachmentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AuthorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ChecklistProgress, ['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.DueOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LatestCommit, ['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.Provider, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Snippet, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SourceBranch, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.State, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SubscriberCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.TargetBranch, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Title, ['inline']), _ElementDisplaySchema);
27
+ var ElementDisplaySchema = (_ElementDisplaySchema = {}, (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AttachmentCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.AuthorGroup, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.ChecklistProgress, ['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.DueOn, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.LatestCommit, ['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.OwnedBy, ['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.Provider, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Snippet, ['block']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SourceBranch, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.State, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.SubscriberCount, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.TargetBranch, ['inline']), (0, _defineProperty2.default)(_ElementDisplaySchema, _constants.ElementName.Title, ['inline']), _ElementDisplaySchema);
28
28
  exports.ElementDisplaySchema = ElementDisplaySchema;
29
29
  var getDirectionStyles = function getDirectionStyles(direction) {
30
30
  switch (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.TargetBranch = exports.SubscriberCount = exports.State = exports.SourceBranch = exports.Snippet = exports.ReactCount = exports.Provider = exports.ProgrammingLanguage = exports.Priority = exports.Preview = exports.ModifiedOn = exports.ModifiedBy = exports.LinkIcon = exports.LatestCommit = exports.DueOn = exports.CreatedOn = exports.CreatedBy = exports.CommentCount = exports.CollaboratorGroup = exports.ChecklistProgress = exports.AuthorGroup = exports.AttachmentCount = void 0;
6
+ exports.VoteCount = exports.ViewCount = exports.Title = exports.TargetBranch = exports.SubscriberCount = exports.State = exports.SourceBranch = exports.Snippet = exports.ReactCount = exports.Provider = exports.ProgrammingLanguage = exports.Priority = exports.Preview = exports.OwnedBy = exports.ModifiedOn = exports.ModifiedBy = exports.LinkIcon = exports.LatestCommit = exports.DueOn = exports.CreatedOn = exports.CreatedBy = exports.CommentCount = exports.CollaboratorGroup = exports.ChecklistProgress = exports.AuthorGroup = exports.AttachmentCount = void 0;
7
7
  var _utils = require("./utils");
8
8
  var _constants = require("../../../../constants");
9
9
  // Attention: Keep the export name and element name the same.
@@ -79,11 +79,17 @@ var ModifiedBy = (0, _utils.createElement)(_constants.ElementName.ModifiedBy);
79
79
  */
80
80
  exports.ModifiedBy = ModifiedBy;
81
81
  var ModifiedOn = (0, _utils.createElement)(_constants.ElementName.ModifiedOn);
82
+ /**
83
+ * Creates a OwnedBy text element using the data from OwnedBy in the Flexible UI Context.
84
+ * @see Text
85
+ */
86
+ exports.ModifiedOn = ModifiedOn;
87
+ var OwnedBy = (0, _utils.createElement)(_constants.ElementName.OwnedBy);
82
88
  /**
83
89
  * Creates a Preview element using the data from Preview in the Flexible UI Context.
84
90
  * @see Preview
85
91
  */
86
- exports.ModifiedOn = ModifiedOn;
92
+ exports.OwnedBy = OwnedBy;
87
93
  var Preview = (0, _utils.createElement)(_constants.ElementName.Preview);
88
94
  /**
89
95
  * Creates a Priority Badge element using the data from Priority in the Flexible UI Context.
@@ -64,6 +64,8 @@ var elementMappings = (_elementMappings = {}, (0, _defineProperty2.default)(_ele
64
64
  }
65
65
  }), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.CreatedBy, {
66
66
  component: _text.default
67
+ }), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.OwnedBy, {
68
+ component: _text.default
67
69
  }), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.CreatedOn, {
68
70
  component: _dateTime.default
69
71
  }), (0, _defineProperty2.default)(_elementMappings, _constants.ElementName.DueOn, {
@@ -136,6 +138,8 @@ var getData = function getData(elementName, contextKey, context) {
136
138
  return toBadgeProps(data);
137
139
  case _constants.ElementName.CreatedBy:
138
140
  return toFormattedTextProps(_messages.messages.created_by, context.createdBy);
141
+ case _constants.ElementName.OwnedBy:
142
+ return toFormattedTextProps(_messages.messages.owned_by, context.ownedBy);
139
143
  case _constants.ElementName.CreatedOn:
140
144
  return toDateTimeProps('created', context.createdOn);
141
145
  case _constants.ElementName.DueOn:
@@ -10,7 +10,6 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
10
10
  var _react = require("@emotion/react");
11
11
  var _shortcut = _interopRequireDefault(require("@atlaskit/icon/glyph/shortcut"));
12
12
  var _copy = _interopRequireDefault(require("@atlaskit/icon/glyph/copy"));
13
- var _extractors = require("@atlaskit/linking-common/extractors");
14
13
  var _analyticsNext = require("@atlaskit/analytics-next");
15
14
  var _react2 = _interopRequireWildcard(require("react"));
16
15
  var _constants = require("../../../constants");
@@ -126,8 +125,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
126
125
  return [getCopyAction(url), getOpenAction(url, analytics, onActionClick)];
127
126
  }, [url, analytics, onActionClick]);
128
127
  var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
129
- var types = data ? (0, _extractors.extractType)(data) : undefined;
130
- var _extractMetadata = (0, _extractMetadata2.extractMetadata)((0, _utils2.getSimulatedMetadata)(extensionKey, types)),
128
+ var _extractMetadata = (0, _extractMetadata2.extractMetadata)((0, _utils2.getSimulatedMetadata)(extensionKey, data)),
131
129
  subtitle = _extractMetadata.subtitle;
132
130
  var titleMaxLines = subtitle && subtitle.length > 0 ? 1 : 2;
133
131
  var titleBlockProps = {
@@ -63,7 +63,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
63
63
  var _useMemo = (0, _react.useMemo)(function () {
64
64
  var types = data ? (0, _extractors.extractType)(data) : undefined;
65
65
  //TODO: EDM-3224 deleted simulated and use real JsonLd
66
- var metadata = (0, _extractMetadata.extractMetadata)((0, _utils.getSimulatedMetadata)(extensionKey, types));
66
+ var metadata = (0, _extractMetadata.extractMetadata)((0, _utils.getSimulatedMetadata)(extensionKey, data));
67
67
  var primary = showActionableElement ? (0, _utils.toActionableMetadata)(onActionClick, extensionKey, types, cardActions, metadata.primary) : metadata.primary;
68
68
  return {
69
69
  primary: primary,
@@ -7,15 +7,18 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.toActionableMetadata = exports.getSimulatedMetadata = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _constants = require("../../constants");
10
+ var _extractors = require("@atlaskit/linking-common/extractors");
11
+ var _utils = require("../../extractors/flexible/utils");
10
12
  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; }
11
13
  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; }
12
14
  var getSimulatedMetadata = function getSimulatedMetadata() {
13
15
  var extensionKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
14
- var types = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
16
+ var data = arguments.length > 1 ? arguments[1] : undefined;
17
+ var types = data ? (0, _extractors.extractType)(data) : undefined;
15
18
  switch (extensionKey) {
16
19
  case 'bitbucket-object-provider':
17
20
  case 'native-bitbucket-object-provider':
18
- if (types.includes('atlassian:SourceCodePullRequest')) {
21
+ if (types !== null && types !== void 0 && types.includes('atlassian:SourceCodePullRequest')) {
19
22
  return {
20
23
  metadata: {
21
24
  primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.ModifiedOn, _constants.ElementName.SubscriberCount, _constants.ElementName.State],
@@ -32,9 +35,10 @@ var getSimulatedMetadata = function getSimulatedMetadata() {
32
35
  }
33
36
  };
34
37
  case 'confluence-object-provider':
38
+ var primaryAttribution = data && (0, _utils.extractOwnedBy)(data) ? _constants.ElementName.OwnedBy : _constants.ElementName.CreatedBy;
35
39
  return {
36
40
  metadata: {
37
- primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.CreatedBy],
41
+ primary: [_constants.ElementName.AuthorGroup, primaryAttribution],
38
42
  secondary: [_constants.ElementName.CommentCount, _constants.ElementName.ReactCount],
39
43
  subtitle: []
40
44
  }
@@ -56,7 +60,7 @@ var getSimulatedMetadata = function getSimulatedMetadata() {
56
60
  }
57
61
  };
58
62
  case 'watermelon-object-provider':
59
- if (types.includes('atlassian:Project')) {
63
+ if (types !== null && types !== void 0 && types.includes('atlassian:Project')) {
60
64
  return {
61
65
  metadata: {
62
66
  primary: [_constants.ElementName.AuthorGroup, _constants.ElementName.ModifiedOn, _constants.ElementName.State, _constants.ElementName.DueOn],
@@ -38,14 +38,37 @@ var useLinkWarningModal = function useLinkWarningModal() {
38
38
  * It checks and warns if a link text is a URL and different from an actual link destination
39
39
  */
40
40
  var checkLinkSafety = function checkLinkSafety(event, href) {
41
- var linkText = event.currentTarget.innerText;
41
+ if (!href) {
42
+ return;
43
+ }
44
+ var anchor = event.currentTarget;
45
+ var linkText = anchor.innerText;
46
+ var normalisedUrlFromLinkText = (0, _url.normalizeUrl)(linkText);
47
+ if (!normalisedUrlFromLinkText) {
48
+ return;
49
+ }
42
50
  var anchorLinkRegex = new RegExp(/^#/im);
43
51
  var isAnchorLink = anchorLinkRegex.test(linkText);
44
52
  if (isAnchorLink) {
45
53
  return;
46
54
  }
47
- var normalisedUrlFromLinkText = (0, _url.normalizeUrl)(linkText);
48
- if (!!normalisedUrlFromLinkText && normalisedUrlFromLinkText !== href) {
55
+ var relativeLinkRegex = new RegExp(/^\//im);
56
+ var isRelativeHrefLink = relativeLinkRegex.test(href);
57
+ if (isRelativeHrefLink) {
58
+ return;
59
+ }
60
+ var hrefUrl = new URL(href, window.location.origin);
61
+ var linkTextUrl = new URL(normalisedUrlFromLinkText, hrefUrl.origin);
62
+ var httpProtocols = ['http:', 'https:'];
63
+ var areProtocolsEquivalent;
64
+ if (httpProtocols.includes(linkTextUrl.protocol) && httpProtocols.includes(hrefUrl.protocol)) {
65
+ var noUserNameAndPassword = !linkTextUrl.username && !linkTextUrl.password && !hrefUrl.username && !hrefUrl.password;
66
+ areProtocolsEquivalent = noUserNameAndPassword;
67
+ } else {
68
+ areProtocolsEquivalent = linkTextUrl.protocol === hrefUrl.protocol;
69
+ }
70
+ var areEquivalentLinks = linkTextUrl.hostname === hrefUrl.hostname && linkTextUrl.pathname === hrefUrl.pathname && linkTextUrl.search === hrefUrl.search && linkTextUrl.username === hrefUrl.username && linkTextUrl.password === hrefUrl.password && areProtocolsEquivalent;
71
+ if (!areEquivalentLinks) {
49
72
  event.preventDefault();
50
73
  setUnsafeLinkText(linkText);
51
74
  href && setUrl(href);
@@ -112,6 +112,7 @@ export let ElementName;
112
112
  ElementName["LinkIcon"] = "LinkIcon";
113
113
  ElementName["ModifiedBy"] = "ModifiedBy";
114
114
  ElementName["ModifiedOn"] = "ModifiedOn";
115
+ ElementName["OwnedBy"] = "OwnedBy";
115
116
  ElementName["Preview"] = "Preview";
116
117
  ElementName["Priority"] = "Priority";
117
118
  ElementName["ProgrammingLanguage"] = "ProgrammingLanguage";
@@ -1,6 +1,6 @@
1
1
  import { extractSummary } from '../common/primitives';
2
2
  import { extractLinkIcon } from './icon';
3
- import { extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn } from './utils';
3
+ import { extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn, extractOwnedBy } from './utils';
4
4
  import { extractPersonsUpdatedBy } from './collaboratorGroup';
5
5
  import { extractPersonCreatedBy, extractTitle, extractDateUpdated, extractDateCreated, extractLink } from '@atlaskit/linking-common/extractors';
6
6
  import extractPriority from './extract-priority';
@@ -34,6 +34,7 @@ const extractFlexibleUiContext = ({
34
34
  voteCount: extractVoteCount(data),
35
35
  checklistProgress: extractChecklistProgress(data),
36
36
  createdBy: extractCreatedBy(data),
37
+ ownedBy: extractOwnedBy(data),
37
38
  createdOn: extractDateCreated(data),
38
39
  dueOn: extractDueOn(data),
39
40
  previewAction: extractPreviewAction(response),
@@ -1,4 +1,4 @@
1
- import { extractPersonCreatedBy, extractPersonUpdatedBy } from '@atlaskit/linking-common/extractors';
1
+ import { extractPersonOwnedBy, extractPersonCreatedBy, extractPersonUpdatedBy } from '@atlaskit/linking-common/extractors';
2
2
  const extractLinkName = link => {
3
3
  if (link && typeof link === 'object' && link['@type'] === 'Link') {
4
4
  return link.name;
@@ -12,6 +12,12 @@ export const extractDueOn = data => extractValue(data, 'endTime');
12
12
  export const extractViewCount = data => extractValue(data, 'atlassian:viewCount');
13
13
  export const extractReactCount = data => extractValue(data, 'atlassian:reactCount');
14
14
  export const extractVoteCount = data => extractValue(data, 'atlassian:voteCount');
15
+ export const extractOwnedBy = data => {
16
+ const persons = extractPersonOwnedBy(data);
17
+ if (persons && persons.length) {
18
+ return persons[0].name;
19
+ }
20
+ };
15
21
  export const extractCreatedBy = data => {
16
22
  const persons = extractPersonCreatedBy(data);
17
23
  if (persons && persons.length) {
@@ -205,6 +205,11 @@ export const messages = defineMessages({
205
205
  defaultMessage: 'Open link in a new tab',
206
206
  description: 'Click to open link in a new tab'
207
207
  },
208
+ owned_by: {
209
+ id: 'fabric.linking.owned_by',
210
+ defaultMessage: 'Owned by {context}',
211
+ description: 'Indicates the person or entity that owns or maintains the resource.'
212
+ },
208
213
  preview: {
209
214
  id: 'fabric.linking.preview',
210
215
  defaultMessage: 'Full screen view',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.5.6",
3
+ "version": "25.6.0",
4
4
  "sideEffects": false
5
5
  }
@@ -4,7 +4,7 @@ import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
4
4
  import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock } from '../../../FlexibleCard/components/blocks';
5
5
  import { ActionName, CardDisplay, ElementName, MediaPlacement, SmartLinkPosition } from '../../../../constants';
6
6
  import uuid from 'uuid';
7
-
7
+ import { extractOwnedBy } from '../../../../extractors/flexible/utils';
8
8
  /**
9
9
  * This view represents a Block card that has an 'Resolved' status.
10
10
  * @see SmartLinkStatus
@@ -22,11 +22,36 @@ const FlexibleResolvedView = ({
22
22
  url,
23
23
  analytics
24
24
  }) => {
25
+ var _cardState$details, _cardState$details2;
25
26
  const [isPreviewBlockErrored, setIsPreviewBlockErrored] = useState(false);
26
27
  useEffect(() => {
27
28
  setIsPreviewBlockErrored(false);
28
29
  }, [url, cardState]);
29
30
  const [analyticsId] = useState(() => id ? id : uuid());
31
+ const baseMetadata = [{
32
+ name: ElementName.ModifiedOn
33
+ }, {
34
+ name: ElementName.AttachmentCount
35
+ }, {
36
+ name: ElementName.CommentCount
37
+ }, {
38
+ name: ElementName.ReactCount
39
+ }, {
40
+ name: ElementName.SubscriberCount
41
+ }, {
42
+ name: ElementName.ViewCount
43
+ }, {
44
+ name: ElementName.VoteCount
45
+ }, {
46
+ name: ElementName.ChecklistProgress
47
+ }, {
48
+ name: ElementName.DueOn
49
+ }];
50
+ const metadata = cardState !== null && cardState !== void 0 && (_cardState$details = cardState.details) !== null && _cardState$details !== void 0 && _cardState$details.data && extractOwnedBy(cardState === null || cardState === void 0 ? void 0 : (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data) ? [{
51
+ name: ElementName.OwnedBy
52
+ }, ...baseMetadata] : [{
53
+ name: ElementName.ModifiedBy
54
+ }, ...baseMetadata];
30
55
  return /*#__PURE__*/React.createElement(FlexibleCard, {
31
56
  appearance: "block",
32
57
  cardState: cardState,
@@ -48,27 +73,7 @@ const FlexibleResolvedView = ({
48
73
  }],
49
74
  hideRetry: true
50
75
  }), /*#__PURE__*/React.createElement(MetadataBlock, {
51
- primary: [{
52
- name: ElementName.ModifiedBy
53
- }, {
54
- name: ElementName.ModifiedOn
55
- }, {
56
- name: ElementName.AttachmentCount
57
- }, {
58
- name: ElementName.CommentCount
59
- }, {
60
- name: ElementName.ReactCount
61
- }, {
62
- name: ElementName.SubscriberCount
63
- }, {
64
- name: ElementName.ViewCount
65
- }, {
66
- name: ElementName.VoteCount
67
- }, {
68
- name: ElementName.ChecklistProgress
69
- }, {
70
- name: ElementName.DueOn
71
- }],
76
+ primary: metadata,
72
77
  maxLines: 1
73
78
  }), /*#__PURE__*/React.createElement(SnippetBlock, null), !isPreviewBlockErrored ? /*#__PURE__*/React.createElement(PreviewBlock, {
74
79
  placement: MediaPlacement.Right,
@@ -25,6 +25,7 @@ export const ElementDisplaySchema = {
25
25
  [ElementName.LinkIcon]: ['inline'],
26
26
  [ElementName.ModifiedBy]: ['inline'],
27
27
  [ElementName.ModifiedOn]: ['inline'],
28
+ [ElementName.OwnedBy]: ['inline'],
28
29
  [ElementName.Preview]: ['block'],
29
30
  [ElementName.Priority]: ['inline'],
30
31
  [ElementName.ProgrammingLanguage]: ['inline'],
@@ -62,6 +62,11 @@ export const ModifiedBy = createElement(ElementName.ModifiedBy);
62
62
  * @see DateTime
63
63
  */
64
64
  export const ModifiedOn = createElement(ElementName.ModifiedOn);
65
+ /**
66
+ * Creates a OwnedBy text element using the data from OwnedBy in the Flexible UI Context.
67
+ * @see Text
68
+ */
69
+ export const OwnedBy = createElement(ElementName.OwnedBy);
65
70
  /**
66
71
  * Creates a Preview element using the data from Preview in the Flexible UI Context.
67
72
  * @see Preview
@@ -61,6 +61,9 @@ const elementMappings = {
61
61
  [ElementName.CreatedBy]: {
62
62
  component: Text
63
63
  },
64
+ [ElementName.OwnedBy]: {
65
+ component: Text
66
+ },
64
67
  [ElementName.CreatedOn]: {
65
68
  component: DateTime
66
69
  },
@@ -151,6 +154,8 @@ const getData = (elementName, contextKey, context) => {
151
154
  return toBadgeProps(data);
152
155
  case ElementName.CreatedBy:
153
156
  return toFormattedTextProps(messages.created_by, context.createdBy);
157
+ case ElementName.OwnedBy:
158
+ return toFormattedTextProps(messages.owned_by, context.ownedBy);
154
159
  case ElementName.CreatedOn:
155
160
  return toDateTimeProps('created', context.createdOn);
156
161
  case ElementName.DueOn:
@@ -2,7 +2,6 @@
2
2
  import { jsx } from '@emotion/react';
3
3
  import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
4
4
  import CopyIcon from '@atlaskit/icon/glyph/copy';
5
- import { extractType } from '@atlaskit/linking-common/extractors';
6
5
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
7
6
  import React, { useCallback, useEffect, useMemo } from 'react';
8
7
  import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../constants';
@@ -83,10 +82,9 @@ const HoverCardContent = ({
83
82
  }, [createAnalyticsEvent, cardState.status, analytics.ui, id]);
84
83
  const titleActions = useMemo(() => [getCopyAction(url), getOpenAction(url, analytics, onActionClick)], [url, analytics, onActionClick]);
85
84
  const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
86
- const types = data ? extractType(data) : undefined;
87
85
  const {
88
86
  subtitle
89
- } = extractMetadata(getSimulatedMetadata(extensionKey, types));
87
+ } = extractMetadata(getSimulatedMetadata(extensionKey, data));
90
88
  const titleMaxLines = subtitle && subtitle.length > 0 ? 1 : 2;
91
89
  const titleBlockProps = {
92
90
  actions: titleActions,
@@ -48,7 +48,7 @@ const HoverCardResolvedView = ({
48
48
  } = useMemo(() => {
49
49
  const types = data ? extractType(data) : undefined;
50
50
  //TODO: EDM-3224 deleted simulated and use real JsonLd
51
- const metadata = extractMetadata(getSimulatedMetadata(extensionKey, types));
51
+ const metadata = extractMetadata(getSimulatedMetadata(extensionKey, data));
52
52
  const primary = showActionableElement ? toActionableMetadata(onActionClick, extensionKey, types, cardActions, metadata.primary) : metadata.primary;
53
53
  return {
54
54
  primary,
@@ -1,9 +1,12 @@
1
1
  import { ElementName } from '../../constants';
2
- export const getSimulatedMetadata = (extensionKey = '', types = []) => {
2
+ import { extractType } from '@atlaskit/linking-common/extractors';
3
+ import { extractOwnedBy } from '../../extractors/flexible/utils';
4
+ export const getSimulatedMetadata = (extensionKey = '', data) => {
5
+ const types = data ? extractType(data) : undefined;
3
6
  switch (extensionKey) {
4
7
  case 'bitbucket-object-provider':
5
8
  case 'native-bitbucket-object-provider':
6
- if (types.includes('atlassian:SourceCodePullRequest')) {
9
+ if (types !== null && types !== void 0 && types.includes('atlassian:SourceCodePullRequest')) {
7
10
  return {
8
11
  metadata: {
9
12
  primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.SubscriberCount, ElementName.State],
@@ -20,9 +23,10 @@ export const getSimulatedMetadata = (extensionKey = '', types = []) => {
20
23
  }
21
24
  };
22
25
  case 'confluence-object-provider':
26
+ const primaryAttribution = data && extractOwnedBy(data) ? ElementName.OwnedBy : ElementName.CreatedBy;
23
27
  return {
24
28
  metadata: {
25
- primary: [ElementName.AuthorGroup, ElementName.CreatedBy],
29
+ primary: [ElementName.AuthorGroup, primaryAttribution],
26
30
  secondary: [ElementName.CommentCount, ElementName.ReactCount],
27
31
  subtitle: []
28
32
  }
@@ -44,7 +48,7 @@ export const getSimulatedMetadata = (extensionKey = '', types = []) => {
44
48
  }
45
49
  };
46
50
  case 'watermelon-object-provider':
47
- if (types.includes('atlassian:Project')) {
51
+ if (types !== null && types !== void 0 && types.includes('atlassian:Project')) {
48
52
  return {
49
53
  metadata: {
50
54
  primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.State, ElementName.DueOn],
@@ -22,14 +22,37 @@ export const useLinkWarningModal = () => {
22
22
  * It checks and warns if a link text is a URL and different from an actual link destination
23
23
  */
24
24
  const checkLinkSafety = (event, href) => {
25
- const linkText = event.currentTarget.innerText;
25
+ if (!href) {
26
+ return;
27
+ }
28
+ const anchor = event.currentTarget;
29
+ const linkText = anchor.innerText;
30
+ const normalisedUrlFromLinkText = normalizeUrl(linkText);
31
+ if (!normalisedUrlFromLinkText) {
32
+ return;
33
+ }
26
34
  const anchorLinkRegex = new RegExp(/^#/im);
27
35
  const isAnchorLink = anchorLinkRegex.test(linkText);
28
36
  if (isAnchorLink) {
29
37
  return;
30
38
  }
31
- const normalisedUrlFromLinkText = normalizeUrl(linkText);
32
- if (!!normalisedUrlFromLinkText && normalisedUrlFromLinkText !== href) {
39
+ const relativeLinkRegex = new RegExp(/^\//im);
40
+ const isRelativeHrefLink = relativeLinkRegex.test(href);
41
+ if (isRelativeHrefLink) {
42
+ return;
43
+ }
44
+ const hrefUrl = new URL(href, window.location.origin);
45
+ const linkTextUrl = new URL(normalisedUrlFromLinkText, hrefUrl.origin);
46
+ const httpProtocols = ['http:', 'https:'];
47
+ let areProtocolsEquivalent;
48
+ if (httpProtocols.includes(linkTextUrl.protocol) && httpProtocols.includes(hrefUrl.protocol)) {
49
+ const noUserNameAndPassword = !linkTextUrl.username && !linkTextUrl.password && !hrefUrl.username && !hrefUrl.password;
50
+ areProtocolsEquivalent = noUserNameAndPassword;
51
+ } else {
52
+ areProtocolsEquivalent = linkTextUrl.protocol === hrefUrl.protocol;
53
+ }
54
+ const areEquivalentLinks = linkTextUrl.hostname === hrefUrl.hostname && linkTextUrl.pathname === hrefUrl.pathname && linkTextUrl.search === hrefUrl.search && linkTextUrl.username === hrefUrl.username && linkTextUrl.password === hrefUrl.password && areProtocolsEquivalent;
55
+ if (!areEquivalentLinks) {
33
56
  event.preventDefault();
34
57
  setUnsafeLinkText(linkText);
35
58
  href && setUrl(href);
@@ -112,6 +112,7 @@ export var ElementName;
112
112
  ElementName["LinkIcon"] = "LinkIcon";
113
113
  ElementName["ModifiedBy"] = "ModifiedBy";
114
114
  ElementName["ModifiedOn"] = "ModifiedOn";
115
+ ElementName["OwnedBy"] = "OwnedBy";
115
116
  ElementName["Preview"] = "Preview";
116
117
  ElementName["Priority"] = "Priority";
117
118
  ElementName["ProgrammingLanguage"] = "ProgrammingLanguage";
@@ -1,6 +1,6 @@
1
1
  import { extractSummary } from '../common/primitives';
2
2
  import { extractLinkIcon } from './icon';
3
- import { extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn } from './utils';
3
+ import { extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn, extractOwnedBy } from './utils';
4
4
  import { extractPersonsUpdatedBy } from './collaboratorGroup';
5
5
  import { extractPersonCreatedBy, extractTitle, extractDateUpdated, extractDateCreated, extractLink } from '@atlaskit/linking-common/extractors';
6
6
  import extractPriority from './extract-priority';
@@ -34,6 +34,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
34
34
  voteCount: extractVoteCount(data),
35
35
  checklistProgress: extractChecklistProgress(data),
36
36
  createdBy: extractCreatedBy(data),
37
+ ownedBy: extractOwnedBy(data),
37
38
  createdOn: extractDateCreated(data),
38
39
  dueOn: extractDueOn(data),
39
40
  previewAction: extractPreviewAction(response),
@@ -1,5 +1,5 @@
1
1
  import _typeof from "@babel/runtime/helpers/typeof";
2
- import { extractPersonCreatedBy, extractPersonUpdatedBy } from '@atlaskit/linking-common/extractors';
2
+ import { extractPersonOwnedBy, extractPersonCreatedBy, extractPersonUpdatedBy } from '@atlaskit/linking-common/extractors';
3
3
  var extractLinkName = function extractLinkName(link) {
4
4
  if (link && _typeof(link) === 'object' && link['@type'] === 'Link') {
5
5
  return link.name;
@@ -23,6 +23,12 @@ export var extractReactCount = function extractReactCount(data) {
23
23
  export var extractVoteCount = function extractVoteCount(data) {
24
24
  return extractValue(data, 'atlassian:voteCount');
25
25
  };
26
+ export var extractOwnedBy = function extractOwnedBy(data) {
27
+ var persons = extractPersonOwnedBy(data);
28
+ if (persons && persons.length) {
29
+ return persons[0].name;
30
+ }
31
+ };
26
32
  export var extractCreatedBy = function extractCreatedBy(data) {
27
33
  var persons = extractPersonCreatedBy(data);
28
34
  if (persons && persons.length) {
@@ -205,6 +205,11 @@ export var messages = defineMessages({
205
205
  defaultMessage: 'Open link in a new tab',
206
206
  description: 'Click to open link in a new tab'
207
207
  },
208
+ owned_by: {
209
+ id: 'fabric.linking.owned_by',
210
+ defaultMessage: 'Owned by {context}',
211
+ description: 'Indicates the person or entity that owns or maintains the resource.'
212
+ },
208
213
  preview: {
209
214
  id: 'fabric.linking.preview',
210
215
  defaultMessage: 'Full screen view',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.5.6",
3
+ "version": "25.6.0",
4
4
  "sideEffects": false
5
5
  }
@@ -5,13 +5,14 @@ import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
5
5
  import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock } from '../../../FlexibleCard/components/blocks';
6
6
  import { ActionName, CardDisplay, ElementName, MediaPlacement, SmartLinkPosition } from '../../../../constants';
7
7
  import uuid from 'uuid';
8
-
8
+ import { extractOwnedBy } from '../../../../extractors/flexible/utils';
9
9
  /**
10
10
  * This view represents a Block card that has an 'Resolved' status.
11
11
  * @see SmartLinkStatus
12
12
  * @see FlexibleCardProps
13
13
  */
14
14
  var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
15
+ var _cardState$details, _cardState$details2;
15
16
  var id = _ref.id,
16
17
  cardState = _ref.cardState,
17
18
  onClick = _ref.onClick,
@@ -35,6 +36,30 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
35
36
  }),
36
37
  _useState4 = _slicedToArray(_useState3, 1),
37
38
  analyticsId = _useState4[0];
39
+ var baseMetadata = [{
40
+ name: ElementName.ModifiedOn
41
+ }, {
42
+ name: ElementName.AttachmentCount
43
+ }, {
44
+ name: ElementName.CommentCount
45
+ }, {
46
+ name: ElementName.ReactCount
47
+ }, {
48
+ name: ElementName.SubscriberCount
49
+ }, {
50
+ name: ElementName.ViewCount
51
+ }, {
52
+ name: ElementName.VoteCount
53
+ }, {
54
+ name: ElementName.ChecklistProgress
55
+ }, {
56
+ name: ElementName.DueOn
57
+ }];
58
+ var metadata = cardState !== null && cardState !== void 0 && (_cardState$details = cardState.details) !== null && _cardState$details !== void 0 && _cardState$details.data && extractOwnedBy(cardState === null || cardState === void 0 ? void 0 : (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data) ? [{
59
+ name: ElementName.OwnedBy
60
+ }].concat(baseMetadata) : [{
61
+ name: ElementName.ModifiedBy
62
+ }].concat(baseMetadata);
38
63
  return /*#__PURE__*/React.createElement(FlexibleCard, {
39
64
  appearance: "block",
40
65
  cardState: cardState,
@@ -56,27 +81,7 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
56
81
  }],
57
82
  hideRetry: true
58
83
  }), /*#__PURE__*/React.createElement(MetadataBlock, {
59
- primary: [{
60
- name: ElementName.ModifiedBy
61
- }, {
62
- name: ElementName.ModifiedOn
63
- }, {
64
- name: ElementName.AttachmentCount
65
- }, {
66
- name: ElementName.CommentCount
67
- }, {
68
- name: ElementName.ReactCount
69
- }, {
70
- name: ElementName.SubscriberCount
71
- }, {
72
- name: ElementName.ViewCount
73
- }, {
74
- name: ElementName.VoteCount
75
- }, {
76
- name: ElementName.ChecklistProgress
77
- }, {
78
- name: ElementName.DueOn
79
- }],
84
+ primary: metadata,
80
85
  maxLines: 1
81
86
  }), /*#__PURE__*/React.createElement(SnippetBlock, null), !isPreviewBlockErrored ? /*#__PURE__*/React.createElement(PreviewBlock, {
82
87
  placement: MediaPlacement.Right,
@@ -15,7 +15,7 @@ import ElementGroup from './element-group';
15
15
 
16
16
  // Determine whether the element can be display as inline/block.
17
17
 
18
- export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AttachmentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ChecklistProgress, ['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.DueOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LatestCommit, ['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.Provider, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.SourceBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.TargetBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _ElementDisplaySchema);
18
+ export var ElementDisplaySchema = (_ElementDisplaySchema = {}, _defineProperty(_ElementDisplaySchema, ElementName.AttachmentCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.AuthorGroup, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ChecklistProgress, ['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.DueOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LatestCommit, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.LinkIcon, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ModifiedOn, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.OwnedBy, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Preview, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.Priority, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.ProgrammingLanguage, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Provider, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Snippet, ['block']), _defineProperty(_ElementDisplaySchema, ElementName.SourceBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.State, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.SubscriberCount, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.TargetBranch, ['inline']), _defineProperty(_ElementDisplaySchema, ElementName.Title, ['inline']), _ElementDisplaySchema);
19
19
  var getDirectionStyles = function getDirectionStyles(direction) {
20
20
  switch (direction) {
21
21
  case SmartLinkDirection.Vertical:
@@ -62,6 +62,11 @@ export var ModifiedBy = createElement(ElementName.ModifiedBy);
62
62
  * @see DateTime
63
63
  */
64
64
  export var ModifiedOn = createElement(ElementName.ModifiedOn);
65
+ /**
66
+ * Creates a OwnedBy text element using the data from OwnedBy in the Flexible UI Context.
67
+ * @see Text
68
+ */
69
+ export var OwnedBy = createElement(ElementName.OwnedBy);
65
70
  /**
66
71
  * Creates a Preview element using the data from Preview in the Flexible UI Context.
67
72
  * @see Preview
@@ -54,6 +54,8 @@ var elementMappings = (_elementMappings = {}, _defineProperty(_elementMappings,
54
54
  }
55
55
  }), _defineProperty(_elementMappings, ElementName.CreatedBy, {
56
56
  component: Text
57
+ }), _defineProperty(_elementMappings, ElementName.OwnedBy, {
58
+ component: Text
57
59
  }), _defineProperty(_elementMappings, ElementName.CreatedOn, {
58
60
  component: DateTime
59
61
  }), _defineProperty(_elementMappings, ElementName.DueOn, {
@@ -126,6 +128,8 @@ var getData = function getData(elementName, contextKey, context) {
126
128
  return toBadgeProps(data);
127
129
  case ElementName.CreatedBy:
128
130
  return toFormattedTextProps(messages.created_by, context.createdBy);
131
+ case ElementName.OwnedBy:
132
+ return toFormattedTextProps(messages.owned_by, context.ownedBy);
129
133
  case ElementName.CreatedOn:
130
134
  return toDateTimeProps('created', context.createdOn);
131
135
  case ElementName.DueOn:
@@ -5,7 +5,6 @@ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyri
5
5
  import { jsx } from '@emotion/react';
6
6
  import ShortcutIcon from '@atlaskit/icon/glyph/shortcut';
7
7
  import CopyIcon from '@atlaskit/icon/glyph/copy';
8
- import { extractType } from '@atlaskit/linking-common/extractors';
9
8
  import { useAnalyticsEvents } from '@atlaskit/analytics-next';
10
9
  import React, { useCallback, useEffect, useMemo } from 'react';
11
10
  import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../constants';
@@ -115,8 +114,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
115
114
  return [getCopyAction(url), getOpenAction(url, analytics, onActionClick)];
116
115
  }, [url, analytics, onActionClick]);
117
116
  var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
118
- var types = data ? extractType(data) : undefined;
119
- var _extractMetadata = extractMetadata(getSimulatedMetadata(extensionKey, types)),
117
+ var _extractMetadata = extractMetadata(getSimulatedMetadata(extensionKey, data)),
120
118
  subtitle = _extractMetadata.subtitle;
121
119
  var titleMaxLines = subtitle && subtitle.length > 0 ? 1 : 2;
122
120
  var titleBlockProps = {
@@ -52,7 +52,7 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
52
52
  var _useMemo = useMemo(function () {
53
53
  var types = data ? extractType(data) : undefined;
54
54
  //TODO: EDM-3224 deleted simulated and use real JsonLd
55
- var metadata = extractMetadata(getSimulatedMetadata(extensionKey, types));
55
+ var metadata = extractMetadata(getSimulatedMetadata(extensionKey, data));
56
56
  var primary = showActionableElement ? toActionableMetadata(onActionClick, extensionKey, types, cardActions, metadata.primary) : metadata.primary;
57
57
  return {
58
58
  primary: primary,
@@ -2,13 +2,16 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; }
3
3
  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) { _defineProperty(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; }
4
4
  import { ElementName } from '../../constants';
5
+ import { extractType } from '@atlaskit/linking-common/extractors';
6
+ import { extractOwnedBy } from '../../extractors/flexible/utils';
5
7
  export var getSimulatedMetadata = function getSimulatedMetadata() {
6
8
  var extensionKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
7
- var types = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
9
+ var data = arguments.length > 1 ? arguments[1] : undefined;
10
+ var types = data ? extractType(data) : undefined;
8
11
  switch (extensionKey) {
9
12
  case 'bitbucket-object-provider':
10
13
  case 'native-bitbucket-object-provider':
11
- if (types.includes('atlassian:SourceCodePullRequest')) {
14
+ if (types !== null && types !== void 0 && types.includes('atlassian:SourceCodePullRequest')) {
12
15
  return {
13
16
  metadata: {
14
17
  primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.SubscriberCount, ElementName.State],
@@ -25,9 +28,10 @@ export var getSimulatedMetadata = function getSimulatedMetadata() {
25
28
  }
26
29
  };
27
30
  case 'confluence-object-provider':
31
+ var primaryAttribution = data && extractOwnedBy(data) ? ElementName.OwnedBy : ElementName.CreatedBy;
28
32
  return {
29
33
  metadata: {
30
- primary: [ElementName.AuthorGroup, ElementName.CreatedBy],
34
+ primary: [ElementName.AuthorGroup, primaryAttribution],
31
35
  secondary: [ElementName.CommentCount, ElementName.ReactCount],
32
36
  subtitle: []
33
37
  }
@@ -49,7 +53,7 @@ export var getSimulatedMetadata = function getSimulatedMetadata() {
49
53
  }
50
54
  };
51
55
  case 'watermelon-object-provider':
52
- if (types.includes('atlassian:Project')) {
56
+ if (types !== null && types !== void 0 && types.includes('atlassian:Project')) {
53
57
  return {
54
58
  metadata: {
55
59
  primary: [ElementName.AuthorGroup, ElementName.ModifiedOn, ElementName.State, ElementName.DueOn],
@@ -31,14 +31,37 @@ export var useLinkWarningModal = function useLinkWarningModal() {
31
31
  * It checks and warns if a link text is a URL and different from an actual link destination
32
32
  */
33
33
  var checkLinkSafety = function checkLinkSafety(event, href) {
34
- var linkText = event.currentTarget.innerText;
34
+ if (!href) {
35
+ return;
36
+ }
37
+ var anchor = event.currentTarget;
38
+ var linkText = anchor.innerText;
39
+ var normalisedUrlFromLinkText = normalizeUrl(linkText);
40
+ if (!normalisedUrlFromLinkText) {
41
+ return;
42
+ }
35
43
  var anchorLinkRegex = new RegExp(/^#/im);
36
44
  var isAnchorLink = anchorLinkRegex.test(linkText);
37
45
  if (isAnchorLink) {
38
46
  return;
39
47
  }
40
- var normalisedUrlFromLinkText = normalizeUrl(linkText);
41
- if (!!normalisedUrlFromLinkText && normalisedUrlFromLinkText !== href) {
48
+ var relativeLinkRegex = new RegExp(/^\//im);
49
+ var isRelativeHrefLink = relativeLinkRegex.test(href);
50
+ if (isRelativeHrefLink) {
51
+ return;
52
+ }
53
+ var hrefUrl = new URL(href, window.location.origin);
54
+ var linkTextUrl = new URL(normalisedUrlFromLinkText, hrefUrl.origin);
55
+ var httpProtocols = ['http:', 'https:'];
56
+ var areProtocolsEquivalent;
57
+ if (httpProtocols.includes(linkTextUrl.protocol) && httpProtocols.includes(hrefUrl.protocol)) {
58
+ var noUserNameAndPassword = !linkTextUrl.username && !linkTextUrl.password && !hrefUrl.username && !hrefUrl.password;
59
+ areProtocolsEquivalent = noUserNameAndPassword;
60
+ } else {
61
+ areProtocolsEquivalent = linkTextUrl.protocol === hrefUrl.protocol;
62
+ }
63
+ var areEquivalentLinks = linkTextUrl.hostname === hrefUrl.hostname && linkTextUrl.pathname === hrefUrl.pathname && linkTextUrl.search === hrefUrl.search && linkTextUrl.username === hrefUrl.username && linkTextUrl.password === hrefUrl.password && areProtocolsEquivalent;
64
+ if (!areEquivalentLinks) {
42
65
  event.preventDefault();
43
66
  setUnsafeLinkText(linkText);
44
67
  href && setUrl(href);
@@ -92,6 +92,7 @@ export declare enum ElementName {
92
92
  LinkIcon = "LinkIcon",
93
93
  ModifiedBy = "ModifiedBy",
94
94
  ModifiedOn = "ModifiedOn",
95
+ OwnedBy = "OwnedBy",
95
96
  Preview = "Preview",
96
97
  Priority = "Priority",
97
98
  ProgrammingLanguage = "ProgrammingLanguage",
@@ -4,6 +4,7 @@ export declare const extractDueOn: (data: JsonLd.Data.BaseData) => string | unde
4
4
  export declare const extractViewCount: (data: JsonLd.Data.BaseData) => number | undefined;
5
5
  export declare const extractReactCount: (data: JsonLd.Data.BaseData) => number | undefined;
6
6
  export declare const extractVoteCount: (data: JsonLd.Data.BaseData) => number | undefined;
7
+ export declare const extractOwnedBy: (data: JsonLd.Data.BaseData) => string | undefined;
7
8
  export declare const extractCreatedBy: (data: JsonLd.Data.BaseData) => string | undefined;
8
9
  export declare const extractModifiedBy: (data: JsonLd.Data.BaseData) => string | undefined;
9
10
  export declare const extractProgrammingLanguage: (data: JsonLd.Data.BaseData) => string | undefined;
@@ -1,6 +1,6 @@
1
1
  import { MessageDescriptor } from 'react-intl-next';
2
2
  export declare type RequestAccessMessageKey = 'click_to_join' | 'click_to_join_description' | 'forbidden_description' | 'request_access' | 'request_access_description' | 'request_access_pending' | 'request_access_pending_description' | 'request_denied_description';
3
- export declare type MessageKey = 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_link_in_a_new_tab' | 'preview' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'try_again' | 'try_another_account' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey;
3
+ export declare type MessageKey = 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'try_again' | 'try_another_account' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey;
4
4
  declare type Messages = {
5
5
  [K in MessageKey]: MessageDescriptor;
6
6
  };
@@ -64,6 +64,12 @@ export declare type FlexibleUiDataContext = {
64
64
  * @see CreatedBy
65
65
  */
66
66
  createdBy?: string;
67
+ /**
68
+ * Contains the name of the entity that owns the resource.
69
+ * @type string
70
+ * @see OwnedBy
71
+ */
72
+ ownedBy?: string;
67
73
  /**
68
74
  * Contains the ISO timestamp of when the resource was created.
69
75
  * @type string - ISO Timestamp
@@ -168,7 +168,7 @@ export declare type OnActionMenuOpenChangeOptions = {
168
168
  /**
169
169
  * A type that contains all the possible combinations of elements with their corresponding props.
170
170
  */
171
- export declare type ElementItemProps = AttachmentCount | AuthorGroup | ChecklistProgress | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | Preview | Priority | ProgrammingLanguage | Provider | ReactCount | Snippet | SourceBranch | State | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
171
+ export declare type ElementItemProps = AttachmentCount | AuthorGroup | ChecklistProgress | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | OwnedBy | Preview | Priority | ProgrammingLanguage | Provider | ReactCount | Snippet | SourceBranch | State | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
172
172
  /**
173
173
  * Represents the props available for an AttachmentCount element.
174
174
  * @see AttachmentCount
@@ -211,6 +211,13 @@ export declare type CommentCount = {
211
211
  export declare type CreatedBy = {
212
212
  name: ElementName.CreatedBy;
213
213
  };
214
+ /**
215
+ * Represents the props available for an OwnedBy element.
216
+ * @see OwnedBy
217
+ */
218
+ export declare type OwnedBy = {
219
+ name: ElementName.OwnedBy;
220
+ };
214
221
  /**
215
222
  * Represents the props available for an CreatedOn element.
216
223
  * @see CreatedOn
@@ -66,6 +66,11 @@ export declare const ModifiedBy: import("react").FC<TextProps>;
66
66
  * @see DateTime
67
67
  */
68
68
  export declare const ModifiedOn: import("react").FC<DateTimeProps>;
69
+ /**
70
+ * Creates a OwnedBy text element using the data from OwnedBy in the Flexible UI Context.
71
+ * @see Text
72
+ */
73
+ export declare const OwnedBy: import("react").FC<TextProps>;
69
74
  /**
70
75
  * Creates a Preview element using the data from Preview in the Flexible UI Context.
71
76
  * @see Preview
@@ -1,5 +1,5 @@
1
1
  import { JsonLd } from 'json-ld-types';
2
2
  import { LinkAction } from '../../state/hooks-external/useSmartLinkActions';
3
3
  import { ElementItem } from '../FlexibleCard/components/blocks/types';
4
- export declare const getSimulatedMetadata: (extensionKey?: string, types?: JsonLd.Primitives.ObjectType[]) => JsonLd.Primitives.Property<any>;
4
+ export declare const getSimulatedMetadata: (extensionKey: string | undefined, data: JsonLd.Data.BaseData) => JsonLd.Primitives.Property<any>;
5
5
  export declare const toActionableMetadata: (onActionClick: (actionId: string) => void, extensionKey?: string | undefined, types?: JsonLd.Primitives.ObjectType[], cardActions?: LinkAction[], elementItems?: ElementItem[]) => ElementItem[];
@@ -1,6 +1,6 @@
1
1
  import { MouseEvent } from 'react';
2
2
  export declare const useLinkWarningModal: () => {
3
- checkLinkSafety: (event: MouseEvent, href: string | undefined) => void;
3
+ checkLinkSafety: (event: MouseEvent<HTMLAnchorElement>, href: string | undefined) => void;
4
4
  unsafeLinkText: string | null;
5
5
  onClose: () => void;
6
6
  onContinue: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "25.5.6",
3
+ "version": "25.6.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -34,8 +34,8 @@
34
34
  "@atlaskit/icon-priority": "^6.3.0",
35
35
  "@atlaskit/in-product-testing": "^0.1.0",
36
36
  "@atlaskit/link-client-extension": "^0.4.0",
37
- "@atlaskit/linking-common": "^2.5.0",
38
- "@atlaskit/linking-types": "^1.0.0",
37
+ "@atlaskit/linking-common": "^2.6.0",
38
+ "@atlaskit/linking-types": "^1.1.0",
39
39
  "@atlaskit/logo": "^13.13.0",
40
40
  "@atlaskit/lozenge": "^11.3.0",
41
41
  "@atlaskit/media-common": "^4.0.0",
@@ -52,7 +52,7 @@
52
52
  "@emotion/styled": "^11.0.0",
53
53
  "@formatjs/intl-utils": "^3.8.4",
54
54
  "facepaint": "^1.2.1",
55
- "json-ld-types": "3.6.0",
55
+ "json-ld-types": "3.7.0",
56
56
  "react-error-boundary": "^3.1.3",
57
57
  "react-lazily-render": "^1.2.0",
58
58
  "react-loadable": "^5.1.0",
@@ -60,7 +60,7 @@
60
60
  "uuid": "^3.1.0"
61
61
  },
62
62
  "peerDependencies": {
63
- "@atlaskit/link-provider": "^1.5.3",
63
+ "@atlaskit/link-provider": "^1.5.4",
64
64
  "react": "^16.8.0",
65
65
  "react-dom": "^16.8.0",
66
66
  "react-intl-next": "npm:react-intl@^5.18.1"
package/report.api.md CHANGED
@@ -442,6 +442,7 @@ type ElementItemProps =
442
442
  | LinkIcon
443
443
  | ModifiedBy
444
444
  | ModifiedOn
445
+ | OwnedBy
445
446
  | Preview
446
447
  | Priority
447
448
  | ProgrammingLanguage
@@ -483,6 +484,8 @@ export enum ElementName {
483
484
  // (undocumented)
484
485
  ModifiedOn = 'ModifiedOn',
485
486
  // (undocumented)
487
+ OwnedBy = 'OwnedBy',
488
+ // (undocumented)
486
489
  Preview = 'Preview',
487
490
  // (undocumented)
488
491
  Priority = 'Priority',
@@ -670,6 +673,11 @@ type OnResolveCallback = (data: {
670
673
  aspectRatio?: number;
671
674
  }) => void;
672
675
 
676
+ // @public
677
+ type OwnedBy = {
678
+ name: ElementName.OwnedBy;
679
+ };
680
+
673
681
  // @public
674
682
  type Preview = {
675
683
  name: ElementName.Preview;
@@ -1228,7 +1236,7 @@ type VoteCount = {
1228
1236
 
1229
1237
  ```json
1230
1238
  {
1231
- "@atlaskit/link-provider": "^1.5.3",
1239
+ "@atlaskit/link-provider": "^1.5.4",
1232
1240
  "react": "^16.8.0",
1233
1241
  "react-dom": "^16.8.0",
1234
1242
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -333,7 +333,7 @@ export type ElementItem = {
333
333
  } & ElementItemProps;
334
334
 
335
335
  // @public
336
- type ElementItemProps = AttachmentCount | AuthorGroup | ChecklistProgress | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | Preview | Priority | ProgrammingLanguage | Provider_2 | ReactCount | Snippet | SourceBranch | State_2 | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
336
+ type ElementItemProps = AttachmentCount | AuthorGroup | ChecklistProgress | CollaboratorGroup | CommentCount | CreatedBy | CreatedOn | DueOn | LatestCommit | LinkIcon | ModifiedBy | ModifiedOn | OwnedBy | Preview | Priority | ProgrammingLanguage | Provider_2 | ReactCount | Snippet | SourceBranch | State_2 | SubscriberCount | TargetBranch | Title | ViewCount | VoteCount;
337
337
 
338
338
  // @public
339
339
  export enum ElementName {
@@ -362,6 +362,8 @@ export enum ElementName {
362
362
  // (undocumented)
363
363
  ModifiedOn = "ModifiedOn",
364
364
  // (undocumented)
365
+ OwnedBy = "OwnedBy",
366
+ // (undocumented)
365
367
  Preview = "Preview",
366
368
  // (undocumented)
367
369
  Priority = "Priority",
@@ -536,6 +538,11 @@ type OnResolveCallback = (data: {
536
538
  aspectRatio?: number;
537
539
  }) => void;
538
540
 
541
+ // @public
542
+ type OwnedBy = {
543
+ name: ElementName.OwnedBy;
544
+ };
545
+
539
546
  // @public
540
547
  type Preview = {
541
548
  name: ElementName.Preview;