@atlaskit/smart-card 26.56.3 → 26.56.5

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 (54) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/extractors/flexible/actions/extract-follow-action.js +4 -1
  3. package/dist/cjs/extractors/flexible/actions/index.js +2 -1
  4. package/dist/cjs/extractors/flexible/index.js +1 -1
  5. package/dist/cjs/messages.js +40 -0
  6. package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/readStream.js +42 -52
  7. package/dist/cjs/utils/analytics/analytics.js +1 -1
  8. package/dist/cjs/view/FlexibleCard/components/actions/follow-action/goal-icon/index.js +29 -0
  9. package/dist/cjs/view/FlexibleCard/components/actions/follow-action/index.js +53 -3
  10. package/dist/cjs/view/FlexibleCard/components/actions/follow-action/projects-icon/index.js +29 -0
  11. package/dist/cjs/view/FlexibleCard/components/blocks/action-block/index.js +14 -5
  12. package/dist/cjs/view/FlexibleCard/components/utils.js +14 -1
  13. package/dist/cjs/view/LinkUrl/index.js +1 -1
  14. package/dist/es2019/extractors/flexible/actions/extract-follow-action.js +5 -2
  15. package/dist/es2019/extractors/flexible/actions/index.js +2 -1
  16. package/dist/es2019/extractors/flexible/index.js +1 -1
  17. package/dist/es2019/messages.js +40 -0
  18. package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/readStream.js +1 -5
  19. package/dist/es2019/utils/analytics/analytics.js +1 -1
  20. package/dist/es2019/view/FlexibleCard/components/actions/follow-action/goal-icon/index.js +18 -0
  21. package/dist/es2019/view/FlexibleCard/components/actions/follow-action/index.js +40 -3
  22. package/dist/es2019/view/FlexibleCard/components/actions/follow-action/projects-icon/index.js +18 -0
  23. package/dist/es2019/view/FlexibleCard/components/blocks/action-block/index.js +15 -6
  24. package/dist/es2019/view/FlexibleCard/components/utils.js +7 -0
  25. package/dist/es2019/view/LinkUrl/index.js +1 -1
  26. package/dist/esm/extractors/flexible/actions/extract-follow-action.js +5 -2
  27. package/dist/esm/extractors/flexible/actions/index.js +2 -1
  28. package/dist/esm/extractors/flexible/index.js +1 -1
  29. package/dist/esm/messages.js +40 -0
  30. package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/readStream.js +42 -52
  31. package/dist/esm/utils/analytics/analytics.js +1 -1
  32. package/dist/esm/view/FlexibleCard/components/actions/follow-action/goal-icon/index.js +22 -0
  33. package/dist/esm/view/FlexibleCard/components/actions/follow-action/index.js +46 -3
  34. package/dist/esm/view/FlexibleCard/components/actions/follow-action/projects-icon/index.js +22 -0
  35. package/dist/esm/view/FlexibleCard/components/blocks/action-block/index.js +15 -6
  36. package/dist/esm/view/FlexibleCard/components/utils.js +13 -0
  37. package/dist/esm/view/LinkUrl/index.js +1 -1
  38. package/dist/types/extractors/flexible/actions/index.d.ts +1 -1
  39. package/dist/types/messages.d.ts +1 -1
  40. package/dist/types/state/flexible-ui-context/types.d.ts +1 -0
  41. package/dist/types/view/FlexibleCard/components/actions/follow-action/__fixtures__/follow-goal-context.d.ts +3 -0
  42. package/dist/types/view/FlexibleCard/components/actions/follow-action/goal-icon/index.d.ts +3 -0
  43. package/dist/types/view/FlexibleCard/components/actions/follow-action/projects-icon/index.d.ts +3 -0
  44. package/dist/types/view/FlexibleCard/components/blocks/action-block/types.d.ts +0 -4
  45. package/dist/types/view/FlexibleCard/components/utils.d.ts +1 -0
  46. package/dist/types-ts4.5/extractors/flexible/actions/index.d.ts +1 -1
  47. package/dist/types-ts4.5/messages.d.ts +1 -1
  48. package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +1 -0
  49. package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/__fixtures__/follow-goal-context.d.ts +3 -0
  50. package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/goal-icon/index.d.ts +3 -0
  51. package/dist/types-ts4.5/view/FlexibleCard/components/actions/follow-action/projects-icon/index.d.ts +3 -0
  52. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/action-block/types.d.ts +0 -4
  53. package/dist/types-ts4.5/view/FlexibleCard/components/utils.d.ts +1 -0
  54. package/package.json +1 -1
