@atlaskit/smart-card 38.4.4 → 38.5.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 (49) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/compass.yml +2 -2
  3. package/dist/cjs/extractors/flexible/index.js +8 -1
  4. package/dist/cjs/extractors/flexible/utils.js +10 -1
  5. package/dist/cjs/utils/analytics/analytics.js +1 -1
  6. package/dist/cjs/view/FlexibleCard/components/blocks/snippet-block/index.js +28 -4
  7. package/dist/cjs/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -2
  8. package/dist/cjs/view/LinkUrl/index.js +1 -1
  9. package/dist/es2019/extractors/flexible/index.js +9 -1
  10. package/dist/es2019/extractors/flexible/utils.js +4 -1
  11. package/dist/es2019/utils/analytics/analytics.js +1 -1
  12. package/dist/es2019/view/FlexibleCard/components/blocks/snippet-block/index.js +28 -4
  13. package/dist/es2019/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -2
  14. package/dist/es2019/view/LinkUrl/index.js +1 -1
  15. package/dist/esm/extractors/flexible/index.js +9 -2
  16. package/dist/esm/extractors/flexible/utils.js +9 -0
  17. package/dist/esm/utils/analytics/analytics.js +1 -1
  18. package/dist/esm/view/FlexibleCard/components/blocks/snippet-block/index.js +28 -4
  19. package/dist/esm/view/FlexibleCard/components/common/atlaskit-icon/index.js +2 -2
  20. package/dist/esm/view/LinkUrl/index.js +1 -1
  21. package/dist/types/__fixtures__/bitbucket-pull-request.d.ts +2 -0
  22. package/dist/types/__fixtures__/compass-scorecard.d.ts +2 -0
  23. package/dist/types/__fixtures__/confluence-blog.d.ts +2 -0
  24. package/dist/types/__fixtures__/confluence-page.d.ts +2 -0
  25. package/dist/types/__fixtures__/confluence-space.d.ts +2 -0
  26. package/dist/types/__fixtures__/confluence-template.d.ts +2 -0
  27. package/dist/types/__fixtures__/figma-entity.d.ts +2 -0
  28. package/dist/types/__fixtures__/figma.d.ts +2 -0
  29. package/dist/types/__fixtures__/jira-roadmap.d.ts +2 -0
  30. package/dist/types/__fixtures__/jira-task.d.ts +2 -0
  31. package/dist/types/__fixtures__/jira-timeline.d.ts +2 -0
  32. package/dist/types/__fixtures__/youtube-video.d.ts +2 -0
  33. package/dist/types/extractors/flexible/utils.d.ts +3 -0
  34. package/dist/types/state/flexible-ui-context/types.d.ts +8 -0
  35. package/dist/types-ts4.5/__fixtures__/bitbucket-pull-request.d.ts +2 -0
  36. package/dist/types-ts4.5/__fixtures__/compass-scorecard.d.ts +2 -0
  37. package/dist/types-ts4.5/__fixtures__/confluence-blog.d.ts +2 -0
  38. package/dist/types-ts4.5/__fixtures__/confluence-page.d.ts +2 -0
  39. package/dist/types-ts4.5/__fixtures__/confluence-space.d.ts +2 -0
  40. package/dist/types-ts4.5/__fixtures__/confluence-template.d.ts +2 -0
  41. package/dist/types-ts4.5/__fixtures__/figma-entity.d.ts +2 -0
  42. package/dist/types-ts4.5/__fixtures__/figma.d.ts +2 -0
  43. package/dist/types-ts4.5/__fixtures__/jira-roadmap.d.ts +2 -0
  44. package/dist/types-ts4.5/__fixtures__/jira-task.d.ts +2 -0
  45. package/dist/types-ts4.5/__fixtures__/jira-timeline.d.ts +2 -0
  46. package/dist/types-ts4.5/__fixtures__/youtube-video.d.ts +2 -0
  47. package/dist/types-ts4.5/extractors/flexible/utils.d.ts +3 -0
  48. package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +8 -0
  49. package/package.json +11 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 38.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#158715](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/158715)
