@atlaskit/smart-card 26.61.0 → 26.62.1

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 +23 -0
  2. package/analytics.spec.yaml +6 -0
  3. package/dist/cjs/messages.js +15 -0
  4. package/dist/cjs/utils/analytics/analytics.js +1 -1
  5. package/dist/cjs/view/FlexibleCard/components/actions/action/action-icon/index.js +4 -3
  6. package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/index.js +1 -1
  7. package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +1 -1
  8. package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js +59 -0
  9. package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.js +20 -51
  10. package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.js +62 -0
  11. package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +2 -2
  12. package/dist/cjs/view/LinkUrl/index.js +1 -1
  13. package/dist/es2019/messages.js +15 -0
  14. package/dist/es2019/utils/analytics/analytics.js +1 -1
  15. package/dist/es2019/view/FlexibleCard/components/actions/action/action-icon/index.js +4 -3
  16. package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/index.js +1 -1
  17. package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +1 -1
  18. package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js +49 -0
  19. package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.js +19 -45
  20. package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.js +36 -0
  21. package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +2 -2
  22. package/dist/es2019/view/LinkUrl/index.js +1 -1
  23. package/dist/esm/messages.js +15 -0
  24. package/dist/esm/utils/analytics/analytics.js +1 -1
  25. package/dist/esm/view/FlexibleCard/components/actions/action/action-icon/index.js +4 -3
  26. package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/index.js +1 -1
  27. package/dist/esm/view/FlexibleCard/components/actions/action/index.js +1 -1
  28. package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js +49 -0
  29. package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.js +20 -48
  30. package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.js +52 -0
  31. package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +2 -2
  32. package/dist/esm/view/LinkUrl/index.js +1 -1
  33. package/dist/types/common/analytics/generated/analytics.types.d.ts +5 -1
  34. package/dist/types/messages.d.ts +2 -2
  35. package/dist/types/view/FlexibleCard/components/actions/action/action-icon/types.d.ts +1 -1
  36. package/dist/types/view/FlexibleCard/components/actions/action/action-stack-item/index.d.ts +1 -1
  37. package/dist/types/view/FlexibleCard/components/actions/action/index.d.ts +1 -1
  38. package/dist/types/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.d.ts +8 -0
  39. package/dist/types/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.d.ts +3 -3
  40. package/dist/types/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.d.ts +6 -0
  41. package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +5 -1
  42. package/dist/types-ts4.5/messages.d.ts +2 -2
  43. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-icon/types.d.ts +1 -1
  44. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-stack-item/index.d.ts +1 -1
  45. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/index.d.ts +1 -1
  46. package/dist/types-ts4.5/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.d.ts +8 -0
  47. package/dist/types-ts4.5/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.d.ts +3 -3
  48. package/dist/types-ts4.5/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.d.ts +6 -0
  49. package/package.json +4 -4
  50. package/dist/cjs/view/FlexibleCard/components/actions/preview-action/preview-icon/index.js +0 -19
  51. package/dist/es2019/view/FlexibleCard/components/actions/preview-action/preview-icon/index.js +0 -10
  52. package/dist/esm/view/FlexibleCard/components/actions/preview-action/preview-icon/index.js +0 -12
  53. package/dist/types/view/FlexibleCard/components/actions/preview-action/preview-icon/index.d.ts +0 -4
  54. package/dist/types-ts4.5/view/FlexibleCard/components/actions/preview-action/preview-icon/index.d.ts +0 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 26.62.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#98616](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/98616)
