@atlaskit/smart-card 26.23.1 → 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 (90) hide show
  1. package/CHANGELOG.md +17 -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 +4 -3
  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/FlexibleCard/index.js +1 -9
  17. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +1 -3
  18. package/dist/cjs/view/HoverCard/styled.js +2 -2
  19. package/dist/cjs/view/LinkUrl/index.js +1 -1
  20. package/dist/cjs/view/RedesignedInlineCard/Frame/styled.js +1 -1
  21. package/dist/cjs/view/RedesignedInlineCard/styled.js +1 -1
  22. package/dist/es2019/constants.js +1 -0
  23. package/dist/es2019/extractors/flexible/actions/extract-follow-action.js +45 -0
  24. package/dist/es2019/extractors/flexible/index.js +4 -3
  25. package/dist/es2019/messages.js +10 -0
  26. package/dist/es2019/utils/analytics/analytics.js +1 -1
  27. package/dist/es2019/view/BlockCard/views/flexible/styled.js +10 -1
  28. package/dist/es2019/view/EmbedCard/components/styled.js +2 -2
  29. package/dist/es2019/view/FlexibleCard/components/actions/action/server-action/index.js +1 -1
  30. package/dist/es2019/view/FlexibleCard/components/actions/follow-action/index.js +31 -0
  31. package/dist/es2019/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +28 -0
  32. package/dist/es2019/view/FlexibleCard/components/actions/index.js +3 -0
  33. package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +2 -17
  34. package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +9 -2
  35. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +19 -1
  36. package/dist/es2019/view/FlexibleCard/index.js +1 -7
  37. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +1 -3
  38. package/dist/es2019/view/HoverCard/styled.js +3 -3
  39. package/dist/es2019/view/LinkUrl/index.js +1 -1
  40. package/dist/es2019/view/RedesignedInlineCard/Frame/styled.js +1 -1
  41. package/dist/es2019/view/RedesignedInlineCard/styled.js +1 -1
  42. package/dist/esm/constants.js +1 -0
  43. package/dist/esm/extractors/flexible/actions/extract-follow-action.js +45 -0
  44. package/dist/esm/extractors/flexible/index.js +4 -3
  45. package/dist/esm/messages.js +10 -0
  46. package/dist/esm/utils/analytics/analytics.js +1 -1
  47. package/dist/esm/view/BlockCard/views/flexible/styled.js +2 -2
  48. package/dist/esm/view/EmbedCard/components/styled.js +2 -2
  49. package/dist/esm/view/FlexibleCard/components/actions/action/server-action/index.js +4 -4
  50. package/dist/esm/view/FlexibleCard/components/actions/follow-action/index.js +32 -0
  51. package/dist/esm/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.js +32 -0
  52. package/dist/esm/view/FlexibleCard/components/actions/index.js +3 -0
  53. package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +2 -19
  54. package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +9 -2
  55. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +21 -1
  56. package/dist/esm/view/FlexibleCard/index.js +1 -9
  57. package/dist/esm/view/HoverCard/components/HoverCardContent.js +1 -3
  58. package/dist/esm/view/HoverCard/styled.js +2 -2
  59. package/dist/esm/view/LinkUrl/index.js +1 -1
  60. package/dist/esm/view/RedesignedInlineCard/Frame/styled.js +1 -1
  61. package/dist/esm/view/RedesignedInlineCard/styled.js +1 -1
  62. package/dist/types/__fixtures__/atlas-project.d.ts +68 -0
  63. package/dist/types/constants.d.ts +1 -0
  64. package/dist/types/extractors/common/__mocks__/jsonld.d.ts +3 -0
  65. package/dist/types/extractors/flexible/actions/extract-follow-action.d.ts +5 -0
  66. package/dist/types/extractors/flexible/index.d.ts +1 -1
  67. package/dist/types/messages.d.ts +1 -1
  68. package/dist/types/state/flexible-ui-context/types.d.ts +11 -0
  69. package/dist/types/view/FlexibleCard/components/actions/follow-action/index.d.ts +4 -0
  70. package/dist/types/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.d.ts +4 -0
  71. package/dist/types/view/FlexibleCard/components/actions/index.d.ts +1 -0
  72. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +1 -1
  73. package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +3 -1
  74. package/dist/types/view/FlexibleCard/types.d.ts +1 -2
  75. package/dist/types-ts4.5/__fixtures__/atlas-project.d.ts +68 -0
  76. package/dist/types-ts4.5/constants.d.ts +1 -0
  77. package/dist/types-ts4.5/extractors/common/__mocks__/jsonld.d.ts +3 -0
  78. package/dist/types-ts4.5/extractors/flexible/actions/extract-follow-action.d.ts +5 -0
  79. package/dist/types-ts4.5/extractors/flexible/index.d.ts +1 -1
  80. package/dist/types-ts4.5/messages.d.ts +1 -1
  81. package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +11 -0
  82. package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/index.d.ts +4 -0
  83. package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/unfollow-icon/index.d.ts +4 -0
  84. package/dist/types-ts4.5/view/FlexibleCard/components/actions/index.d.ts +1 -0
  85. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +1 -1
  86. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/utils.d.ts +3 -1
  87. package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +1 -2
  88. package/package.json +4 -4
  89. package/report.api.md +3 -0
  90. package/tmp/api-report-tmp.d.ts +3 -1
@@ -0,0 +1,32 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import Icon from '@atlaskit/icon';
3
+ import React from 'react';
4
+ var UnfollowGlyph = function UnfollowGlyph(props) {
5
+ return /*#__PURE__*/React.createElement("svg", {
6
+ width: "16",
7
+ height: "16",
8
+ viewBox: "0 0 16 16",
9
+ "data-testid": props['data-testid'],
10
+ "aria-label": props['aria-label'],
11
+ className: props.className,
12
+ role: "presentation",
13
+ xmlns: "http://www.w3.org/2000/svg"
14
+ }, /*#__PURE__*/React.createElement("path", {
15
+ 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",
16
+ fill: "currentColor"
17
+ }), /*#__PURE__*/React.createElement("path", {
18
+ fillRule: "evenodd",
19
+ clipRule: "evenodd",
20
+ 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",
21
+ fill: "currentColor"
22
+ }), /*#__PURE__*/React.createElement("path", {
23
+ 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",
24
+ fill: "currentColor"
25
+ }));
26
+ };
27
+ var UnfollowIcon = function UnfollowIcon(props) {
28
+ return /*#__PURE__*/React.createElement(Icon, _extends({
29
+ glyph: UnfollowGlyph
30
+ }, props));
31
+ };
32
+ export default UnfollowIcon;
@@ -1,8 +1,11 @@
1
1
  import { ActionName } from '../../../../constants';
2
2
  import { createDataAction, createUIAction } from './utils';
3
+ export { default as FollowAction } from './follow-action';
4
+
3
5
  // Attention: Keep the export name and action name the same.
4
6
  // This will help reducing the code for mapping action inside
5
7
  // createAction and renderActionItems
8
+
6
9
  /**
7
10
  * Creates a DeleteAction component. Accepts default ActionProps, but defaults
8
11
  * the icon to a cross icon.
@@ -11,13 +11,14 @@ import { css, jsx } from '@emotion/react';
11
11
  import ButtonGroup from '@atlaskit/button/button-group';
12
12
  import Tooltip from '@atlaskit/tooltip';
13
13
  import DropdownMenu from '@atlaskit/dropdown-menu';
14
- import { ActionName, SmartLinkSize } from '../../../../../constants';
14
+ import { SmartLinkSize } from '../../../../../constants';
15
15
  import Button from '@atlaskit/button/standard-button';
16
16
  import MoreIcon from '@atlaskit/icon/glyph/more';
17
17
  import { sizeToButtonSpacing } from '../../utils';
18
18
  import { messages } from '../../../../../messages';
19
19
  import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
20
20
  import ActionGroupItem from './action-group-item';
21
+ import { filterActionItems } from '../utils';
21
22
  var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n line-height: 1rem;\n > div {\n align-items: center;\n button:focus-visible {\n // AK button removes the default browser outline on focus and apply\n // box-shadow styling to create the outline appearance.\n // Due to our container elements (Container/Block/ElementGroup) has\n // overflow hidden to prevent the metadata element from leaking outside\n // of its container, the box-shadow doesn't show properly.\n // Invert the AK box-shadow styling.\n outline-offset: -2px;\n }\n }\n"])));
22
23
  var renderActionItems = function renderActionItems() {
23
24
  var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
@@ -36,24 +37,6 @@ var renderActionItems = function renderActionItems() {
36
37
  });
37
38
  });
38
39
  };
39
- var filterActionItems = function filterActionItems() {
40
- var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
41
- var context = arguments.length > 1 ? arguments[1] : undefined;
42
- return items.filter(function (item) {
43
- switch (item.name) {
44
- // Action that require data from the data context to render.
45
- case ActionName.DownloadAction:
46
- return Boolean(context === null || context === void 0 ? void 0 : context.downloadAction);
47
- case ActionName.PreviewAction:
48
- return Boolean(context === null || context === void 0 ? void 0 : context.previewAction);
49
- case ActionName.ViewAction:
50
- return Boolean(context === null || context === void 0 ? void 0 : context.viewAction);
51
- default:
52
- // Named and custom actions that user defines.
53
- return Boolean(ActionName[item.name]);
54
- }
55
- });
56
- };
57
40
 
58
41
  /**
59
42
  * Creates a group of Action components. Accepts an array of Actions, in addition to some styling
@@ -1,13 +1,15 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
3
  var _templateObject;
4
- import React, { useCallback } from 'react';
4
+ import React, { useCallback, useMemo } from 'react';
5
5
  import { css } from '@emotion/react';
6
6
  import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkStatus, SmartLinkWidth } from '../../../../../constants';
7
7
  import Block from '../block';
8
8
  import ElementGroup from '../element-group';
9
9
  import { Provider } from '../../elements';
10
10
  import ActionGroup from '../action-group';
11
+ import { filterActionItems } from '../utils';
12
+ import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
11
13
  var getActionGroupStyles = function getActionGroupStyles(size) {
12
14
  if (size === SmartLinkSize.XLarge) {
13
15
  // The biggest height of the action button exceeds the max line-height
@@ -32,6 +34,11 @@ var FooterBlock = function FooterBlock(props) {
32
34
  _props$testId = props.testId,
33
35
  testId = _props$testId === void 0 ? 'smart-footer-block' : _props$testId,
34
36
  onActionMenuOpenChange = props.onActionMenuOpenChange;
37
+ var context = useFlexibleUiContext();
38
+ var hasActions = useMemo(function () {
39
+ var _filterActionItems;
40
+ return ((_filterActionItems = filterActionItems(actions, context)) === null || _filterActionItems === void 0 ? void 0 : _filterActionItems.length) > 0;
41
+ }, [actions, context]);
35
42
  var onDropdownOpenChange = useCallback(function (isOpen) {
36
43
  if (onActionMenuOpenChange) {
37
44
  onActionMenuOpenChange({
@@ -46,7 +53,7 @@ var FooterBlock = function FooterBlock(props) {
46
53
  testId: "".concat(testId, "-resolved-view")
47
54
  }), /*#__PURE__*/React.createElement(Provider, {
48
55
  testId: "".concat(testId, "-provider")
49
- }), actions && actions.length > 0 ? /*#__PURE__*/React.createElement(ElementGroup, {
56
+ }), actions && hasActions ? /*#__PURE__*/React.createElement(ElementGroup, {
50
57
  testId: "smart-element-group-actions",
51
58
  align: SmartLinkAlignment.Right,
52
59
  direction: SmartLinkDirection.Horizontal,
@@ -7,7 +7,7 @@ var _excluded = ["name"];
7
7
  var _ElementDisplaySchema, _templateObject, _templateObject2, _templateObject3, _templateObject4;
8
8
  import React from 'react';
9
9
  import { css } from '@emotion/react';
10
- import { ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../constants';
10
+ import { ActionName, ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../constants';
11
11
  import * as Elements from '../elements';
12
12
  import { isFlexibleUiElement } from '../../../../utils/flexible';
13
13
  import ActionGroup from './action-group';
@@ -55,6 +55,26 @@ export var isJSXElementNull = function isJSXElementNull(children) {
55
55
  var isElementOrElementGroup = function isElementOrElementGroup(node) {
56
56
  return /*#__PURE__*/React.isValidElement(node) && (isFlexibleUiElement(node) || node.type === ElementGroup);
57
57
  };
58
+ export var filterActionItems = function filterActionItems() {
59
+ var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
60
+ var context = arguments.length > 1 ? arguments[1] : undefined;
61
+ return items.filter(function (item) {
62
+ switch (item.name) {
63
+ // Action that require data from the data context to render.
64
+ case ActionName.DownloadAction:
65
+ return Boolean(context === null || context === void 0 ? void 0 : context.downloadAction);
66
+ case ActionName.FollowAction:
67
+ return Boolean(context === null || context === void 0 ? void 0 : context.followAction);
68
+ case ActionName.PreviewAction:
69
+ return Boolean(context === null || context === void 0 ? void 0 : context.previewAction);
70
+ case ActionName.ViewAction:
71
+ return Boolean(context === null || context === void 0 ? void 0 : context.viewAction);
72
+ default:
73
+ // Named and custom actions that user defines.
74
+ return Boolean(ActionName[item.name]);
75
+ }
76
+ });
77
+ };
58
78
  export var renderChildren = function renderChildren(children, size) {
59
79
  return React.Children.map(children, function (child) {
60
80
  if (isElementOrElementGroup(child) || isActionGroup(child)) {
@@ -1,6 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useEffect, useMemo } from 'react';
3
- import { useFeatureFlag } from '@atlaskit/link-provider';
4
3
  import { SmartLinkStatus } from '../../constants';
5
4
  import Container from './components/container';
6
5
  import { FlexibleUiAnalyticsContext, FlexibleUiContext, FlexibleUiOptionContext } from '../../state/flexible-ui-context';
@@ -31,23 +30,16 @@ var FlexibleCard = function FlexibleCard(_ref) {
31
30
  var cardType = cardState.status,
32
31
  details = cardState.details;
33
32
  var status = cardType;
34
- var useLozengeAction = useFeatureFlag('useLozengeAction');
35
- var featureFlags = useMemo(function () {
36
- return {
37
- useLozengeAction: useLozengeAction
38
- };
39
- }, [useLozengeAction]);
40
33
  var context = useMemo(function () {
41
34
  return getContextByStatus({
42
35
  response: details,
43
- featureFlags: featureFlags,
44
36
  id: id,
45
37
  renderers: renderers,
46
38
  showServerActions: showServerActions,
47
39
  status: status,
48
40
  url: url
49
41
  });
50
- }, [details, featureFlags, id, renderers, showServerActions, status, url]);
42
+ }, [details, id, renderers, showServerActions, status, url]);
51
43
  var retry = getRetryOptions(url, status, details, onAuthorize);
52
44
  var _ref2 = context || {},
53
45
  title = _ref2.title;
@@ -19,7 +19,6 @@ import { FormattedMessage } from 'react-intl-next';
19
19
  import { messages } from '../../../messages';
20
20
  import { fireLinkClickedEvent } from '../../../utils/analytics/click';
21
21
  import { useSmartCardState } from '../../../state/store';
22
- import { useFeatureFlag } from '@atlaskit/link-provider';
23
22
  export var hoverCardClassName = 'smart-links-hover-preview';
24
23
  export var getCopyAction = function getCopyAction(url) {
25
24
  return {
@@ -68,7 +67,6 @@ var HoverCardContent = function HoverCardContent(_ref) {
68
67
  onMouseEnter = _ref.onMouseEnter,
69
68
  onMouseLeave = _ref.onMouseLeave,
70
69
  showServerActions = _ref.showServerActions;
71
- var useLozengeAction = useFeatureFlag('useLozengeAction');
72
70
  var _useAnalyticsEvents = useAnalyticsEvents(),
73
71
  createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
74
72
  var defaultAnalytics = useSmartLinkAnalytics(url, undefined, id);
@@ -143,7 +141,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
143
141
  onClick: onClick,
144
142
  onResolve: onResolve,
145
143
  renderers: renderers,
146
- showServerActions: useLozengeAction === 'experiment' || showServerActions ? {
144
+ showServerActions: showServerActions ? {
147
145
  showStateActionFeatureDiscovery: true
148
146
  } : false,
149
147
  ui: flexibleUiOptions,
@@ -33,7 +33,7 @@ export var titleBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTe
33
33
  export var getTransitionStyles = function getTransitionStyles(snippetHeight) {
34
34
  return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n transition: height 300ms ease-in-out;\n height: ", "px;\n"])), snippetHeight);
35
35
  };
36
- export var popupContainerStyles = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border-radius: ", ";\n background-color: ", ";\n box-shadow: ", ";\n"])), "var(--ds-border-radius-300, 12px)", themed({
36
+ export var popupContainerStyles = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border-radius: ", ";\n background-color: ", ";\n box-shadow: ", ";\n"])), "var(--ds-border-radius-200, 8px)", themed({
37
37
  light: "var(--ds-surface-raised, white)",
38
38
  dark: "var(--ds-surface-raised, #262B31)"
39
39
  })(), themed({
@@ -41,5 +41,5 @@ export var popupContainerStyles = css(_templateObject5 || (_templateObject5 = _t
41
41
  dark: "var(--ds-shadow-overlay, 0px 0px 0px rgba(188, 214, 240, 0.12),0px 8px 12px rgba(3, 4, 4, 0.36),0px 0px 1px rgba(3, 4, 4, 0.5))"
42
42
  })());
43
43
  export var getPreviewBlockStyles = function getPreviewBlockStyles(snippetHeight) {
44
- return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n height: ", "px;\n ", "\n"])), snippetHeight, 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 }") : "");
44
+ return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n height: ", "px;\n ", "\n"])), snippetHeight, 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 }") : "");
45
45
  };
@@ -11,7 +11,7 @@ import LinkWarningModal from './LinkWarningModal';
11
11
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
12
12
  var PACKAGE_DATA = {
13
13
  packageName: "@atlaskit/smart-card",
14
- packageVersion: "26.23.1",
14
+ packageVersion: "26.24.0",
15
15
  componentName: 'linkUrl'
16
16
  };
17
17
  var Link = withLinkClickedEvent('a');
@@ -41,7 +41,7 @@ var isSelected = function isSelected(_ref2) {
41
41
  // NB: `display: inline` required for `box-decoration-break` to work.
42
42
  // NB: `box-decoration-break` required for retaining properties (border-radius) on wrap.
43
43
  var baseWrapperStyle = function baseWrapperStyle(props) {
44
- 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(themed({
44
+ 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(themed({
45
45
  light: "var(--ds-link, ".concat(B400, ")"),
46
46
  dark: "var(--ds-link, #4794FF)"
47
47
  })(props), ";\n\n background-color: ").concat(props.withoutBackground ? '' : themed({
@@ -7,7 +7,7 @@ var LINK_COLOR_DARK = '#4794FF';
7
7
 
8
8
  // By default buttons will hide overflow and ellipsis content instead of wrapping.
9
9
  // This basically turns the button back into inline content
10
- export var IconStyledButton = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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)");
10
+ export var IconStyledButton = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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)");
11
11
  export var NoLinkAppearance = styled.span(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: ", ";\n margin-left: ", ";\n"])), themed({
12
12
  light: "var(--ds-text-subtlest, ".concat(N200, ")"),
13
13
  dark: "var(--ds-text-subtlest, ".concat(LINK_COLOR_DARK, ")")
@@ -0,0 +1,68 @@
1
+ declare const _default: {
2
+ meta: {
3
+ auth: never[];
4
+ definitionId: string;
5
+ product: string;
6
+ visibility: string;
7
+ access: string;
8
+ key: string;
9
+ };
10
+ data: {
11
+ '@context': {
12
+ '@vocab': string;
13
+ atlassian: string;
14
+ schema: string;
15
+ };
16
+ generator: {
17
+ '@type': string;
18
+ '@id': string;
19
+ name: string;
20
+ icon: {
21
+ '@type': string;
22
+ url: string;
23
+ };
24
+ };
25
+ '@type': string[];
26
+ url: string;
27
+ icon: {
28
+ '@type': string;
29
+ url: string;
30
+ };
31
+ name: string;
32
+ summary: string;
33
+ 'atlassian:state': {
34
+ '@type': string;
35
+ name: string;
36
+ appearance: string;
37
+ };
38
+ attributedTo: {
39
+ name: string;
40
+ icon: string;
41
+ }[];
42
+ 'atlassian:updatedBy': {
43
+ name: string;
44
+ icon: string;
45
+ }[];
46
+ preview: {
47
+ '@type': string;
48
+ href: string;
49
+ };
50
+ 'schema:commentCount': number;
51
+ 'atlassian:subscriberCount': number;
52
+ endTime: string;
53
+ updated: string;
54
+ 'atlassian:serverAction': {
55
+ '@type': string;
56
+ name: string;
57
+ dataUpdateAction: {
58
+ '@type': string;
59
+ name: string;
60
+ };
61
+ resourceIdentifiers: {
62
+ ari: string;
63
+ };
64
+ refField: string;
65
+ }[];
66
+ };
67
+ };
68
+ export default _default;
@@ -125,6 +125,7 @@ export declare enum ElementName {
125
125
  export declare enum ActionName {
126
126
  DeleteAction = "DeleteAction",
127
127
  EditAction = "EditAction",
128
+ FollowAction = "FollowAction",
128
129
  PreviewAction = "PreviewAction",
129
130
  ViewAction = "ViewAction",
130
131
  DownloadAction = "DownloadAction",
@@ -29,6 +29,9 @@ export declare const TEST_UNDEFINED_LINK: JsonLd.Data.UndefinedLinkDocument;
29
29
  export declare const TEST_ASSIGN_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
30
30
  export declare const TEST_NO_ID_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
31
31
  export declare const TEST_VIEW_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
32
+ export declare const TEST_FOLLOW_ACTION: JsonLd.Primitives.UpdateAction;
33
+ export declare const TEST_UNFOLLOW_ACTION: JsonLd.Primitives.UpdateAction;
34
+ export declare const TEST_STATUS_UPDATE_ACTION: JsonLd.Primitives.UpdateAction;
32
35
  export declare const TEST_DOCUMENT_WITH_ACTIONS: JsonLd.Data.BaseData;
33
36
  export declare const TEST_DOCUMENT_WITH_DOWNLOAD_ACTION: JsonLd.Data.BaseData;
34
37
  export declare const TEST_DOCUMENT_WITH_VIEW_ACTION: JsonLd.Data.BaseData;
@@ -0,0 +1,5 @@
1
+ import type { JsonLd } from 'json-ld-types';
2
+ import { ServerActionProp } from '../../../state/flexible-ui-context/types';
3
+ import { ServerActionOptions } from '../../../view/FlexibleCard/types';
4
+ declare const extractFollowAction: (response?: JsonLd.Response, showServerActions?: boolean | ServerActionOptions, id?: string) => ServerActionProp<boolean> | undefined;
5
+ export default extractFollowAction;
@@ -1,4 +1,4 @@
1
1
  import { FlexibleUiDataContext } from '../../state/flexible-ui-context/types';
2
2
  import { ExtractFlexibleUiDataContextParams } from '../../view/FlexibleCard/types';
3
- declare const extractFlexibleUiContext: ({ featureFlags, id, renderers, showServerActions, response, }?: Partial<ExtractFlexibleUiDataContextParams>) => FlexibleUiDataContext | undefined;
3
+ declare const extractFlexibleUiContext: ({ id, renderers, showServerActions, response, }?: Partial<ExtractFlexibleUiDataContextParams>) => FlexibleUiDataContext | undefined;
4
4
  export default extractFlexibleUiContext;
@@ -1,6 +1,6 @@
1
1
  import { MessageDescriptor } from 'react-intl-next';
2
2
  export type RequestAccessMessageKey = 'click_to_join' | 'click_to_join_description' | 'forbidden_description' | 'request_access' | 'request_access_description' | 'request_access_pending' | 'request_access_pending_description' | 'request_denied_description';
3
- export type MessageKey = 'assigned_to' | 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview_improved' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'read_time' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'sent_on_relative' | 'sent_on_absolute' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'unauthorised_account_description' | 'unauthorised_account_description_no_provider' | 'unauthorised_account_name' | 'unauthorised_account_name_no_provider' | 'unassigned' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey;
3
+ export type MessageKey = 'assigned_to' | 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'follow' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview_improved' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'read_time' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'sent_on_relative' | 'sent_on_absolute' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'unauthorised_account_description' | 'unauthorised_account_description_no_provider' | 'unauthorised_account_name' | 'unauthorised_account_name_no_provider' | 'unassigned' | 'unfollow' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey;
4
4
  type Messages = {
5
5
  [K in MessageKey]: MessageDescriptor;
6
6
  };
@@ -1,6 +1,7 @@
1
1
  import { LinkLozenge } from '../../extractors/common/lozenge/types';
2
2
  import { LinkPerson } from '@atlaskit/link-extractors';
3
3
  import { IconType, MediaType } from '../../constants';
4
+ import { InvokeRequestWithCardDetails } from '../hooks/use-invoke/types';
4
5
  /**
5
6
  * This provides the data that will be used by Smart Links Flexible UI to populate it's
6
7
  * underlying elements.
@@ -45,6 +46,12 @@ export type FlexibleUiDataContext = {
45
46
  * @see DueOn
46
47
  */
47
48
  dueOn?: string;
49
+ /**
50
+ * Contains data needed to perform follow action.
51
+ * @type PreviewActionData
52
+ * @see FollowAction
53
+ */
54
+ followAction?: ServerActionProp<boolean>;
48
55
  /**
49
56
  * Contains the number of views of the linked resource.
50
57
  * @type number
@@ -254,3 +261,7 @@ export type ViewActionData = {
254
261
  export type DownloadActionData = {
255
262
  downloadUrl?: string;
256
263
  };
264
+ export type ServerActionProp<TValue> = {
265
+ action: InvokeRequestWithCardDetails;
266
+ value?: TValue;
267
+ };
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { ActionProps } from '../action/types';
3
+ declare const FollowAction: React.FC<ActionProps>;
4
+ export default FollowAction;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { type IconProps } from '@atlaskit/icon';
3
+ declare const UnfollowIcon: (props: IconProps) => JSX.Element;
4
+ export default UnfollowIcon;
@@ -3,6 +3,7 @@ import { ActionProps } from './action/types';
3
3
  import { PreviewActionProps } from './action/preview-action/types';
4
4
  import { ViewActionProps } from './action/view-action/types';
5
5
  import { DownloadActionProps } from './action/download-action/types';
6
+ export { default as FollowAction } from './follow-action';
6
7
  /**
7
8
  * Creates a DeleteAction component. Accepts default ActionProps, but defaults
8
9
  * the icon to a cross icon.
@@ -145,7 +145,7 @@ export type BaseDataActionItem = {
145
145
  * renders a preview modal when clicked.
146
146
  */
147
147
  export type NamedDataActionItem = BaseDataActionItem & {
148
- name: ActionName.PreviewAction | ActionName.DownloadAction | ActionName.ViewAction;
148
+ name: ActionName.FollowAction | ActionName.PreviewAction | ActionName.DownloadAction | ActionName.ViewAction;
149
149
  };
150
150
  /**
151
151
  * This represents an action that does not fetch data where Icon and Content are provided implicitly.
@@ -1,12 +1,14 @@
1
1
  import React from 'react';
2
2
  import { SerializedStyles } from '@emotion/react';
3
- import { ElementItem } from './types';
3
+ import { ActionItem, ElementItem } from './types';
4
4
  import { ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../constants';
5
+ import type { FlexibleUiDataContext } from '../../../../state/flexible-ui-context/types';
5
6
  export type ElementDisplaySchemaType = 'inline' | 'block';
6
7
  export declare const ElementDisplaySchema: Record<ElementName, ElementDisplaySchemaType[]>;
7
8
  export declare const getGapSize: (size: SmartLinkSize) => number;
8
9
  export declare const getBaseStyles: (direction: SmartLinkDirection, size: SmartLinkSize) => SerializedStyles;
9
10
  export declare const highlightRemoveStyles: SerializedStyles;
10
11
  export declare const isJSXElementNull: (children: JSX.Element) => boolean;
12
+ export declare const filterActionItems: (items?: ActionItem[], context?: FlexibleUiDataContext) => ActionItem[];
11
13
  export declare const renderChildren: (children: React.ReactNode, size: SmartLinkSize) => React.ReactNode;
12
14
  export declare const renderElementItems: (items?: ElementItem[], display?: ElementDisplaySchemaType) => React.ReactNode | undefined;
@@ -139,8 +139,7 @@ export type FlexibleUiOptions = {
139
139
  export type ServerActionOptions = {
140
140
  /**
141
141
  * DO NOT USE: This prop is part of an experiment. It will be removed once
142
- * the experiment is completed. To be cleaned up on
143
- * https://product-fabric.atlassian.net/browse/EDM-5795
142
+ * the experiment is completed.
144
143
  * @see https://team.atlassian.com/project/ATLAS-13099/about
145
144
  * @internal
146
145
  * @deprecated
@@ -0,0 +1,68 @@
1
+ declare const _default: {
2
+ meta: {
3
+ auth: never[];
4
+ definitionId: string;
5
+ product: string;
6
+ visibility: string;
7
+ access: string;
8
+ key: string;
9
+ };
10
+ data: {
11
+ '@context': {
12
+ '@vocab': string;
13
+ atlassian: string;
14
+ schema: string;
15
+ };
16
+ generator: {
17
+ '@type': string;
18
+ '@id': string;
19
+ name: string;
20
+ icon: {
21
+ '@type': string;
22
+ url: string;
23
+ };
24
+ };
25
+ '@type': string[];
26
+ url: string;
27
+ icon: {
28
+ '@type': string;
29
+ url: string;
30
+ };
31
+ name: string;
32
+ summary: string;
33
+ 'atlassian:state': {
34
+ '@type': string;
35
+ name: string;
36
+ appearance: string;
37
+ };
38
+ attributedTo: {
39
+ name: string;
40
+ icon: string;
41
+ }[];
42
+ 'atlassian:updatedBy': {
43
+ name: string;
44
+ icon: string;
45
+ }[];
46
+ preview: {
47
+ '@type': string;
48
+ href: string;
49
+ };
50
+ 'schema:commentCount': number;
51
+ 'atlassian:subscriberCount': number;
52
+ endTime: string;
53
+ updated: string;
54
+ 'atlassian:serverAction': {
55
+ '@type': string;
56
+ name: string;
57
+ dataUpdateAction: {
58
+ '@type': string;
59
+ name: string;
60
+ };
61
+ resourceIdentifiers: {
62
+ ari: string;
63
+ };
64
+ refField: string;
65
+ }[];
66
+ };
67
+ };
68
+ export default _default;
@@ -125,6 +125,7 @@ export declare enum ElementName {
125
125
  export declare enum ActionName {
126
126
  DeleteAction = "DeleteAction",
127
127
  EditAction = "EditAction",
128
+ FollowAction = "FollowAction",
128
129
  PreviewAction = "PreviewAction",
129
130
  ViewAction = "ViewAction",
130
131
  DownloadAction = "DownloadAction",
@@ -29,6 +29,9 @@ export declare const TEST_UNDEFINED_LINK: JsonLd.Data.UndefinedLinkDocument;
29
29
  export declare const TEST_ASSIGN_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
30
30
  export declare const TEST_NO_ID_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
31
31
  export declare const TEST_VIEW_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
32
+ export declare const TEST_FOLLOW_ACTION: JsonLd.Primitives.UpdateAction;
33
+ export declare const TEST_UNFOLLOW_ACTION: JsonLd.Primitives.UpdateAction;
34
+ export declare const TEST_STATUS_UPDATE_ACTION: JsonLd.Primitives.UpdateAction;
32
35
  export declare const TEST_DOCUMENT_WITH_ACTIONS: JsonLd.Data.BaseData;
33
36
  export declare const TEST_DOCUMENT_WITH_DOWNLOAD_ACTION: JsonLd.Data.BaseData;
34
37
  export declare const TEST_DOCUMENT_WITH_VIEW_ACTION: JsonLd.Data.BaseData;
@@ -0,0 +1,5 @@
1
+ import type { JsonLd } from 'json-ld-types';
2
+ import { ServerActionProp } from '../../../state/flexible-ui-context/types';
3
+ import { ServerActionOptions } from '../../../view/FlexibleCard/types';
4
+ declare const extractFollowAction: (response?: JsonLd.Response, showServerActions?: boolean | ServerActionOptions, id?: string) => ServerActionProp<boolean> | undefined;
5
+ export default extractFollowAction;
@@ -1,4 +1,4 @@
1
1
  import { FlexibleUiDataContext } from '../../state/flexible-ui-context/types';
2
2
  import { ExtractFlexibleUiDataContextParams } from '../../view/FlexibleCard/types';
3
- declare const extractFlexibleUiContext: ({ featureFlags, id, renderers, showServerActions, response, }?: Partial<ExtractFlexibleUiDataContextParams>) => FlexibleUiDataContext | undefined;
3
+ declare const extractFlexibleUiContext: ({ id, renderers, showServerActions, response, }?: Partial<ExtractFlexibleUiDataContextParams>) => FlexibleUiDataContext | undefined;
4
4
  export default extractFlexibleUiContext;
@@ -1,6 +1,6 @@
1
1
  import { MessageDescriptor } from 'react-intl-next';
2
2
  export type RequestAccessMessageKey = 'click_to_join' | 'click_to_join_description' | 'forbidden_description' | 'request_access' | 'request_access_description' | 'request_access_pending' | 'request_access_pending_description' | 'request_denied_description';
3
- export type MessageKey = 'assigned_to' | 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview_improved' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'read_time' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'sent_on_relative' | 'sent_on_absolute' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'unauthorised_account_description' | 'unauthorised_account_description_no_provider' | 'unauthorised_account_name' | 'unauthorised_account_name_no_provider' | 'unassigned' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey;
3
+ export type MessageKey = 'assigned_to' | 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'follow' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview_improved' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'read_time' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'sent_on_relative' | 'sent_on_absolute' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'unauthorised_account_description' | 'unauthorised_account_description_no_provider' | 'unauthorised_account_name' | 'unauthorised_account_name_no_provider' | 'unassigned' | 'unfollow' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey;
4
4
  type Messages = {
5
5
  [K in MessageKey]: MessageDescriptor;
6
6
  };