@atlaskit/smart-card 38.10.2 → 38.11.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 (33) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/extractors/action/extract-invoke-copy-link-action.js +2 -1
  3. package/dist/cjs/extractors/action/extract-invoke-download-action.js +3 -1
  4. package/dist/cjs/extractors/action/extract-invoke-preview-action.js +6 -5
  5. package/dist/cjs/extractors/common/primitives/extractSummary.js +16 -1
  6. package/dist/cjs/extractors/flexible/actions/extract-view-related-links-action.js +2 -1
  7. package/dist/cjs/extractors/flexible/index.js +3 -3
  8. package/dist/cjs/utils/analytics/analytics.js +1 -1
  9. package/dist/cjs/utils/mocks.js +1 -0
  10. package/dist/cjs/view/LinkUrl/index.js +1 -1
  11. package/dist/es2019/extractors/action/extract-invoke-copy-link-action.js +3 -2
  12. package/dist/es2019/extractors/action/extract-invoke-download-action.js +3 -1
  13. package/dist/es2019/extractors/action/extract-invoke-preview-action.js +7 -6
  14. package/dist/es2019/extractors/common/primitives/extractSummary.js +16 -0
  15. package/dist/es2019/extractors/flexible/actions/extract-view-related-links-action.js +3 -2
  16. package/dist/es2019/extractors/flexible/index.js +4 -4
  17. package/dist/es2019/utils/analytics/analytics.js +1 -1
  18. package/dist/es2019/utils/mocks.js +1 -0
  19. package/dist/es2019/view/LinkUrl/index.js +1 -1
  20. package/dist/esm/extractors/action/extract-invoke-copy-link-action.js +3 -2
  21. package/dist/esm/extractors/action/extract-invoke-download-action.js +3 -1
  22. package/dist/esm/extractors/action/extract-invoke-preview-action.js +7 -6
  23. package/dist/esm/extractors/common/primitives/extractSummary.js +16 -0
  24. package/dist/esm/extractors/flexible/actions/extract-view-related-links-action.js +3 -2
  25. package/dist/esm/extractors/flexible/index.js +4 -4
  26. package/dist/esm/utils/analytics/analytics.js +1 -1
  27. package/dist/esm/utils/mocks.js +1 -0
  28. package/dist/esm/view/LinkUrl/index.js +1 -1
  29. package/dist/types/__fixtures__/document-entity.d.ts +3 -0
  30. package/dist/types/extractors/common/primitives/extractSummary.d.ts +5 -0
  31. package/dist/types-ts4.5/__fixtures__/document-entity.d.ts +3 -0
  32. package/dist/types-ts4.5/extractors/common/primitives/extractSummary.d.ts +5 -0
  33. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 38.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#172309](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/172309)