8
+ [`0d489a075749`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0d489a075749) -
9
+ [ux] Update PreviewAction button to reuse media-service actual-size icon
10
+ - Updated dependencies
11
+
12
+ ## 26.62.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [#97986](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/97986)
17
+ [`add59fc2532d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/add59fc2532d) -
18
+ [ux] AI summary button to change to copy summary button when summary generation is complete
19
+
20
+ ### Patch Changes
21
+
22
+ - [#98122](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/98122)
23
+ [`97965a03cc96`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/97965a03cc96) -
24
+ Hover preview redesign: Update action icon size
25
+
3
26
  ## 26.61.0
4
27
 
5
28
  ### Minor Changes
@@ -91,6 +91,12 @@ events:
91
91
  attributes:
92
92
  <<: [*PackageMetaDataContext, *ResolvedAttributes]
93
93
 
94
+ - button clicked (copySummary):
95
+ type: ui
96
+ description: fired when the copy ai summary button is clicked
97
+ attributes:
98
+ <<: [*PackageMetaDataContext, *ResolvedAttributes]
99
+
94
100
  - summary viewed:
95
101
  type: ui
96
102
  description: fired when a summary is viewed
@@ -211,6 +211,21 @@ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
211
211
  defaultMessage: 'Summarize the content of this link using Atlassian Intelligence.',
212
212
  description: 'Description of what the summarize link with AI action does'
213
213
  },
214
+ copy_summary_action: {
215
+ id: 'fabric.linking.copy_summary_action.nonfinal',
216
+ defaultMessage: 'Copy summary',
217
+ description: 'Allow a user to copy a generated summary'
218
+ },
219
+ copy_summary_action_description: {
220
+ id: 'fabric.linking.copy_summary_action.nonfinal',
221
+ defaultMessage: 'Copy summary',
222
+ description: 'Description of what the copy summary AI action does'
223
+ },
224
+ copied_summary_action_description: {
225
+ id: 'fabric.linking.copied_summary_action_description.nonfinal',
226
+ defaultMessage: 'Copied summary to clipboard',
227
+ description: 'Confirmation to the user that the summry has been copied'
228
+ },
214
229
  edit: {
215
230
  id: 'fabric.linking.edit',
216
231
  defaultMessage: 'Edit',
@@ -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.61.0"
25
+ packageVersion: "26.62.1"
26
26
  };
27
27
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
28
28
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -27,7 +27,8 @@ var getIconStyles = function getIconStyles(isDisabled) {
27
27
  color: isDisabled ? "var(--ds-text-disabled, #6B778C)" : "var(--ds-icon, #44546F)"
28
28
  });
29
29
  };
30
- var backgroundStyles = (0, _react2.css)({
30
+ var stackItemIconSizeStyles = (0, _utils.getIconSizeStyles)('20px');
31
+ var stackItemIconStyles = (0, _react2.css)(stackItemIconSizeStyles, {
31
32
  display: 'inline-block',
32
33
  lineHeight: 0,
33
34
  padding: "var(--ds-space-025, 2px)",
@@ -40,9 +41,9 @@ var ActionIcon = function ActionIcon(_ref) {
40
41
  testId = _ref.testId,
41
42
  icon = _ref.icon,
42
43
  isDisabled = _ref.isDisabled,
43
- showBackground = _ref.showBackground;
44
+ asStackItemIcon = _ref.asStackItemIcon;
44
45
  return (0, _react2.jsx)("span", {
45
- css: [getIconStyles(isDisabled), (0, _utils.getIconSizeStyles)(getIconWidth(size)), showBackground && backgroundStyles],
46
+ css: [getIconStyles(isDisabled), asStackItemIcon ? stackItemIconStyles : (0, _utils.getIconSizeStyles)(getIconWidth(size))],
46
47
  "data-testid": "".concat(testId, "-icon")
47
48
  }, icon);
48
49
  };
@@ -66,10 +66,10 @@ var ActionStackItem = function ActionStackItem(_ref) {
66
66
  }
67
67
  }, [isDisabled, isLoading, onClickCallback]);
68
68
  var icon = iconOption && isLoading ? /*#__PURE__*/_react.default.createElement(_actionIcon.default, {
69
+ asStackItemIcon: true,
69
70
  icon: /*#__PURE__*/_react.default.createElement(_spinner.default, {
70
71
  testId: "".concat(testId, "-loading")
71
72
  }),
72
- showBackground: true,
73
73
  size: size
74
74
  }) : iconOption;
75
75
 
@@ -50,10 +50,10 @@ var Action = function Action(_ref) {
50
50
  var isStackItem = as === 'stack-item';
51
51
  var isDropdownItem = as === 'dropdown-item' || asDropDownItem;
52
52
  var actionIcon = icon && (0, _react.jsx)(_actionIcon.default, {
53
+ asStackItemIcon: isStackItem,
53
54
  isDisabled: isDisabled,
54
55
  icon: icon,
55
56
  size: size,
56
- showBackground: isStackItem,
57
57
  testId: testId
58
58
  });
59
59
  var iconBefore = icon && iconPosition === 'before' ? actionIcon : undefined;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.AISummariseAction = AISummariseAction;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var _reactIntlNext = require("react-intl-next");
13
+ var _action = _interopRequireDefault(require("../action"));
14
+ var _aiIcon = _interopRequireDefault(require("../../../../common/ai-icon"));
15
+ var _messages = require("../../../../../messages");
16
+ var _useAnalyticsEvents2 = require("../../../../../common/analytics/generated/use-analytics-events");
17
+ var _utils = require("./utils");
18
+ var _excluded = ["url", "ari", "product", "onClick", "onError", "testId", "status", "summariseUrl"];
19
+ 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); }
20
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(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; }
21
+ function AISummariseAction(_ref) {
22
+ var url = _ref.url,
23
+ ari = _ref.ari,
24
+ product = _ref.product,
25
+ onClickCallback = _ref.onClick,
26
+ onErrorCallback = _ref.onError,
27
+ testId = _ref.testId,
28
+ status = _ref.status,
29
+ summariseUrl = _ref.summariseUrl,
30
+ props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
31
+ var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
32
+ fireEvent = _useAnalyticsEvents.fireEvent;
33
+ var onCompleted = (0, _react.useCallback)(function (state) {
34
+ if ((state === null || state === void 0 ? void 0 : state.status) === 'error') {
35
+ onErrorCallback === null || onErrorCallback === void 0 || onErrorCallback((0, _utils.getErrorMessage)(state.error));
36
+ }
37
+ }, [onErrorCallback]);
38
+ var handleActionClick = (0, _react.useCallback)(function () {
39
+ var _summariseUrl;
40
+ fireEvent('ui.button.clicked.aiSummary', {});
41
+ fireEvent('track.aiInteraction.initiated', {
42
+ aiFeatureName: 'Smart Links Summary',
43
+ proactiveAIGenerated: 0,
44
+ userGeneratedAI: 1
45
+ });
46
+ (_summariseUrl = summariseUrl()) === null || _summariseUrl === void 0 || _summariseUrl.then(onCompleted, onCompleted);
47
+ onClickCallback === null || onClickCallback === void 0 || onClickCallback();
48
+ }, [fireEvent, onClickCallback, onCompleted, summariseUrl]);
49
+ return /*#__PURE__*/_react.default.createElement(_action.default, (0, _extends2.default)({
50
+ content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.ai_summary_action),
51
+ icon: /*#__PURE__*/_react.default.createElement(_aiIcon.default, {
52
+ label: "Summarise with AI"
53
+ }),
54
+ onClick: handleActionClick,
55
+ testId: "".concat(testId, "-summarise-action"),
56
+ isLoading: status === 'loading',
57
+ tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.ai_summary_action_description)
58
+ }, props));
59
+ }
@@ -1,68 +1,37 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.AISummaryActionComponent = void 0;
9
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
- var _react = _interopRequireWildcard(require("react"));
12
- var _reactIntlNext = require("react-intl-next");
9
+ var _react = _interopRequireDefault(require("react"));
13
10
  var _reactMagneticDi = require("react-magnetic-di");
14
- var _messages = require("../../../../../messages");
15
- var _action = _interopRequireDefault(require("../action"));
16
- var _aiIcon = _interopRequireDefault(require("../../../../common/ai-icon"));
17
- var _useAnalyticsEvents2 = require("../../../../../common/analytics/generated/use-analytics-events");
18
11
  var _useAiSummary = require("../../../../../state/hooks/use-ai-summary");
19
- var _utils = require("./utils");
20
- var _excluded = ["onClick", "onError", "url", "ari", "product"];
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" != _typeof(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 AISummaryActionComponent = exports.AISummaryActionComponent = function AISummaryActionComponent(_ref) {
24
- var onClickCallback = _ref.onClick,
25
- onErrorCallback = _ref.onError,
26
- _ref$url = _ref.url,
27
- url = _ref$url === void 0 ? '' : _ref$url,
28
- _ref$ari = _ref.ari,
29
- ari = _ref$ari === void 0 ? '' : _ref$ari,
30
- product = _ref.product,
31
- props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
32
- var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
33
- fireEvent = _useAnalyticsEvents.fireEvent;
12
+ var _copySummaryAction = require("./copy-summary-action");
13
+ var _aiSummariseAction = require("./ai-summarise-action");
14
+ var AISummaryActionComponent = exports.AISummaryActionComponent = function AISummaryActionComponent(props) {
15
+ var url = props.url,
16
+ ari = props.ari,
17
+ product = props.product,
18
+ _props$testId = props.testId,
19
+ testId = _props$testId === void 0 ? 'smart-action-ai-summary-action' : _props$testId;
34
20
  var _useAISummary = (0, _useAiSummary.useAISummary)({
35
21
  url: url,
36
22
  ari: ari,
37
23
  product: product
38
24
  }),
39
- status = _useAISummary.state.status,
25
+ _useAISummary$state = _useAISummary.state,
26
+ status = _useAISummary$state.status,
27
+ content = _useAISummary$state.content,
40
28
  summariseUrl = _useAISummary.summariseUrl;
41
- var onCompleted = (0, _react.useCallback)(function (state) {
42
- if ((state === null || state === void 0 ? void 0 : state.status) === 'error') {
43
- onErrorCallback === null || onErrorCallback === void 0 || onErrorCallback((0, _utils.getErrorMessage)(state.error));
44
- }
45
- }, [onErrorCallback]);
46
- var handleActionClick = (0, _react.useCallback)(function () {
47
- var _summariseUrl;
48
- fireEvent('ui.button.clicked.aiSummary', {});
49
- fireEvent('track.aiInteraction.initiated', {
50
- aiFeatureName: 'Smart Links Summary',
51
- proactiveAIGenerated: 0,
52
- userGeneratedAI: 1
53
- });
54
- (_summariseUrl = summariseUrl()) === null || _summariseUrl === void 0 || _summariseUrl.then(onCompleted, onCompleted);
55
- onClickCallback === null || onClickCallback === void 0 || onClickCallback();
56
- }, [fireEvent, onClickCallback, onCompleted, summariseUrl]);
57
- return /*#__PURE__*/_react.default.createElement(_action.default, (0, _extends2.default)({
58
- content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.ai_summary_action),
59
- icon: /*#__PURE__*/_react.default.createElement(_aiIcon.default, {
60
- label: "Summarise with AI"
61
- }),
62
- isLoading: status === 'loading',
63
- onClick: handleActionClick,
64
- testId: "smart-action-ai-summary-action",
65
- tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.ai_summary_action_description)
66
- }, props));
67
- return null;
29
+ return status === 'done' ? /*#__PURE__*/_react.default.createElement(_copySummaryAction.CopySummaryAction, (0, _extends2.default)({}, props, {
30
+ testId: testId,
31
+ content: content
32
+ })) : /*#__PURE__*/_react.default.createElement(_aiSummariseAction.AISummariseAction, (0, _extends2.default)({}, props, {
33
+ testId: testId,
34
+ summariseUrl: summariseUrl,
35
+ status: status
36
+ }));
68
37
  };
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.CopySummaryAction = CopySummaryAction;
9
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
14
+ var _react = _interopRequireWildcard(require("react"));
15
+ var _copy = _interopRequireDefault(require("@atlaskit/icon/glyph/copy"));
16
+ var _reactIntlNext = require("react-intl-next");
17
+ var _action = _interopRequireDefault(require("../action"));
18
+ var _messages = require("../../../../../messages");
19
+ var _useAnalyticsEvents2 = require("../../../../../common/analytics/generated/use-analytics-events");
20
+ var _excluded = ["url", "ari", "product", "onClick", "testId", "content"];
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" != _typeof(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
+ function CopySummaryAction(_ref) {
24
+ var url = _ref.url,
25
+ ari = _ref.ari,
26
+ product = _ref.product,
27
+ onClickCallback = _ref.onClick,
28
+ testId = _ref.testId,
29
+ content = _ref.content,
30
+ props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
31
+ var _useAnalyticsEvents = (0, _useAnalyticsEvents2.useAnalyticsEvents)(),
32
+ fireEvent = _useAnalyticsEvents.fireEvent;
33
+ var _useState = (0, _react.useState)(_messages.messages.copy_summary_action),
34
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
35
+ tooltipMessage = _useState2[0],
36
+ setTooltipMessage = _useState2[1];
37
+ var handleCopySummaryClick = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
38
+ return _regenerator.default.wrap(function _callee$(_context) {
39
+ while (1) switch (_context.prev = _context.next) {
40
+ case 0:
41
+ fireEvent('ui.button.clicked.copySummary', {});
42
+ _context.next = 3;
43
+ return navigator.clipboard.writeText(content !== null && content !== void 0 ? content : '');
44
+ case 3:
45
+ setTooltipMessage(_messages.messages.copied_summary_action_description);
46
+ onClickCallback === null || onClickCallback === void 0 || onClickCallback();
47
+ case 5:
48
+ case "end":
49
+ return _context.stop();
50
+ }
51
+ }, _callee);
52
+ })), [fireEvent, onClickCallback, content]);
53
+ return /*#__PURE__*/_react.default.createElement(_action.default, (0, _extends2.default)({
54
+ content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.copy_summary_action),
55
+ icon: /*#__PURE__*/_react.default.createElement(_copy.default, {
56
+ label: "Copy Summary"
57
+ }),
58
+ onClick: handleCopySummaryClick,
59
+ testId: "".concat(testId, "-copy-summary-action"),
60
+ tooltipMessage: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, tooltipMessage)
61
+ }, props));
62
+ }
@@ -12,6 +12,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
12
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
13
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
14
14
  var _vidFullScreenOn = _interopRequireDefault(require("@atlaskit/icon/glyph/vid-full-screen-on"));
15
+ var _actualSize = _interopRequireDefault(require("@atlaskit/icon/glyph/media-services/actual-size"));
15
16
  var _react = _interopRequireWildcard(require("react"));
16
17
  var _reactIntlNext = require("react-intl-next");
17
18
  var _constants = require("../../../../../constants");
@@ -20,7 +21,6 @@ var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
20
21
  var _useInvokeClientAction = _interopRequireDefault(require("../../../../../state/hooks/use-invoke-client-action"));
21
22
  var _utils = require("../../utils");
22
23
  var _action = _interopRequireDefault(require("../action"));
23
- var _previewIcon = _interopRequireDefault(require("./preview-icon"));
24
24
  var _excluded = ["onClick"];
25
25
  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); }
26
26
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(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; }
@@ -72,7 +72,7 @@ var PreviewAction = function PreviewAction(_ref) {
72
72
  }
73
73
  }, [analytics, data, invoke, onClickCallback]);
74
74
  var isStackItem = props.as === 'stack-item';
75
- var Icon = isStackItem ? _previewIcon.default : _vidFullScreenOn.default;
75
+ var Icon = isStackItem ? _actualSize.default : _vidFullScreenOn.default;
76
76
  var tooltipMessage = isStackItem ? _messages.messages.preview_description : _messages.messages.preview_improved;
77
77
  return data ? /*#__PURE__*/_react.default.createElement(_action.default, (0, _extends2.default)({
78
78
  content: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.preview_improved),
@@ -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.61.0",
20
+ packageVersion: "26.62.1",
21
21
  componentName: 'linkUrl'
22
22
  };
23
23
  var Link = (0, _click.withLinkClickedEvent)('a');
@@ -205,6 +205,21 @@ export const messages = defineMessages({
205
205
  defaultMessage: 'Summarize the content of this link using Atlassian Intelligence.',
206
206
  description: 'Description of what the summarize link with AI action does'
207
207
  },
208
+ copy_summary_action: {
209
+ id: 'fabric.linking.copy_summary_action.nonfinal',
210
+ defaultMessage: 'Copy summary',
211
+ description: 'Allow a user to copy a generated summary'
212
+ },
213
+ copy_summary_action_description: {
214
+ id: 'fabric.linking.copy_summary_action.nonfinal',
215
+ defaultMessage: 'Copy summary',
216
+ description: 'Description of what the copy summary AI action does'
217
+ },
218
+ copied_summary_action_description: {
219
+ id: 'fabric.linking.copied_summary_action_description.nonfinal',
220
+ defaultMessage: 'Copied summary to clipboard',
221
+ description: 'Confirmation to the user that the summry has been copied'
222
+ },
208
223
  edit: {
209
224
  id: 'fabric.linking.edit',
210
225
  defaultMessage: 'Edit',
@@ -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.61.0"
7
+ packageVersion: "26.62.1"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -17,7 +17,8 @@ const getIconWidth = size => {
17
17
  const getIconStyles = isDisabled => css({
18
18
  color: isDisabled ? "var(--ds-text-disabled, #6B778C)" : "var(--ds-icon, #44546F)"
19
19
  });
20
- const backgroundStyles = css({
20
+ const stackItemIconSizeStyles = getIconSizeStyles('20px');
21
+ const stackItemIconStyles = css(stackItemIconSizeStyles, {
21
22
  display: 'inline-block',
22
23
  lineHeight: 0,
23
24
  padding: "var(--ds-space-025, 2px)",
@@ -30,9 +31,9 @@ const ActionIcon = ({
30
31
  testId,
31
32
  icon,
32
33
  isDisabled,
33
- showBackground
34
+ asStackItemIcon
34
35
  }) => jsx("span", {
35
- css: [getIconStyles(isDisabled), getIconSizeStyles(getIconWidth(size)), showBackground && backgroundStyles],
36
+ css: [getIconStyles(isDisabled), asStackItemIcon ? stackItemIconStyles : getIconSizeStyles(getIconWidth(size))],
36
37
  "data-testid": `${testId}-icon`
37
38
  }, icon);
38
39
  export default ActionIcon;
@@ -57,10 +57,10 @@ const ActionStackItem = ({
57
57
  }
58
58
  }, [isDisabled, isLoading, onClickCallback]);
59
59
  const icon = iconOption && isLoading ? /*#__PURE__*/React.createElement(ActionIcon, {
60
+ asStackItemIcon: true,
60
61
  icon: /*#__PURE__*/React.createElement(Spinner, {
61
62
  testId: `${testId}-loading`
62
63
  }),
63
- showBackground: true,
64
64
  size: size
65
65
  }) : iconOption;
66
66
 
@@ -40,10 +40,10 @@ const Action = ({
40
40
  const isStackItem = as === 'stack-item';
41
41
  const isDropdownItem = as === 'dropdown-item' || asDropDownItem;
42
42
  const actionIcon = icon && jsx(ActionIcon, {
43
+ asStackItemIcon: isStackItem,
43
44
  isDisabled: isDisabled,
44
45
  icon: icon,
45
46
  size: size,
46
- showBackground: isStackItem,
47
47
  testId: testId
48
48
  });
49
49
  const iconBefore = icon && iconPosition === 'before' ? actionIcon : undefined;
@@ -0,0 +1,49 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { useCallback } from 'react';
3
+ import { FormattedMessage } from 'react-intl-next';
4
+ import Action from '../action';
5
+ import AiIcon from '../../../../common/ai-icon';
6
+ import { messages } from '../../../../../messages';
7
+ import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
8
+ import { getErrorMessage } from './utils';
9
+ export function AISummariseAction({
10
+ url,
11
+ ari,
12
+ product,
13
+ onClick: onClickCallback,
14
+ onError: onErrorCallback,
15
+ testId,
16
+ status,
17
+ summariseUrl,
18
+ ...props
19
+ }) {
20
+ const {
21
+ fireEvent
22
+ } = useAnalyticsEvents();
23
+ const onCompleted = useCallback(state => {
24
+ if ((state === null || state === void 0 ? void 0 : state.status) === 'error') {
25
+ onErrorCallback === null || onErrorCallback === void 0 ? void 0 : onErrorCallback(getErrorMessage(state.error));
26
+ }
27
+ }, [onErrorCallback]);
28
+ const handleActionClick = useCallback(() => {
29
+ var _summariseUrl;
30
+ fireEvent('ui.button.clicked.aiSummary', {});
31
+ fireEvent('track.aiInteraction.initiated', {
32
+ aiFeatureName: 'Smart Links Summary',
33
+ proactiveAIGenerated: 0,
34
+ userGeneratedAI: 1
35
+ });
36
+ (_summariseUrl = summariseUrl()) === null || _summariseUrl === void 0 ? void 0 : _summariseUrl.then(onCompleted, onCompleted);
37
+ onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback();
38
+ }, [fireEvent, onClickCallback, onCompleted, summariseUrl]);
39
+ return /*#__PURE__*/React.createElement(Action, _extends({
40
+ content: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summary_action),
41
+ icon: /*#__PURE__*/React.createElement(AiIcon, {
42
+ label: "Summarise with AI"
43
+ }),
44
+ onClick: handleActionClick,
45
+ testId: `${testId}-summarise-action`,
46
+ isLoading: status === 'loading',
47
+ tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summary_action_description)
48
+ }, props));
49
+ }
@@ -1,27 +1,20 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { useCallback } from 'react';
3
- import { FormattedMessage } from 'react-intl-next';
2
+ import React from 'react';
4
3
  import { di } from 'react-magnetic-di';
5
- import { messages } from '../../../../../messages';
6
- import Action from '../action';
7
- import AiIcon from '../../../../common/ai-icon';
8
- import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
9
4
  import { useAISummary } from '../../../../../state/hooks/use-ai-summary';
10
- import { getErrorMessage } from './utils';
11
- export const AISummaryActionComponent = ({
12
- onClick: onClickCallback,
13
- onError: onErrorCallback,
14
- url = '',
15
- ari = '',
16
- product,
17
- ...props
18
- }) => {
5
+ import { CopySummaryAction } from './copy-summary-action';
6
+ import { AISummariseAction } from './ai-summarise-action';
7
+ export const AISummaryActionComponent = props => {
19
8
  const {
20
- fireEvent
21
- } = useAnalyticsEvents();
9
+ url,
10
+ ari,
11
+ product,
12
+ testId = 'smart-action-ai-summary-action'
13
+ } = props;
22
14
  const {
23
15
  state: {
24
- status
16
+ status,
17
+ content
25
18
  },
26
19
  summariseUrl
27
20
  } = useAISummary({
@@ -29,31 +22,12 @@ export const AISummaryActionComponent = ({
29
22
  ari,
30
23
  product
31
24
  });
32
- const onCompleted = useCallback(state => {
33
- if ((state === null || state === void 0 ? void 0 : state.status) === 'error') {
34
- onErrorCallback === null || onErrorCallback === void 0 ? void 0 : onErrorCallback(getErrorMessage(state.error));
35
- }
36
- }, [onErrorCallback]);
37
- const handleActionClick = useCallback(() => {
38
- var _summariseUrl;
39
- fireEvent('ui.button.clicked.aiSummary', {});
40
- fireEvent('track.aiInteraction.initiated', {
41
- aiFeatureName: 'Smart Links Summary',
42
- proactiveAIGenerated: 0,
43
- userGeneratedAI: 1
44
- });
45
- (_summariseUrl = summariseUrl()) === null || _summariseUrl === void 0 ? void 0 : _summariseUrl.then(onCompleted, onCompleted);
46
- onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback();
47
- }, [fireEvent, onClickCallback, onCompleted, summariseUrl]);
48
- return /*#__PURE__*/React.createElement(Action, _extends({
49
- content: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summary_action),
50
- icon: /*#__PURE__*/React.createElement(AiIcon, {
51
- label: "Summarise with AI"
52
- }),
53
- isLoading: status === 'loading',
54
- onClick: handleActionClick,
55
- testId: "smart-action-ai-summary-action",
56
- tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summary_action_description)
57
- }, props));
58
- return null;
25
+ return status === 'done' ? /*#__PURE__*/React.createElement(CopySummaryAction, _extends({}, props, {
26
+ testId: testId,
27
+ content: content
28
+ })) : /*#__PURE__*/React.createElement(AISummariseAction, _extends({}, props, {
29
+ testId: testId,
30
+ summariseUrl: summariseUrl,
31
+ status: status
32
+ }));
59
33
  };
@@ -0,0 +1,36 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { useCallback, useState } from 'react';
3
+ import CopyIcon from '@atlaskit/icon/glyph/copy';
4
+ import { FormattedMessage } from 'react-intl-next';
5
+ import Action from '../action';
6
+ import { messages } from '../../../../../messages';
7
+ import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
8
+ export function CopySummaryAction({
9
+ url,
10
+ ari,
11
+ product,
12
+ onClick: onClickCallback,
13
+ testId,
14
+ content,
15
+ ...props
16
+ }) {
17
+ const {
18
+ fireEvent
19
+ } = useAnalyticsEvents();
20
+ const [tooltipMessage, setTooltipMessage] = useState(messages.copy_summary_action);
21
+ const handleCopySummaryClick = useCallback(async () => {
22
+ fireEvent('ui.button.clicked.copySummary', {});
23
+ await navigator.clipboard.writeText(content !== null && content !== void 0 ? content : '');
24
+ setTooltipMessage(messages.copied_summary_action_description);
25
+ onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback();
26
+ }, [fireEvent, onClickCallback, content]);
27
+ return /*#__PURE__*/React.createElement(Action, _extends({
28
+ content: /*#__PURE__*/React.createElement(FormattedMessage, messages.copy_summary_action),
29
+ icon: /*#__PURE__*/React.createElement(CopyIcon, {
30
+ label: "Copy Summary"
31
+ }),
32
+ onClick: handleCopySummaryClick,
33
+ testId: `${testId}-copy-summary-action`,
34
+ tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, tooltipMessage)
35
+ }, props));
36
+ }