@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 26.56.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#90940](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/90940) [`c74e41ce62aa`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c74e41ce62aa) - [ux] Updating FollowAction to support ActionBlock
8
+
9
+ ## 26.56.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [#92048](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/92048) [`2780e081d2c9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2780e081d2c9) - ActionBlock: Sort actions
14
+ - [#92399](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/92399) [`e0c0acd16c19`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e0c0acd16c19) - Fix for the AI Summary custom errors handling
15
+
3
16
  ## 26.56.3
4
17
 
5
18
  ### Patch Changes
@@ -19,6 +19,8 @@ var extractFollowAction = function extractFollowAction(response, actionOptions,
19
19
  var extensionKey = (0, _helpers.getExtensionKey)(response);
20
20
  var data = response === null || response === void 0 ? void 0 : response.data;
21
21
  var actions = (0, _extractServerAction.default)(data);
22
+ var type = (0, _linkExtractors.extractType)(data);
23
+ var isProject = type === null || type === void 0 ? void 0 : type.includes('atlassian:Project');
22
24
  if (!extensionKey || actions.length === 0) {
23
25
  return;
24
26
  }
@@ -48,7 +50,8 @@ var extractFollowAction = function extractFollowAction(response, actionOptions,
48
50
  providerKey: extensionKey,
49
51
  reload: reload
50
52
  },
51
- value: actionType === _linkingTypes.SmartLinkActionType.FollowEntityAction
53
+ value: actionType === _linkingTypes.SmartLinkActionType.FollowEntityAction,
54
+ isProject: isProject
52
55
  };
53
56
  };
54
57
  var _default = exports.default = extractFollowAction;
@@ -11,8 +11,9 @@ var _extractDownloadAction = require("./extract-download-action");
11
11
  var _extractPreviewAction = require("./extract-preview-action");
12
12
  var _extractFollowAction = _interopRequireDefault(require("./extract-follow-action"));
13
13
  var _extractCopyLinkAction = require("./extract-copy-link-action");