@@ -0,0 +1,18 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import Icon from '@atlaskit/icon';
3
+ import React from 'react';
4
+ const GoalGlyph = props => /*#__PURE__*/React.createElement("svg", {
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ width: "16",
7
+ height: "16",
8
+ viewBox: "0 0 16 16",
9
+ fill: "none"
10
+ }, /*#__PURE__*/React.createElement("path", {
11
+ fillRule: "evenodd",
12
+ clipRule: "evenodd",
13
+ d: "M12.6667 8C12.6667 10.5773 10.5773 12.6667 8 12.6667C5.42267 12.6667 3.33333 10.5773 3.33333 8C3.33333 5.42267 5.42267 3.33333 8 3.33333C10.5773 3.33333 12.6667 5.42267 12.6667 8ZM14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8ZM9.33333 8C9.33333 8.73638 8.73638 9.33333 8 9.33333C7.26362 9.33333 6.66667 8.73638 6.66667 8C6.66667 7.26362 7.26362 6.66667 8 6.66667C8.73638 6.66667 9.33333 7.26362 9.33333 8ZM10.6667 8C10.6667 9.47276 9.47276 10.6667 8 10.6667C6.52724 10.6667 5.33333 9.47276 5.33333 8C5.33333 6.52724 6.52724 5.33333 8 5.33333C9.47276 5.33333 10.6667 6.52724 10.6667 8Z",
14
+ fill: "#0C66E4"
15
+ }));
16
+ export const GoalIcon = props => /*#__PURE__*/React.createElement(Icon, _extends({
17
+ glyph: GoalGlyph
18
+ }, props));
@@ -7,6 +7,26 @@ import { messages } from '../../../../../messages';
7
7
  import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
8
8
  import ServerAction from '../action/server-action';
9
9
  import UnfollowIcon from './unfollow-icon';
10
+ import { importIcon } from '../../utils';
11
+ const importIconMapper = {
12
+ goal: () => import( /* webpackChunkName: "glyphGoal" */'./goal-icon').then(({
13
+ GoalIcon
14
+ }) => ({
15
+ default: GoalIcon
16
+ })),
17
+ projects: () => import( /* webpackChunkName: "glyphProjects" */'./projects-icon').then(({
18
+ ProjectsIcon
19
+ }) => ({
20
+ default: ProjectsIcon
21
+ }))
22
+ };
23
+ const getIcon = stackIconType => {
24
+ const importFn = importIconMapper[stackIconType];
25
+ if (!importFn) {
26
+ return null;
27
+ }
28
+ return importIcon(importFn);
29
+ };
10
30
  const FollowAction = props => {
11
31
  var _context$actions, _context$actions2;
12
32
  const context = useFlexibleUiContext();
@@ -17,17 +37,34 @@ const FollowAction = props => {
17
37
  value,
18
38
  ...data
19
39
  } = context === null || context === void 0 ? void 0 : (_context$actions2 = context.actions) === null || _context$actions2 === void 0 ? void 0 : _context$actions2[ActionName.FollowAction];
40
+ const isStackItem = props.as === 'stack-item';
41
+ const isProject = data.isProject;
20
42
  const message = value ? messages.follow : messages.unfollow;
43
+ const projectMessage = value ? messages.follow_project : messages.unfollow_project;
44
+ const goalMessage = value ? messages.follow_goal : messages.unfollow_goal;
45
+ const stackMessage = isProject ? projectMessage : goalMessage;
46
+ const label = isStackItem ? stackMessage : message;
47
+ const projectTooltipMessage = value ? messages.follow_project_description : messages.unfollow_project_description;
48
+ const goalTooltipMessage = value ? messages.follow_goal_description : messages.unfollow_goal_description;
49
+ const stackTooltipMessage = isProject ? projectTooltipMessage : goalTooltipMessage;
50
+ const tooltipMessage = isStackItem ? stackTooltipMessage : message;
21
51
  const icon = value ? /*#__PURE__*/React.createElement(InviteTeamIcon, {
22
52
  label: "Follow"
23
53
  }) : /*#__PURE__*/React.createElement(UnfollowIcon, {
24
54
  label: "Unfollow"
25
55
  });
56
+ const stackIconType = isProject ? 'projects' : 'goal';
57
+ const ImportedIcon = getIcon(stackIconType);
58
+ const stackIcon = /*#__PURE__*/React.createElement(ImportedIcon, {
59
+ label: "Follow",
60
+ testId: `smart-action-follow-action-${stackIconType}-icon`
61
+ });
62
+ const followIcon = isStackItem ? stackIcon : icon;
26
63
  return /*#__PURE__*/React.createElement(ServerAction, _extends({
27
- content: /*#__PURE__*/React.createElement(FormattedMessage, message),
28
- icon: icon,
64
+ content: /*#__PURE__*/React.createElement(FormattedMessage, label),
65
+ icon: followIcon,
29
66
  testId: "smart-action-follow-action",
30
- tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, message)
67
+ tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, tooltipMessage)
31
68
  }, data, props));
32
69
  };
33
70
  export default FollowAction;
