@atlaskit/smart-card 26.48.4 → 26.48.6

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 (51) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/constants.js +3 -1
  3. package/dist/cjs/messages.js +5 -0
  4. package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +37 -26
  5. package/dist/cjs/utils/analytics/analytics.js +1 -1
  6. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.js +1 -1
  7. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +11 -5
  8. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +6 -1
  9. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.js +54 -0
  10. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.js +6 -7
  11. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +6 -0
  12. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +21 -11
  13. package/dist/cjs/view/LinkUrl/index.js +1 -1
  14. package/dist/cjs/view/common/ai-summary/index.js +23 -5
  15. package/dist/es2019/constants.js +2 -0
  16. package/dist/es2019/messages.js +5 -0
  17. package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +21 -14
  18. package/dist/es2019/utils/analytics/analytics.js +1 -1
  19. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.js +1 -1
  20. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +11 -10
  21. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +6 -1
  22. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.js +46 -0
  23. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.js +6 -7
  24. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +6 -0
  25. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +25 -14
  26. package/dist/es2019/view/LinkUrl/index.js +1 -1
  27. package/dist/es2019/view/common/ai-summary/index.js +19 -9
  28. package/dist/esm/constants.js +2 -0
  29. package/dist/esm/messages.js +5 -0
  30. package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +37 -26
  31. package/dist/esm/utils/analytics/analytics.js +1 -1
  32. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.js +1 -1
  33. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +11 -5
  34. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +6 -1
  35. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.js +47 -0
  36. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.js +6 -7
  37. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +6 -0
  38. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +23 -13
  39. package/dist/esm/view/LinkUrl/index.js +1 -1
  40. package/dist/esm/view/common/ai-summary/index.js +22 -5
  41. package/dist/types/constants.d.ts +1 -0
  42. package/dist/types/messages.d.ts +1 -1
  43. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.d.ts +4 -0
  44. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +2 -0
  45. package/dist/types/view/common/ai-summary/index.d.ts +3 -1
  46. package/dist/types-ts4.5/constants.d.ts +1 -0
  47. package/dist/types-ts4.5/messages.d.ts +1 -1
  48. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.d.ts +4 -0
  49. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +2 -0
  50. package/dist/types-ts4.5/view/common/ai-summary/index.d.ts +3 -1
  51. package/package.json +5 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 26.48.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#77644](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/77644) [`781a14e5ab00`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/781a14e5ab00) - Add generic AI summary error message
8
+
9
+ ## 26.48.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [#77953](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/77953) [`484ed33c13bd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/484ed33c13bd) - AI summary: Set generic error state
14
+ - [#76006](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/76006) [`2798568fef46`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2798568fef46) - AI Summary: Add AI icon after the summary
15
+
3
16
  ## 26.48.4
4
17
 
5
18
  ### Patch Changes
@@ -3,10 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.SmartLinkWidth = exports.SmartLinkTheme = exports.SmartLinkStatus = exports.SmartLinkSize = exports.SmartLinkPosition = exports.SmartLinkInternalTheme = exports.SmartLinkDirection = exports.SmartLinkAlignment = exports.MediaType = exports.MediaPlacement = exports.IconType = exports.ElementName = exports.CardDisplay = exports.CONTENT_URL_SECURITY_AND_PERMISSIONS = exports.CONTENT_URL_AI = exports.CONTENT_URL_3P_ACCOUNT_AUTH = exports.ActionName = void 0;
6
+ exports.SmartLinkWidth = exports.SmartLinkTheme = exports.SmartLinkStatus = exports.SmartLinkSize = exports.SmartLinkPosition = exports.SmartLinkInternalTheme = exports.SmartLinkDirection = exports.SmartLinkAlignment = exports.MediaType = exports.MediaPlacement = exports.IconType = exports.ElementName = exports.CardDisplay = exports.CONTENT_URL_SECURITY_AND_PERMISSIONS = exports.CONTENT_URL_AI_TROUBLESHOOTING = exports.CONTENT_URL_AI = exports.CONTENT_URL_3P_ACCOUNT_AUTH = exports.ActionName = void 0;
7
7
  var CONTENT_URL_SECURITY_AND_PERMISSIONS = exports.CONTENT_URL_SECURITY_AND_PERMISSIONS = 'https://support.atlassian.com/confluence-cloud/docs/insert-links-and-anchors/#Smart-links';
8
8
  var CONTENT_URL_3P_ACCOUNT_AUTH = exports.CONTENT_URL_3P_ACCOUNT_AUTH = 'https://support.atlassian.com/confluence-cloud/docs/what-data-is-sent-and-received-when-pasting-a-smart-link/';
9
9
  var CONTENT_URL_AI = exports.CONTENT_URL_AI = 'https://www.atlassian.com/trust/atlassian-intelligence';
10
+ var CONTENT_URL_AI_TROUBLESHOOTING = exports.CONTENT_URL_AI_TROUBLESHOOTING = 'https://support.atlassian.com/organization-administration/docs/troubleshooting-for-atlassian-intelligence/';
11
+
10
12
  /**
11
13
  * The alignment of Flexible UI component.
12
14
  */
@@ -36,6 +36,11 @@ var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
36
36
  defaultMessage: 'Atlassian Intelligence is working...',
37
37
  description: 'Shown when AI summary is summarising the link resource content.'
38
38
  },