8
+ [`2277073f3598c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2277073f3598c) -
9
+ EDM-12975 use entity data to render google document links
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 38.10.2
4
16
 
5
17
  ### Patch Changes
@@ -8,6 +8,7 @@ exports.extractInvokeCopyLinkAction = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _linkExtractors = require("@atlaskit/link-extractors");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _index = require("../../index");
12
13
  var _helpers = require("../../state/helpers");
13
14
  var _canShowAction = require("../../utils/actions/can-show-action");
@@ -20,7 +21,7 @@ var extractInvokeCopyLinkAction = exports.extractInvokeCopyLinkAction = function
20
21
  return;
21
22
  }
22
23
  var data = response.data;
23
- var url = (0, _linkExtractors.extractLink)(data);
24
+ var url = (0, _platformFeatureFlags.fg)('smart_links_noun_support') ? (0, _linkExtractors.extractSmartLinkUrl)(response) : (0, _linkExtractors.extractLink)(data);
24
25
  if (!url) {
25
26
  return;
26
27
  }
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.extractInvokeDownloadAction = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
+ var _linkExtractors = require("@atlaskit/link-extractors");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
12
  var _index = require("../../index");
11
13
  var _helpers = require("../../state/helpers");
12
14
  var _utils = require("../../utils");
@@ -26,7 +28,7 @@ var extractInvokeDownloadAction = exports.extractInvokeDownloadAction = function
26
28
  return action['@type'] === 'DownloadAction';
27
29
  });
28
30
  if (downloadActionExists) {
29
- var downloadUrl = (0, _extractDownloadUrl.extractDownloadUrl)(data);
31
+ var downloadUrl = (0, _platformFeatureFlags.fg)('smart_links_noun_support') ? (0, _linkExtractors.extractSmartLinkDownloadUrl)(response) : (0, _extractDownloadUrl.extractDownloadUrl)(data);
30
32
  return {
31
33
  actionFn: function () {
32
34
  var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
@@ -8,6 +8,7 @@ exports.extractInvokePreviewAction = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _linkExtractors = require("@atlaskit/link-extractors");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _index = require("../../index");
12
13
  var _helpers = require("../../state/helpers");
13
14
  var _canShowAction = require("../../utils/actions/can-show-action");
@@ -38,7 +39,7 @@ var extractInvokePreviewAction = exports.extractInvokePreviewAction = function e
38
39
  return {
39
40
  actionFn: function () {
40
41
  var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
41
- var _extractProvider;
42
+ var _extractSmartLinkProv, _extractProvider, _extractSmartLinkEmbe;
42
43
  return _regenerator.default.wrap(function _callee$(_context) {
43
44
  while (1) switch (_context.prev = _context.next) {
44
45
  case 0:
@@ -51,12 +52,12 @@ var extractInvokePreviewAction = exports.extractInvokePreviewAction = function e
51
52
  isSupportTheming: (0, _extractIsSupportTheming.extractIsSupportTheming)(meta),
52
53
  isTrusted: (0, _extractIsTrusted.extractIsTrusted)(meta),
53
54
  linkIcon: (0, _icon.extractLinkIcon)(response),
54
- providerName: (_extractProvider = (0, _linkExtractors.extractProvider)(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text,
55
+ providerName: (0, _platformFeatureFlags.fg)('smart_links_noun_support') ? (_extractSmartLinkProv = (0, _linkExtractors.extractSmartLinkProvider)(response)) === null || _extractSmartLinkProv === void 0 ? void 0 : _extractSmartLinkProv.text : (_extractProvider = (0, _linkExtractors.extractProvider)(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text,
55
56
  onClose: onClose,
56
57
  origin: origin,
57
- src: src,
58
- title: (0, _linkExtractors.extractTitle)(data),
59
- url: url
58
+ src: (0, _platformFeatureFlags.fg)('smart_links_noun_support') ? (_extractSmartLinkEmbe = (0, _linkExtractors.extractSmartLinkEmbed)(response)) === null || _extractSmartLinkEmbe === void 0 ? void 0 : _extractSmartLinkEmbe.src : src,
59
+ title: (0, _platformFeatureFlags.fg)('smart_links_noun_support') ? (0, _linkExtractors.extractSmartLinkTitle)(response) : (0, _linkExtractors.extractTitle)(data),
60
+ url: (0, _platformFeatureFlags.fg)('smart_links_noun_support') ? (0, _linkExtractors.extractSmartLinkUrl)(response) : url
60
61
  }));
61
62
  case 1:
62
63
  case "end":
@@ -3,7 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.extractSummary = void 0;
6
+ exports.extractSummary = exports.extractSmartLinkSummary = void 0;
7
+ var _linkExtractors = require("@atlaskit/link-extractors");
8
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
7
9
  /**
8
10
  * Return link summary
9
11
  */
@@ -12,4 +14,17 @@ var extractSummary = exports.extractSummary = function extractSummary(jsonLd) {
12
14
  var summary = jsonLd.summary.trim();
13
15
  return Boolean(summary) ? summary : undefined;
14
16
  }
17
+ };
18
+
19
+ /**
20
+ * Return link summary
21
+ */
22
+ var extractSmartLinkSummary = exports.extractSmartLinkSummary = function extractSmartLinkSummary(response) {
23
+ if ((0, _platformFeatureFlags.fg)('smart_links_noun_support')) {
24
+ if ((0, _linkExtractors.isEntityPresent)(response)) {
25
+ var _extractEntity;
26
+ return (_extractEntity = (0, _linkExtractors.extractEntity)(response)) === null || _extractEntity === void 0 ? void 0 : _extractEntity.description;
27
+ }
28
+ }
29
+ return (response === null || response === void 0 ? void 0 : response.data) && extractSummary(response.data);
15
30
  };
@@ -5,12 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.extractViewRelatedLinksAction = void 0;
7
7
  var _linkExtractors = require("@atlaskit/link-extractors");
8
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
9
  var extractViewRelatedLinksAction = exports.extractViewRelatedLinksAction = function extractViewRelatedLinksAction(response) {
9
10
  var _response$meta;
10
11
  if (!(response !== null && response !== void 0 && (_response$meta = response.meta) !== null && _response$meta !== void 0 && (_response$meta = _response$meta.supportedFeature) !== null && _response$meta !== void 0 && _response$meta.includes('RelatedLinks'))) {
11
12
  return;
12
13
  }
13
- var ari = (0, _linkExtractors.extractAri)(response.data);
14
+ var ari = (0, _platformFeatureFlags.fg)('smart_links_noun_support') ? (0, _linkExtractors.extractSmartLinkAri)(response) : (0, _linkExtractors.extractAri)(response.data);
14
15
  if (!ari) {
15
16
  return;
16
17
  }
@@ -9,7 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
10
  var _linkExtractors = require("@atlaskit/link-extractors");
11
11
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
- var _primitives = require("../common/primitives");
12
+ var _extractSummary = require("../common/primitives/extractSummary");
13
13
  var _actions = require("./actions");
14
14
  var _collaboratorGroup = require("./collaboratorGroup");
15
15
  var _extractLinkTitle = _interopRequireDefault(require("./extract-link-title"));
@@ -57,7 +57,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
57
57
  appliedToComponentsCount: (0, _utils.extractAppliedToComponentsCount)(data),
58
58
  assignedToGroup: (0, _utils.extractPersonAssignedToAsArray)(data),
59
59
  attachmentCount: (0, _utils.extractAttachmentCount)(data),
60
- authorGroup: (0, _linkExtractors.extractPersonCreatedBy)(data),
60
+ authorGroup: (0, _linkExtractors.extractSmartLinkAuthorGroup)(response),
61
61
  ownedByGroup: (0, _linkExtractors.extractPersonOwnedBy)(data),
62
62
  collaboratorGroup: (0, _collaboratorGroup.extractPersonsUpdatedBy)(data),
63
63
  commentCount: (0, _utils.extractCommentCount)(data),
@@ -84,7 +84,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
84
84
  programmingLanguage: (0, _utils.extractProgrammingLanguage)(data),
85
85
  readTime: (0, _utils.extractReadTime)(data),
86
86
  sentOn: (0, _utils.extractSentOn)(data),
87
- snippet: (0, _primitives.extractSummary)(data) || undefined,
87
+ snippet: (0, _extractSummary.extractSmartLinkSummary)(response) || undefined,
88
88
  // Explicitly set here to remove an empty string
89
89
  sourceBranch: (0, _utils.extractSourceBranch)(data),
90
90
  state: (0, _extractState.default)(response, actionOptions, id, appearance, origin, fireEvent, resolve),
@@ -11,7 +11,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
11
11
  var context = exports.context = {
12
12
  componentName: 'smart-cards',
13
13
  packageName: "@atlaskit/smart-card",
14
- packageVersion: "38.10.1"
14
+ packageVersion: "38.10.2"
15
15
  };
16
16
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
17
17
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -104,6 +104,7 @@ var entityDataResponse = {
104
104
  entityData: {
105
105
  id: 'I love cheese',
106
106
  displayName: 'I love cheese',
107
+ description: 'Here is your serving of cheese: 🧀',
107
108
  url: 'https://some.url',
108
109
  lastUpdatedAt: '2025-01-08T22:26:52.501Z',
109
110
  thumbnail: {
@@ -20,7 +20,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
20
20
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
21
21
  var PACKAGE_DATA = {
22
22
  packageName: "@atlaskit/smart-card",
23
- packageVersion: "38.10.1",
23
+ packageVersion: "38.10.2",
24
24
  componentName: 'linkUrl'
25
25
  };
26
26
  var Anchor = (0, _click.withLinkClickedEvent)('a');
@@ -1,4 +1,5 @@
1
- import { extractLink } from '@atlaskit/link-extractors';
1
+ import { extractLink, extractSmartLinkUrl } from '@atlaskit/link-extractors';
2
+ import { fg } from "@atlaskit/platform-feature-flags";
2
3
  import { ActionName, CardAction } from '../../index';
3
4
  import { getDefinitionId, getExtensionKey, getResourceType } from '../../state/helpers';
4
5
  import { canShowAction } from '../../utils/actions/can-show-action';
@@ -12,7 +13,7 @@ export const extractInvokeCopyLinkAction = ({
12
13
  return;
13
14
  }
14
15
  const data = response.data;
15
- const url = extractLink(data);
16
+ const url = fg('smart_links_noun_support') ? extractSmartLinkUrl(response) : extractLink(data);
16
17
  if (!url) {
17
18
  return;
18
19
  }
@@ -1,3 +1,5 @@
1
+ import { extractSmartLinkDownloadUrl } from "@atlaskit/link-extractors";
2
+ import { fg } from "@atlaskit/platform-feature-flags";
1
3
  import { ActionName, CardAction } from '../../index';
2
4
  import { getDefinitionId, getExtensionKey, getResourceType } from '../../state/helpers';
3
5
  import { downloadUrl as download } from '../../utils';
@@ -16,7 +18,7 @@ export const extractInvokeDownloadAction = ({
16
18
  const data = response.data;
17
19
  const downloadActionExists = getActionsFromJsonLd(data).find(action => action['@type'] === 'DownloadAction');
18
20
  if (downloadActionExists) {
19
- const downloadUrl = extractDownloadUrl(data);
21
+ const downloadUrl = fg('smart_links_noun_support') ? extractSmartLinkDownloadUrl(response) : extractDownloadUrl(data);
20
22
  return {
21
23
  actionFn: async () => download(downloadUrl),
22
24
  actionSubjectId: 'downloadDocument',
@@ -1,4 +1,5 @@
1
- import { extractLink, extractPreview as extractPreviewData, extractProvider, extractTitle } from '@atlaskit/link-extractors';
1
+ import { extractLink, extractPreview as extractPreviewData, extractProvider, extractSmartLinkEmbed, extractSmartLinkProvider, extractSmartLinkTitle, extractSmartLinkUrl, extractTitle } from '@atlaskit/link-extractors';
2
+ import { fg } from "@atlaskit/platform-feature-flags";
2
3
  import { ActionName, CardAction } from '../../index';
3
4
  import { getExtensionKey } from '../../state/helpers';
4
5
  import { canShowAction } from '../../utils/actions/can-show-action';
@@ -30,7 +31,7 @@ export const extractInvokePreviewAction = param => {
30
31
  const extensionKey = getExtensionKey(response);
31
32
  return {
32
33
  actionFn: async () => {
33
- var _extractProvider;
34
+ var _extractSmartLinkProv, _extractProvider, _extractSmartLinkEmbe;
34
35
  return openEmbedModal({
35
36
  fireEvent,
36
37
  extensionKey,
@@ -40,12 +41,12 @@ export const extractInvokePreviewAction = param => {
40
41
  isSupportTheming: extractIsSupportTheming(meta),
41
42
  isTrusted: extractIsTrusted(meta),
42
43
  linkIcon: extractLinkIcon(response),
43
- providerName: (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text,
44
+ providerName: fg('smart_links_noun_support') ? (_extractSmartLinkProv = extractSmartLinkProvider(response)) === null || _extractSmartLinkProv === void 0 ? void 0 : _extractSmartLinkProv.text : (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text,
44
45
  onClose,
45
46
  origin,
46
- src,
47
- title: extractTitle(data),
48
- url
47
+ src: fg('smart_links_noun_support') ? (_extractSmartLinkEmbe = extractSmartLinkEmbed(response)) === null || _extractSmartLinkEmbe === void 0 ? void 0 : _extractSmartLinkEmbe.src : src,
48
+ title: fg('smart_links_noun_support') ? extractSmartLinkTitle(response) : extractTitle(data),
49
+ url: fg('smart_links_noun_support') ? extractSmartLinkUrl(response) : url
49
50
  });
50
51
  },
51
52
  actionSubjectId: 'invokePreviewScreen',
@@ -1,3 +1,6 @@
1
+ import { extractEntity, isEntityPresent } from "@atlaskit/link-extractors";
2
+ import { fg } from "@atlaskit/platform-feature-flags";
3
+
1
4
  /**
2
5
  * Return link summary
3
6
  */
@@ -6,4 +9,17 @@ export const extractSummary = jsonLd => {
6
9
  const summary = jsonLd.summary.trim();
7
10
  return Boolean(summary) ? summary : undefined;
8
11
  }
12
+ };
13
+
14
+ /**
15
+ * Return link summary
16
+ */
17
+ export const extractSmartLinkSummary = response => {
18
+ if (fg('smart_links_noun_support')) {
19
+ if (isEntityPresent(response)) {
20
+ var _extractEntity;
21
+ return (_extractEntity = extractEntity(response)) === null || _extractEntity === void 0 ? void 0 : _extractEntity.description;
22
+ }
23
+ }
24
+ return (response === null || response === void 0 ? void 0 : response.data) && extractSummary(response.data);
9
25
  };
@@ -1,10 +1,11 @@
1
- import { extractAri } from '@atlaskit/link-extractors';
1
+ import { extractAri, extractSmartLinkAri } from '@atlaskit/link-extractors';
2
+ import { fg } from "@atlaskit/platform-feature-flags";
2
3
  export const extractViewRelatedLinksAction = response => {
3
4
  var _response$meta, _response$meta$suppor;
4
5
  if (!(response !== null && response !== void 0 && (_response$meta = response.meta) !== null && _response$meta !== void 0 && (_response$meta$suppor = _response$meta.supportedFeature) !== null && _response$meta$suppor !== void 0 && _response$meta$suppor.includes('RelatedLinks'))) {
5
6
  return;
6
7
  }
7
- const ari = extractAri(response.data);
8
+ const ari = fg('smart_links_noun_support') ? extractSmartLinkAri(response) : extractAri(response.data);
8
9
  if (!ari) {
9
10
  return;
10
11
  }
@@ -1,6 +1,6 @@
1
- import { extractPersonCreatedBy, extractPersonOwnedBy, extractSmartLinkAri, extractSmartLinkCreatedBy, extractSmartLinkCreatedOn, extractSmartLinkModifiedBy, extractSmartLinkModifiedOn, extractSmartLinkTitle, extractSmartLinkUrl, extractType } from '@atlaskit/link-extractors';
1
+ import { extractPersonOwnedBy, extractSmartLinkAri, extractSmartLinkAuthorGroup, extractSmartLinkCreatedBy, extractSmartLinkCreatedOn, extractSmartLinkModifiedBy, extractSmartLinkModifiedOn, extractSmartLinkTitle, extractSmartLinkUrl, extractType } from '@atlaskit/link-extractors';
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
- import { extractSummary } from '../common/primitives';
3
+ import { extractSmartLinkSummary } from "../common/primitives/extractSummary";
4
4
  import { extractFlexibleCardActions } from './actions';
5
5
  import { extractPersonsUpdatedBy } from './collaboratorGroup';
6
6
  import extractLinkTitle from './extract-link-title';
@@ -45,7 +45,7 @@ const extractFlexibleUiContext = ({
45
45
  appliedToComponentsCount: extractAppliedToComponentsCount(data),
46
46
  assignedToGroup: extractPersonAssignedToAsArray(data),
47
47
  attachmentCount: extractAttachmentCount(data),
48
- authorGroup: extractPersonCreatedBy(data),
48
+ authorGroup: extractSmartLinkAuthorGroup(response),
49
49
  ownedByGroup: extractPersonOwnedBy(data),
50
50
  collaboratorGroup: extractPersonsUpdatedBy(data),
51
51
  commentCount: extractCommentCount(data),
@@ -72,7 +72,7 @@ const extractFlexibleUiContext = ({
72
72
  programmingLanguage: extractProgrammingLanguage(data),
73
73
  readTime: extractReadTime(data),
74
74
  sentOn: extractSentOn(data),
75
- snippet: extractSummary(data) || undefined,
75
+ snippet: extractSmartLinkSummary(response) || undefined,
76
76
  // Explicitly set here to remove an empty string
77
77
  sourceBranch: extractSourceBranch(data),
78
78
  state: extractState(response, actionOptions, id, appearance, origin, fireEvent, resolve),
@@ -2,7 +2,7 @@ export const ANALYTICS_CHANNEL = 'media';
2
2
  export const context = {
3
3
  componentName: 'smart-cards',
4
4
  packageName: "@atlaskit/smart-card",
5
- packageVersion: "38.10.1"
5
+ packageVersion: "38.10.2"
6
6
  };
7
7
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
8
8
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -86,6 +86,7 @@ const entityDataResponse = {
86
86
  entityData: {
87
87
  id: 'I love cheese',
88
88
  displayName: 'I love cheese',
89
+ description: 'Here is your serving of cheese: 🧀',
89
90
  url: 'https://some.url',
90
91
  lastUpdatedAt: '2025-01-08T22:26:52.501Z',
91
92
  thumbnail: {
@@ -10,7 +10,7 @@ import LinkWarningModal from './LinkWarningModal';
10
10
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
11
11
  const PACKAGE_DATA = {
12
12
  packageName: "@atlaskit/smart-card",
13
- packageVersion: "38.10.1",
13
+ packageVersion: "38.10.2",
14
14
  componentName: 'linkUrl'
15
15
  };
16
16
  const Anchor = withLinkClickedEvent('a');
@@ -1,6 +1,7 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
- import { extractLink } from '@atlaskit/link-extractors';
3
+ import { extractLink, extractSmartLinkUrl } from '@atlaskit/link-extractors';
4
+ import { fg } from "@atlaskit/platform-feature-flags";
4
5
  import { ActionName, CardAction } from '../../index';
5
6
  import { getDefinitionId, getExtensionKey, getResourceType } from '../../state/helpers';
6
7
  import { canShowAction } from '../../utils/actions/can-show-action';
@@ -13,7 +14,7 @@ export var extractInvokeCopyLinkAction = function extractInvokeCopyLinkAction(_r
13
14
  return;
14
15
  }
15
16
  var data = response.data;
16
- var url = extractLink(data);
17
+ var url = fg('smart_links_noun_support') ? extractSmartLinkUrl(response) : extractLink(data);
17
18
  if (!url) {
18
19
  return;
19
20
  }
@@ -1,5 +1,7 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import { extractSmartLinkDownloadUrl } from "@atlaskit/link-extractors";
4
+ import { fg } from "@atlaskit/platform-feature-flags";
3
5
  import { ActionName, CardAction } from '../../index';
4
6
  import { getDefinitionId, getExtensionKey, getResourceType } from '../../state/helpers';
5
7
  import { downloadUrl as download } from '../../utils';
@@ -19,7 +21,7 @@ export var extractInvokeDownloadAction = function extractInvokeDownloadAction(_r
19
21
  return action['@type'] === 'DownloadAction';
20
22
  });
21
23
  if (downloadActionExists) {
22
- var downloadUrl = extractDownloadUrl(data);
24
+ var downloadUrl = fg('smart_links_noun_support') ? extractSmartLinkDownloadUrl(response) : extractDownloadUrl(data);
23
25
  return {
24
26
  actionFn: function () {
25
27
  var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
@@ -1,6 +1,7 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
- import { extractLink, extractPreview as extractPreviewData, extractProvider, extractTitle } from '@atlaskit/link-extractors';
3
+ import { extractLink, extractPreview as extractPreviewData, extractProvider, extractSmartLinkEmbed, extractSmartLinkProvider, extractSmartLinkTitle, extractSmartLinkUrl, extractTitle } from '@atlaskit/link-extractors';
4
+ import { fg } from "@atlaskit/platform-feature-flags";
4
5
  import { ActionName, CardAction } from '../../index';
5
6
  import { getExtensionKey } from '../../state/helpers';
6
7
  import { canShowAction } from '../../utils/actions/can-show-action';
@@ -31,7 +32,7 @@ export var extractInvokePreviewAction = function extractInvokePreviewAction(para
31
32
  return {
32
33
  actionFn: function () {
33
34
  var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
34
- var _extractProvider;
35
+ var _extractSmartLinkProv, _extractProvider, _extractSmartLinkEmbe;
35
36
  return _regeneratorRuntime.wrap(function _callee$(_context) {
36
37
  while (1) switch (_context.prev = _context.next) {
37
38
  case 0:
@@ -44,12 +45,12 @@ export var extractInvokePreviewAction = function extractInvokePreviewAction(para
44
45
  isSupportTheming: extractIsSupportTheming(meta),
45
46
  isTrusted: extractIsTrusted(meta),
46
47
  linkIcon: extractLinkIcon(response),
47
- providerName: (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text,
48
+ providerName: fg('smart_links_noun_support') ? (_extractSmartLinkProv = extractSmartLinkProvider(response)) === null || _extractSmartLinkProv === void 0 ? void 0 : _extractSmartLinkProv.text : (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text,
48
49
  onClose: onClose,
49
50
  origin: origin,
50
- src: src,
51
- title: extractTitle(data),
52
- url: url
51
+ src: fg('smart_links_noun_support') ? (_extractSmartLinkEmbe = extractSmartLinkEmbed(response)) === null || _extractSmartLinkEmbe === void 0 ? void 0 : _extractSmartLinkEmbe.src : src,
52
+ title: fg('smart_links_noun_support') ? extractSmartLinkTitle(response) : extractTitle(data),
53
+ url: fg('smart_links_noun_support') ? extractSmartLinkUrl(response) : url
53
54
  }));
54
55
  case 1:
55
56
  case "end":
@@ -1,3 +1,6 @@
1
+ import { extractEntity, isEntityPresent } from "@atlaskit/link-extractors";
2
+ import { fg } from "@atlaskit/platform-feature-flags";
3
+
1
4
  /**
2
5
  * Return link summary
3
6
  */
@@ -6,4 +9,17 @@ export var extractSummary = function extractSummary(jsonLd) {
6
9
  var summary = jsonLd.summary.trim();
7
10
  return Boolean(summary) ? summary : undefined;
8
11
  }
12
+ };
13
+
14
+ /**
15
+ * Return link summary
16
+ */
17
+ export var extractSmartLinkSummary = function extractSmartLinkSummary(response) {
18
+ if (fg('smart_links_noun_support')) {
19
+ if (isEntityPresent(response)) {
20
+ var _extractEntity;
21
+ return (_extractEntity = extractEntity(response)) === null || _extractEntity === void 0 ? void 0 : _extractEntity.description;
22
+ }
23
+ }
24
+ return (response === null || response === void 0 ? void 0 : response.data) && extractSummary(response.data);
9
25
  };
@@ -1,10 +1,11 @@
1
- import { extractAri } from '@atlaskit/link-extractors';
1
+ import { extractAri, extractSmartLinkAri } from '@atlaskit/link-extractors';
2
+ import { fg } from "@atlaskit/platform-feature-flags";
2
3
  export var extractViewRelatedLinksAction = function extractViewRelatedLinksAction(response) {
3
4
  var _response$meta;
4
5
  if (!(response !== null && response !== void 0 && (_response$meta = response.meta) !== null && _response$meta !== void 0 && (_response$meta = _response$meta.supportedFeature) !== null && _response$meta !== void 0 && _response$meta.includes('RelatedLinks'))) {
5
6
  return;
6
7
  }
7
- var ari = extractAri(response.data);
8
+ var ari = fg('smart_links_noun_support') ? extractSmartLinkAri(response) : extractAri(response.data);
8
9
  if (!ari) {
9
10
  return;
10
11
  }
@@ -3,9 +3,9 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
3
3
  var _excluded = ["appearance", "fireEvent", "id", "onClick", "origin", "renderers", "resolve", "actionOptions", "response", "status", "aiSummaryConfig"];
4
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
- import { extractPersonCreatedBy, extractPersonOwnedBy, extractSmartLinkAri, extractSmartLinkCreatedBy, extractSmartLinkCreatedOn, extractSmartLinkModifiedBy, extractSmartLinkModifiedOn, extractSmartLinkTitle, extractSmartLinkUrl, extractType } from '@atlaskit/link-extractors';
6
+ import { extractPersonOwnedBy, extractSmartLinkAri, extractSmartLinkAuthorGroup, extractSmartLinkCreatedBy, extractSmartLinkCreatedOn, extractSmartLinkModifiedBy, extractSmartLinkModifiedOn, extractSmartLinkTitle, extractSmartLinkUrl, extractType } from '@atlaskit/link-extractors';
7
7
  import { fg } from '@atlaskit/platform-feature-flags';
8
- import { extractSummary } from '../common/primitives';
8
+ import { extractSmartLinkSummary } from "../common/primitives/extractSummary";
9
9
  import { extractFlexibleCardActions } from './actions';
10
10
  import { extractPersonsUpdatedBy } from './collaboratorGroup';
11
11
  import extractLinkTitle from './extract-link-title';
@@ -50,7 +50,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
50
50
  appliedToComponentsCount: extractAppliedToComponentsCount(data),
51
51
  assignedToGroup: extractPersonAssignedToAsArray(data),
52
52
  attachmentCount: extractAttachmentCount(data),
53
- authorGroup: extractPersonCreatedBy(data),
53
+ authorGroup: extractSmartLinkAuthorGroup(response),
54
54
  ownedByGroup: extractPersonOwnedBy(data),
55
55
  collaboratorGroup: extractPersonsUpdatedBy(data),
56
56
  commentCount: extractCommentCount(data),
@@ -77,7 +77,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
77
77
  programmingLanguage: extractProgrammingLanguage(data),
78
78
  readTime: extractReadTime(data),
79
79
  sentOn: extractSentOn(data),
80
- snippet: extractSummary(data) || undefined,
80
+ snippet: extractSmartLinkSummary(response) || undefined,
81
81
  // Explicitly set here to remove an empty string
82
82
  sourceBranch: extractSourceBranch(data),
83
83
  state: extractState(response, actionOptions, id, appearance, origin, fireEvent, resolve),
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
4
4
  export var context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card",
7
- packageVersion: "38.10.1"
7
+ packageVersion: "38.10.2"
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -97,6 +97,7 @@ var entityDataResponse = {
97
97
  entityData: {
98
98
  id: 'I love cheese',
99
99
  displayName: 'I love cheese',
100
+ description: 'Here is your serving of cheese: 🧀',
100
101
  url: 'https://some.url',
101
102
  lastUpdatedAt: '2025-01-08T22:26:52.501Z',
102
103
  thumbnail: {
@@ -13,7 +13,7 @@ import LinkWarningModal from './LinkWarningModal';
13
13
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
14
14
  var PACKAGE_DATA = {
15
15
  packageName: "@atlaskit/smart-card",
16
- packageVersion: "38.10.1",
16
+ packageVersion: "38.10.2",
17
17
  componentName: 'linkUrl'
18
18
  };
19
19
  var Anchor = withLinkClickedEvent('a');
@@ -0,0 +1,3 @@
1
+ import { SmartLinkResponse } from "@atlaskit/linking-types";
2
+ declare const _default: SmartLinkResponse;
3
+ export default _default;
@@ -1,5 +1,10 @@
1
1
  import { type JsonLd } from '@atlaskit/json-ld-types';
2
+ import type { SmartLinkResponse } from "@atlaskit/linking-types";
2
3
  /**
3
4
  * Return link summary
4
5
  */
5
6
  export declare const extractSummary: (jsonLd: JsonLd.Data.BaseData) => string | undefined;
7
+ /**
8
+ * Return link summary
9
+ */
10
+ export declare const extractSmartLinkSummary: (response?: SmartLinkResponse) => string | undefined;
@@ -0,0 +1,3 @@
1
+ import { SmartLinkResponse } from "@atlaskit/linking-types";
2
+ declare const _default: SmartLinkResponse;
3
+ export default _default;
@@ -1,5 +1,10 @@
1
1
  import { type JsonLd } from '@atlaskit/json-ld-types';
2
+ import type { SmartLinkResponse } from "@atlaskit/linking-types";
2
3
  /**
3
4
  * Return link summary
4
5
  */
5
6
  export declare const extractSummary: (jsonLd: JsonLd.Data.BaseData) => string | undefined;
7
+ /**
8
+ * Return link summary
9
+ */
10
+ export declare const extractSmartLinkSummary: (response?: SmartLinkResponse) => string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "38.10.2",
3
+ "version": "38.11.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -50,9 +50,9 @@
50
50
  "@atlaskit/link": "^3.2.0",
51
51
  "@atlaskit/link-analytics": "^10.0.0",
52
52
  "@atlaskit/link-client-extension": "^5.0.0",
53
- "@atlaskit/link-extractors": "^2.3.0",
53
+ "@atlaskit/link-extractors": "^2.4.0",
54
54
  "@atlaskit/linking-common": "^9.1.0",
55
- "@atlaskit/linking-types": "^12.0.0",
55
+ "@atlaskit/linking-types": "^12.1.0",
56
56
  "@atlaskit/logo": "^19.1.0",
57
57
  "@atlaskit/lozenge": "^13.0.0",
58
58
  "@atlaskit/menu": "^8.0.0",