@atlaskit/smart-card 26.23.2 → 26.24.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 (80) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/constants.js +1 -0
  3. package/dist/cjs/extractors/flexible/actions/extract-follow-action.js +53 -0
  4. package/dist/cjs/extractors/flexible/index.js +3 -0
  5. package/dist/cjs/messages.js +10 -0
  6. package/dist/cjs/utils/analytics/analytics.js +1 -1
  7. package/dist/cjs/view/BlockCard/views/flexible/styled.js +2 -2
  8. package/dist/cjs/view/EmbedCard/components/styled.js +2 -2
  9. package/dist/cjs/view/FlexibleCard/components/actions/action/server-action/index.js +4 -4
  10. package/dist/cjs/view/FlexibleCard/components/actions/follow-action/index.js +43 -0
  11. package/dist/cjs/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +40 -0
  12. package/dist/cjs/view/FlexibleCard/components/actions/index.js +10 -1
  13. package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +2 -19
  14. package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +8 -1
  15. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +22 -1
  16. package/dist/cjs/view/HoverCard/styled.js +2 -2
  17. package/dist/cjs/view/LinkUrl/index.js +1 -1
  18. package/dist/cjs/view/RedesignedInlineCard/Frame/styled.js +1 -1
  19. package/dist/cjs/view/RedesignedInlineCard/styled.js +1 -1
  20. package/dist/es2019/constants.js +1 -0
  21. package/dist/es2019/extractors/flexible/actions/extract-follow-action.js +45 -0
  22. package/dist/es2019/extractors/flexible/index.js +3 -0
  23. package/dist/es2019/messages.js +10 -0
  24. package/dist/es2019/utils/analytics/analytics.js +1 -1
  25. package/dist/es2019/view/BlockCard/views/flexible/styled.js +10 -1
  26. package/dist/es2019/view/EmbedCard/components/styled.js +2 -2
  27. package/dist/es2019/view/FlexibleCard/components/actions/action/server-action/index.js +1 -1
  28. package/dist/es2019/view/FlexibleCard/components/actions/follow-action/index.js +31 -0
  29. package/dist/es2019/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +28 -0
  30. package/dist/es2019/view/FlexibleCard/components/actions/index.js +3 -0
  31. package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +2 -17
  32. package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +9 -2
  33. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +19 -1
  34. package/dist/es2019/view/HoverCard/styled.js +3 -3
  35. package/dist/es2019/view/LinkUrl/index.js +1 -1
  36. package/dist/es2019/view/RedesignedInlineCard/Frame/styled.js +1 -1
  37. package/dist/es2019/view/RedesignedInlineCard/styled.js +1 -1
  38. package/dist/esm/constants.js +1 -0
  39. package/dist/esm/extractors/flexible/actions/extract-follow-action.js +45 -0
  40. package/dist/esm/extractors/flexible/index.js +3 -0
  41. package/dist/esm/messages.js +10 -0
  42. package/dist/esm/utils/analytics/analytics.js +1 -1
  43. package/dist/esm/view/BlockCard/views/flexible/styled.js +2 -2
  44. package/dist/esm/view/EmbedCard/components/styled.js +2 -2
  45. package/dist/esm/view/FlexibleCard/components/actions/action/server-action/index.js +4 -4
  46. package/dist/esm/view/FlexibleCard/components/actions/follow-action/index.js +32 -0
  47. package/dist/esm/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +32 -0
  48. package/dist/esm/view/FlexibleCard/components/actions/index.js +3 -0
  49. package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +2 -19
  50. package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +9 -2
  51. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +21 -1
  52. package/dist/esm/view/HoverCard/styled.js +2 -2
  53. package/dist/esm/view/LinkUrl/index.js +1 -1
  54. package/dist/esm/view/RedesignedInlineCard/Frame/styled.js +1 -1
  55. package/dist/esm/view/RedesignedInlineCard/styled.js +1 -1
  56. package/dist/types/__fixtures__/atlas-project.d.ts +68 -0
  57. package/dist/types/constants.d.ts +1 -0
  58. package/dist/types/extractors/common/__mocks__/jsonld.d.ts +3 -0
  59. package/dist/types/extractors/flexible/actions/extract-follow-action.d.ts +5 -0
  60. package/dist/types/messages.d.ts +1 -1
  61. package/dist/types/state/flexible-ui-context/types.d.ts +11 -0
  62. package/dist/types/view/FlexibleCard/components/actions/follow-action/index.d.ts +4 -0
  63. package/dist/types/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.d.ts +4 -0
  64. package/dist/types/view/FlexibleCard/components/actions/index.d.ts +1 -0
  65. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +1 -1
  66. package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +3 -1
  67. package/dist/types-ts4.5/__fixtures__/atlas-project.d.ts +68 -0
  68. package/dist/types-ts4.5/constants.d.ts +1 -0
  69. package/dist/types-ts4.5/extractors/common/__mocks__/jsonld.d.ts +3 -0
  70. package/dist/types-ts4.5/extractors/flexible/actions/extract-follow-action.d.ts +5 -0
  71. package/dist/types-ts4.5/messages.d.ts +1 -1
  72. package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +11 -0
  73. package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/index.d.ts +4 -0
  74. package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.d.ts +4 -0
  75. package/dist/types-ts4.5/view/FlexibleCard/components/actions/index.d.ts +1 -0
  76. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +1 -1
  77. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/utils.d.ts +3 -1
  78. package/package.json +2 -2
  79. package/report.api.md +3 -0
  80. package/tmp/api-report-tmp.d.ts +3 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 26.24.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`cb6f1d7a319`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb6f1d7a319) - Add Follow/Unfollow action to flexible smart links (behind feature flag)