@@ -0,0 +1,18 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import Icon from '@atlaskit/icon';
3
+ import React from 'react';
4
+ const ProjectsGlyph = props => /*#__PURE__*/React.createElement("svg", {
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ width: "16",
7
+ height: "16",
8
+ viewBox: "0 0 16 16",
9
+ fill: "none"
10
+ }, /*#__PURE__*/React.createElement("path", {
11
+ fillRule: "evenodd",
12
+ clipRule: "evenodd",
13
+ d: "M9.88573 4.00002C9.70892 4.00002 9.53935 4.07026 9.41433 4.19528L6.97282 6.63678L4.20525 6.94429C4.05479 6.96101 3.91451 7.02844 3.80746 7.13548L3.60959 7.33335L4.35367 8.07743C4.6791 8.40287 4.6791 8.93051 4.35367 9.25594L3.47152 10.1381C3.21117 10.3984 2.78906 10.3984 2.52871 10.1381C2.26836 9.87774 2.26836 9.45563 2.52871 9.19528L3.0573 8.66669L2.43108 8.04046C2.04055 7.64993 2.04055 7.01677 2.43108 6.62625L2.86465 6.19267C3.18578 5.87154 3.60664 5.66927 4.05801 5.61911L6.36073 5.36326L8.47152 3.25247C8.84659 2.8774 9.3553 2.66669 9.88573 2.66669H12.0001C12.7365 2.66669 13.3334 3.26364 13.3334 4.00002V6.1144C13.3334 6.64483 13.1227 7.15354 12.7477 7.52862L10.6369 9.6394L10.381 11.9421C10.3309 12.3935 10.1286 12.8143 9.80746 13.1355L9.37389 13.5691C8.98336 13.9596 8.3502 13.9596 7.95967 13.5691L7.33345 12.9428L6.80485 13.4714C6.5445 13.7318 6.12239 13.7318 5.86204 13.4714C5.60169 13.2111 5.60169 12.789 5.86204 12.5286L6.74419 11.6465C7.06963 11.321 7.59726 11.321 7.9227 11.6465L8.66678 12.3905L8.86466 12.1927C8.9717 12.0856 9.03912 11.9453 9.05584 11.7949L9.36335 9.02731L11.8049 6.58581C11.9299 6.46078 12.0001 6.29121 12.0001 6.1144V4.00002H9.88573ZM5.80486 10.1953C6.06521 10.4556 6.06521 10.8777 5.80486 11.1381L3.80486 13.1381C3.54451 13.3984 3.1224 13.3984 2.86205 13.1381C2.6017 12.8777 2.6017 12.4556 2.86205 12.1953L4.86205 10.1953C5.1224 9.93493 5.54451 9.93493 5.80486 10.1953ZM10.0001 6.66669C10.3683 6.66669 10.6668 6.36821 10.6668 6.00002C10.6668 5.63183 10.3683 5.33335 10.0001 5.33335C9.63193 5.33335 9.33346 5.63183 9.33346 6.00002C9.33346 6.36821 9.63193 6.66669 10.0001 6.66669Z",
14
+ fill: "#0C66E4"
15
+ }));
16
+ export const ProjectsIcon = props => /*#__PURE__*/React.createElement(Icon, _extends({
17
+ glyph: ProjectsGlyph
18
+ }, props));
@@ -1,6 +1,6 @@
1
1
  import { Stack, xcss } from '@atlaskit/primitives';
2
2
  import React, { useMemo } from 'react';
3
- import { SmartLinkSize } from '../../../../../constants';
3
+ import { ActionName, SmartLinkSize } from '../../../../../constants';
4
4
  import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
5
5
  import * as Actions from '../../actions';
6
6
  import { getPrimitivesPaddingSpaceBySize } from '../../utils';
@@ -10,11 +10,22 @@ const ignoreContainerPaddingStyles = xcss({
10
10
  marginLeft: 'calc(var(--container-gap-left) * -1)',
11
11
  marginRight: 'calc(var(--container-gap-right) * -1)'
12
12
  });