39
+ ai_summary_error_generic: {
40
+ id: 'fabric.linking.ai_summary_error_generic',
41
+ defaultMessage: "Atlassian Intelligence can't provide a response right now. Read more <a>in our support documentation</a>.",
42
+ description: 'Shown when AI summary is summarising the link resource content.'
43
+ },
39
44
  assigned_to: {
40
45
  id: 'fabric.linking.assigned_to',
41
46
  defaultMessage: 'Assigned to {context}',
@@ -118,21 +118,22 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
118
118
  } finally {
119
119
  _iterator2.f();
120
120
  }
121
- _context2.next = 6;
121
+ _context2.prev = 4;
122
+ _context2.next = 7;
122
123
  return this.fetchStream(summaryStyle);
123
- case 6:
124
+ case 7:
124
125
  stream = _context2.sent;
125
126
  bufferContent = '';
126
127
  _iteratorAbruptCompletion = false;
127
128
  _didIteratorError = false;
128
- _context2.prev = 10;
129
+ _context2.prev = 11;
129
130
  _iterator = _asyncIterator(stream);
130
- case 12:
131
- _context2.next = 14;
131
+ case 13:
132
+ _context2.next = 15;
132
133
  return _iterator.next();
133
- case 14:
134
+ case 15:
134
135
  if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
135
- _context2.next = 20;
136
+ _context2.next = 21;
136
137
  break;
137
138
  }
138
139
  chunk = _step.value;
@@ -152,43 +153,53 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
152
153
  _iterator3.f();
153
154
  }
154
155
  }
155
- case 17:
156
+ case 18:
156
157
  _iteratorAbruptCompletion = false;
157
- _context2.next = 12;
158
+ _context2.next = 13;
158
159
  break;
159
- case 20:
160
- _context2.next = 26;
160
+ case 21:
161
+ _context2.next = 27;
161
162
  break;
162
- case 22:
163
- _context2.prev = 22;
164
- _context2.t0 = _context2["catch"](10);
163
+ case 23:
164
+ _context2.prev = 23;
165
+ _context2.t0 = _context2["catch"](11);
165
166
  _didIteratorError = true;
166
167
  _iteratorError = _context2.t0;
167
- case 26:
168
- _context2.prev = 26;
168
+ case 27:
169
169
  _context2.prev = 27;
170
+ _context2.prev = 28;
170
171
  if (!(_iteratorAbruptCompletion && _iterator.return != null)) {
171
- _context2.next = 31;
172
+ _context2.next = 32;
172
173
  break;
173
174
  }
174
- _context2.next = 31;
175
+ _context2.next = 32;
175
176
  return _iterator.return();
176
- case 31:
177
- _context2.prev = 31;
177
+ case 32:
178
+ _context2.prev = 32;
178
179
  if (!_didIteratorError) {
179
- _context2.next = 34;
180
+ _context2.next = 35;
180
181
  break;
181
182
  }
182
183
  throw _iteratorError;
183
- case 34:
184
- return _context2.finish(31);
185
184
  case 35:
186
- return _context2.finish(26);
185
+ return _context2.finish(32);
187
186
  case 36:
187
+ return _context2.finish(27);
188
+ case 37:
188
189
  this.state = {
189
190
  status: 'done',
190
191
  content: bufferContent
191
192
  };
193
+ _context2.next = 43;
194
+ break;
195
+ case 40:
196
+ _context2.prev = 40;
197
+ _context2.t1 = _context2["catch"](4);
198
+ this.state = {
199
+ status: 'error',
200
+ content: ''
201
+ };
202
+ case 43:
192
203
  _iterator4 = _createForOfIteratorHelper(this.subscribedStateSetters);
193
204
  try {
194
205
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
@@ -200,11 +211,11 @@ var AISummaryService = exports.AISummaryService = /*#__PURE__*/function () {
200
211
  } finally {
201
212
  _iterator4.f();
202
213
  }
203
- case 39:
214
+ case 45:
204
215
  case "end":
205
216
  return _context2.stop();
206
217
  }
207
- }, _callee2, this, [[10, 22, 26, 36], [27,, 31, 35]]);
218
+ }, _callee2, this, [[4, 40], [11, 23, 27, 37], [28,, 32, 36]]);
208
219
  }));
209
220
  function summariseUrl() {
210
221
  return _summariseUrl.apply(this, arguments);
@@ -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.48.4"
25
+ packageVersion: "26.48.6"
26
26
  };
27
27
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
28
28
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -18,7 +18,7 @@ var AIIndicatorContainer = function AIIndicatorContainer(_ref) {
18
18
  content = _ref.content,
19
19
  testId = _ref.testId;
20
20
  return /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
21
- alignBlock: "center",
21
+ alignBlock: "start",
22
22
  alignInline: "start",
23
23
  space: "space.050",
24
24
  xcss: contentStyles,
@@ -7,28 +7,34 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
10
  var _react = _interopRequireDefault(require("react"));
12
11
  var _styled = _interopRequireDefault(require("@emotion/styled"));
13
12
  var _tooltip = _interopRequireWildcard(require("@atlaskit/tooltip"));
14
13
  var _primitives = require("@atlaskit/primitives");
15
- var _templateObject;
16
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
15
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
18
- var AIIndicatorTooltipPrimitive = (0, _styled.default)(_tooltip.TooltipPrimitive)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n border-radius: ", ";\n background-color: ", ";\n box-shadow: ", ";\n box-sizing: content-box;\n padding: ", ";\n max-width: 350px;\n"])), "var(--ds-border-radius, 3px)", "var(--ds-surface-raised, white)", "var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))", "var(--ds-space-200, 16px)");
16
+ var AIIndicatorTooltipPrimitive = (0, _styled.default)(_tooltip.TooltipPrimitive)({
17
+ borderRadius: "var(--ds-border-radius, 3px)",
18
+ backgroundColor: "var(--ds-surface-raised, white)",
19
+ boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))",
20
+ boxSizing: 'content-box',
21
+ padding: "var(--ds-space-200, 16px)",
22
+ maxWidth: '350px'
23
+ });
19
24
  var triggerStyles = (0, _primitives.xcss)({
20
25
  display: 'inline-flex'
21
26
  });
22
27
  var AIIndicatorTooltip = function AIIndicatorTooltip(_ref) {
23
28
  var content = _ref.content,
24
- trigger = _ref.trigger;
29
+ trigger = _ref.trigger,
30
+ overrideXcss = _ref.xcss;
25
31
  return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
26
32
  component: AIIndicatorTooltipPrimitive,
27
33
  content: content,
28
34
  tag: "span"
29
35
  }, function (tooltipProps) {
30
36
  return /*#__PURE__*/_react.default.createElement(_primitives.Box, (0, _extends2.default)({
31
- xcss: triggerStyles
37
+ xcss: [triggerStyles, overrideXcss]
32
38
  }, tooltipProps), trigger);
33
39
  });
34
40
  };
@@ -49,6 +49,10 @@ var iconTooltipDescStyles = (0, _primitives.xcss)({
49
49
  fontWeight: '400',
50
50
  lineHeight: '14px'
51
51
  });
52
+ var iconTooltipTriggerStyles = (0, _primitives.xcss)({
53
+ position: 'relative',
54
+ bottom: 'space.negative.050'
55
+ });
52
56
  var AIStateDone = function AIStateDone(_ref) {
53
57
  var appearance = _ref.appearance,
54
58
  testId = _ref.testId;
@@ -81,7 +85,8 @@ var AIStateDone = function AIStateDone(_ref) {
81
85
  }
82
86
  }
83
87
  }))))),
84
- trigger: icon
88
+ trigger: icon,
89
+ xcss: iconTooltipTriggerStyles
85
90
  });
86
91
  default:
87
92
  return (0, _react2.jsx)(_aiIndicatorContainer.default, {
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _reactIntlNext = require("react-intl-next");
11
+ var _error = _interopRequireDefault(require("@atlaskit/icon/glyph/error"));
12
+ var _primitives = require("@atlaskit/primitives");
13
+ var _messages = require("../../../../../../messages");
14
+ var _aiIndicatorContainer = _interopRequireDefault(require("./ai-indicator-container"));
15
+ var _aiLearnMoreAnchor = _interopRequireDefault(require("./ai-learn-more-anchor"));
16
+ var _constants = require("../../../../../../constants");
17
+ var contentStyles = (0, _primitives.xcss)({
18
+ color: 'color.text.subtle',
19
+ fontSize: '11px',
20
+ fontStyle: 'normal',
21
+ fontWeight: '400',
22
+ lineHeight: '14px'
23
+ });
24
+ var AIStateError = function AIStateError(_ref) {
25
+ var appearance = _ref.appearance,
26
+ testId = _ref.testId;
27
+ switch (appearance) {
28
+ case 'icon-only':
29
+ return null;
30
+ default:
31
+ return /*#__PURE__*/_react.default.createElement(_aiIndicatorContainer.default, {
32
+ icon: /*#__PURE__*/_react.default.createElement(_error.default, {
33
+ primaryColor: "var(--ds-icon-danger, #C9372C)",
34
+ label: "AI",
35
+ size: "small",
36
+ testId: "".concat(testId, "-error-icon")
37
+ }),
38
+ content: /*#__PURE__*/_react.default.createElement(_primitives.Box, {
39
+ testId: "".concat(testId, "-error-message"),
40
+ xcss: contentStyles
41
+ }, /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.messages.ai_summary_error_generic, {
42
+ values: {
43
+ a: function a(chunks) {
44
+ return /*#__PURE__*/_react.default.createElement(_aiLearnMoreAnchor.default, {
45
+ href: _constants.CONTENT_URL_AI_TROUBLESHOOTING
46
+ }, chunks);
47
+ }
48
+ }
49
+ }))),
50
+ testId: "".concat(testId, "-error")
51
+ });
52
+ }
53
+ };
54
+ var _default = exports.default = AIStateError;
@@ -14,17 +14,16 @@ var _aiIndicatorContainer = _interopRequireDefault(require("./ai-indicator-conta
14
14
  var AIStateLoading = function AIStateLoading(_ref) {
15
15
  var appearance = _ref.appearance,
16
16
  testId = _ref.testId;
17
- var icon = /*#__PURE__*/_react.default.createElement(_aiIconLoading.default, {
18
- label: "AI",
19
- size: "small",
20
- testId: "".concat(testId, "-loading-icon")
21
- });
22
17
  switch (appearance) {
23
18
  case 'icon-only':
24
- return icon;
19
+ return null;
25
20
  default:
26
21
  return /*#__PURE__*/_react.default.createElement(_aiIndicatorContainer.default, {
27
- icon: icon,
22
+ icon: /*#__PURE__*/_react.default.createElement(_aiIconLoading.default, {
23
+ label: "AI",
24
+ size: "small",
25
+ testId: "".concat(testId, "-loading-icon")
26
+ }),
28
27
  content: /*#__PURE__*/_react.default.createElement(_primitives.Box, {
29
28
  testId: "".concat(testId, "-loading-message")
30
29
  }, /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.ai_summarizing)),
@@ -9,6 +9,7 @@ var _react = require("@emotion/react");
9
9
  var _react2 = _interopRequireDefault(require("react"));
10
10
  var _aiStateLoading = _interopRequireDefault(require("./ai-state-loading"));
11
11
  var _aiStateDone = _interopRequireDefault(require("./ai-state-done"));
12
+ var _aiStateError = _interopRequireDefault(require("./ai-state-error"));
12
13
  /** @jsx jsx */
13
14
 
14
15
  var AIStateIndicator = function AIStateIndicator(_ref) {
@@ -18,6 +19,11 @@ var AIStateIndicator = function AIStateIndicator(_ref) {
18
19
  _ref$testId = _ref.testId,
19
20
  testId = _ref$testId === void 0 ? 'ai-state-indicator' : _ref$testId;
20
21
  switch (state) {
22
+ case 'error':
23
+ return (0, _react.jsx)(_aiStateError.default, {
24
+ appearance: appearance,
25
+ testId: testId
26
+ });
21
27
  case 'loading':
22
28
  return (0, _react.jsx)(_aiStateLoading.default, {
23
29
  appearance: appearance,
@@ -19,21 +19,21 @@ var _elementGroup = _interopRequireDefault(require("../../element-group"));
19
19
  var _aiStateIndicator = _interopRequireDefault(require("../ai-state-indicator"));
20
20
  var _utils = require("../../utils");
21
21
  var _messages = require("../../../../../../messages");
22
- var _aiIcon = _interopRequireDefault(require("../../../../../common/ai-icon"));
23
- var _aiSummary = _interopRequireDefault(require("../../../../../common/ai-summary"));
24
22
  var _useAiSummary = require("../../../../../../state/hooks/use-ai-summary");
25
23
  var _flexibleUiContext = require("../../../../../../state/flexible-ui-context");
24
+ var _aiIcon = _interopRequireDefault(require("../../../../../common/ai-icon"));
25
+ var _aiSummary = _interopRequireDefault(require("../../../../../common/ai-summary"));
26
26
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
27
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
28
28
  var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
29
29
  var _props$actions = props.actions,
30
30
  actions = _props$actions === void 0 ? [] : _props$actions,
31
31
  metadata = props.metadata,
32
- testId = props.testId,
33
32
  onActionMenuOpenChange = props.onActionMenuOpenChange,
34
33
  onAIActionChange = props.onAIActionChange,
35
34
  _props$size = props.size,
36
- size = _props$size === void 0 ? _constants.SmartLinkSize.Medium : _props$size;
35
+ size = _props$size === void 0 ? _constants.SmartLinkSize.Medium : _props$size,
36
+ testId = props.testId;
37
37
  var _useState = (0, _react.useState)('ready'),
38
38
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
39
39
  aiState = _useState2[0],
@@ -44,7 +44,10 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
44
44
  var aiSummary = (0, _useAiSummary.useAISummary)({
45
45
  url: url
46
46
  });
47
- var content = aiSummary.state.content;
47
+ var _aiSummary$state = aiSummary.state,
48
+ content = _aiSummary$state.content,
49
+ status = _aiSummary$state.status,
50
+ isSummarisedOnMount = aiSummary.isSummarisedOnMount;
48
51
  var onAIActionClick = (0, _react.useCallback)(function () {
49
52
  setAIState('loading');
50
53
  if (onAIActionChange) {
@@ -59,7 +62,7 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
59
62
  onClick: onAIActionClick,
60
63
  testId: "".concat(testId, "-ai-summary-action"),
61
64
  icon: /*#__PURE__*/_react.default.createElement(_aiIcon.default, {
62
- label: "AiIcon"
65
+ label: "AIIcon"
63
66
  })
64
67
  };
65
68
  return [aiAction].concat((0, _toConsumableArray2.default)(actions));
@@ -77,22 +80,29 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
77
80
  direction: _constants.SmartLinkDirection.Vertical,
78
81
  testId: "".concat(testId, "-resolved-view")
79
82
  }), /*#__PURE__*/_react.default.createElement(_aiSummary.default, {
80
- content: content
83
+ content: content,
84
+ showIcon: isSummarisedOnMount
81
85
  }), /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
82
86
  alignBlock: "center",
83
87
  alignInline: "end",
84
88
  grow: "fill",
85
89
  spread: "space-between"
86
- }, /*#__PURE__*/_react.default.createElement(_primitives.Box, null, aiState === 'loading' || aiState === 'done' ? /*#__PURE__*/_react.default.createElement(_aiStateIndicator.default, {
90
+ }, /*#__PURE__*/_react.default.createElement(_primitives.Box, null, !isSummarisedOnMount && (aiState === 'loading' || aiState === 'done') ? /*#__PURE__*/_react.default.createElement(_aiStateIndicator.default, {
87
91
  state: aiState,
88
- testId: testId
92
+ testId: "".concat(testId, "-state-indicator")
89
93
  }) : /*#__PURE__*/_react.default.createElement(_elementGroup.default, {
90
- width: _constants.SmartLinkWidth.FitToContent
94
+ width: _constants.SmartLinkWidth.FitToContent,
95
+ testId: "".concat(testId, "-metadata-group")
91
96
  }, metadataElements)), /*#__PURE__*/_react.default.createElement(_primitives.Box, null, /*#__PURE__*/_react.default.createElement(_actionGroup.default, {
92
97
  onDropdownOpenChange: onDropdownOpenChange,
93
98
  items: combinedActions,
94
99
  appearance: "default",
95
100
  size: size
96
- }))));
101
+ }))), status === 'error' && /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
102
+ grow: "fill"
103
+ }, /*#__PURE__*/_react.default.createElement(_aiStateIndicator.default, {
104
+ state: status,
105
+ testId: testId
106
+ })));
97
107
  };
98
108
  var _default = exports.default = AISummaryBlockResolvedView;
@@ -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.48.4",
20
+ packageVersion: "26.48.6",
21
21
  componentName: 'linkUrl'
22
22
  };
23
23
  var Link = (0, _click.withLinkClickedEvent)('a');
@@ -5,13 +5,25 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
8
  var _react = _interopRequireDefault(require("react"));
10
9
  var _markdownToJsx = _interopRequireDefault(require("markdown-to-jsx"));
11
10
  var _react2 = require("@emotion/react");
12
- var _templateObject;
11
+ var _aiStateIndicator = _interopRequireDefault(require("../../FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator"));
13
12
  /** @jsx jsx */
14
- var AISummaryCSS = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n overflow-y: auto;\n font-size: 0.75rem;\n line-height: 1rem;\n word-wrap: break-word;\n white-space: normal;\n"])));
13
+
14
+ var AITooltipIcon = function AITooltipIcon() {
15
+ return (0, _react2.jsx)(_aiStateIndicator.default, {
16
+ appearance: "icon-only",
17
+ state: "done",
18
+ testId: "ai-tooltip"
19
+ });
20
+ };
21
+ var AISummaryCSS = (0, _react2.css)({
22
+ fontSize: '0.75rem',
23
+ lineHeight: '1rem',
24
+ wordWrap: 'break-word',
25
+ whiteSpace: 'normal'
26
+ });
15
27
  /**
16
28
  * A component to render a response from AI in markdown text.
17
29
  * @internal
@@ -20,6 +32,9 @@ var AISummaryCSS = (0, _react2.css)(_templateObject || (_templateObject = (0, _t
20
32
 
21
33
  var AISummary = function AISummary(_ref) {
22
34
  var content = _ref.content,
35
+ _ref$showIcon = _ref.showIcon,
36
+ showIcon = _ref$showIcon === void 0 ? false : _ref$showIcon,
37
+ iconComponent = _ref.iconComponent,
23
38
  overrideCss = _ref.overrideCss,
24
39
  _ref$testId = _ref.testId,
25
40
  testId = _ref$testId === void 0 ? 'ai-summary' : _ref$testId;
@@ -29,9 +44,12 @@ var AISummary = function AISummary(_ref) {
29
44
  return (0, _react2.jsx)(_markdownToJsx.default, {
30
45
  "data-testid": testId,
31
46
  css: [AISummaryCSS, overrideCss],
32
- children: content,
47
+ children: showIcon ? "".concat(content, " <Icon />") : content,
33
48
  options: {
34
- forceWrapper: true
49
+ forceWrapper: true,
50
+ overrides: {
51
+ Icon: iconComponent !== null && iconComponent !== void 0 ? iconComponent : AITooltipIcon
52
+ }
35
53
  }
36
54
  });
37
55
  };
@@ -1,6 +1,8 @@
1
1
  export const CONTENT_URL_SECURITY_AND_PERMISSIONS = 'https://support.atlassian.com/confluence-cloud/docs/insert-links-and-anchors/#Smart-links';
2
2
  export const CONTENT_URL_3P_ACCOUNT_AUTH = 'https://support.atlassian.com/confluence-cloud/docs/what-data-is-sent-and-received-when-pasting-a-smart-link/';
3
3
  export const CONTENT_URL_AI = 'https://www.atlassian.com/trust/atlassian-intelligence';
4
+ export const CONTENT_URL_AI_TROUBLESHOOTING = 'https://support.atlassian.com/organization-administration/docs/troubleshooting-for-atlassian-intelligence/';
5
+
4
6
  /**
5
7
  * The alignment of Flexible UI component.
6
8
  */
@@ -30,6 +30,11 @@ export const messages = defineMessages({
30
30
  defaultMessage: 'Atlassian Intelligence is working...',
31
31
  description: 'Shown when AI summary is summarising the link resource content.'
32
32
  },
33
+ ai_summary_error_generic: {
34
+ id: 'fabric.linking.ai_summary_error_generic',
35
+ defaultMessage: "Atlassian Intelligence can't provide a response right now. Read more <a>in our support documentation</a>.",
36
+ description: 'Shown when AI summary is summarising the link resource content.'
37
+ },
33
38
  assigned_to: {
34
39
  id: 'fabric.linking.assigned_to',
35
40
  defaultMessage: 'Assigned to {context}',
@@ -50,23 +50,30 @@ export class AISummaryService {
50
50
  for (const subscriber of this.subscribedStateSetters) {
51
51
  subscriber(this.state);
52
52
  }
53
- const stream = await this.fetchStream(summaryStyle);
54
- let bufferContent = '';
55
- for await (const chunk of stream) {
56
- if (chunk.type === 'ANSWER_PART') {
57
- bufferContent += chunk.message.content;
58
- for (const subscriber of this.subscribedStateSetters) {
59
- subscriber({
60
- ...this.state,
61
- content: bufferContent
62
- });
53
+ try {
54
+ const stream = await this.fetchStream(summaryStyle);
55
+ let bufferContent = '';
56
+ for await (const chunk of stream) {
57
+ if (chunk.type === 'ANSWER_PART') {
58
+ bufferContent += chunk.message.content;
59
+ for (const subscriber of this.subscribedStateSetters) {
60
+ subscriber({
61
+ ...this.state,
62
+ content: bufferContent
63
+ });
64
+ }
63
65
  }
64
66
  }
67
+ this.state = {
68
+ status: 'done',
69
+ content: bufferContent
70
+ };
71
+ } catch {
72
+ this.state = {
73
+ status: 'error',
74
+ content: ''
75
+ };
65
76
  }
66
- this.state = {
67
- status: 'done',
68
- content: bufferContent
69
- };
70
77
  for (const subscriber of this.subscribedStateSetters) {
71
78
  subscriber(this.state);
72
79
  }
@@ -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.48.4"
7
+ packageVersion: "26.48.6"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -12,7 +12,7 @@ const AIIndicatorContainer = ({
12
12
  testId
13
13
  }) => {
14
14
  return /*#__PURE__*/React.createElement(Inline, {
15
- alignBlock: "center",
15
+ alignBlock: "start",
16
16
  alignInline: "start",
17
17
  space: "space.050",
18
18
  xcss: contentStyles,
@@ -3,27 +3,28 @@ import React from 'react';
3
3
  import styled from '@emotion/styled';
4
4
  import Tooltip, { TooltipPrimitive } from '@atlaskit/tooltip';
5
5
  import { Box, xcss } from '@atlaskit/primitives';
6
- const AIIndicatorTooltipPrimitive = styled(TooltipPrimitive)`
7
- border-radius: ${"var(--ds-border-radius, 3px)"};
8
- background-color: ${"var(--ds-surface-raised, white)"};
9
- box-shadow: ${"var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))"};
10
- box-sizing: content-box;
11
- padding: ${"var(--ds-space-200, 16px)"};
12
- max-width: 350px;
13
- `;
6
+ const AIIndicatorTooltipPrimitive = styled(TooltipPrimitive)({
7
+ borderRadius: "var(--ds-border-radius, 3px)",
8
+ backgroundColor: "var(--ds-surface-raised, white)",
9
+ boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))",
10
+ boxSizing: 'content-box',
11
+ padding: "var(--ds-space-200, 16px)",
12
+ maxWidth: '350px'
13
+ });
14
14
  const triggerStyles = xcss({
15
15
  display: 'inline-flex'
16
16
  });
17
17
  const AIIndicatorTooltip = ({
18
18
  content,
19
- trigger
19
+ trigger,
20
+ xcss: overrideXcss
20
21
  }) => {
21
22
  return /*#__PURE__*/React.createElement(Tooltip, {
22
23
  component: AIIndicatorTooltipPrimitive,
23
24
  content: content,
24
25
  tag: "span"
25
26
  }, tooltipProps => /*#__PURE__*/React.createElement(Box, _extends({
26
- xcss: triggerStyles
27
+ xcss: [triggerStyles, overrideXcss]
27
28
  }, tooltipProps), trigger));
28
29
  };
29
30
  export default AIIndicatorTooltip;
@@ -41,6 +41,10 @@ const iconTooltipDescStyles = xcss({
41
41
  fontWeight: '400',
42
42
  lineHeight: '14px'
43
43
  });
44
+ const iconTooltipTriggerStyles = xcss({
45
+ position: 'relative',
46
+ bottom: 'space.negative.050'
47
+ });
44
48
  const AIStateDone = ({
45
49
  appearance,
46
50
  testId
@@ -72,7 +76,8 @@ const AIStateDone = ({
72
76
  }, chunks)
73
77
  }
74
78
  }))))),
75
- trigger: icon
79
+ trigger: icon,
80
+ xcss: iconTooltipTriggerStyles
76
81
  });
77
82
  default:
78
83
  return jsx(AIIndicatorContainer, {