14
- var extractActions = function extractActions(response, data, actionOptions, id) {
14
+ var extractActions = function extractActions(response, actionOptions, id) {
15
15
  var _action;
16
+ var data = response.data;
16
17
  var action = (_action = {}, (0, _defineProperty2.default)(_action, _constants.ActionName.CopyLinkAction, (0, _extractCopyLinkAction.extractCopyLinkAction)(data, actionOptions)), (0, _defineProperty2.default)(_action, _constants.ActionName.DownloadAction, (0, _extractDownloadAction.extractDownloadAction)(data, actionOptions)), (0, _defineProperty2.default)(_action, _constants.ActionName.FollowAction, (0, _extractFollowAction.default)(response, actionOptions, id)), (0, _defineProperty2.default)(_action, _constants.ActionName.PreviewAction, (0, _extractPreviewAction.extractPreviewAction)(response, actionOptions)), _action);
17
18
  return Object.values(action).some(function (value) {
18
19
  return Boolean(value);
@@ -29,7 +29,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
29
29
  var data = response.data;
30
30
  var url = (0, _linkExtractors.extractLink)(data);
31
31
  return {
32
- actions: (0, _actions.default)(response, data, actionOptions, id),
32
+ actions: (0, _actions.default)(response, actionOptions, id),
33
33
  assignedToGroup: (0, _utils.extractPersonAssignedToAsArray)(data),
34
34
  attachmentCount: (0, _utils.extractAttachmentCount)(data),
35
35
  authorGroup: (0, _linkExtractors.extractPersonCreatedBy)(data),
@@ -211,6 +211,26 @@ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
211
211
  defaultMessage: 'Follow',
212
212
  description: 'Click to follow a project.'
213
213
  },
214
+ follow_project_description: {
215
+ id: 'fabric.linking.follow_project_description.nonfinal',
216
+ defaultMessage: 'Follow to get notifications on this project',
217
+ description: 'Description on what Follow does'
218
+ },
219
+ follow_project: {
220
+ id: 'fabric.linking.follow_project.nonfinal',
221
+ defaultMessage: 'Follow project',
222
+ description: 'Click to follow a project.'
223
+ },
224
+ follow_goal_description: {
225
+ id: 'fabric.linking.follow_goal_description.nonfinal',
226
+ defaultMessage: 'Follow this goal to get notifications on updates',
227
+ description: 'Description on what Follow does'
228
+ },
229
+ follow_goal: {
230
+ id: 'fabric.linking.follow_goal.nonfinal',
231
+ defaultMessage: 'Follow goal',
232
+ description: 'Click to follow a project.'
233
+ },
214
234
  go_back: {
215
235
  id: 'fabric.linking.go_back',
216
236
  defaultMessage: 'Go back',
@@ -471,6 +491,26 @@ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
471
491
  defaultMessage: 'Unfollow',
472
492
  description: 'Click to unfollow a project.'
473
493
  },
494
+ unfollow_project_description: {
495
+ id: 'fabric.linking.unfollow_project_description.nonfinal',
496
+ defaultMessage: 'Unfollow to stop receiving project notifications',
497
+ description: 'Description on what Unfollow does'
498
+ },
499
+ unfollow_project: {
500
+ id: 'fabric.linking.unfollow_project.nonfinal',
501
+ defaultMessage: 'Unfollow project',
502
+ description: 'Click to unfollow a project.'
503
+ },
504
+ unfollow_goal_description: {
505
+ id: 'fabric.linking.unfollow_goal_description.nonfinal',
506
+ defaultMessage: 'Unfollow to stop receiving notifications for this goal',
507
+ description: 'Description on what Unfollow does'
508
+ },
509
+ unfollow_goal: {
510
+ id: 'fabric.linking.unfollow_goal.nonfinal',
511
+ defaultMessage: 'Unfollow goal',
512
+ description: 'Click to unfollow a project.'
513
+ },
474
514
  unlink_account: {
475
515
  id: 'fabric.linking.unlink_account',
476
516
  defaultMessage: 'Unlink Account',
@@ -17,109 +17,99 @@ function readStream(_x) {
17
17
  }
18
18
  function _readStream() {
19
19
  _readStream = (0, _wrapAsyncGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(response) {
20
- var reader, doneStreaming, chunkBuffer, chunkTypeErrorMessage, _yield$_awaitAsyncGen, value, done, processedChunks, _iterator, _step, chunk, jsonChunk, error;
20
+ var reader, doneStreaming, chunkBuffer, _yield$_awaitAsyncGen, value, done, processedChunks, _iterator, _step, chunk, jsonChunk, error;
21
21
  return _regenerator.default.wrap(function _callee$(_context) {
22
22
  while (1) switch (_context.prev = _context.next) {
23
23
  case 0:
24
24
  reader = (0, _utils.getBufferReader)(response);
25
25
  doneStreaming = false;
26
26
  chunkBuffer = '';
27
- chunkTypeErrorMessage = 'jsonChunkType error';
28
- case 4:
29
- _context.prev = 4;
30
- _context.next = 7;
27
+ case 3:
28
+ _context.prev = 3;
29
+ _context.next = 6;
31
30
  return (0, _awaitAsyncGenerator2.default)(reader.read());
32
- case 7:
31
+ case 6:
33
32
  _yield$_awaitAsyncGen = _context.sent;
34
33
  value = _yield$_awaitAsyncGen.value;
35
34
  done = _yield$_awaitAsyncGen.done;
36
35
  doneStreaming = done;
37
36
  if (!value) {
38
- _context.next = 42;
37
+ _context.next = 38;
39
38
  break;
40
39
  }
41
40
  processedChunks = "".concat(chunkBuffer).concat(value).split('\n'); // assumes that all JSON chunks are separated by a new-line;
42
41
  chunkBuffer = '';
43
42
  _iterator = _createForOfIteratorHelper(processedChunks);
44
- _context.prev = 15;
43
+ _context.prev = 14;
45
44
  _iterator.s();
46
- case 17:
45
+ case 16:
47
46
  if ((_step = _iterator.n()).done) {
48
- _context.next = 34;
47
+ _context.next = 30;
49
48
  break;
50
49
  }
51
50
  chunk = _step.value;
52
- _context.prev = 19;
51
+ _context.prev = 18;
53
52
  jsonChunk = JSON.parse(chunk);
54
- if (!(jsonChunk.type === 'ERROR')) {
55
- _context.next = 23;
56
- break;
53
+ if (jsonChunk.type === 'ERROR') {
54
+ reader.cancel();
57
55
  }
58
- throw new Error(chunkTypeErrorMessage);
59
- case 23:
60
- _context.next = 25;
56
+ _context.next = 23;
61
57
  return jsonChunk;
62
- case 25:
63
- _context.next = 32;
58
+ case 23:
59
+ _context.next = 28;
64
60
  break;
65
- case 27:
66
- _context.prev = 27;
67
- _context.t0 = _context["catch"](19);
68
- if (!(_context.t0 instanceof Error && _context.t0.message === chunkTypeErrorMessage)) {
69
- _context.next = 31;
70
- break;
71
- }
72
- throw _context.t0;
73
- case 31:
61
+ case 25:
62
+ _context.prev = 25;
63
+ _context.t0 = _context["catch"](18);
74
64
  // the chunk may be incomplete, so we'll save it for the next iteration.
75
65
  chunkBuffer = chunk;
76
- case 32:
77
- _context.next = 17;
66
+ case 28:
67
+ _context.next = 16;
78
68
  break;
79
- case 34:
80
- _context.next = 39;
69
+ case 30:
70
+ _context.next = 35;
81
71
  break;
82
- case 36:
83
- _context.prev = 36;
84
- _context.t1 = _context["catch"](15);
72
+ case 32:
73
+ _context.prev = 32;
74
+ _context.t1 = _context["catch"](14);
85
75
  _iterator.e(_context.t1);
86
- case 39:
87
- _context.prev = 39;
76
+ case 35:
77
+ _context.prev = 35;
88
78
  _iterator.f();
89
- return _context.finish(39);
90
- case 42:
91
- _context.next = 52;
79
+ return _context.finish(35);
80
+ case 38:
81
+ _context.next = 48;
92
82
  break;
93
- case 44:
94
- _context.prev = 44;
95
- _context.t2 = _context["catch"](4);
83
+ case 40:
84
+ _context.prev = 40;
85
+ _context.t2 = _context["catch"](3);
96
86
  if (!(_context.t2 instanceof DOMException && _context.t2.name === 'AbortError')) {
97
- _context.next = 50;
87
+ _context.next = 46;
98
88
  break;
99
89
  }
100
90
  doneStreaming = true;
101
- _context.next = 52;
91
+ _context.next = 48;
102
92
  break;
103
- case 50:
93
+ case 46:
104
94
  reader.cancel();
105
95
  throw _context.t2;
106
- case 52:
96
+ case 48:
107
97
  if (!doneStreaming) {
108
- _context.next = 4;
98
+ _context.next = 3;
109
99
  break;
110
100
  }
111
- case 53:
101
+ case 49:
112
102
  if (!chunkBuffer) {
113
- _context.next = 56;
103
+ _context.next = 52;
114
104
  break;
115
105
  }
116
106
  error = new Error("Not all the data was processed: ".concat(chunkBuffer));
117
107
  throw error;
118
- case 56:
108
+ case 52:
119
109
  case "end":
120
110
  return _context.stop();
121
111
  }
122
- }, _callee, null, [[4, 44], [15, 36, 39, 42], [19, 27]]);
112
+ }, _callee, null, [[3, 40], [14, 32, 35, 38], [18, 25]]);
123
113
  }));
124
114
  return _readStream.apply(this, arguments);
125
115
  }
@@ -22,7 +22,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
22
22
  var context = exports.context = {
23
23
  componentName: 'smart-cards',
24
24
  packageName: "@atlaskit/smart-card",
25
- packageVersion: "26.56.3"
25
+ packageVersion: "26.56.5"
26
26
  };
27
27
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
28
28
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.GoalIcon = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _icon = _interopRequireDefault(require("@atlaskit/icon"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var GoalGlyph = function GoalGlyph(props) {
12
+ return /*#__PURE__*/_react.default.createElement("svg", {
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ width: "16",
15
+ height: "16",
16
+ viewBox: "0 0 16 16",
17
+ fill: "none"
18
+ }, /*#__PURE__*/_react.default.createElement("path", {
19
+ fillRule: "evenodd",
20
+ clipRule: "evenodd",
21
+ 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",
22
+ fill: "#0C66E4"
23
+ }));
24
+ };
25
+ var GoalIcon = exports.GoalIcon = function GoalIcon(props) {
26
+ return /*#__PURE__*/_react.default.createElement(_icon.default, (0, _extends2.default)({
27
+ glyph: GoalGlyph
28
+ }, props));
29
+ };
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
8
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
11
  var _inviteTeam = _interopRequireDefault(require("@atlaskit/icon/glyph/invite-team"));
@@ -15,7 +16,39 @@ var _messages = require("../../../../../messages");
15
16
  var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
16
17
  var _serverAction = _interopRequireDefault(require("../action/server-action"));
17
18
  var _unfollowIcon = _interopRequireDefault(require("./unfollow-icon"));
19
+ var _utils = require("../../utils");
18
20
  var _excluded = ["value"];
21
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
22
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != (0, _typeof2.default)(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
23
+ var importIconMapper = {
24
+ goal: function goal() {
25
+ return Promise.resolve().then(function () {
26
+ return _interopRequireWildcard(require( /* webpackChunkName: "glyphGoal" */'./goal-icon'));
27
+ }).then(function (_ref) {
28
+ var GoalIcon = _ref.GoalIcon;
29
+ return {
30
+ default: GoalIcon
31
+ };
32
+ });
33
+ },
34
+ projects: function projects() {
35
+ return Promise.resolve().then(function () {
36
+ return _interopRequireWildcard(require( /* webpackChunkName: "glyphProjects" */'./projects-icon'));
37
+ }).then(function (_ref2) {
38
+ var ProjectsIcon = _ref2.ProjectsIcon;
39
+ return {
40
+ default: ProjectsIcon
41
+ };
42
+ });
43
+ }
44
+ };
45
+ var getIcon = function getIcon(stackIconType) {
46
+ var importFn = importIconMapper[stackIconType];
47
+ if (!importFn) {
48
+ return null;
49
+ }
50
+ return (0, _utils.importIcon)(importFn);
51
+ };
19
52
  var FollowAction = function FollowAction(props) {
20
53
  var _context$actions, _context$actions2;
21
54
  var context = (0, _flexibleUiContext.useFlexibleUiContext)();
@@ -25,17 +58,34 @@ var FollowAction = function FollowAction(props) {
25
58
  var _context$actions$Acti = context === null || context === void 0 || (_context$actions2 = context.actions) === null || _context$actions2 === void 0 ? void 0 : _context$actions2[_constants.ActionName.FollowAction],
26
59
  value = _context$actions$Acti.value,
27
60
  data = (0, _objectWithoutProperties2.default)(_context$actions$Acti, _excluded);
61
+ var isStackItem = props.as === 'stack-item';
62
+ var isProject = data.isProject;
28
63
  var message = value ? _messages.messages.follow : _messages.messages.unfollow;
64
+ var projectMessage = value ? _messages.messages.follow_project : _messages.messages.unfollow_project;
65
+ var goalMessage = value ? _messages.messages.follow_goal : _messages.messages.unfollow_goal;
66
+ var stackMessage = isProject ? projectMessage : goalMessage;
67
+ var label = isStackItem ? stackMessage : message;
68
+ var projectTooltipMessage = value ? _messages.messages.follow_project_description : _messages.messages.unfollow_project_description;
69
+ var goalTooltipMessage = value ? _messages.messages.follow_goal_description : _messages.messages.unfollow_goal_description;
70
+ var stackTooltipMessage = isProject ? projectTooltipMessage : goalTooltipMessage;
71
+ var tooltipMessage = isStackItem ? stackTooltipMessage : message;
29
72
  var icon = value ? /*#__PURE__*/_react.default.createElement(_inviteTeam.default, {
30
73
  label: "Follow"
31
74
  }) : /*#__PURE__*/_react.default.createElement(_unfollowIcon.default, {
32
75
  label: "Unfollow"
33
76
  });
77
+ var stackIconType = isProject ? 'projects' : 'goal';
78
+ var ImportedIcon = getIcon(stackIconType);
79
+ var stackIcon = /*#__PURE__*/_react.default.createElement(ImportedIcon, {
80
+ label: "Follow",
81
+ testId: "smart-action-follow-action-".concat(stackIconType, "-icon")
82
+ });
83
+ var followIcon = isStackItem ? stackIcon : icon;
34
84
  return /*#__PURE__*/_react.default.createElement(_serverAction.default, (0, _extends2.default)({
35
- content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, message),
36
- icon: icon,
85
+ content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, label),
86
+ icon: followIcon,
37
87
  testId: "smart-action-follow-action",
38
- tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, message)
88
+ tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, tooltipMessage)
39
89
  }, data, props));
40
90
  };
41
91
  var _default = exports.default = FollowAction;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.ProjectsIcon = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _icon = _interopRequireDefault(require("@atlaskit/icon"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var ProjectsGlyph = function ProjectsGlyph(props) {
12
+ return /*#__PURE__*/_react.default.createElement("svg", {
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ width: "16",
15
+ height: "16",
16
+ viewBox: "0 0 16 16",
17
+ fill: "none"
18
+ }, /*#__PURE__*/_react.default.createElement("path", {
19
+ fillRule: "evenodd",
20
+ clipRule: "evenodd",
21
+ 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",
22
+ fill: "#0C66E4"
23
+ }));
24
+ };
25
+ var ProjectsIcon = exports.ProjectsIcon = function ProjectsIcon(props) {
26
+ return /*#__PURE__*/_react.default.createElement(_icon.default, (0, _extends2.default)({
27
+ glyph: ProjectsGlyph
28
+ }, props));
29
+ };
@@ -19,11 +19,22 @@ var ignoreContainerPaddingStyles = (0, _primitives.xcss)({
19
19
  marginLeft: 'calc(var(--container-gap-left) * -1)',
20
20
  marginRight: 'calc(var(--container-gap-right) * -1)'
21
21
  });
22
+ var DEFAULT_SORT_ORDER = [_constants.ActionName.PreviewAction, _constants.ActionName.CopyLinkAction];
23
+ var sort = function sort(a, b) {
24
+ var idxA = DEFAULT_SORT_ORDER.indexOf(a);
25
+ var idxB = DEFAULT_SORT_ORDER.indexOf(b);
26
+ if (idxA === -1) {
27
+ idxA = DEFAULT_SORT_ORDER.length;
28
+ }
29
+ if (idxB === -1) {
30
+ idxB = DEFAULT_SORT_ORDER.length;
31
+ }
32
+ return idxA - idxB;
33
+ };
22
34
  var ActionBlock = function ActionBlock(_ref) {
23
35
  var blockRef = _ref.blockRef,
24
36
  onClickCallback = _ref.onClick,
25
37
  size = _ref.size,
26
- sort = _ref.sort,
27
38
  spaceInline = _ref.spaceInline,
28
39
  _ref$testId = _ref.testId,
29
40
  testId = _ref$testId === void 0 ? 'smart-block-action' : _ref$testId;
@@ -35,9 +46,7 @@ var ActionBlock = function ActionBlock(_ref) {
35
46
  return;
36
47
  }
37
48
  var arr = Object.keys(context.actions);
38
- if (sort) {
39
- arr.sort(sort);
40
- }
49
+ arr.sort(sort);
41
50
  return arr.map(function (name) {
42
51
  var Action = name in Actions ? Actions[name] : undefined;
43
52
  return Action ? /*#__PURE__*/_react.default.createElement(Action, {
@@ -53,7 +62,7 @@ var ActionBlock = function ActionBlock(_ref) {
53
62
  })
54
63
  }) : null;
55
64
  });
56
- }, [context === null || context === void 0 ? void 0 : context.actions, onClickCallback, padding, size, sort, spaceInline]);
65
+ }, [context === null || context === void 0 ? void 0 : context.actions, onClickCallback, padding, size, spaceInline]);
57
66
  return actions ? /*#__PURE__*/_react.default.createElement(_primitives.Stack, {
58
67
  grow: "fill",
59
68
  xcss: ignoreContainerPaddingStyles,
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.sizeToButtonSpacing = exports.openEmbedModalWithFlexibleUiIcon = exports.hasWhiteSpace = exports.getTruncateStyles = exports.getPrimitivesPaddingSpaceBySize = exports.getPrimitivesInlineSpaceBySize = exports.getMaxLines = exports.getMaxLineHeight = exports.getLinkSizeStyles = exports.getLinkLineHeight = exports.getIconWidth = exports.getIconSizeStyles = exports.getFormattedMessageAsString = exports.getFormattedMessage = void 0;
7
+ exports.sizeToButtonSpacing = exports.openEmbedModalWithFlexibleUiIcon = exports.importIcon = exports.hasWhiteSpace = exports.getTruncateStyles = exports.getPrimitivesPaddingSpaceBySize = exports.getPrimitivesInlineSpaceBySize = exports.getMaxLines = exports.getMaxLineHeight = exports.getLinkSizeStyles = exports.getLinkLineHeight = exports.getIconWidth = exports.getIconSizeStyles = exports.getFormattedMessageAsString = exports.getFormattedMessage = void 0;
8
8
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
9
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
@@ -15,6 +15,7 @@ var _reactIntlNext = require("react-intl-next");
15
15
  var _constants = require("../../../constants");
16
16
  var _icon = _interopRequireDefault(require("./elements/icon"));
17
17
  var _utils = require("../../EmbedModal/utils");
18
+ var _reactLoadable = _interopRequireDefault(require("react-loadable"));
18
19
  var _excluded = ["linkIcon"];
19
20
  var _sizeToButtonSpacing, _templateObject;
20
21
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -63,6 +64,18 @@ var getIconWidth = exports.getIconWidth = function getIconWidth(size) {
63
64
  return '.75rem';
64
65
  }
65
66
  };
67
+ var importIcon = exports.importIcon = function importIcon(importFn) {
68
+ return (0, _reactLoadable.default)({
69
+ loader: function loader() {
70
+ return importFn().then(function (module) {
71
+ return module.default;
72
+ });
73
+ },
74
+ loading: function loading() {
75
+ return null;
76
+ }
77
+ }); // Because we're using dynamic loading here, TS will not be able to infer the type.
78
+ };
66
79
  var getLinkLineHeight = exports.getLinkLineHeight = function getLinkLineHeight(size) {
67
80
  switch (size) {
68
81
  case _constants.SmartLinkSize.XLarge:
@@ -17,7 +17,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
17
17
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
18
18
  var PACKAGE_DATA = {
19
19
  packageName: "@atlaskit/smart-card",
20
- packageVersion: "26.56.3",
20
+ packageVersion: "26.56.5",
21
21
  componentName: 'linkUrl'
22
22
  };
23
23
  var Link = (0, _click.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 @@ const extractFollowAction = (response, actionOptions, id) => {
12
12
  const extensionKey = getExtensionKey(response);
13
13
  const data = response === null || response === void 0 ? void 0 : response.data;
14
14
  const actions = extractServerAction(data);
15
+ const type = extractType(data);
16
+ const 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 @@ const extractFollowAction = (response, actionOptions, id) => {
41
43
  providerKey: extensionKey,
42
44
  reload
43
45
  },
44
- value: actionType === SmartLinkActionType.FollowEntityAction
46
+ value: actionType === SmartLinkActionType.FollowEntityAction,
47
+ isProject
45
48
  };
46
49
  };
47
50
  export default extractFollowAction;
@@ -3,7 +3,8 @@ import { extractDownloadAction } from './extract-download-action';
3
3
  import { extractPreviewAction } from './extract-preview-action';
4
4
  import extractFollowAction from './extract-follow-action';
5
5
  import { extractCopyLinkAction } from './extract-copy-link-action';
6
- const extractActions = (response, data, actionOptions, id) => {
6
+ const extractActions = (response, actionOptions, id) => {
7
+ const data = response.data;
7
8
  const action = {
8
9
  [ActionName.CopyLinkAction]: extractCopyLinkAction(data, actionOptions),
9
10
  [ActionName.DownloadAction]: extractDownloadAction(data, actionOptions),
@@ -22,7 +22,7 @@ const extractFlexibleUiContext = ({
22
22
  const data = response.data;
23
23
  const 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 const 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 const 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',
@@ -3,7 +3,6 @@ export async function* readStream(response) {
3
3
  const reader = getBufferReader(response);
4
4
  let doneStreaming = false;
5
5
  let chunkBuffer = '';
6
- const chunkTypeErrorMessage = 'jsonChunkType error';
7
6
  do {
8
7
  try {
9
8
  const {
@@ -19,13 +18,10 @@ export async function* readStream(response) {
19
18
  try {
20
19
  const jsonChunk = JSON.parse(chunk);
21
20
  if (jsonChunk.type === 'ERROR') {
22
- throw new Error(chunkTypeErrorMessage);
21
+ reader.cancel();
23
22
  }
24
23
  yield jsonChunk;
25
24
  } catch (e) {
26
- if (e instanceof Error && e.message === chunkTypeErrorMessage) {
27
- throw e;
28
- }
29
25
  // the chunk may be incomplete, so we'll save it for the next iteration.
30
26
  chunkBuffer = chunk;
31
27
  }
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
4
4
  export const context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card",
7
- packageVersion: "26.56.3"
7
+ packageVersion: "26.56.5"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";