13
+ const DEFAULT_SORT_ORDER = [ActionName.PreviewAction, ActionName.CopyLinkAction];
14
+ const sort = (a, b) => {
15
+ let idxA = DEFAULT_SORT_ORDER.indexOf(a);
16
+ let idxB = DEFAULT_SORT_ORDER.indexOf(b);
17
+ if (idxA === -1) {
18
+ idxA = DEFAULT_SORT_ORDER.length;
19
+ }
20
+ if (idxB === -1) {
21
+ idxB = DEFAULT_SORT_ORDER.length;
22
+ }
23
+ return idxA - idxB;
24
+ };
13
25
  const ActionBlock = ({
14
26
  blockRef,
15
27
  onClick: onClickCallback,
16
28
  size,
17
- sort,
18
29
  spaceInline,
19
30
  testId = 'smart-block-action'
20
31
  }) => {
@@ -26,9 +37,7 @@ const ActionBlock = ({
26
37
  return;
27
38
  }
28
39
  const arr = Object.keys(context.actions);
29
- if (sort) {
30
- arr.sort(sort);
31
- }
40
+ arr.sort(sort);
32
41
  return arr.map(name => {
33
42
  const Action = name in Actions ? Actions[name] : undefined;
34
43
  return Action ? /*#__PURE__*/React.createElement(Action, {
@@ -42,7 +51,7 @@ const ActionBlock = ({
42
51
  })
43
52
  }) : null;
44
53
  });
45
- }, [context === null || context === void 0 ? void 0 : context.actions, onClickCallback, padding, size, sort, spaceInline]);
54
+ }, [context === null || context === void 0 ? void 0 : context.actions, onClickCallback, padding, size, spaceInline]);
46
55
  return actions ? /*#__PURE__*/React.createElement(Stack, {
47
56
  grow: "fill",
48
57
  xcss: ignoreContainerPaddingStyles,
@@ -5,6 +5,7 @@ import { FormattedMessage } from 'react-intl-next';
5
5
  import { SmartLinkSize } from '../../../constants';
6
6
  import Icon from './elements/icon';
7
7
  import { openEmbedModal } from '../../EmbedModal/utils';
8
+ import Loadable from 'react-loadable';
8
9
  export const sizeToButtonSpacing = {
9
10
  [SmartLinkSize.Small]: 'none',
10
11
  [SmartLinkSize.Medium]: 'compact',
@@ -67,6 +68,12 @@ export const getIconWidth = size => {
67
68
  return '.75rem';
68
69
  }
69
70
  };
71
+ export const importIcon = importFn => {
72
+ return Loadable({
73
+ loader: () => importFn().then(module => module.default),
74
+ loading: () => null
75
+ }); // Because we're using dynamic loading here, TS will not be able to infer the type.
76
+ };
70
77
  export const getLinkLineHeight = size => {
71
78
  switch (size) {
72
79
  case SmartLinkSize.XLarge:
@@ -7,7 +7,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
7
7
  import LinkWarningModal from './LinkWarningModal';
8
8
  const PACKAGE_DATA = {
9
9
  packageName: "@atlaskit/smart-card",
10
- packageVersion: "26.56.3",
10
+ packageVersion: "26.56.5",
11
11
  componentName: 'linkUrl'
12
12
  };
13
13
  const Link = withLinkClickedEvent('a');
@@ -1,4 +1,4 @@
1
- import { extractLink } from '@atlaskit/link-extractors';
1
+ import { extractLink, extractType } from '@atlaskit/link-extractors';
2
2
  import { SmartLinkActionType } from '@atlaskit/linking-types';
3
3
  import { getExtensionKey } from '../../../state/helpers';
4
4
  import extractServerAction from '../extract-server-action';
@@ -12,6 +12,8 @@ var extractFollowAction = function extractFollowAction(response, actionOptions,
12
12
  var extensionKey = getExtensionKey(response);
13
13
  var data = response === null || response === void 0 ? void 0 : response.data;
14
14
  var actions = extractServerAction(data);
15
+ var type = extractType(data);
16
+ var isProject = type === null || type === void 0 ? void 0 : type.includes('atlassian:Project');
15
17
  if (!extensionKey || actions.length === 0) {
16
18
  return;
17
19
  }
@@ -41,7 +43,8 @@ var extractFollowAction = function extractFollowAction(response, actionOptions,
41
43
  providerKey: extensionKey,
42
44
  reload: reload
43
45
  },
44
- value: actionType === SmartLinkActionType.FollowEntityAction
46
+ value: actionType === SmartLinkActionType.FollowEntityAction,
47
+ isProject: isProject
45
48
  };
46
49
  };
47
50
  export default extractFollowAction;
@@ -4,8 +4,9 @@ import { extractDownloadAction } from './extract-download-action';
4
4
  import { extractPreviewAction } from './extract-preview-action';
5
5
  import extractFollowAction from './extract-follow-action';
6
6
  import { extractCopyLinkAction } from './extract-copy-link-action';
7
- var extractActions = function extractActions(response, data, actionOptions, id) {
7
+ var extractActions = function extractActions(response, actionOptions, id) {
8
8
  var _action;
9
+ var data = response.data;
9
10
  var action = (_action = {}, _defineProperty(_action, ActionName.CopyLinkAction, extractCopyLinkAction(data, actionOptions)), _defineProperty(_action, ActionName.DownloadAction, extractDownloadAction(data, actionOptions)), _defineProperty(_action, ActionName.FollowAction, extractFollowAction(response, actionOptions, id)), _defineProperty(_action, ActionName.PreviewAction, extractPreviewAction(response, actionOptions)), _action);
10
11
  return Object.values(action).some(function (value) {
11
12
  return Boolean(value);
@@ -22,7 +22,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
22
22
  var data = response.data;
23
23
  var url = extractLink(data);
24
24
  return {
25
- actions: extractActions(response, data, actionOptions, id),
25
+ actions: extractActions(response, actionOptions, id),
26
26
  assignedToGroup: extractPersonAssignedToAsArray(data),
27
27
  attachmentCount: extractAttachmentCount(data),
28
28
  authorGroup: extractPersonCreatedBy(data),
@@ -205,6 +205,26 @@ export var messages = defineMessages({
205
205
  defaultMessage: 'Follow',
206
206
  description: 'Click to follow a project.'
207
207
  },
208
+ follow_project_description: {
209
+ id: 'fabric.linking.follow_project_description.nonfinal',
210
+ defaultMessage: 'Follow to get notifications on this project',
211
+ description: 'Description on what Follow does'
212
+ },
213
+ follow_project: {
214
+ id: 'fabric.linking.follow_project.nonfinal',
215
+ defaultMessage: 'Follow project',
216
+ description: 'Click to follow a project.'
217
+ },
218
+ follow_goal_description: {
219
+ id: 'fabric.linking.follow_goal_description.nonfinal',
220
+ defaultMessage: 'Follow this goal to get notifications on updates',
221
+ description: 'Description on what Follow does'
222
+ },
223
+ follow_goal: {
224
+ id: 'fabric.linking.follow_goal.nonfinal',
225
+ defaultMessage: 'Follow goal',
226
+ description: 'Click to follow a project.'
227
+ },
208
228
  go_back: {
209
229
  id: 'fabric.linking.go_back',
210
230
  defaultMessage: 'Go back',
@@ -465,6 +485,26 @@ export var messages = defineMessages({
465
485
  defaultMessage: 'Unfollow',
466
486
  description: 'Click to unfollow a project.'
467
487
  },
488
+ unfollow_project_description: {
489
+ id: 'fabric.linking.unfollow_project_description.nonfinal',
490
+ defaultMessage: 'Unfollow to stop receiving project notifications',
491
+ description: 'Description on what Unfollow does'
492
+ },
493
+ unfollow_project: {
494
+ id: 'fabric.linking.unfollow_project.nonfinal',
495
+ defaultMessage: 'Unfollow project',
496
+ description: 'Click to unfollow a project.'
497
+ },
498
+ unfollow_goal_description: {
499
+ id: 'fabric.linking.unfollow_goal_description.nonfinal',
500
+ defaultMessage: 'Unfollow to stop receiving notifications for this goal',
501
+ description: 'Description on what Unfollow does'
502
+ },
503
+ unfollow_goal: {
504
+ id: 'fabric.linking.unfollow_goal.nonfinal',
505
+ defaultMessage: 'Unfollow goal',
506
+ description: 'Click to unfollow a project.'
507
+ },
468
508
  unlink_account: {
469
509
  id: 'fabric.linking.unlink_account',
470
510
  defaultMessage: 'Unlink Account',
@@ -10,109 +10,99 @@ export function readStream(_x) {
10
10
  }
11
11
  function _readStream() {
12
12
  _readStream = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(response) {
13
- var reader, doneStreaming, chunkBuffer, chunkTypeErrorMessage, _yield$_awaitAsyncGen, value, done, processedChunks, _iterator, _step, chunk, jsonChunk, error;
13
+ var reader, doneStreaming, chunkBuffer, _yield$_awaitAsyncGen, value, done, processedChunks, _iterator, _step, chunk, jsonChunk, error;
14
14
  return _regeneratorRuntime.wrap(function _callee$(_context) {
15
15
  while (1) switch (_context.prev = _context.next) {
16
16
  case 0:
17
17
  reader = getBufferReader(response);
18
18
  doneStreaming = false;
19
19
  chunkBuffer = '';
20
- chunkTypeErrorMessage = 'jsonChunkType error';
21
- case 4:
22
- _context.prev = 4;
23
- _context.next = 7;
20
+ case 3:
21
+ _context.prev = 3;
22
+ _context.next = 6;
24
23
  return _awaitAsyncGenerator(reader.read());
25
- case 7:
24
+ case 6:
26
25
  _yield$_awaitAsyncGen = _context.sent;
27
26
  value = _yield$_awaitAsyncGen.value;
28
27
  done = _yield$_awaitAsyncGen.done;
29
28
  doneStreaming = done;
30
29
  if (!value) {
31
- _context.next = 42;
30
+ _context.next = 38;
32
31
  break;
33
32
  }
34
33
  processedChunks = "".concat(chunkBuffer).concat(value).split('\n'); // assumes that all JSON chunks are separated by a new-line;
35
34
  chunkBuffer = '';
36
35
  _iterator = _createForOfIteratorHelper(processedChunks);
37
- _context.prev = 15;
36
+ _context.prev = 14;
38
37
  _iterator.s();
39
- case 17:
38
+ case 16:
40
39
  if ((_step = _iterator.n()).done) {
41
- _context.next = 34;
40
+ _context.next = 30;
42
41
  break;
43
42
  }
44
43
  chunk = _step.value;
45
- _context.prev = 19;
44
+ _context.prev = 18;
46
45
  jsonChunk = JSON.parse(chunk);
47
- if (!(jsonChunk.type === 'ERROR')) {
48
- _context.next = 23;
49
- break;
46
+ if (jsonChunk.type === 'ERROR') {
47
+ reader.cancel();
50
48
  }
51
- throw new Error(chunkTypeErrorMessage);
52
- case 23:
53
- _context.next = 25;
49
+ _context.next = 23;
54
50
  return jsonChunk;
55
- case 25:
56
- _context.next = 32;
51
+ case 23:
52
+ _context.next = 28;
57
53
  break;
58
- case 27:
59
- _context.prev = 27;
60
- _context.t0 = _context["catch"](19);
61
- if (!(_context.t0 instanceof Error && _context.t0.message === chunkTypeErrorMessage)) {
62
- _context.next = 31;
63
- break;
64
- }
65
- throw _context.t0;
66
- case 31:
54
+ case 25:
55
+ _context.prev = 25;
56
+ _context.t0 = _context["catch"](18);
67
57
  // the chunk may be incomplete, so we'll save it for the next iteration.
68
58
  chunkBuffer = chunk;
69
- case 32:
70
- _context.next = 17;
59
+ case 28:
60
+ _context.next = 16;
71
61
  break;
72
- case 34:
73
- _context.next = 39;
62
+ case 30:
63
+ _context.next = 35;
74
64
  break;
75
- case 36:
76
- _context.prev = 36;
77
- _context.t1 = _context["catch"](15);
65
+ case 32:
66
+ _context.prev = 32;
67
+ _context.t1 = _context["catch"](14);
78
68
  _iterator.e(_context.t1);
79
- case 39:
80
- _context.prev = 39;
69
+ case 35:
70
+ _context.prev = 35;
81
71
  _iterator.f();
82
- return _context.finish(39);
83
- case 42:
84
- _context.next = 52;
72
+ return _context.finish(35);
73
+ case 38:
74
+ _context.next = 48;
85
75
  break;
86
- case 44:
87
- _context.prev = 44;
88
- _context.t2 = _context["catch"](4);
76
+ case 40:
77
+ _context.prev = 40;
78
+ _context.t2 = _context["catch"](3);
89
79
  if (!(_context.t2 instanceof DOMException && _context.t2.name === 'AbortError')) {
90
- _context.next = 50;
80
+ _context.next = 46;
91
81
  break;
92
82
  }
93
83
  doneStreaming = true;
94
- _context.next = 52;
84
+ _context.next = 48;
95
85
  break;
96
- case 50:
86
+ case 46:
97
87
  reader.cancel();
98
88
  throw _context.t2;
99
- case 52:
89
+ case 48:
100
90
  if (!doneStreaming) {
101
- _context.next = 4;
91
+ _context.next = 3;
102
92
  break;
103
93
  }
104
- case 53:
94
+ case 49:
105
95
  if (!chunkBuffer) {
106
- _context.next = 56;
96
+ _context.next = 52;
107
97
  break;
108
98
  }
109
99
  error = new Error("Not all the data was processed: ".concat(chunkBuffer));
110
100
  throw error;
111
- case 56:
101
+ case 52:
112
102
  case "end":
113
103
  return _context.stop();
114
104
  }
115
- }, _callee, null, [[4, 44], [15, 36, 39, 42], [19, 27]]);
105
+ }, _callee, null, [[3, 40], [14, 32, 35, 38], [18, 25]]);
116
106
  }));
117
107
  return _readStream.apply(this, arguments);
118
108
  }
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
15
15
  export var context = {
16
16
  componentName: 'smart-cards',
17
17
  packageName: "@atlaskit/smart-card",
18
- packageVersion: "26.56.3"
18
+ packageVersion: "26.56.5"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -0,0 +1,22 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import Icon from '@atlaskit/icon';
3
+ import React from 'react';
4
+ var GoalGlyph = function GoalGlyph(props) {
5
+ return /*#__PURE__*/React.createElement("svg", {
6
+ xmlns: "http://www.w3.org/2000/svg",
7
+ width: "16",
8
+ height: "16",
9
+ viewBox: "0 0 16 16",
10
+ fill: "none"
11
+ }, /*#__PURE__*/React.createElement("path", {
12
+ fillRule: "evenodd",
13
+ clipRule: "evenodd",
14
+ d: "M12.6667 8C12.6667 10.5773 10.5773 12.6667 8 12.6667C5.42267 12.6667 3.33333 10.5773 3.33333 8C3.33333 5.42267 5.42267 3.33333 8 3.33333C10.5773 3.33333 12.6667 5.42267 12.6667 8ZM14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8ZM9.33333 8C9.33333 8.73638 8.73638 9.33333 8 9.33333C7.26362 9.33333 6.66667 8.73638 6.66667 8C6.66667 7.26362 7.26362 6.66667 8 6.66667C8.73638 6.66667 9.33333 7.26362 9.33333 8ZM10.6667 8C10.6667 9.47276 9.47276 10.6667 8 10.6667C6.52724 10.6667 5.33333 9.47276 5.33333 8C5.33333 6.52724 6.52724 5.33333 8 5.33333C9.47276 5.33333 10.6667 6.52724 10.6667 8Z",
15
+ fill: "#0C66E4"
16
+ }));
17
+ };
18
+ export var GoalIcon = function GoalIcon(props) {
19
+ return /*#__PURE__*/React.createElement(Icon, _extends({
20
+ glyph: GoalGlyph
21
+ }, props));
22
+ };
@@ -9,6 +9,32 @@ import { messages } from '../../../../../messages';
9
9
  import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
10
10
  import ServerAction from '../action/server-action';
11
11
  import UnfollowIcon from './unfollow-icon';
12
+ import { importIcon } from '../../utils';
13
+ var importIconMapper = {
14
+ goal: function goal() {
15
+ return import( /* webpackChunkName: "glyphGoal" */'./goal-icon').then(function (_ref) {
16
+ var GoalIcon = _ref.GoalIcon;
17
+ return {
18
+ default: GoalIcon
19
+ };
20
+ });
21
+ },
22
+ projects: function projects() {
23
+ return import( /* webpackChunkName: "glyphProjects" */'./projects-icon').then(function (_ref2) {
24
+ var ProjectsIcon = _ref2.ProjectsIcon;
25
+ return {
26
+ default: ProjectsIcon
27
+ };
28
+ });
29
+ }
30
+ };
31
+ var getIcon = function getIcon(stackIconType) {
32
+ var importFn = importIconMapper[stackIconType];
33
+ if (!importFn) {
34
+ return null;
35
+ }
36
+ return importIcon(importFn);
37
+ };
12
38
  var FollowAction = function FollowAction(props) {
13
39
  var _context$actions, _context$actions2;
14
40
  var context = useFlexibleUiContext();
@@ -18,17 +44,34 @@ var FollowAction = function FollowAction(props) {
18
44
  var _context$actions$Acti = context === null || context === void 0 || (_context$actions2 = context.actions) === null || _context$actions2 === void 0 ? void 0 : _context$actions2[ActionName.FollowAction],
19
45
  value = _context$actions$Acti.value,
20
46
  data = _objectWithoutProperties(_context$actions$Acti, _excluded);
47
+ var isStackItem = props.as === 'stack-item';
48
+ var isProject = data.isProject;
21
49
  var message = value ? messages.follow : messages.unfollow;
50
+ var projectMessage = value ? messages.follow_project : messages.unfollow_project;
51
+ var goalMessage = value ? messages.follow_goal : messages.unfollow_goal;
52
+ var stackMessage = isProject ? projectMessage : goalMessage;
53
+ var label = isStackItem ? stackMessage : message;
54
+ var projectTooltipMessage = value ? messages.follow_project_description : messages.unfollow_project_description;
55
+ var goalTooltipMessage = value ? messages.follow_goal_description : messages.unfollow_goal_description;
56
+ var stackTooltipMessage = isProject ? projectTooltipMessage : goalTooltipMessage;
57
+ var tooltipMessage = isStackItem ? stackTooltipMessage : message;
22
58
  var icon = value ? /*#__PURE__*/React.createElement(InviteTeamIcon, {
23
59
  label: "Follow"
24
60
  }) : /*#__PURE__*/React.createElement(UnfollowIcon, {
25
61
  label: "Unfollow"
26
62
  });
63
+ var stackIconType = isProject ? 'projects' : 'goal';
64
+ var ImportedIcon = getIcon(stackIconType);
65
+ var stackIcon = /*#__PURE__*/React.createElement(ImportedIcon, {
66
+ label: "Follow",
67
+ testId: "smart-action-follow-action-".concat(stackIconType, "-icon")
68
+ });
69
+ var followIcon = isStackItem ? stackIcon : icon;
27
70
  return /*#__PURE__*/React.createElement(ServerAction, _extends({
28
- content: /*#__PURE__*/React.createElement(FormattedMessage, message),
29
- icon: icon,
71
+ content: /*#__PURE__*/React.createElement(FormattedMessage, label),
72
+ icon: followIcon,
30
73
  testId: "smart-action-follow-action",
31
- tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, message)
74
+ tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, tooltipMessage)
32
75
  }, data, props));
33
76
  };
34
77
  export default FollowAction;
@@ -0,0 +1,22 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import Icon from '@atlaskit/icon';
3
+ import React from 'react';
4
+ var ProjectsGlyph = function ProjectsGlyph(props) {
5
+ return /*#__PURE__*/React.createElement("svg", {
6
+ xmlns: "http://www.w3.org/2000/svg",
7
+ width: "16",
8
+ height: "16",
9
+ viewBox: "0 0 16 16",
10
+ fill: "none"
11
+ }, /*#__PURE__*/React.createElement("path", {
12
+ fillRule: "evenodd",
13
+ clipRule: "evenodd",
14
+ d: "M9.88573 4.00002C9.70892 4.00002 9.53935 4.07026 9.41433 4.19528L6.97282 6.63678L4.20525 6.94429C4.05479 6.96101 3.91451 7.02844 3.80746 7.13548L3.60959 7.33335L4.35367 8.07743C4.6791 8.40287 4.6791 8.93051 4.35367 9.25594L3.47152 10.1381C3.21117 10.3984 2.78906 10.3984 2.52871 10.1381C2.26836 9.87774 2.26836 9.45563 2.52871 9.19528L3.0573 8.66669L2.43108 8.04046C2.04055 7.64993 2.04055 7.01677 2.43108 6.62625L2.86465 6.19267C3.18578 5.87154 3.60664 5.66927 4.05801 5.61911L6.36073 5.36326L8.47152 3.25247C8.84659 2.8774 9.3553 2.66669 9.88573 2.66669H12.0001C12.7365 2.66669 13.3334 3.26364 13.3334 4.00002V6.1144C13.3334 6.64483 13.1227 7.15354 12.7477 7.52862L10.6369 9.6394L10.381 11.9421C10.3309 12.3935 10.1286 12.8143 9.80746 13.1355L9.37389 13.5691C8.98336 13.9596 8.3502 13.9596 7.95967 13.5691L7.33345 12.9428L6.80485 13.4714C6.5445 13.7318 6.12239 13.7318 5.86204 13.4714C5.60169 13.2111 5.60169 12.789 5.86204 12.5286L6.74419 11.6465C7.06963 11.321 7.59726 11.321 7.9227 11.6465L8.66678 12.3905L8.86466 12.1927C8.9717 12.0856 9.03912 11.9453 9.05584 11.7949L9.36335 9.02731L11.8049 6.58581C11.9299 6.46078 12.0001 6.29121 12.0001 6.1144V4.00002H9.88573ZM5.80486 10.1953C6.06521 10.4556 6.06521 10.8777 5.80486 11.1381L3.80486 13.1381C3.54451 13.3984 3.1224 13.3984 2.86205 13.1381C2.6017 12.8777 2.6017 12.4556 2.86205 12.1953L4.86205 10.1953C5.1224 9.93493 5.54451 9.93493 5.80486 10.1953ZM10.0001 6.66669C10.3683 6.66669 10.6668 6.36821 10.6668 6.00002C10.6668 5.63183 10.3683 5.33335 10.0001 5.33335C9.63193 5.33335 9.33346 5.63183 9.33346 6.00002C9.33346 6.36821 9.63193 6.66669 10.0001 6.66669Z",
15
+ fill: "#0C66E4"
16
+ }));
17
+ };
18
+ export var ProjectsIcon = function ProjectsIcon(props) {
19
+ return /*#__PURE__*/React.createElement(Icon, _extends({
20
+ glyph: ProjectsGlyph
21
+ }, props));
22
+ };
@@ -1,6 +1,6 @@
1
1
  import { Stack, xcss } from '@atlaskit/primitives';
2
2
  import React, { useMemo } from 'react';
3
- import { SmartLinkSize } from '../../../../../constants';
3
+ import { ActionName, SmartLinkSize } from '../../../../../constants';
4
4
  import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
5
5
  import * as Actions from '../../actions';
6
6
  import { getPrimitivesPaddingSpaceBySize } from '../../utils';
@@ -10,11 +10,22 @@ var ignoreContainerPaddingStyles = xcss({
10
10
  marginLeft: 'calc(var(--container-gap-left) * -1)',
11
11
  marginRight: 'calc(var(--container-gap-right) * -1)'
12
12
  });
13
+ var DEFAULT_SORT_ORDER = [ActionName.PreviewAction, ActionName.CopyLinkAction];
14
+ var sort = function sort(a, b) {
15
+ var idxA = DEFAULT_SORT_ORDER.indexOf(a);
16
+ var idxB = DEFAULT_SORT_ORDER.indexOf(b);
17
+ if (idxA === -1) {
18
+ idxA = DEFAULT_SORT_ORDER.length;
19
+ }
20
+ if (idxB === -1) {
21
+ idxB = DEFAULT_SORT_ORDER.length;
22
+ }
23
+ return idxA - idxB;
24
+ };
13
25
  var ActionBlock = function ActionBlock(_ref) {
14
26
  var blockRef = _ref.blockRef,
15
27
  onClickCallback = _ref.onClick,
16
28
  size = _ref.size,
17
- sort = _ref.sort,
18
29
  spaceInline = _ref.spaceInline,
19
30
  _ref$testId = _ref.testId,
20
31
  testId = _ref$testId === void 0 ? 'smart-block-action' : _ref$testId;
@@ -26,9 +37,7 @@ var ActionBlock = function ActionBlock(_ref) {
26
37
  return;
27
38
  }
28
39
  var arr = Object.keys(context.actions);
29
- if (sort) {
30
- arr.sort(sort);
31
- }
40
+ arr.sort(sort);
32
41
  return arr.map(function (name) {
33
42
  var Action = name in Actions ? Actions[name] : undefined;
34
43
  return Action ? /*#__PURE__*/React.createElement(Action, {
@@ -44,7 +53,7 @@ var ActionBlock = function ActionBlock(_ref) {
44
53
  })
45
54
  }) : null;
46
55
  });
47
- }, [context === null || context === void 0 ? void 0 : context.actions, onClickCallback, padding, size, sort, spaceInline]);
56
+ }, [context === null || context === void 0 ? void 0 : context.actions, onClickCallback, padding, size, spaceInline]);
48
57
  return actions ? /*#__PURE__*/React.createElement(Stack, {
49
58
  grow: "fill",
50
59
  xcss: ignoreContainerPaddingStyles,
@@ -12,6 +12,7 @@ import { FormattedMessage } from 'react-intl-next';
12
12
  import { SmartLinkSize } from '../../../constants';
13
13
  import Icon from './elements/icon';
14
14
  import { openEmbedModal } from '../../EmbedModal/utils';
15
+ import Loadable from 'react-loadable';
15
16
  export var sizeToButtonSpacing = (_sizeToButtonSpacing = {}, _defineProperty(_sizeToButtonSpacing, SmartLinkSize.Small, 'none'), _defineProperty(_sizeToButtonSpacing, SmartLinkSize.Medium, 'compact'), _defineProperty(_sizeToButtonSpacing, SmartLinkSize.Large, 'compact'), _defineProperty(_sizeToButtonSpacing, SmartLinkSize.XLarge, 'default'), _sizeToButtonSpacing);
16
17
  export var getFormattedMessage = function getFormattedMessage(message) {
17
18
  if (message) {
@@ -56,6 +57,18 @@ export var getIconWidth = function getIconWidth(size) {
56
57
  return '.75rem';
57
58
  }
58
59
  };
60
+ export var importIcon = function importIcon(importFn) {
61
+ return Loadable({
62
+ loader: function loader() {
63
+ return importFn().then(function (module) {
64
+ return module.default;
65
+ });
66
+ },
67
+ loading: function loading() {
68
+ return null;
69
+ }
70
+ }); // Because we're using dynamic loading here, TS will not be able to infer the type.
71
+ };
59
72
  export var getLinkLineHeight = function getLinkLineHeight(size) {
60
73
  switch (size) {
61
74
  case SmartLinkSize.XLarge: