@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
@@ -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';
@@ -12,7 +14,6 @@ import { extractPreviewAction } from './actions/extract-preview-action';
12
14
  import { extractDownloadAction } from './actions/extract-download-action';
13
15
  import { extractViewAction } from './actions/extract-view-action';
14
16
  const extractFlexibleUiContext = ({
15
- featureFlags,
16
17
  id,
17
18
  renderers,
18
19
  showServerActions,
@@ -23,7 +24,6 @@ const extractFlexibleUiContext = ({
23
24
  }
24
25
  const data = response.data;
25
26
  const url = extractLink(data);
26
- const showLozengeAction = (featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.useLozengeAction) === 'experiment';
27
27
  return {
28
28
  assignedToGroup: extractPersonAssignedToAsArray(data),
29
29
  attachmentCount: extractAttachmentCount(data),
@@ -40,6 +40,7 @@ const extractFlexibleUiContext = ({
40
40
  assignedTo: extractAssignedTo(data),
41
41
  createdOn: extractDateCreated(data),
42
42
  dueOn: extractDueOn(data),
43
+ followAction: getBooleanFF('platform.linking-platform.smart-card.follow-button') ? extractFollowAction(response, showServerActions, id) : undefined,
43
44
  previewAction: extractPreviewAction(response),
44
45
  viewAction: extractViewAction(data),
45
46
  downloadAction: extractDownloadAction(data),
@@ -57,7 +58,7 @@ const extractFlexibleUiContext = ({
57
58
  snippet: extractSummary(data) || undefined,
58
59
  // Explicitly set here to remove an empty string
59
60
  sourceBranch: extractSourceBranch(data),
60
- state: extractState(response, showServerActions || showLozengeAction, id),
61
+ state: extractState(response, showServerActions, id),
61
62
  subscriberCount: extractSubscriberCount(data),
62
63
  subTasksProgress: extractSubTasksProgress(data),
63
64
  storyPoints: extractStoryPoints(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.1"
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
  }
@@ -0,0 +1,31 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import InviteTeamIcon from '@atlaskit/icon/glyph/invite-team';
3
+ import React, { useContext } from 'react';
4
+ import { FormattedMessage } from 'react-intl-next';
5
+ import { messages } from '../../../../../messages';
6
+ import { FlexibleUiContext } from '../../../../../state/flexible-ui-context';
7
+ import ServerAction from '../action/server-action';
8
+ import UnfollowIcon from './unfollow-icon';
9
+ const FollowAction = props => {
10
+ const context = useContext(FlexibleUiContext);
11
+ if (!context || !context.followAction) {
12
+ return null;
13
+ }
14
+ const {
15
+ value,
16
+ ...data
17
+ } = context.followAction;
18
+ const message = value ? messages.follow : messages.unfollow;
19
+ const icon = value ? /*#__PURE__*/React.createElement(InviteTeamIcon, {
20
+ label: "Follow"
21
+ }) : /*#__PURE__*/React.createElement(UnfollowIcon, {
22
+ label: "Unfollow"
23
+ });
24
+ return /*#__PURE__*/React.createElement(ServerAction, _extends({
25
+ content: /*#__PURE__*/React.createElement(FormattedMessage, message),
26
+ icon: icon,
27
+ testId: "smart-action-follow-action",
28
+ tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, message)
29
+ }, data, props));
30
+ };
31
+ export default FollowAction;
@@ -0,0 +1,28 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import Icon from '@atlaskit/icon';
3
+ import React from 'react';
4
+ const UnfollowGlyph = props => /*#__PURE__*/React.createElement("svg", {
5
+ width: "16",
6
+ height: "16",
7
+ viewBox: "0 0 16 16",
8
+ "data-testid": props['data-testid'],
9
+ "aria-label": props['aria-label'],
10
+ className: props.className,
11
+ role: "presentation",
12
+ xmlns: "http://www.w3.org/2000/svg"
13
+ }, /*#__PURE__*/React.createElement("path", {
14
+ 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",
15
+ fill: "currentColor"
16
+ }), /*#__PURE__*/React.createElement("path", {
17
+ fillRule: "evenodd",
18
+ clipRule: "evenodd",
19
+ 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",
20
+ fill: "currentColor"
21
+ }), /*#__PURE__*/React.createElement("path", {
22
+ 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",
23
+ fill: "currentColor"
24
+ }));
25
+ const UnfollowIcon = props => /*#__PURE__*/React.createElement(Icon, _extends({
26
+ glyph: UnfollowGlyph
27
+ }, props));
28
+ 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.
@@ -6,13 +6,14 @@ import { css, jsx } from '@emotion/react';
6
6
  import ButtonGroup from '@atlaskit/button/button-group';
7
7
  import Tooltip from '@atlaskit/tooltip';
8
8
  import DropdownMenu from '@atlaskit/dropdown-menu';
9
- import { ActionName, SmartLinkSize } from '../../../../../constants';
9
+ import { SmartLinkSize } from '../../../../../constants';
10
10
  import Button from '@atlaskit/button/standard-button';
11
11
  import MoreIcon from '@atlaskit/icon/glyph/more';
12
12
  import { sizeToButtonSpacing } from '../../utils';
13
13
  import { messages } from '../../../../../messages';
14
14
  import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
15
15
  import ActionGroupItem from './action-group-item';
16
+ import { filterActionItems } from '../utils';
16
17
  const styles = css`
17
18
  display: inline-flex;
18
19
  line-height: 1rem;
@@ -37,22 +38,6 @@ const renderActionItems = (items = [], size = SmartLinkSize.Medium, appearance,
37
38
  asDropDownItems: asDropDownItems,
38
39
  onActionItemClick: onActionItemClick
39
40
  }));
40
- const filterActionItems = (items = [], context) => {
41
- return items.filter(item => {
42
- switch (item.name) {
43
- // Action that require data from the data context to render.
44
- case ActionName.DownloadAction:
45
- return Boolean(context === null || context === void 0 ? void 0 : context.downloadAction);
46
- case ActionName.PreviewAction:
47
- return Boolean(context === null || context === void 0 ? void 0 : context.previewAction);
48
- case ActionName.ViewAction:
49
- return Boolean(context === null || context === void 0 ? void 0 : context.viewAction);
50
- default:
51
- // Named and custom actions that user defines.
52
- return Boolean(ActionName[item.name]);
53
- }
54
- });
55
- };
56
41
 
57
42
  /**
58
43
  * Creates a group of Action components. Accepts an array of Actions, in addition to some styling
@@ -1,11 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { useCallback } from 'react';
2
+ import React, { useCallback, useMemo } from 'react';
3
3
  import { css } from '@emotion/react';
4
4
  import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkStatus, SmartLinkWidth } from '../../../../../constants';
5
5
  import Block from '../block';
6
6
  import ElementGroup from '../element-group';
7
7
  import { Provider } from '../../elements';
8
8
  import ActionGroup from '../action-group';
9
+ import { filterActionItems } from '../utils';
10
+ import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
9
11
  const getActionGroupStyles = size => {
10
12
  if (size === SmartLinkSize.XLarge) {
11
13
  // The biggest height of the action button exceeds the max line-height
@@ -32,6 +34,11 @@ const FooterBlock = props => {
32
34
  testId = 'smart-footer-block',
33
35
  onActionMenuOpenChange
34
36
  } = props;
37
+ const context = useFlexibleUiContext();
38
+ const hasActions = useMemo(() => {
39
+ var _filterActionItems;
40
+ return ((_filterActionItems = filterActionItems(actions, context)) === null || _filterActionItems === void 0 ? void 0 : _filterActionItems.length) > 0;
41
+ }, [actions, context]);
35
42
  const onDropdownOpenChange = useCallback(isOpen => {
36
43
  if (onActionMenuOpenChange) {
37
44
  onActionMenuOpenChange({
@@ -46,7 +53,7 @@ const FooterBlock = props => {
46
53
  testId: `${testId}-resolved-view`
47
54
  }), /*#__PURE__*/React.createElement(Provider, {
48
55
  testId: `${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,
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import { css } from '@emotion/react';
4
- import { ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../constants';
4
+ import { ActionName, ElementName, SmartLinkDirection, SmartLinkSize } from '../../../../constants';
5
5
  import * as Elements from '../elements';
6
6
  import { isFlexibleUiElement } from '../../../../utils/flexible';
7
7
  import ActionGroup from './action-group';
@@ -111,6 +111,24 @@ export const isJSXElementNull = children => {
111
111
  return Boolean(children.type() === null);
112
112
  };
113
113
  const isElementOrElementGroup = node => /*#__PURE__*/React.isValidElement(node) && (isFlexibleUiElement(node) || node.type === ElementGroup);
114
+ export const filterActionItems = (items = [], context) => {
115
+ return items.filter(item => {
116
+ switch (item.name) {
117
+ // Action that require data from the data context to render.
118
+ case ActionName.DownloadAction:
119
+ return Boolean(context === null || context === void 0 ? void 0 : context.downloadAction);
120
+ case ActionName.FollowAction:
121
+ return Boolean(context === null || context === void 0 ? void 0 : context.followAction);
122
+ case ActionName.PreviewAction:
123
+ return Boolean(context === null || context === void 0 ? void 0 : context.previewAction);
124
+ case ActionName.ViewAction:
125
+ return Boolean(context === null || context === void 0 ? void 0 : context.viewAction);
126
+ default:
127
+ // Named and custom actions that user defines.
128
+ return Boolean(ActionName[item.name]);
129
+ }
130
+ });
131
+ };
114
132
  export const renderChildren = (children, size) => React.Children.map(children, child => {
115
133
  if (isElementOrElementGroup(child) || isActionGroup(child)) {
116
134
  const node = 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';
@@ -34,19 +33,14 @@ const FlexibleCard = ({
34
33
  details
35
34
  } = cardState;
36
35
  const status = cardType;
37
- const useLozengeAction = useFeatureFlag('useLozengeAction');
38
- const featureFlags = useMemo(() => ({
39
- useLozengeAction
40
- }), [useLozengeAction]);
41
36
  const context = useMemo(() => getContextByStatus({
42
37
  response: details,
43
- featureFlags,
44
38
  id,
45
39
  renderers,
46
40
  showServerActions,
47
41
  status,
48
42
  url
49
- }), [details, featureFlags, id, renderers, showServerActions, status, url]);
43
+ }), [details, id, renderers, showServerActions, status, url]);
50
44
  const retry = getRetryOptions(url, status, details, onAuthorize);
51
45
  const {
52
46
  title
@@ -17,7 +17,6 @@ import { FormattedMessage } from 'react-intl-next';
17
17
  import { messages } from '../../../messages';
18
18
  import { fireLinkClickedEvent } from '../../../utils/analytics/click';
19
19
  import { useSmartCardState } from '../../../state/store';
20
- import { useFeatureFlag } from '@atlaskit/link-provider';
21
20
  export const hoverCardClassName = 'smart-links-hover-preview';
22
21
  export const getCopyAction = url => ({
23
22
  name: ActionName.CustomAction,
@@ -44,7 +43,6 @@ const HoverCardContent = ({
44
43
  showServerActions
45
44
  }) => {
46
45
  var _linkState$status, _cardState$details;
47
- const useLozengeAction = useFeatureFlag('useLozengeAction');
48
46
  const {
49
47
  createAnalyticsEvent
50
48
  } = useAnalyticsEvents();
@@ -117,7 +115,7 @@ const HoverCardContent = ({
117
115
  onClick: onClick,
118
116
  onResolve: onResolve,
119
117
  renderers: renderers,
120
- showServerActions: useLozengeAction === 'experiment' || showServerActions ? {
118
+ showServerActions: showServerActions ? {
121
119
  showStateActionFeatureDiscovery: true
122
120
  } : false,
123
121
  ui: flexibleUiOptions,
@@ -66,7 +66,7 @@ export const getTransitionStyles = snippetHeight => css`
66
66
  height: ${snippetHeight}px;
67
67
  `;
68
68
  export const popupContainerStyles = css`
69
- border-radius: ${"var(--ds-border-radius-300, 12px)"};
69
+ border-radius: ${"var(--ds-border-radius-200, 8px)"};
70
70
  background-color: ${themed({
71
71
  light: "var(--ds-surface-raised, white)",
72
72
  dark: "var(--ds-surface-raised, #262B31)"
@@ -78,8 +78,8 @@ export const popupContainerStyles = css`
78
78
  `;
79
79
  export const getPreviewBlockStyles = snippetHeight => css`
80
80
  height: ${snippetHeight}px;
81
- ${getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? ` border-top-left-radius: ${"var(--ds-border-radius-300, 12px)"};
82
- border-top-right-radius: ${"var(--ds-border-radius-300, 12px)"};
81
+ ${getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? ` border-top-left-radius: ${"var(--ds-border-radius-200, 8px)"};
82
+ border-top-right-radius: ${"var(--ds-border-radius-200, 8px)"};
83
83
  margin-bottom: ${blockGap};
84
84
  }` : ``}
85
85
  `;
@@ -8,7 +8,7 @@ import LinkWarningModal from './LinkWarningModal';
8
8
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
9
  const PACKAGE_DATA = {
10
10
  packageName: "@atlaskit/smart-card",
11
- packageVersion: "26.23.1",
11
+ packageVersion: "26.24.0",
12
12
  componentName: 'linkUrl'
13
13
  };
14
14
  const Link = withLinkClickedEvent('a');
@@ -67,7 +67,7 @@ const baseWrapperStyle = props => `
67
67
  ${props.withoutBackground ? `padding-left: 0; margin-left:-2px;` : ''}
68
68
  display: inline;
69
69
  box-decoration-break: clone;
70
- border-radius: ${"var(--ds-border-radius-100, 3px)"};
70
+ border-radius: ${"var(--ds-border-radius-100, 4px)"};
71
71
  color: ${themed({
72
72
  light: `var(--ds-link, ${B400})`,
73
73
  dark: "var(--ds-link, #4794FF)"
@@ -10,7 +10,7 @@ export const IconStyledButton = styled.span`
10
10
  text-align: initial;
11
11
  display: inline;
12
12
  vertical-align: baseline;
13
- border-radius: ${"var(--ds-border-radius-100, 2px)"};
13
+ border-radius: ${"var(--ds-border-radius-100, 4px)"};
14
14
  border-top-left-radius: 0px;
15
15
  border-bottom-left-radius: 0px;
16
16
  padding: ${"var(--ds-space-025, 2px)"} ${"var(--ds-space-075, 6px)"};
@@ -143,6 +143,7 @@ export var ElementName = /*#__PURE__*/function (ElementName) {
143
143
  export var 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
+ var extractFollowAction = function extractFollowAction(response, showServerActions, id) {
6
+ var _action$dataUpdateAct;
7
+ if (!showServerActions) {
8
+ return;
9
+ }
10
+ var extensionKey = getExtensionKey(response);
11
+ var data = response === null || response === void 0 ? void 0 : response.data;
12
+ var actions = extractServerAction(data);
13
+ if (!extensionKey || actions.length === 0) {
14
+ return;
15
+ }
16
+ var action = actions.find(function (item) {
17
+ if ((item === null || item === void 0 ? void 0 : item.name) === 'UpdateAction') {
18
+ var _dataUpdateAction;
19
+ var 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
+ var url = extractLink(data);
28
+ var reload = url ? {
29
+ id: id,
30
+ url: url
31
+ } : undefined;
32
+ var actionType = (_action$dataUpdateAct = action.dataUpdateAction) === null || _action$dataUpdateAct === void 0 ? void 0 : _action$dataUpdateAct.name;
33
+ return {
34
+ action: {
35
+ action: {
36
+ actionType: actionType,
37
+ resourceIdentifiers: action.resourceIdentifiers
38
+ },
39
+ providerKey: extensionKey,
40
+ reload: 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';
@@ -13,7 +15,6 @@ import { extractDownloadAction } from './actions/extract-download-action';
13
15
  import { extractViewAction } from './actions/extract-view-action';
14
16
  var extractFlexibleUiContext = function extractFlexibleUiContext() {
15
17
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
16
- featureFlags = _ref.featureFlags,
17
18
  id = _ref.id,
18
19
  renderers = _ref.renderers,
19
20
  showServerActions = _ref.showServerActions,
@@ -23,7 +24,6 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
23
24
  }
24
25
  var data = response.data;
25
26
  var url = extractLink(data);
26
- var showLozengeAction = (featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.useLozengeAction) === 'experiment';
27
27
  return {
28
28
  assignedToGroup: extractPersonAssignedToAsArray(data),
29
29
  attachmentCount: extractAttachmentCount(data),
@@ -40,6 +40,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
40
40
  assignedTo: extractAssignedTo(data),
41
41
  createdOn: extractDateCreated(data),
42
42
  dueOn: extractDueOn(data),
43
+ followAction: getBooleanFF('platform.linking-platform.smart-card.follow-button') ? extractFollowAction(response, showServerActions, id) : undefined,
43
44
  previewAction: extractPreviewAction(response),
44
45
  viewAction: extractViewAction(data),
45
46
  downloadAction: extractDownloadAction(data),
@@ -57,7 +58,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
57
58
  snippet: extractSummary(data) || undefined,
58
59
  // Explicitly set here to remove an empty string
59
60
  sourceBranch: extractSourceBranch(data),
60
- state: extractState(response, showServerActions || showLozengeAction, id),
61
+ state: extractState(response, showServerActions, id),
61
62
  subscriberCount: extractSubscriberCount(data),
62
63
  subTasksProgress: extractSubTasksProgress(data),
63
64
  storyPoints: extractStoryPoints(data),
@@ -140,6 +140,11 @@ export var 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 var 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',
@@ -13,7 +13,7 @@ export var ANALYTICS_CHANNEL = 'media';
13
13
  export var context = {
14
14
  componentName: 'smart-cards',
15
15
  packageName: "@atlaskit/smart-card",
16
- packageVersion: "26.23.1"
16
+ packageVersion: "26.24.0"
17
17
  };
18
18
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
19
19
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -8,7 +8,7 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
8
  // in editor prosemirror adds padding-left so we need to overwrite it
9
9
  export var metadataBlockCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* primary element group */\n span[data-smart-element-avatar-group] {\n > ul {\n padding-left: 0px;\n }\n }\n [data-smart-element-group] {\n line-height: 1rem;\n }\n"])));
10
10
  export var titleBlockCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n ", "\n"])), getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "gap: 0.5em;" : "", getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? "[data-smart-element=\"Title\"] {\n font-weight: 600;\n }" : "");
11
- export var footerBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: 1.5rem;\n"])));
11
+ export var footerBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\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"])));
12
12
  var flexibleBlockCardElevationStyle = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-radius: 1.5px;\n box-shadow: ", ";\n margin: ", ";\n"])), tokens.elevation, "var(--ds-space-025, 2px)");
13
- var refreshedFlexibleBlockCardStyle = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n & > div {\n border-radius: ", ";\n border: 1px solid ", ";\n }\n"])), "var(--ds-border-radius-300, 12px)", "var(--ds-border-input, ".concat(N40, ")"));
13
+ var refreshedFlexibleBlockCardStyle = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n & > div {\n border-radius: ", ";\n border: 1px solid ", ";\n }\n"])), "var(--ds-border-radius-200, 8px)", "var(--ds-border-input, ".concat(N40, ")"));
14
14
  export var flexibleBlockCardStyle = getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? refreshedFlexibleBlockCardStyle : flexibleBlockCardElevationStyle;
@@ -10,8 +10,8 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
10
10
  export var className = 'media-card-frame';
11
11
  export var borderRadius = "\n border-radius: ".concat(akBorderRadius(), "px;\n");
12
12
  var BACKGROUND_COLOR_DARK = '#262B31';
13
- var wrapperBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-400, 16px)", ";\n");
14
- var contentBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-300, 12px)", ";\n");
13
+ var wrapperBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-200, 8px)", ";\n");
14
+ var contentBorderRadius = "\n border-radius: ".concat("var(--ds-border-radius-100, 4px)", ";\n");
15
15
  export var ellipsis = function ellipsis() {
16
16
  var maxWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '100%';
17
17
  var unit = typeof maxWidth === 'number' ? 'px' : '';
@@ -34,14 +34,14 @@ var ServerAction = function ServerAction(_ref) {
34
34
  _context.next = 6;
35
35
  return invoke(request);
36
36
  case 6:
37
- setIsLoading(false);
38
37
  if (!(action.reload && action.reload.url)) {
39
- _context.next = 10;
38
+ _context.next = 9;
40
39
  break;
41
40
  }
42
- _context.next = 10;
41
+ _context.next = 9;
43
42
  return reload(action.reload.url, true, undefined, action.reload.id);
44
- case 10:
43
+ case 9:
44
+ setIsLoading(false);
45
45
  if (onClick) {
46
46
  onClick();
47
47
  }
@@ -0,0 +1,32 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["value"];
4
+ import InviteTeamIcon from '@atlaskit/icon/glyph/invite-team';
5
+ import React, { useContext } from 'react';
6
+ import { FormattedMessage } from 'react-intl-next';
7
+ import { messages } from '../../../../../messages';
8
+ import { FlexibleUiContext } from '../../../../../state/flexible-ui-context';
9
+ import ServerAction from '../action/server-action';
10
+ import UnfollowIcon from './unfollow-icon';
11
+ var FollowAction = function FollowAction(props) {
12
+ var context = useContext(FlexibleUiContext);
13
+ if (!context || !context.followAction) {
14
+ return null;
15
+ }
16
+ var _context$followAction = context.followAction,
17
+ value = _context$followAction.value,
18
+ data = _objectWithoutProperties(_context$followAction, _excluded);
19
+ var message = value ? messages.follow : messages.unfollow;
20
+ var icon = value ? /*#__PURE__*/React.createElement(InviteTeamIcon, {
21
+ label: "Follow"
22
+ }) : /*#__PURE__*/React.createElement(UnfollowIcon, {
23
+ label: "Unfollow"
24
+ });
25
+ return /*#__PURE__*/React.createElement(ServerAction, _extends({
26
+ content: /*#__PURE__*/React.createElement(FormattedMessage, message),
27
+ icon: icon,
28
+ testId: "smart-action-follow-action",
29
+ tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, message)
30
+ }, data, props));
31
+ };
32
+ export default FollowAction;