8
+
9
+ ### Patch Changes
10
+
11
+ - [`93888ff40ba`](https://bitbucket.org/atlassian/atlassian-frontend/commits/93888ff40ba) - [ux] Style updates for refreshed smart cards behind a feature flag. If this update is successful it will be available in a later release.
12
+
3
13
  ## 26.23.2
4
14
 
5
15
  ### Patch Changes
@@ -151,6 +151,7 @@ exports.ElementName = ElementName;
151
151
  var ActionName = /*#__PURE__*/function (ActionName) {
152
152
  ActionName["DeleteAction"] = "DeleteAction";
153
153
  ActionName["EditAction"] = "EditAction";
154
+ ActionName["FollowAction"] = "FollowAction";
154
155
  ActionName["PreviewAction"] = "PreviewAction";
155
156
  ActionName["ViewAction"] = "ViewAction";
156
157
  ActionName["DownloadAction"] = "DownloadAction";
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _linkExtractors = require("@atlaskit/link-extractors");
9
+ var _linkingTypes = require("@atlaskit/linking-types");
10
+ var _helpers = require("../../../state/helpers");
11
+ var _extractServerAction = _interopRequireDefault(require("../extract-server-action"));
12
+ var extractFollowAction = function extractFollowAction(response, showServerActions, id) {
13
+ var _action$dataUpdateAct;
14
+ if (!showServerActions) {
15
+ return;
16
+ }
17
+ var extensionKey = (0, _helpers.getExtensionKey)(response);
18
+ var data = response === null || response === void 0 ? void 0 : response.data;
19
+ var actions = (0, _extractServerAction.default)(data);
20
+ if (!extensionKey || actions.length === 0) {
21
+ return;
22
+ }
23
+ var action = actions.find(function (item) {
24
+ if ((item === null || item === void 0 ? void 0 : item.name) === 'UpdateAction') {
25
+ var _dataUpdateAction;
26
+ var actionName = item === null || item === void 0 ? void 0 : (_dataUpdateAction = item.dataUpdateAction) === null || _dataUpdateAction === void 0 ? void 0 : _dataUpdateAction.name;
27
+ return actionName === _linkingTypes.SmartLinkActionType.FollowEntityAction || actionName === _linkingTypes.SmartLinkActionType.UnfollowEntityAction;
28
+ }
29
+ return false;
30
+ });
31
+ if (!action || !action.resourceIdentifiers) {
32
+ return;
33
+ }
34
+ var url = (0, _linkExtractors.extractLink)(data);
35
+ var reload = url ? {
36
+ id: id,
37
+ url: url
38
+ } : undefined;
39
+ var actionType = (_action$dataUpdateAct = action.dataUpdateAction) === null || _action$dataUpdateAct === void 0 ? void 0 : _action$dataUpdateAct.name;
40
+ return {
41
+ action: {
42
+ action: {
43
+ actionType: actionType,
44
+ resourceIdentifiers: action.resourceIdentifiers
45
+ },
46
+ providerKey: extensionKey,
47
+ reload: reload
48
+ },
49
+ value: actionType === _linkingTypes.SmartLinkActionType.FollowEntityAction
50
+ };
51
+ };
52
+ var _default = extractFollowAction;
53
+ exports.default = _default;
@@ -5,7 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
9
  var _primitives = require("../common/primitives");
10
+ var _extractFollowAction = _interopRequireDefault(require("./actions/extract-follow-action"));
9
11
  var _icon = require("./icon");
10
12
  var _utils = require("./utils");
11
13
  var _collaboratorGroup = require("./collaboratorGroup");
@@ -45,6 +47,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
45
47
  assignedTo: (0, _utils.extractAssignedTo)(data),
46
48
  createdOn: (0, _linkExtractors.extractDateCreated)(data),
47
49
  dueOn: (0, _utils.extractDueOn)(data),
50
+ followAction: (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.follow-button') ? (0, _extractFollowAction.default)(response, showServerActions, id) : undefined,
48
51
  previewAction: (0, _extractPreviewAction.extractPreviewAction)(response),
49
52
  viewAction: (0, _extractViewAction.extractViewAction)(data),
50
53
  downloadAction: (0, _extractDownloadAction.extractDownloadAction)(data),
@@ -146,6 +146,11 @@ var messages = (0, _reactIntlNext.defineMessages)({
146
146
  defaultMessage: 'Edit',
147
147
  description: 'Allow a user to edit a link'
148
148
  },
149
+ follow: {
150
+ id: 'fabric.linking.follow',
151
+ defaultMessage: 'Follow',
152
+ description: 'Click to follow a project.'
153
+ },
149
154
  forbidden_description: {
150
155
  id: 'fabric.linking.forbidden_description',
151
156
  defaultMessage: 'You don’t have access to this preview. Contact the site admin if you need access.',
@@ -431,6 +436,11 @@ var messages = (0, _reactIntlNext.defineMessages)({
431
436
  defaultMessage: 'Unassigned',
432
437
  description: 'Shown as a tooltip text for a default unassigned fallback avatar'
433
438
  },
439
+ unfollow: {
440
+ id: 'fabric.linking.unfollow',
441
+ defaultMessage: 'Unfollow',
442
+ description: 'Click to unfollow a project.'
443
+ },
434
444
  unlink_account: {
435
445
  id: 'fabric.linking.unlink_account',
436
446
  defaultMessage: 'Unlink Account',
@@ -21,7 +21,7 @@ exports.ANALYTICS_CHANNEL = ANALYTICS_CHANNEL;
21
21
  var context = {
22
22
  componentName: 'smart-cards',
23
23
  packageName: "@atlaskit/smart-card",
24
- packageVersion: "26.23.2"
24
+ packageVersion: "26.24.0"
25
25
  };
26
26
  exports.context = context;
27
27
  var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
@@ -16,9 +16,9 @@ var metadataBlockCss = (0, _react.css)(_templateObject || (_templateObject = (0,
16
16
  exports.metadataBlockCss = metadataBlockCss;
17
17
  var titleBlockCss = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n"])), (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "gap: 0.5em;" : "", (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? "[data-smart-element=\"Title\"] {\n font-weight: 600;\n }" : "");
18
18
  exports.titleBlockCss = titleBlockCss;
19
- var footerBlockCss = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n height: 1.5rem;\n"])));
19
+ var footerBlockCss = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n height: 1.5rem;\n\n .actions-button-group {\n button,\n button:hover,\n button:focus,\n button:active {\n font-size: 0.875rem;\n }\n }\n"])));
20
20
  exports.footerBlockCss = footerBlockCss;
21
21
  var flexibleBlockCardElevationStyle = (0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: 1.5px;\n box-shadow: ", ";\n margin: ", ";\n"])), _token.tokens.elevation, "var(--ds-space-025, 2px)");
22
- var refreshedFlexibleBlockCardStyle = (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n & > div {\n border-radius: ", ";\n border: 1px solid ", ";\n }\n"])), "var(--ds-border-radius-300, 12px)", "var(--ds-border-input, ".concat(_colors.N40, ")"));
22
+ var refreshedFlexibleBlockCardStyle = (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n & > div {\n border-radius: ", ";\n border: 1px solid ", ";\n }\n"])), "var(--ds-border-radius-200, 8px)", "var(--ds-border-input, ".concat(_colors.N40, ")"));
23
23
  var flexibleBlockCardStyle = (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? refreshedFlexibleBlockCardStyle : flexibleBlockCardElevationStyle;
24
24
  exports.flexibleBlockCardStyle = flexibleBlockCardStyle;
@@ -21,8 +21,8 @@ exports.className = className;
21
21
  var borderRadius = "\n border-radius: ".concat((0, _constants.borderRadius)(), "px;\n");
22
22
  exports.borderRadius = borderRadius;
23
23
  var BACKGROUND_COLOR_DARK = '#262B31';
24
- var wrapperBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-400, 16px)", ";\n");
25
- var contentBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-300, 12px)", ";\n");
24
+ var wrapperBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-200, 8px)", ";\n");
25
+ var contentBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-100, 4px)", ";\n");
26
26
  var ellipsis = function ellipsis() {
27
27
  var maxWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '100%';
28
28
  var unit = typeof maxWidth === 'number' ? 'px' : '';
@@ -44,14 +44,14 @@ var ServerAction = function ServerAction(_ref) {
44
44
  _context.next = 6;
45
45
  return invoke(request);
46
46
  case 6:
47
- setIsLoading(false);
48
47
  if (!(action.reload && action.reload.url)) {
49
- _context.next = 10;
48
+ _context.next = 9;
50
49
  break;
51
50
  }
52
- _context.next = 10;
51
+ _context.next = 9;
53
52
  return reload(action.reload.url, true, undefined, action.reload.id);
54
- case 10:
53
+ case 9:
54
+ setIsLoading(false);
55
55
  if (onClick) {
56
56
  onClick();
57
57
  }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _inviteTeam = _interopRequireDefault(require("@atlaskit/icon/glyph/invite-team"));
12
+ var _react = _interopRequireWildcard(require("react"));
13
+ var _reactIntlNext = require("react-intl-next");
14
+ var _messages = require("../../../../../messages");
15
+ var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
16
+ var _serverAction = _interopRequireDefault(require("../action/server-action"));
17
+ var _unfollowIcon = _interopRequireDefault(require("./unfollow-icon"));
18
+ var _excluded = ["value"];
19
+ 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); }
20
+ 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; }
21
+ var FollowAction = function FollowAction(props) {
22
+ var context = (0, _react.useContext)(_flexibleUiContext.FlexibleUiContext);
23
+ if (!context || !context.followAction) {
24
+ return null;
25
+ }
26
+ var _context$followAction = context.followAction,
27
+ value = _context$followAction.value,
28
+ data = (0, _objectWithoutProperties2.default)(_context$followAction, _excluded);
29
+ var message = value ? _messages.messages.follow : _messages.messages.unfollow;
30
+ var icon = value ? /*#__PURE__*/_react.default.createElement(_inviteTeam.default, {
31
+ label: "Follow"
32
+ }) : /*#__PURE__*/_react.default.createElement(_unfollowIcon.default, {
33
+ label: "Unfollow"
34
+ });
35
+ return /*#__PURE__*/_react.default.createElement(_serverAction.default, (0, _extends2.default)({
36
+ content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, message),
37
+ icon: icon,
38
+ testId: "smart-action-follow-action",
39
+ tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, message)
40
+ }, data, props));
41
+ };
42
+ var _default = FollowAction;
43
+ exports.default = _default;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _icon = _interopRequireDefault(require("@atlaskit/icon"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var UnfollowGlyph = function UnfollowGlyph(props) {
12
+ return /*#__PURE__*/_react.default.createElement("svg", {
13
+ width: "16",
14
+ height: "16",
15
+ viewBox: "0 0 16 16",
16
+ "data-testid": props['data-testid'],
17
+ "aria-label": props['aria-label'],
18
+ className: props.className,
19
+ role: "presentation",
20
+ xmlns: "http://www.w3.org/2000/svg"
21
+ }, /*#__PURE__*/_react.default.createElement("path", {
22
+ d: "M14 4.66667H11.3333C10.9652 4.66667 10.6667 4.96514 10.6667 5.33333C10.6667 5.70152 10.9652 6 11.3333 6H14C14.3682 6 14.6667 5.70152 14.6667 5.33333C14.6667 4.96514 14.3682 4.66667 14 4.66667Z",
23
+ fill: "currentColor"
24
+ }), /*#__PURE__*/_react.default.createElement("path", {
25
+ fillRule: "evenodd",
26
+ clipRule: "evenodd",
27
+ d: "M3.33334 9.33333C3.33334 8.59667 3.93468 8 4.67268 8H9.99401C10.734 8 11.3333 8.596 11.3333 9.33733V12.2973C11.3333 14.5673 3.33334 14.5673 3.33334 12.2973V9.33333Z",
28
+ fill: "currentColor"
29
+ }), /*#__PURE__*/_react.default.createElement("path", {
30
+ d: "M7.33334 7.33333C8.8061 7.33333 10 6.13943 10 4.66667C10 3.19391 8.8061 2 7.33334 2C5.86058 2 4.66668 3.19391 4.66668 4.66667C4.66668 6.13943 5.86058 7.33333 7.33334 7.33333Z",
31
+ fill: "currentColor"
32
+ }));
33
+ };
34
+ var UnfollowIcon = function UnfollowIcon(props) {
35
+ return /*#__PURE__*/_react.default.createElement(_icon.default, (0, _extends2.default)({
36
+ glyph: UnfollowGlyph
37
+ }, props));
38
+ };
39
+ var _default = UnfollowIcon;
40
+ exports.default = _default;
@@ -1,11 +1,20 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
- exports.ViewAction = exports.PreviewAction = exports.EditAction = exports.DownloadAction = exports.DeleteAction = exports.CustomAction = void 0;
7
+ exports.EditAction = exports.DownloadAction = exports.DeleteAction = exports.CustomAction = void 0;
8
+ Object.defineProperty(exports, "FollowAction", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _followAction.default;
12
+ }
13
+ });
14
+ exports.ViewAction = exports.PreviewAction = void 0;
7
15
  var _constants = require("../../../../constants");
8
16
  var _utils = require("./utils");
17
+ var _followAction = _interopRequireDefault(require("./follow-action"));
9
18
  // Attention: Keep the export name and action name the same.
10
19
  // This will help reducing the code for mapping action inside
11
20
  // createAction and renderActionItems
@@ -22,6 +22,7 @@ var _utils = require("../../utils");
22
22
  var _messages = require("../../../../../messages");
23
23
  var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
24
24
  var _actionGroupItem = _interopRequireDefault(require("./action-group-item"));
25
+ var _utils2 = require("../utils");
25
26
  var _excluded = ["triggerRef"];
26
27
  var _templateObject;
27
28
  /** @jsx jsx */
@@ -43,24 +44,6 @@ var renderActionItems = function renderActionItems() {
43
44
  });
44
45
  });
45
46
  };
46
- var filterActionItems = function filterActionItems() {
47
- var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
48
- var context = arguments.length > 1 ? arguments[1] : undefined;
49
- return items.filter(function (item) {
50
- switch (item.name) {
51
- // Action that require data from the data context to render.
52
- case _constants.ActionName.DownloadAction:
53
- return Boolean(context === null || context === void 0 ? void 0 : context.downloadAction);
54
- case _constants.ActionName.PreviewAction:
55
- return Boolean(context === null || context === void 0 ? void 0 : context.previewAction);
56
- case _constants.ActionName.ViewAction:
57
- return Boolean(context === null || context === void 0 ? void 0 : context.viewAction);
58
- default:
59
- // Named and custom actions that user defines.
60
- return Boolean(_constants.ActionName[item.name]);
61
- }
62
- });
63
- };
64
47
 
65
48
  /**
66
49
  * Creates a group of Action components. Accepts an array of Actions, in addition to some styling
@@ -86,7 +69,7 @@ var ActionGroup = function ActionGroup(_ref) {
86
69
  isOpen = _useState2[0],
87
70
  setIsOpen = _useState2[1];
88
71
  var renderableActionItems = (0, _react.useMemo)(function () {
89
- return filterActionItems(items, context);
72
+ return (0, _utils2.filterActionItems)(items, context);
90
73
  }, [context, items]);
91
74
  var isMoreThenTwoItems = renderableActionItems.length > visibleButtonsNum;
92
75
  var onOpenChange = (0, _react.useCallback)(function (attrs) {
@@ -15,6 +15,8 @@ var _block = _interopRequireDefault(require("../block"));
15
15
  var _elementGroup = _interopRequireDefault(require("../element-group"));
16
16
  var _elements = require("../../elements");
17
17
  var _actionGroup = _interopRequireDefault(require("../action-group"));
18
+ var _utils = require("../utils");
19
+ var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
18
20
  var _templateObject;
19
21
  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); }
20
22
  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; }
@@ -42,6 +44,11 @@ var FooterBlock = function FooterBlock(props) {
42
44
  _props$testId = props.testId,
43
45
  testId = _props$testId === void 0 ? 'smart-footer-block' : _props$testId,
44
46
  onActionMenuOpenChange = props.onActionMenuOpenChange;
47
+ var context = (0, _flexibleUiContext.useFlexibleUiContext)();
48
+ var hasActions = (0, _react.useMemo)(function () {
49
+ var _filterActionItems;
50
+ return ((_filterActionItems = (0, _utils.filterActionItems)(actions, context)) === null || _filterActionItems === void 0 ? void 0 : _filterActionItems.length) > 0;
51
+ }, [actions, context]);
45
52
  var onDropdownOpenChange = (0, _react.useCallback)(function (isOpen) {
46
53
  if (onActionMenuOpenChange) {
47
54
  onActionMenuOpenChange({
@@ -56,7 +63,7 @@ var FooterBlock = function FooterBlock(props) {
56
63
  testId: "".concat(testId, "-resolved-view")
57
64
  }), /*#__PURE__*/_react.default.createElement(_elements.Provider, {
58
65
  testId: "".concat(testId, "-provider")
59
- }), actions && actions.length > 0 ? /*#__PURE__*/_react.default.createElement(_elementGroup.default, {
66
+ }), actions && hasActions ? /*#__PURE__*/_react.default.createElement(_elementGroup.default, {
60
67
  testId: "smart-element-group-actions",
61
68
  align: _constants.SmartLinkAlignment.Right,
62
69
  direction: _constants.SmartLinkDirection.Horizontal,
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.renderElementItems = exports.renderChildren = exports.isJSXElementNull = exports.highlightRemoveStyles = exports.getGapSize = exports.getBaseStyles = exports.ElementDisplaySchema = void 0;
8
+ exports.renderElementItems = exports.renderChildren = exports.isJSXElementNull = exports.highlightRemoveStyles = exports.getGapSize = exports.getBaseStyles = exports.filterActionItems = exports.ElementDisplaySchema = void 0;
9
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
@@ -69,6 +69,27 @@ exports.isJSXElementNull = isJSXElementNull;
69
69
  var isElementOrElementGroup = function isElementOrElementGroup(node) {
70
70
  return /*#__PURE__*/_react.default.isValidElement(node) && ((0, _flexible.isFlexibleUiElement)(node) || node.type === _elementGroup.default);
71
71
  };
72
+ var filterActionItems = function filterActionItems() {
73
+ var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
74
+ var context = arguments.length > 1 ? arguments[1] : undefined;
75
+ return items.filter(function (item) {
76
+ switch (item.name) {
77
+ // Action that require data from the data context to render.
78
+ case _constants.ActionName.DownloadAction:
79
+ return Boolean(context === null || context === void 0 ? void 0 : context.downloadAction);
80
+ case _constants.ActionName.FollowAction:
81
+ return Boolean(context === null || context === void 0 ? void 0 : context.followAction);
82
+ case _constants.ActionName.PreviewAction:
83
+ return Boolean(context === null || context === void 0 ? void 0 : context.previewAction);
84
+ case _constants.ActionName.ViewAction:
85
+ return Boolean(context === null || context === void 0 ? void 0 : context.viewAction);
86
+ default:
87
+ // Named and custom actions that user defines.
88
+ return Boolean(_constants.ActionName[item.name]);
89
+ }
90
+ });
91
+ };
92
+ exports.filterActionItems = filterActionItems;
72
93
  var renderChildren = function renderChildren(children, size) {
73
94
  return _react.default.Children.map(children, function (child) {
74
95
  if (isElementOrElementGroup(child) || isActionGroup(child)) {
@@ -47,7 +47,7 @@ var getTransitionStyles = function getTransitionStyles(snippetHeight) {
47
47
  return (0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n transition: height 300ms ease-in-out;\n height: ", "px;\n"])), snippetHeight);
48
48
  };
49
49
  exports.getTransitionStyles = getTransitionStyles;
50
- var popupContainerStyles = (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: ", ";\n background-color: ", ";\n box-shadow: ", ";\n"])), "var(--ds-border-radius-300, 12px)", (0, _components.themed)({
50
+ var popupContainerStyles = (0, _react.css)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n border-radius: ", ";\n background-color: ", ";\n box-shadow: ", ";\n"])), "var(--ds-border-radius-200, 8px)", (0, _components.themed)({
51
51
  light: "var(--ds-surface-raised, white)",
52
52
  dark: "var(--ds-surface-raised, #262B31)"
53
53
  })(), (0, _components.themed)({
@@ -56,6 +56,6 @@ var popupContainerStyles = (0, _react.css)(_templateObject5 || (_templateObject5
56
56
  })());
57
57
  exports.popupContainerStyles = popupContainerStyles;
58
58
  var getPreviewBlockStyles = function getPreviewBlockStyles(snippetHeight) {
59
- return (0, _react.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n height: ", "px;\n ", "\n"])), snippetHeight, (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? " border-top-left-radius: ".concat("var(--ds-border-radius-300, 12px)", ";\n border-top-right-radius: ", "var(--ds-border-radius-300, 12px)", ";\n margin-bottom: ", blockGap, ";\n }") : "");
59
+ return (0, _react.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n height: ", "px;\n ", "\n"])), snippetHeight, (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? " border-top-left-radius: ".concat("var(--ds-border-radius-200, 8px)", ";\n border-top-right-radius: ", "var(--ds-border-radius-200, 8px)", ";\n margin-bottom: ", blockGap, ";\n }") : "");
60
60
  };
61
61
  exports.getPreviewBlockStyles = getPreviewBlockStyles;
@@ -18,7 +18,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
18
18
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
19
19
  var PACKAGE_DATA = {
20
20
  packageName: "@atlaskit/smart-card",
21
- packageVersion: "26.23.2",
21
+ packageVersion: "26.24.0",
22
22
  componentName: 'linkUrl'
23
23
  };
24
24
  var Link = (0, _click.withLinkClickedEvent)('a');
@@ -48,7 +48,7 @@ var isSelected = function isSelected(_ref2) {
48
48
  // NB: `display: inline` required for `box-decoration-break` to work.
49
49
  // NB: `box-decoration-break` required for retaining properties (border-radius) on wrap.
50
50
  var baseWrapperStyle = function baseWrapperStyle(props) {
51
- return "\n line-height: 22px;\n padding: 2px 0px;\n ".concat(props.withoutBackground ? "padding-left: 0; margin-left:-2px;" : '', "\n display: inline;\n box-decoration-break: clone;\n border-radius: ", "var(--ds-border-radius-100, 3px)", ";\n color: ").concat((0, _components.themed)({
51
+ return "\n line-height: 22px;\n padding: 2px 0px;\n ".concat(props.withoutBackground ? "padding-left: 0; margin-left:-2px;" : '', "\n display: inline;\n box-decoration-break: clone;\n border-radius: ", "var(--ds-border-radius-100, 4px)", ";\n color: ").concat((0, _components.themed)({
52
52
  light: "var(--ds-link, ".concat(_colors.B400, ")"),
53
53
  dark: "var(--ds-link, #4794FF)"
54
54
  })(props), ";\n\n background-color: ").concat(props.withoutBackground ? '' : (0, _components.themed)({
@@ -14,7 +14,7 @@ var LINK_COLOR_DARK = '#4794FF';
14
14
 
15
15
  // By default buttons will hide overflow and ellipsis content instead of wrapping.
16
16
  // This basically turns the button back into inline content
17
- var IconStyledButton = _styled.default.span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n &&& {\n text-align: initial;\n display: inline;\n vertical-align: baseline;\n border-radius: ", ";\n border-top-left-radius: 0px;\n border-bottom-left-radius: 0px;\n padding: ", " ", ";\n background-clip: padding-box;\n box-decoration-break: clone;\n }\n > span {\n display: inline;\n overflow: initial;\n text-overflow: initial;\n white-space: initial;\n > span {\n overflow: initial;\n text-overflow: initial;\n white-space: initial;\n }\n }\n"])), "var(--ds-border-radius-100, 2px)", "var(--ds-space-025, 2px)", "var(--ds-space-075, 6px)");
17
+ var IconStyledButton = _styled.default.span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n &&& {\n text-align: initial;\n display: inline;\n vertical-align: baseline;\n border-radius: ", ";\n border-top-left-radius: 0px;\n border-bottom-left-radius: 0px;\n padding: ", " ", ";\n background-clip: padding-box;\n box-decoration-break: clone;\n }\n > span {\n display: inline;\n overflow: initial;\n text-overflow: initial;\n white-space: initial;\n > span {\n overflow: initial;\n text-overflow: initial;\n white-space: initial;\n }\n }\n"])), "var(--ds-border-radius-100, 4px)", "var(--ds-space-025, 2px)", "var(--ds-space-075, 6px)");
18
18
  exports.IconStyledButton = IconStyledButton;
19
19
  var NoLinkAppearance = _styled.default.span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n margin-left: ", ";\n"])), (0, _components.themed)({
20
20
  light: "var(--ds-text-subtlest, ".concat(_colors.N200, ")"),
@@ -143,6 +143,7 @@ export let ElementName = /*#__PURE__*/function (ElementName) {
143
143
  export let ActionName = /*#__PURE__*/function (ActionName) {
144
144
  ActionName["DeleteAction"] = "DeleteAction";
145
145
  ActionName["EditAction"] = "EditAction";
146
+ ActionName["FollowAction"] = "FollowAction";
146
147
  ActionName["PreviewAction"] = "PreviewAction";
147
148
  ActionName["ViewAction"] = "ViewAction";
148
149
  ActionName["DownloadAction"] = "DownloadAction";
@@ -0,0 +1,45 @@
1
+ import { extractLink } from '@atlaskit/link-extractors';
2
+ import { SmartLinkActionType } from '@atlaskit/linking-types';
3
+ import { getExtensionKey } from '../../../state/helpers';
4
+ import extractServerAction from '../extract-server-action';
5
+ const extractFollowAction = (response, showServerActions, id) => {
6
+ var _action$dataUpdateAct;
7
+ if (!showServerActions) {
8
+ return;
9
+ }
10
+ const extensionKey = getExtensionKey(response);
11
+ const data = response === null || response === void 0 ? void 0 : response.data;
12
+ const actions = extractServerAction(data);
13
+ if (!extensionKey || actions.length === 0) {
14
+ return;
15
+ }
16
+ const action = actions.find(item => {
17
+ if ((item === null || item === void 0 ? void 0 : item.name) === 'UpdateAction') {
18
+ var _dataUpdateAction;
19
+ const actionName = item === null || item === void 0 ? void 0 : (_dataUpdateAction = item.dataUpdateAction) === null || _dataUpdateAction === void 0 ? void 0 : _dataUpdateAction.name;
20
+ return actionName === SmartLinkActionType.FollowEntityAction || actionName === SmartLinkActionType.UnfollowEntityAction;
21
+ }
22
+ return false;
23
+ });
24
+ if (!action || !action.resourceIdentifiers) {
25
+ return;
26
+ }
27
+ const url = extractLink(data);
28
+ const reload = url ? {
29
+ id,
30
+ url
31
+ } : undefined;
32
+ const actionType = (_action$dataUpdateAct = action.dataUpdateAction) === null || _action$dataUpdateAct === void 0 ? void 0 : _action$dataUpdateAct.name;
33
+ return {
34
+ action: {
35
+ action: {
36
+ actionType,
37
+ resourceIdentifiers: action.resourceIdentifiers
38
+ },
39
+ providerKey: extensionKey,
40
+ reload
41
+ },
42
+ value: actionType === SmartLinkActionType.FollowEntityAction
43
+ };
44
+ };
45
+ export default extractFollowAction;
@@ -1,4 +1,6 @@
1
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
1
2
  import { extractSummary } from '../common/primitives';
3
+ import extractFollowAction from './actions/extract-follow-action';
2
4
  import { extractLinkIcon } from './icon';
3
5
  import { extractAttachmentCount, extractChecklistProgress, extractCommentCount, extractCreatedBy, extractModifiedBy, extractProgrammingLanguage, extractSubscriberCount, extractViewCount, extractReactCount, extractVoteCount, extractSourceBranch, extractTargetBranch, extractDueOn, extractLocation, extractOwnedBy, extractAssignedTo, extractSubTasksProgress, extractStoryPoints, extractReadTime, extractSentOn, extractPersonAssignedToAsArray } from './utils';
4
6
  import { extractPersonsUpdatedBy } from './collaboratorGroup';
@@ -38,6 +40,7 @@ const extractFlexibleUiContext = ({
38
40
  assignedTo: extractAssignedTo(data),
39
41
  createdOn: extractDateCreated(data),
40
42
  dueOn: extractDueOn(data),
43
+ followAction: getBooleanFF('platform.linking-platform.smart-card.follow-button') ? extractFollowAction(response, showServerActions, id) : undefined,
41
44
  previewAction: extractPreviewAction(response),
42
45
  viewAction: extractViewAction(data),
43
46
  downloadAction: extractDownloadAction(data),
@@ -140,6 +140,11 @@ export const messages = defineMessages({
140
140
  defaultMessage: 'Edit',
141
141
  description: 'Allow a user to edit a link'
142
142
  },
143
+ follow: {
144
+ id: 'fabric.linking.follow',
145
+ defaultMessage: 'Follow',
146
+ description: 'Click to follow a project.'
147
+ },
143
148
  forbidden_description: {
144
149
  id: 'fabric.linking.forbidden_description',
145
150
  defaultMessage: 'You don’t have access to this preview. Contact the site admin if you need access.',
@@ -425,6 +430,11 @@ export const messages = defineMessages({
425
430
  defaultMessage: 'Unassigned',
426
431
  description: 'Shown as a tooltip text for a default unassigned fallback avatar'
427
432
  },
433
+ unfollow: {
434
+ id: 'fabric.linking.unfollow',
435
+ defaultMessage: 'Unfollow',
436
+ description: 'Click to unfollow a project.'
437
+ },
428
438
  unlink_account: {
429
439
  id: 'fabric.linking.unlink_account',
430
440
  defaultMessage: 'Unlink Account',
@@ -3,7 +3,7 @@ export const ANALYTICS_CHANNEL = 'media';
3
3
  export const context = {
4
4
  componentName: 'smart-cards',
5
5
  packageName: "@atlaskit/smart-card",
6
- packageVersion: "26.23.2"
6
+ packageVersion: "26.24.0"
7
7
  };
8
8
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
9
9
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -23,6 +23,15 @@ export const titleBlockCss = css`
23
23
  `;
24
24
  export const footerBlockCss = css`
25
25
  height: 1.5rem;
26
+
27
+ .actions-button-group {
28
+ button,
29
+ button:hover,
30
+ button:focus,
31
+ button:active {
32
+ font-size: 0.875rem;
33
+ }
34
+ }
26
35
  `;
27
36
  const flexibleBlockCardElevationStyle = css`
28
37
  border-radius: 1.5px;
@@ -31,7 +40,7 @@ const flexibleBlockCardElevationStyle = css`
31
40
  `;
32
41
  const refreshedFlexibleBlockCardStyle = css`
33
42
  & > div {
34
- border-radius: ${"var(--ds-border-radius-300, 12px)"};
43
+ border-radius: ${"var(--ds-border-radius-200, 8px)"};
35
44
  border: 1px solid ${`var(--ds-border-input, ${N40})`};
36
45
  }
37
46
  `;
@@ -11,10 +11,10 @@ export const borderRadius = `
11
11
  `;
12
12
  const BACKGROUND_COLOR_DARK = '#262B31';
13
13
  const wrapperBorderRadius = `
14
- border-radius: ${"var(--ds-border-radius-400, 16px)"};
14
+ border-radius: ${"var(--ds-border-radius-200, 8px)"};
15
15
  `;
16
16
  const contentBorderRadius = `
17
- border-radius: ${"var(--ds-border-radius-300, 12px)"};
17
+ border-radius: ${"var(--ds-border-radius-100, 4px)"};
18
18
  `;
19
19
  export const ellipsis = (maxWidth = '100%') => {
20
20
  const unit = typeof maxWidth === 'number' ? 'px' : '';
@@ -18,10 +18,10 @@ const ServerAction = ({
18
18
  setIsLoading(true);
19
19
  const request = createInvokeRequest(action);
20
20
  await invoke(request);
21
- setIsLoading(false);
22
21
  if (action.reload && action.reload.url) {
23
22
  await reload(action.reload.url, true, undefined, action.reload.id);
24
23
  }
24
+ setIsLoading(false);
25
25
  if (onClick) {
26
26
  onClick();
27
27
  }