8
+ [`baf5cca2f83aa`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/baf5cca2f83aa) -
9
+ Adds an optional snippet renderer method to SmardCardProvider context for overriding the default
10
+ snippet component on smart cards
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
16
+ ## 38.4.5
17
+
18
+ ### Patch Changes
19
+
20
+ - [#154600](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/154600)
21
+ [`0b06dde976fe0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0b06dde976fe0) -
22
+ Internal updates to logo component usage
23
+ - Updated dependencies
24
+
3
25
  ## 38.4.4
4
26
 
5
27
  ### Patch Changes
package/compass.yml CHANGED
@@ -19,11 +19,11 @@ links:
19
19
  - name: '#help-twg-linking-platform'
20
20
  type: CHAT_CHANNEL
21
21
  url: 'https://atlassian.enterprise.slack.com/archives/CFKGAQZRV'
22
- - name: null
22
+ - name: ''
23
23
  type: ON_CALL
24
24
  url: 'https://atlassian.app.opsgenie.com/settings/schedule/detail/b9c8b313-dd6d-4a41-8eeb-d7a9df55be9d'
25
25
  - name: source code
26
26
  type: REPOSITORY
27
- url: 'https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/linking-platform/smart-card'
27
+ url: 'https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master/platform/packages/linking-platform/smart-card'
28
28
  customFields: []
29
29
  relationships: {}
@@ -41,8 +41,9 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
41
41
  return undefined;
42
42
  }
43
43
  var data = response.data;
44
+ var meta = response.meta;
44
45
  var url = (0, _platformFeatureFlags.fg)('smart_links_noun_support') ? (0, _linkExtractors.extractSmartLinkUrl)(response) : (0, _linkExtractors.extractLink)(data);
45
- return _objectSpread({
46
+ return _objectSpread(_objectSpread({
46
47
  actions: (0, _actions.extractFlexibleCardActions)({
47
48
  actionOptions: actionOptions,
48
49
  aiSummaryConfig: aiSummaryConfig,
@@ -93,6 +94,12 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
93
94
  ari: (0, _platformFeatureFlags.fg)('smart_links_noun_support') ? (0, _linkExtractors.extractSmartLinkAri)(response) : (0, _linkExtractors.extractAri)(data)
94
95
  }, (0, _platformFeatureFlags.fg)('platform-linking-visual-refresh-v2') && {
95
96
  type: (0, _linkExtractors.extractType)(data)
97
+ }), (0, _platformFeatureFlags.fg)('cc-ai-linking-platform-snippet-renderer') && {
98
+ meta: {
99
+ objectId: (0, _utils.extractMetaObjectId)(meta),
100
+ resourceType: (0, _utils.extractMetaResourceType)(meta),
101
+ tenantId: (0, _utils.extractMetaTenantId)(meta)
102
+ }
96
103
  });
97
104
  };
98
105
  var _default = exports.default = extractFlexibleUiContext;
@@ -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.extractSubTasksProgress = exports.extractStoryPoints = exports.extractSourceBranch = exports.extractSentOn = exports.extractReadTime = exports.extractReactCount = exports.extractProgrammingLanguage = exports.extractPersonAssignedToAsArray = exports.extractOwnedBy = exports.extractModifiedBy = exports.extractLocation = exports.extractDueOn = exports.extractCreatedBy = exports.extractCommentCount = exports.extractChecklistProgress = exports.extractAttachmentCount = exports.extractAssignedTo = exports.extractAppliedToComponentsCount = void 0;
7
+ exports.extractVoteCount = exports.extractViewCount = exports.extractTargetBranch = exports.extractSubscriberCount = exports.extractSubTasksProgress = exports.extractStoryPoints = exports.extractSourceBranch = exports.extractSentOn = exports.extractReadTime = exports.extractReactCount = exports.extractProgrammingLanguage = exports.extractPersonAssignedToAsArray = exports.extractOwnedBy = exports.extractModifiedBy = exports.extractMetaTenantId = exports.extractMetaResourceType = exports.extractMetaObjectId = exports.extractLocation = exports.extractDueOn = exports.extractCreatedBy = exports.extractCommentCount = exports.extractChecklistProgress = exports.extractAttachmentCount = exports.extractAssignedTo = exports.extractAppliedToComponentsCount = void 0;
8
8
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
9
  var _linkExtractors = require("@atlaskit/link-extractors");
10
10
  var extractLinkName = function extractLinkName(link) {
@@ -103,4 +103,13 @@ var extractSentOn = exports.extractSentOn = function extractSentOn(data) {
103
103
  };
104
104
  var extractStoryPoints = exports.extractStoryPoints = function extractStoryPoints(data) {
105
105
  return extractValue(data, 'atlassian:storyPoints');
106
+ };
107
+ var extractMetaObjectId = exports.extractMetaObjectId = function extractMetaObjectId(meta) {
108
+ return meta.objectId;
109
+ };
110
+ var extractMetaResourceType = exports.extractMetaResourceType = function extractMetaResourceType(meta) {
111
+ return meta.resourceType;
112
+ };
113
+ var extractMetaTenantId = exports.extractMetaTenantId = function extractMetaTenantId(meta) {
114
+ return meta.tenantId;
106
115
  };
@@ -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.4.4"
14
+ packageVersion: "38.5.0"
15
15
  };
16
16
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
17
17
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -8,7 +8,10 @@ exports.default = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
10
  var _react = _interopRequireDefault(require("react"));
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _constants = require("../../../../../constants");
13
+ var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
14
+ var _renderers = require("../../../../../state/renderers");
12
15
  var _elements = require("../../elements");
13
16
  var _utils = require("../../utils");
14
17
  var _block = _interopRequireDefault(require("../block"));
@@ -24,6 +27,7 @@ var MINIMUM_MAX_LINES = 1;
24
27
  * @see Block
25
28
  */
26
29
  var SnippetBlock = function SnippetBlock(_ref) {
30
+ var _ref2, _context$meta$objectI, _context$meta, _context$meta$resourc, _context$meta2, _context$meta$tenantI, _context$meta3;
27
31
  var _ref$maxLines = _ref.maxLines,
28
32
  maxLines = _ref$maxLines === void 0 ? DEFAULT_MAX_LINES : _ref$maxLines,
29
33
  _ref$status = _ref.status,
@@ -32,16 +36,36 @@ var SnippetBlock = function SnippetBlock(_ref) {
32
36
  testId = _ref$testId === void 0 ? 'smart-block-snippet' : _ref$testId,
33
37
  text = _ref.text,
34
38
  blockProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
39
+ var context = (0, _platformFeatureFlags.fg)('cc-ai-linking-platform-snippet-renderer') ?
40
+ // eslint-disable-next-line react-hooks/rules-of-hooks
41
+ (0, _flexibleUiContext.useFlexibleUiContext)() : undefined;
42
+ var renderers = (0, _platformFeatureFlags.fg)('cc-ai-linking-platform-snippet-renderer') ?
43
+ // eslint-disable-next-line react-hooks/rules-of-hooks
44
+ (0, _renderers.useSmartLinkRenderers)() : undefined;
35
45
  if (status !== _constants.SmartLinkStatus.Resolved && !text) {
36
46
  return null;
37
47
  }
38
48
  var snippetMaxLines = (0, _utils.getMaxLines)(maxLines, DEFAULT_MAX_LINES, MAXIMUM_MAX_LINES, MINIMUM_MAX_LINES);
39
49
  var statusTestId = !text ? 'resolved' : 'non-resolved';
40
- return /*#__PURE__*/_react.default.createElement(_block.default, (0, _extends2.default)({}, blockProps, {
41
- testId: "".concat(testId, "-").concat(statusTestId, "-view")
42
- }), /*#__PURE__*/_react.default.createElement(_elements.Snippet, {
50
+ var snippet = /*#__PURE__*/_react.default.createElement(_elements.Snippet, {
43
51
  maxLines: snippetMaxLines,
44
52
  content: text
45
- }));
53
+ });
54
+ if (!(0, _platformFeatureFlags.fg)('cc-ai-linking-platform-snippet-renderer')) {
55
+ return /*#__PURE__*/_react.default.createElement(_block.default, (0, _extends2.default)({}, blockProps, {
56
+ testId: "".concat(testId, "-").concat(statusTestId, "-view")
57
+ }), snippet);
58
+ }
59
+ var SnippetReplacement = renderers === null || renderers === void 0 ? void 0 : renderers.snippet;
60
+ return /*#__PURE__*/_react.default.createElement(_block.default, (0, _extends2.default)({}, blockProps, {
61
+ testId: "".concat(testId, "-").concat(statusTestId, "-view")
62
+ }), SnippetReplacement ? /*#__PURE__*/_react.default.createElement(SnippetReplacement, {
63
+ fallbackText: (_ref2 = text || (context === null || context === void 0 ? void 0 : context.snippet)) !== null && _ref2 !== void 0 ? _ref2 : '',
64
+ fallbackComponent: snippet,
65
+ contentId: (_context$meta$objectI = context === null || context === void 0 || (_context$meta = context.meta) === null || _context$meta === void 0 ? void 0 : _context$meta.objectId) !== null && _context$meta$objectI !== void 0 ? _context$meta$objectI : '',
66
+ contentType: (_context$meta$resourc = context === null || context === void 0 || (_context$meta2 = context.meta) === null || _context$meta2 === void 0 ? void 0 : _context$meta2.resourceType) !== null && _context$meta$resourc !== void 0 ? _context$meta$resourc : '',
67
+ cloudId: (_context$meta$tenantI = context === null || context === void 0 || (_context$meta3 = context.meta) === null || _context$meta3 === void 0 ? void 0 : _context$meta3.tenantId) !== null && _context$meta$tenantI !== void 0 ? _context$meta$tenantI : '',
68
+ maxLines: snippetMaxLines
69
+ }) : snippet);
46
70
  };
47
71
  var _default = exports.default = SnippetBlock;
@@ -69,13 +69,13 @@ var AtlaskitIcon = function AtlaskitIcon(_ref) {
69
69
  return /*#__PURE__*/_react.default.createElement(_logo.ConfluenceIcon, {
70
70
  appearance: "brand",
71
71
  testId: testId,
72
- size: size === _constants.SmartLinkSize.Large || size === _constants.SmartLinkSize.XLarge ? 'small' : 'xsmall'
72
+ size: size === _constants.SmartLinkSize.Large || size === _constants.SmartLinkSize.XLarge ? 'small' : 'xxsmall'
73
73
  });
74
74
  case _constants.IconType.Jira:
75
75
  return /*#__PURE__*/_react.default.createElement(_logo.JiraIcon, {
76
76
  appearance: "brand",
77
77
  testId: testId,
78
- size: size === _constants.SmartLinkSize.Large || size === _constants.SmartLinkSize.XLarge ? 'small' : 'xsmall'
78
+ size: size === _constants.SmartLinkSize.Large || size === _constants.SmartLinkSize.XLarge ? 'small' : 'xxsmall'
79
79
  });
80
80
  case _constants.IconType.Error:
81
81
  case _constants.IconType.Forbidden:
@@ -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.4.4",
23
+ packageVersion: "38.5.0",
24
24
  componentName: 'linkUrl'
25
25
  };
26
26
  var Anchor = (0, _click.withLinkClickedEvent)('a');
@@ -9,7 +9,7 @@ import extractState from './extract-state';
9
9
  import { extractLinkIcon, extractSmartLinkIcon } from './icon';
10
10
  import extractProviderIcon, { extractSmartLinkProviderIcon } from './icon/extract-provider-icon';
11
11
  import { extractLatestCommit } from './latest-commit';
12
- import { extractAppliedToComponentsCount, extractAssignedTo, extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractDueOn, extractLocation, extractModifiedBy, extractOwnedBy, extractPersonAssignedToAsArray, extractProgrammingLanguage, extractReactCount, extractReadTime, extractSentOn, extractSourceBranch, extractStoryPoints, extractSubscriberCount, extractSubTasksProgress, extractTargetBranch, extractViewCount, extractVoteCount } from './utils';
12
+ import { extractAppliedToComponentsCount, extractAssignedTo, extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractDueOn, extractLocation, extractMetaObjectId, extractMetaResourceType, extractMetaTenantId, extractModifiedBy, extractOwnedBy, extractPersonAssignedToAsArray, extractProgrammingLanguage, extractReactCount, extractReadTime, extractSentOn, extractSourceBranch, extractStoryPoints, extractSubscriberCount, extractSubTasksProgress, extractTargetBranch, extractViewCount, extractVoteCount } from './utils';
13
13
  const extractFlexibleUiContext = ({
14
14
  appearance,
15
15
  fireEvent,
@@ -26,6 +26,7 @@ const extractFlexibleUiContext = ({
26
26
  return undefined;
27
27
  }
28
28
  const data = response.data;
29
+ const meta = response.meta;
29
30
  const url = fg('smart_links_noun_support') ? extractSmartLinkUrl(response) : extractLink(data);
30
31
  return {
31
32
  actions: extractFlexibleCardActions({
@@ -78,6 +79,13 @@ const extractFlexibleUiContext = ({
78
79
  ari: fg('smart_links_noun_support') ? extractSmartLinkAri(response) : extractAri(data),
79
80
  ...(fg('platform-linking-visual-refresh-v2') && {
80
81
  type: extractType(data)
82
+ }),
83
+ ...(fg('cc-ai-linking-platform-snippet-renderer') && {
84
+ meta: {
85
+ objectId: extractMetaObjectId(meta),
86
+ resourceType: extractMetaResourceType(meta),
87
+ tenantId: extractMetaTenantId(meta)
88
+ }
81
89
  })
82
90
  };
83
91
  };
@@ -74,4 +74,7 @@ export const extractSentOn = data => {
74
74
  };
75
75
  export const extractStoryPoints = data => {
76
76
  return extractValue(data, 'atlassian:storyPoints');
77
- };
77
+ };
78
+ export const extractMetaObjectId = meta => meta.objectId;
79
+ export const extractMetaResourceType = meta => meta.resourceType;
80
+ export const extractMetaTenantId = meta => meta.tenantId;
@@ -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.4.4"
5
+ packageVersion: "38.5.0"
6
6
  };
7
7
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
8
8
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -1,6 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { SmartLinkStatus } from '../../../../../constants';
5
+ import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
6
+ import { useSmartLinkRenderers } from '../../../../../state/renderers';
4
7
  import { Snippet } from '../../elements';
5
8
  import { getMaxLines } from '../../utils';
6
9
  import Block from '../block';
@@ -21,16 +24,37 @@ const SnippetBlock = ({
21
24
  text,
22
25
  ...blockProps
23
26
  }) => {
27
+ var _ref, _context$meta$objectI, _context$meta, _context$meta$resourc, _context$meta2, _context$meta$tenantI, _context$meta3;
28
+ const context = fg('cc-ai-linking-platform-snippet-renderer') ?
29
+ // eslint-disable-next-line react-hooks/rules-of-hooks
30
+ useFlexibleUiContext() : undefined;
31
+ const renderers = fg('cc-ai-linking-platform-snippet-renderer') ?
32
+ // eslint-disable-next-line react-hooks/rules-of-hooks
33
+ useSmartLinkRenderers() : undefined;
24
34
  if (status !== SmartLinkStatus.Resolved && !text) {
25
35
  return null;
26
36
  }
27
37
  const snippetMaxLines = getMaxLines(maxLines, DEFAULT_MAX_LINES, MAXIMUM_MAX_LINES, MINIMUM_MAX_LINES);
28
38
  const statusTestId = !text ? 'resolved' : 'non-resolved';
29
- return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
30
- testId: `${testId}-${statusTestId}-view`
31
- }), /*#__PURE__*/React.createElement(Snippet, {
39
+ const snippet = /*#__PURE__*/React.createElement(Snippet, {
32
40
  maxLines: snippetMaxLines,
33
41
  content: text
34
- }));
42
+ });
43
+ if (!fg('cc-ai-linking-platform-snippet-renderer')) {
44
+ return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
45
+ testId: `${testId}-${statusTestId}-view`
46
+ }), snippet);
47
+ }
48
+ const SnippetReplacement = renderers === null || renderers === void 0 ? void 0 : renderers.snippet;
49
+ return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
50
+ testId: `${testId}-${statusTestId}-view`
51
+ }), SnippetReplacement ? /*#__PURE__*/React.createElement(SnippetReplacement, {
52
+ fallbackText: (_ref = text || (context === null || context === void 0 ? void 0 : context.snippet)) !== null && _ref !== void 0 ? _ref : '',
53
+ fallbackComponent: snippet,
54
+ contentId: (_context$meta$objectI = context === null || context === void 0 ? void 0 : (_context$meta = context.meta) === null || _context$meta === void 0 ? void 0 : _context$meta.objectId) !== null && _context$meta$objectI !== void 0 ? _context$meta$objectI : '',
55
+ contentType: (_context$meta$resourc = context === null || context === void 0 ? void 0 : (_context$meta2 = context.meta) === null || _context$meta2 === void 0 ? void 0 : _context$meta2.resourceType) !== null && _context$meta$resourc !== void 0 ? _context$meta$resourc : '',
56
+ cloudId: (_context$meta$tenantI = context === null || context === void 0 ? void 0 : (_context$meta3 = context.meta) === null || _context$meta3 === void 0 ? void 0 : _context$meta3.tenantId) !== null && _context$meta$tenantI !== void 0 ? _context$meta$tenantI : '',
57
+ maxLines: snippetMaxLines
58
+ }) : snippet);
35
59
  };
36
60
  export default SnippetBlock;
@@ -56,13 +56,13 @@ const AtlaskitIcon = ({
56
56
  return /*#__PURE__*/React.createElement(ConfluenceIcon, {
57
57
  appearance: "brand",
58
58
  testId: testId,
59
- size: size === SmartLinkSize.Large || size === SmartLinkSize.XLarge ? 'small' : 'xsmall'
59
+ size: size === SmartLinkSize.Large || size === SmartLinkSize.XLarge ? 'small' : 'xxsmall'
60
60
  });
61
61
  case IconType.Jira:
62
62
  return /*#__PURE__*/React.createElement(JiraIcon, {
63
63
  appearance: "brand",
64
64
  testId: testId,
65
- size: size === SmartLinkSize.Large || size === SmartLinkSize.XLarge ? 'small' : 'xsmall'
65
+ size: size === SmartLinkSize.Large || size === SmartLinkSize.XLarge ? 'small' : 'xxsmall'
66
66
  });
67
67
  case IconType.Error:
68
68
  case IconType.Forbidden:
@@ -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.4.4",
13
+ packageVersion: "38.5.0",
14
14
  componentName: 'linkUrl'
15
15
  };
16
16
  const Anchor = withLinkClickedEvent('a');
@@ -14,7 +14,7 @@ import extractState from './extract-state';
14
14
  import { extractLinkIcon, extractSmartLinkIcon } from './icon';
15
15
  import extractProviderIcon, { extractSmartLinkProviderIcon } from './icon/extract-provider-icon';
16
16
  import { extractLatestCommit } from './latest-commit';
17
- import { extractAppliedToComponentsCount, extractAssignedTo, extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractDueOn, extractLocation, extractModifiedBy, extractOwnedBy, extractPersonAssignedToAsArray, extractProgrammingLanguage, extractReactCount, extractReadTime, extractSentOn, extractSourceBranch, extractStoryPoints, extractSubscriberCount, extractSubTasksProgress, extractTargetBranch, extractViewCount, extractVoteCount } from './utils';
17
+ import { extractAppliedToComponentsCount, extractAssignedTo, extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractDueOn, extractLocation, extractMetaObjectId, extractMetaResourceType, extractMetaTenantId, extractModifiedBy, extractOwnedBy, extractPersonAssignedToAsArray, extractProgrammingLanguage, extractReactCount, extractReadTime, extractSentOn, extractSourceBranch, extractStoryPoints, extractSubscriberCount, extractSubTasksProgress, extractTargetBranch, extractViewCount, extractVoteCount } from './utils';
18
18
  var extractFlexibleUiContext = function extractFlexibleUiContext() {
19
19
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
20
20
  var appearance = _ref.appearance,
@@ -31,8 +31,9 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
31
31
  return undefined;
32
32
  }
33
33
  var data = response.data;
34
+ var meta = response.meta;
34
35
  var url = fg('smart_links_noun_support') ? extractSmartLinkUrl(response) : extractLink(data);
35
- return _objectSpread({
36
+ return _objectSpread(_objectSpread({
36
37
  actions: extractFlexibleCardActions({
37
38
  actionOptions: actionOptions,
38
39
  aiSummaryConfig: aiSummaryConfig,
@@ -83,6 +84,12 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
83
84
  ari: fg('smart_links_noun_support') ? extractSmartLinkAri(response) : extractAri(data)
84
85
  }, fg('platform-linking-visual-refresh-v2') && {
85
86
  type: extractType(data)
87
+ }), fg('cc-ai-linking-platform-snippet-renderer') && {
88
+ meta: {
89
+ objectId: extractMetaObjectId(meta),
90
+ resourceType: extractMetaResourceType(meta),
91
+ tenantId: extractMetaTenantId(meta)
92
+ }
86
93
  });
87
94
  };
88
95
  export default extractFlexibleUiContext;
@@ -96,4 +96,13 @@ export var extractSentOn = function extractSentOn(data) {
96
96
  };
97
97
  export var extractStoryPoints = function extractStoryPoints(data) {
98
98
  return extractValue(data, 'atlassian:storyPoints');
99
+ };
100
+ export var extractMetaObjectId = function extractMetaObjectId(meta) {
101
+ return meta.objectId;
102
+ };
103
+ export var extractMetaResourceType = function extractMetaResourceType(meta) {
104
+ return meta.resourceType;
105
+ };
106
+ export var extractMetaTenantId = function extractMetaTenantId(meta) {
107
+ return meta.tenantId;
99
108
  };
@@ -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.4.4"
7
+ packageVersion: "38.5.0"
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -2,7 +2,10 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["maxLines", "status", "testId", "text"];
4
4
  import React from 'react';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  import { SmartLinkStatus } from '../../../../../constants';
7
+ import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
8
+ import { useSmartLinkRenderers } from '../../../../../state/renderers';
6
9
  import { Snippet } from '../../elements';
7
10
  import { getMaxLines } from '../../utils';
8
11
  import Block from '../block';
@@ -17,6 +20,7 @@ var MINIMUM_MAX_LINES = 1;
17
20
  * @see Block
18
21
  */
19
22
  var SnippetBlock = function SnippetBlock(_ref) {
23
+ var _ref2, _context$meta$objectI, _context$meta, _context$meta$resourc, _context$meta2, _context$meta$tenantI, _context$meta3;
20
24
  var _ref$maxLines = _ref.maxLines,
21
25
  maxLines = _ref$maxLines === void 0 ? DEFAULT_MAX_LINES : _ref$maxLines,
22
26
  _ref$status = _ref.status,
@@ -25,16 +29,36 @@ var SnippetBlock = function SnippetBlock(_ref) {
25
29
  testId = _ref$testId === void 0 ? 'smart-block-snippet' : _ref$testId,
26
30
  text = _ref.text,
27
31
  blockProps = _objectWithoutProperties(_ref, _excluded);
32
+ var context = fg('cc-ai-linking-platform-snippet-renderer') ?
33
+ // eslint-disable-next-line react-hooks/rules-of-hooks
34
+ useFlexibleUiContext() : undefined;
35
+ var renderers = fg('cc-ai-linking-platform-snippet-renderer') ?
36
+ // eslint-disable-next-line react-hooks/rules-of-hooks
37
+ useSmartLinkRenderers() : undefined;
28
38
  if (status !== SmartLinkStatus.Resolved && !text) {
29
39
  return null;
30
40
  }
31
41
  var snippetMaxLines = getMaxLines(maxLines, DEFAULT_MAX_LINES, MAXIMUM_MAX_LINES, MINIMUM_MAX_LINES);
32
42
  var statusTestId = !text ? 'resolved' : 'non-resolved';
33
- return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
34
- testId: "".concat(testId, "-").concat(statusTestId, "-view")
35
- }), /*#__PURE__*/React.createElement(Snippet, {
43
+ var snippet = /*#__PURE__*/React.createElement(Snippet, {
36
44
  maxLines: snippetMaxLines,
37
45
  content: text
38
- }));
46
+ });
47
+ if (!fg('cc-ai-linking-platform-snippet-renderer')) {
48
+ return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
49
+ testId: "".concat(testId, "-").concat(statusTestId, "-view")
50
+ }), snippet);
51
+ }
52
+ var SnippetReplacement = renderers === null || renderers === void 0 ? void 0 : renderers.snippet;
53
+ return /*#__PURE__*/React.createElement(Block, _extends({}, blockProps, {
54
+ testId: "".concat(testId, "-").concat(statusTestId, "-view")
55
+ }), SnippetReplacement ? /*#__PURE__*/React.createElement(SnippetReplacement, {
56
+ fallbackText: (_ref2 = text || (context === null || context === void 0 ? void 0 : context.snippet)) !== null && _ref2 !== void 0 ? _ref2 : '',
57
+ fallbackComponent: snippet,
58
+ contentId: (_context$meta$objectI = context === null || context === void 0 || (_context$meta = context.meta) === null || _context$meta === void 0 ? void 0 : _context$meta.objectId) !== null && _context$meta$objectI !== void 0 ? _context$meta$objectI : '',
59
+ contentType: (_context$meta$resourc = context === null || context === void 0 || (_context$meta2 = context.meta) === null || _context$meta2 === void 0 ? void 0 : _context$meta2.resourceType) !== null && _context$meta$resourc !== void 0 ? _context$meta$resourc : '',
60
+ cloudId: (_context$meta$tenantI = context === null || context === void 0 || (_context$meta3 = context.meta) === null || _context$meta3 === void 0 ? void 0 : _context$meta3.tenantId) !== null && _context$meta$tenantI !== void 0 ? _context$meta$tenantI : '',
61
+ maxLines: snippetMaxLines
62
+ }) : snippet);
39
63
  };
40
64
  export default SnippetBlock;
@@ -62,13 +62,13 @@ var AtlaskitIcon = function AtlaskitIcon(_ref) {
62
62
  return /*#__PURE__*/React.createElement(ConfluenceIcon, {
63
63
  appearance: "brand",
64
64
  testId: testId,
65
- size: size === SmartLinkSize.Large || size === SmartLinkSize.XLarge ? 'small' : 'xsmall'
65
+ size: size === SmartLinkSize.Large || size === SmartLinkSize.XLarge ? 'small' : 'xxsmall'
66
66
  });
67
67
  case IconType.Jira:
68
68
  return /*#__PURE__*/React.createElement(JiraIcon, {
69
69
  appearance: "brand",
70
70
  testId: testId,
71
- size: size === SmartLinkSize.Large || size === SmartLinkSize.XLarge ? 'small' : 'xsmall'
71
+ size: size === SmartLinkSize.Large || size === SmartLinkSize.XLarge ? 'small' : 'xxsmall'
72
72
  });
73
73
  case IconType.Error:
74
74
  case IconType.Forbidden:
@@ -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.4.4",
16
+ packageVersion: "38.5.0",
17
17
  componentName: 'linkUrl'
18
18
  };
19
19
  var Anchor = withLinkClickedEvent('a');
@@ -4,6 +4,8 @@ declare const _default: {
4
4
  access: string;
5
5
  resourceType: string;
6
6
  key: string;
7
+ objectId: string;
8
+ tenantId: string;
7
9
  };
8
10
  data: {
9
11
  '@id': string;
@@ -5,6 +5,8 @@ declare const _default: {
5
5
  product: string;
6
6
  resourceType: string;
7
7
  key: string;
8
+ objectId: string;
9
+ tenantId: string;
8
10
  };
9
11
  data: {
10
12
  '@context': {
@@ -6,6 +6,8 @@ declare const _default: {
6
6
  access: string;
7
7
  resourceType: string;
8
8
  key: string;
9
+ objectId: string;
10
+ tenantId: string;
9
11
  };
10
12
  data: {
11
13
  '@context': {
@@ -6,6 +6,8 @@ declare const _default: {
6
6
  access: string;
7
7
  resourceType: string;
8
8
  key: string;
9
+ objectId: string;
10
+ tenantId: string;
9
11
  };
10
12
  data: {
11
13
  '@context': {
@@ -6,6 +6,8 @@ declare const _default: {
6
6
  access: string;
7
7
  resourceType: string;
8
8
  key: string;
9
+ objectId: string;
10
+ tenantId: string;
9
11
  };
10
12
  data: {
11
13
  '@context': {
@@ -24,7 +24,9 @@ declare const _default: {
24
24
  access: string;
25
25
  auth: never[];
26
26
  definitionId: string;
27
+ objectId: string;
27
28
  resourceType: string;
29
+ tenantId: string;
28
30
  visibility: string;
29
31
  };
30
32
  };
@@ -9,7 +9,9 @@ declare const _default: {
9
9
  }[];
10
10
  definitionId: string;
11
11
  key: string;
12
+ objectId: string;
12
13
  resourceType: string;
14
+ tenantId: string;
13
15
  version: string;
14
16
  };
15
17
  data: {
@@ -9,7 +9,9 @@ declare const _default: {
9
9
  }[];
10
10
  definitionId: string;
11
11
  key: string;
12
+ objectId: string;
12
13
  resourceType: string;
14
+ tenantId: string;
13
15
  version: string;
14
16
  };
15
17
  data: {
@@ -6,6 +6,8 @@ declare const _default: {
6
6
  access: string;
7
7
  resourceType: string;
8
8
  key: string;
9
+ objectId: string;
10
+ tenantId: string;
9
11
  };
10
12
  data: {
11
13
  '@context': {
@@ -7,6 +7,8 @@ declare const _default: {
7
7
  access: string;
8
8
  resourceType: string;
9
9
  key: string;
10
+ objectId: string;
11
+ tenantId: string;
10
12
  };
11
13
  data: {
12
14
  '@context': {
@@ -6,6 +6,8 @@ declare const _default: {
6
6
  access: string;
7
7
  resourceType: string;
8
8
  key: string;
9
+ objectId: string;
10
+ tenantId: string;
9
11
  };
10
12
  data: {
11
13
  '@context': {
@@ -5,7 +5,9 @@ declare const _default: {
5
5
  auth: never[];
6
6
  definitionId: string;
7
7
  key: string;
8
+ objectId: string;
8
9
  resourceType: string;
10
+ tenantId: string;
9
11
  };
10
12
  data: {
11
13
  '@type': string;
@@ -27,3 +27,6 @@ export declare const extractSubTasksProgress: (data: JsonLd.Data.BaseData) => st
27
27
  export declare const extractReadTime: (data: JsonLd.Data.BaseData) => string | undefined;
28
28
  export declare const extractSentOn: (data: JsonLd.Data.BaseData) => string | undefined;
29
29
  export declare const extractStoryPoints: (data: JsonLd.Data.BaseData) => number | undefined;
30
+ export declare const extractMetaObjectId: (meta: JsonLd.Meta.BaseMeta) => string | undefined;
31
+ export declare const extractMetaResourceType: (meta: JsonLd.Meta.BaseMeta) => string | undefined;
32
+ export declare const extractMetaTenantId: (meta: JsonLd.Meta.BaseMeta) => string | undefined;
@@ -237,6 +237,14 @@ export type FlexibleUiDataContext = {
237
237
  * @type string
238
238
  */
239
239
  type?: string[];
240
+ /**
241
+ * Contains metadata about the linked resource.
242
+ */
243
+ meta?: {
244
+ objectId?: string;
245
+ resourceType?: string;
246
+ tenantId?: string;
247
+ };
240
248
  };
241
249
  export type Icon = {
242
250
  icon?: IconType;
@@ -4,6 +4,8 @@ declare const _default: {
4
4
  access: string;
5
5
  resourceType: string;
6
6
  key: string;
7
+ objectId: string;
8
+ tenantId: string;
7
9
  };
8
10
  data: {
9
11
  '@id': string;
@@ -5,6 +5,8 @@ declare const _default: {
5
5
  product: string;
6
6
  resourceType: string;
7
7
  key: string;
8
+ objectId: string;
9
+ tenantId: string;
8
10
  };
9
11
  data: {
10
12
  '@context': {
@@ -6,6 +6,8 @@ declare const _default: {
6
6
  access: string;
7
7
  resourceType: string;
8
8
  key: string;
9
+ objectId: string;
10
+ tenantId: string;
9
11
  };
10
12
  data: {
11
13
  '@context': {
@@ -6,6 +6,8 @@ declare const _default: {
6
6
  access: string;
7
7
  resourceType: string;
8
8
  key: string;
9
+ objectId: string;
10
+ tenantId: string;
9
11
  };
10
12
  data: {
11
13
  '@context': {
@@ -6,6 +6,8 @@ declare const _default: {
6
6
  access: string;
7
7
  resourceType: string;
8
8
  key: string;
9
+ objectId: string;
10
+ tenantId: string;
9
11
  };
10
12
  data: {
11
13
  '@context': {
@@ -24,7 +24,9 @@ declare const _default: {
24
24
  access: string;
25
25
  auth: never[];
26
26
  definitionId: string;
27
+ objectId: string;
27
28
  resourceType: string;
29
+ tenantId: string;
28
30
  visibility: string;
29
31
  };
30
32
  };
@@ -9,7 +9,9 @@ declare const _default: {
9
9
  }[];
10
10
  definitionId: string;
11
11
  key: string;
12
+ objectId: string;
12
13
  resourceType: string;
14
+ tenantId: string;
13
15
  version: string;
14
16
  };
15
17
  data: {
@@ -9,7 +9,9 @@ declare const _default: {
9
9
  }[];
10
10
  definitionId: string;
11
11
  key: string;
12
+ objectId: string;
12
13
  resourceType: string;
14
+ tenantId: string;
13
15
  version: string;
14
16
  };
15
17
  data: {
@@ -6,6 +6,8 @@ declare const _default: {
6
6
  access: string;
7
7
  resourceType: string;
8
8
  key: string;
9
+ objectId: string;
10
+ tenantId: string;
9
11
  };
10
12
  data: {
11
13
  '@context': {
@@ -7,6 +7,8 @@ declare const _default: {
7
7
  access: string;
8
8
  resourceType: string;
9
9
  key: string;
10
+ objectId: string;
11
+ tenantId: string;
10
12
  };
11
13
  data: {
12
14
  '@context': {
@@ -6,6 +6,8 @@ declare const _default: {
6
6
  access: string;
7
7
  resourceType: string;
8
8
  key: string;
9
+ objectId: string;
10
+ tenantId: string;
9
11
  };
10
12
  data: {
11
13
  '@context': {
@@ -5,7 +5,9 @@ declare const _default: {
5
5
  auth: never[];
6
6
  definitionId: string;
7
7
  key: string;
8
+ objectId: string;
8
9
  resourceType: string;
10
+ tenantId: string;
9
11
  };
10
12
  data: {
11
13
  '@type': string;
@@ -27,3 +27,6 @@ export declare const extractSubTasksProgress: (data: JsonLd.Data.BaseData) => st
27
27
  export declare const extractReadTime: (data: JsonLd.Data.BaseData) => string | undefined;
28
28
  export declare const extractSentOn: (data: JsonLd.Data.BaseData) => string | undefined;
29
29
  export declare const extractStoryPoints: (data: JsonLd.Data.BaseData) => number | undefined;
30
+ export declare const extractMetaObjectId: (meta: JsonLd.Meta.BaseMeta) => string | undefined;
31
+ export declare const extractMetaResourceType: (meta: JsonLd.Meta.BaseMeta) => string | undefined;
32
+ export declare const extractMetaTenantId: (meta: JsonLd.Meta.BaseMeta) => string | undefined;
@@ -237,6 +237,14 @@ export type FlexibleUiDataContext = {
237
237
  * @type string
238
238
  */
239
239
  type?: string[];
240
+ /**
241
+ * Contains metadata about the linked resource.
242
+ */
243
+ meta?: {
244
+ objectId?: string;
245
+ resourceType?: string;
246
+ tenantId?: string;
247
+ };
240
248
  };
241
249
  export type Icon = {
242
250
  icon?: IconType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "38.4.4",
3
+ "version": "38.5.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/link-extractors": "^2.3.0",
54
54
  "@atlaskit/linking-common": "^9.0.0",
55
55
  "@atlaskit/linking-types": "^9.10.0",
56
- "@atlaskit/logo": "^18.0.0",
56
+ "@atlaskit/logo": "^18.1.0",
57
57
  "@atlaskit/lozenge": "^12.2.0",
58
58
  "@atlaskit/menu": "^8.0.0",
59
59
  "@atlaskit/modal-dialog": "^14.2.0",
@@ -85,7 +85,7 @@
85
85
  "uuid": "^3.1.0"
86
86
  },
87
87
  "peerDependencies": {
88
- "@atlaskit/link-provider": "^3.0.0",
88
+ "@atlaskit/link-provider": "^3.1.0",
89
89
  "react": "^18.2.0",
90
90
  "react-dom": "^18.2.0",
91
91
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -177,6 +177,9 @@
177
177
  "type": "boolean",
178
178
  "showOnWebsiteForTransitiveDependencies": true
179
179
  },
180
+ "platform-linking-flexible-card-elements-refactor": {
181
+ "type": "boolean"
182
+ },
180
183
  "platform-component-visual-refresh": {
181
184
  "type": "boolean",
182
185
  "showOnWebsiteForTransitiveDependencies": true
@@ -248,6 +251,10 @@
248
251
  },
249
252
  "dst-a11y__replace-anchor-with-link__linking-platfo": {
250
253
  "type": "boolean"
254
+ },
255
+ "cc-ai-linking-platform-snippet-renderer": {
256
+ "type": "boolean"
251
257
  }
252
- }
258
+ },
259
+ "compassUnitTestMetricSourceId": "ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:metric-source/c5751cc6-3513-4070-9deb-af31e86aed34/f74ef1bc-7240-4aac-9dc8-9dc43b502089"
253
260
  }