@atlaskit/smart-card 26.50.10 → 26.50.12

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 (79) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/constants.js +2 -1
  3. package/dist/cjs/messages.js +5 -0
  4. package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +16 -5
  5. package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/types.js +7 -1
  6. package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/utils.js +47 -41
  7. package/dist/cjs/utils/analytics/analytics.js +1 -1
  8. package/dist/cjs/view/BlockCard/views/flexible/FlexibleErroredView.js +1 -0
  9. package/dist/cjs/view/BlockCard/views/flexible/FlexibleForbiddenView.js +1 -1
  10. package/dist/cjs/view/BlockCard/views/flexible/FlexibleNotFoundView.js +2 -1
  11. package/dist/cjs/view/BlockCard/views/flexible/styled.js +31 -7
  12. package/dist/cjs/view/BlockCard/views/flexible/unresolved-view/index.js +7 -1
  13. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-error-viewed/index.js +6 -3
  14. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.js +38 -12
  15. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +4 -2
  16. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +6 -2
  17. package/dist/cjs/view/HoverCard/components/ContentContainer.js +1 -1
  18. package/dist/cjs/view/HoverCard/styled.js +23 -8
  19. package/dist/cjs/view/LinkUrl/index.js +1 -1
  20. package/dist/cjs/view/common/ai-prism/index.js +11 -4
  21. package/dist/es2019/constants.js +1 -0
  22. package/dist/es2019/messages.js +5 -0
  23. package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +8 -2
  24. package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/types.js +1 -0
  25. package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/utils.js +16 -12
  26. package/dist/es2019/utils/analytics/analytics.js +1 -1
  27. package/dist/es2019/view/BlockCard/views/flexible/FlexibleErroredView.js +1 -0
  28. package/dist/es2019/view/BlockCard/views/flexible/FlexibleForbiddenView.js +1 -1
  29. package/dist/es2019/view/BlockCard/views/flexible/FlexibleNotFoundView.js +2 -1
  30. package/dist/es2019/view/BlockCard/views/flexible/styled.js +25 -31
  31. package/dist/es2019/view/BlockCard/views/flexible/unresolved-view/index.js +7 -1
  32. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-error-viewed/index.js +7 -3
  33. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.js +35 -9
  34. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +4 -2
  35. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +6 -2
  36. package/dist/es2019/view/HoverCard/components/ContentContainer.js +1 -1
  37. package/dist/es2019/view/HoverCard/styled.js +19 -20
  38. package/dist/es2019/view/LinkUrl/index.js +1 -1
  39. package/dist/es2019/view/common/ai-prism/index.js +12 -5
  40. package/dist/esm/constants.js +1 -0
  41. package/dist/esm/messages.js +5 -0
  42. package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +16 -5
  43. package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/types.js +1 -0
  44. package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/utils.js +47 -41
  45. package/dist/esm/utils/analytics/analytics.js +1 -1
  46. package/dist/esm/view/BlockCard/views/flexible/FlexibleErroredView.js +1 -0
  47. package/dist/esm/view/BlockCard/views/flexible/FlexibleForbiddenView.js +1 -1
  48. package/dist/esm/view/BlockCard/views/flexible/FlexibleNotFoundView.js +2 -1
  49. package/dist/esm/view/BlockCard/views/flexible/styled.js +31 -6
  50. package/dist/esm/view/BlockCard/views/flexible/unresolved-view/index.js +7 -1
  51. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-error-viewed/index.js +6 -3
  52. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.js +39 -13
  53. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +4 -2
  54. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +6 -2
  55. package/dist/esm/view/HoverCard/components/ContentContainer.js +1 -1
  56. package/dist/esm/view/HoverCard/styled.js +23 -8
  57. package/dist/esm/view/LinkUrl/index.js +1 -1
  58. package/dist/esm/view/common/ai-prism/index.js +12 -5
  59. package/dist/types/common/analytics/generated/analytics.types.d.ts +3 -1
  60. package/dist/types/constants.d.ts +1 -0
  61. package/dist/types/messages.d.ts +1 -1
  62. package/dist/types/state/hooks/use-ai-summary/ai-summary-service/index.d.ts +2 -1
  63. package/dist/types/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +4 -1
  64. package/dist/types/state/hooks/use-ai-summary/index.d.ts +2 -5
  65. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-error-viewed/index.d.ts +3 -1
  66. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +2 -1
  67. package/dist/types/view/FlexibleCard/components/elements/text/types.d.ts +1 -1
  68. package/dist/types/view/HoverCard/styled.d.ts +1 -1
  69. package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +3 -1
  70. package/dist/types-ts4.5/constants.d.ts +1 -0
  71. package/dist/types-ts4.5/messages.d.ts +1 -1
  72. package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/index.d.ts +2 -1
  73. package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +14 -1
  74. package/dist/types-ts4.5/state/hooks/use-ai-summary/index.d.ts +2 -5
  75. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-error-viewed/index.d.ts +3 -1
  76. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +2 -1
  77. package/dist/types-ts4.5/view/FlexibleCard/components/elements/text/types.d.ts +1 -1
  78. package/dist/types-ts4.5/view/HoverCard/styled.d.ts +1 -1
  79. package/package.json +5 -5
@@ -9,27 +9,27 @@ export function readStream(_x) {
9
9
  }
10
10
  function _readStream() {
11
11
  _readStream = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(response) {
12
- var reader, doneStreaming, chunkBuffer, _yield$_awaitAsyncGen, value, done, processedChunks, _iterator, _step, chunk, error, _error;
12
+ var reader, doneStreaming, chunkBuffer, chunkTypeErrorMessage, _yield$_awaitAsyncGen, value, done, processedChunks, _iterator, _step, chunk, jsonChunk, error;
13
13
  return _regeneratorRuntime.wrap(function _callee$(_context) {
14
14
  while (1) switch (_context.prev = _context.next) {
15
15
  case 0:
16
16
  reader = getBufferReader(response);
17
17
  doneStreaming = false;
18
18
  chunkBuffer = '';
19
- case 3:
20
- _context.prev = 3;
21
- _context.next = 6;
19
+ chunkTypeErrorMessage = 'jsonChunkType error';
20
+ case 4:
21
+ _context.prev = 4;
22
+ _context.next = 7;
22
23
  return _awaitAsyncGenerator(reader.read());
23
- case 6:
24
+ case 7:
24
25
  _yield$_awaitAsyncGen = _context.sent;
25
26
  value = _yield$_awaitAsyncGen.value;
26
27
  done = _yield$_awaitAsyncGen.done;
27
28
  doneStreaming = done;
28
29
  if (!value) {
29
- _context.next = 43;
30
+ _context.next = 42;
30
31
  break;
31
32
  }
32
- _context.prev = 11;
33
33
  processedChunks = "".concat(chunkBuffer).concat(value).split('\n'); // assumes that all JSON chunks are separated by a new-line;
34
34
  chunkBuffer = '';
35
35
  _iterator = _createForOfIteratorHelper(processedChunks);
@@ -37,61 +37,67 @@ function _readStream() {
37
37
  _iterator.s();
38
38
  case 17:
39
39
  if ((_step = _iterator.n()).done) {
40
- _context.next = 29;
40
+ _context.next = 34;
41
41
  break;
42
42
  }
43
43
  chunk = _step.value;
44
44
  _context.prev = 19;
45
- _context.next = 22;
46
- return JSON.parse(chunk);
47
- case 22:
48
- _context.next = 27;
45
+ jsonChunk = JSON.parse(chunk);
46
+ if (!(jsonChunk.type === 'ERROR')) {
47
+ _context.next = 23;
48
+ break;
49
+ }
50
+ throw new Error(chunkTypeErrorMessage);
51
+ case 23:
52
+ _context.next = 25;
53
+ return jsonChunk;
54
+ case 25:
55
+ _context.next = 32;
49
56
  break;
50
- case 24:
51
- _context.prev = 24;
57
+ case 27:
58
+ _context.prev = 27;
52
59
  _context.t0 = _context["catch"](19);
60
+ if (!(_context.t0 instanceof Error && _context.t0.message === chunkTypeErrorMessage)) {
61
+ _context.next = 31;
62
+ break;
63
+ }
64
+ throw _context.t0;
65
+ case 31:
53
66
  // the chunk may be incomplete, so we'll save it for the next iteration.
54
67
  chunkBuffer = chunk;
55
- case 27:
68
+ case 32:
56
69
  _context.next = 17;
57
70
  break;
58
- case 29:
59
- _context.next = 34;
71
+ case 34:
72
+ _context.next = 39;
60
73
  break;
61
- case 31:
62
- _context.prev = 31;
74
+ case 36:
75
+ _context.prev = 36;
63
76
  _context.t1 = _context["catch"](15);
64
77
  _iterator.e(_context.t1);
65
- case 34:
66
- _context.prev = 34;
67
- _iterator.f();
68
- return _context.finish(34);
69
- case 37:
70
- _context.next = 43;
71
- break;
72
78
  case 39:
73
79
  _context.prev = 39;
74
- _context.t2 = _context["catch"](11);
75
- error = new Error("Error Processing Stream Data: ".concat(value));
76
- throw error;
77
- case 43:
80
+ _iterator.f();
81
+ return _context.finish(39);
82
+ case 42:
78
83
  _context.next = 52;
79
84
  break;
80
- case 45:
81
- _context.prev = 45;
82
- _context.t3 = _context["catch"](3);
83
- if (!(_context.t3 instanceof DOMException && _context.t3.name === 'AbortError')) {
84
- _context.next = 51;
85
+ case 44:
86
+ _context.prev = 44;
87
+ _context.t2 = _context["catch"](4);
88
+ if (!(_context.t2 instanceof DOMException && _context.t2.name === 'AbortError')) {
89
+ _context.next = 50;
85
90
  break;
86
91
  }
87
92
  doneStreaming = true;
88
93
  _context.next = 52;
89
94
  break;
90
- case 51:
91
- throw _context.t3;
95
+ case 50:
96
+ reader.cancel();
97
+ throw _context.t2;
92
98
  case 52:
93
99
  if (!doneStreaming) {
94
- _context.next = 3;
100
+ _context.next = 4;
95
101
  break;
96
102
  }
97
103
  case 53:
@@ -99,13 +105,13 @@ function _readStream() {
99
105
  _context.next = 56;
100
106
  break;
101
107
  }
102
- _error = new Error("Not all the data was processed: ".concat(chunkBuffer));
103
- throw _error;
108
+ error = new Error("Not all the data was processed: ".concat(chunkBuffer));
109
+ throw error;
104
110
  case 56:
105
111
  case "end":
106
112
  return _context.stop();
107
113
  }
108
- }, _callee, null, [[3, 45], [11, 39], [15, 31, 34, 37], [19, 24]]);
114
+ }, _callee, null, [[4, 44], [15, 36, 39, 42], [19, 27]]);
109
115
  }));
110
116
  return _readStream.apply(this, arguments);
111
117
  }
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
15
15
  export var context = {
16
16
  componentName: 'smart-cards',
17
17
  packageName: "@atlaskit/smart-card",
18
- packageVersion: "26.50.10"
18
+ packageVersion: "26.50.12"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -32,6 +32,7 @@ var FlexibleErroredView = function FlexibleErroredView(_ref) {
32
32
  primaryColor: "var(--ds-icon-warning, ".concat(R300, ")"),
33
33
  testId: "".concat(testId, "-warning-icon")
34
34
  }), /*#__PURE__*/React.createElement(Text, {
35
+ maxLines: 3,
35
36
  message: {
36
37
  descriptor: messages.could_not_load_link
37
38
  }
@@ -82,7 +82,7 @@ var FlexibleForbiddenView = function FlexibleForbiddenView(_ref) {
82
82
  primaryColor: "var(--ds-icon-danger, ".concat(R300, ")"),
83
83
  testId: "".concat(testId, "-lock-icon")
84
84
  }), /*#__PURE__*/React.createElement(Text, {
85
- maxLines: 2,
85
+ maxLines: 3,
86
86
  message: {
87
87
  descriptor: toMessage(messages.invalid_permissions_description, requestAccessContext === null || requestAccessContext === void 0 ? void 0 : requestAccessContext.descriptiveMessageKey),
88
88
  values: messageContext
@@ -50,7 +50,8 @@ var FlexibleNotFoundView = function FlexibleNotFoundView(_ref) {
50
50
  testId: "".concat(testId, "-lock-icon")
51
51
  }), /*#__PURE__*/React.createElement(Text, {
52
52
  message: description,
53
- testId: "".concat(testId, "-message")
53
+ testId: "".concat(testId, "-message"),
54
+ maxLines: 3
54
55
  }));
55
56
  };
56
57
  export default withFlexibleUIBlockCardStyle(FlexibleNotFoundView);
@@ -1,11 +1,36 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
3
1
  import { css } from '@emotion/react';
4
2
  import { N40 } from '@atlaskit/theme/colors';
5
3
 
6
4
  // in editor prosemirror adds padding-left so we need to overwrite it
7
5
  // renderer overwrites the margin-right so we need to add it here
8
- export var metadataBlockCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* primary element group */\n span[data-smart-element-avatar-group] {\n > ul {\n padding-left: 0px;\n margin-right: 0.5rem;\n }\n }\n [data-smart-element-group] {\n line-height: 1rem;\n }\n"])));
9
- export var titleBlockCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n gap: 0.5em;\n\n [data-smart-element='Title'] {\n font-weight: 600;\n }\n"])));
10
- export var footerBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: 1.5rem;\n\n .actions-button-group {\n button,\n button:hover,\n button:focus,\n button:active {\n font-size: 0.875rem;\n }\n }\n"])));
11
- export var flexibleBlockCardStyle = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n & > div {\n border-radius: ", ";\n border: 1px solid ", ";\n }\n"])), "var(--ds-border-radius-200, 8px)", "var(--ds-border, ".concat(N40, ")"));
6
+ export var metadataBlockCss = css({
7
+ 'span[data-smart-element-avatar-group]': {
8
+ '> ul': {
9
+ paddingLeft: '0px',
10
+ marginRight: "var(--ds-space-100, 0.5rem)"
11
+ }
12
+ },
13
+ '[data-smart-element-group]': {
14
+ lineHeight: '1rem'
15
+ }
16
+ });
17
+ export var titleBlockCss = css({
18
+ gap: "var(--ds-space-100, 0.5em)",
19
+ "[data-smart-element='Title']": {
20
+ fontWeight: 600
21
+ }
22
+ });
23
+ export var footerBlockCss = css({
24
+ height: '1.5rem',
25
+ '.actions-button-group': {
26
+ 'button, button:hover, button:focus, button:active': {
27
+ fontSize: '0.875rem'
28
+ }
29
+ }
30
+ });
31
+ export var flexibleBlockCardStyle = css({
32
+ '& > div': {
33
+ borderRadius: "var(--ds-border-radius-200, 8px)",
34
+ border: "1px solid ".concat("var(--ds-border, ".concat(N40, ")"))
35
+ }
36
+ });
@@ -4,6 +4,10 @@ import React from 'react';
4
4
  import FlexibleCard from '../../../../FlexibleCard';
5
5
  import { InternalFooterBlock } from '../../../../FlexibleCard/components/blocks';
6
6
  import { FlexibleCardUiOptions, PreviewBlockOptions, titleBlockOptions, FooterBlockOptions } from '../utils';
7
+ import { css } from '@emotion/react';
8
+ var customBlockStyles = css({
9
+ alignItems: 'flex-start'
10
+ });
7
11
  var UnresolvedView = function UnresolvedView(_ref) {
8
12
  var actions = _ref.actions,
9
13
  cardState = _ref.cardState,
@@ -28,7 +32,9 @@ var UnresolvedView = function UnresolvedView(_ref) {
28
32
  }, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockOptions, {
29
33
  hideIcon: !!title,
30
34
  text: title
31
- })), /*#__PURE__*/React.createElement(CustomBlock, null, children), showPreview && /*#__PURE__*/React.createElement(PreviewBlock, PreviewBlockOptions), /*#__PURE__*/React.createElement(InternalFooterBlock, _extends({}, FooterBlockOptions, {
35
+ })), /*#__PURE__*/React.createElement(CustomBlock, {
36
+ overrideCss: customBlockStyles
37
+ }, children), showPreview && /*#__PURE__*/React.createElement(PreviewBlock, PreviewBlockOptions), /*#__PURE__*/React.createElement(InternalFooterBlock, _extends({}, FooterBlockOptions, {
32
38
  actions: actions,
33
39
  testId: "smart-block-card-footer"
34
40
  })));
@@ -1,11 +1,14 @@
1
1
  import { useEffect } from 'react';
2
2
  import { useAnalyticsEvents } from '../../../../../../common/analytics/generated/use-analytics-events';
3
- var AIEventErrorViewed = function AIEventErrorViewed() {
3
+ var AIEventErrorViewed = function AIEventErrorViewed(_ref) {
4
+ var reason = _ref.reason;
4
5
  var _useAnalyticsEvents = useAnalyticsEvents(),
5
6
  fireEvent = _useAnalyticsEvents.fireEvent;
6
7
  useEffect(function () {
7
- fireEvent('ui.error.viewed.aiSummary', {});
8
- }, [fireEvent]);
8
+ fireEvent('ui.error.viewed.aiSummary', {
9
+ reason: reason
10
+ });
11
+ }, [fireEvent, reason]);
9
12
  return null;
10
13
  };
11
14
  export default AIEventErrorViewed;
@@ -6,7 +6,7 @@ import { Box, xcss } from '@atlaskit/primitives';
6
6
  import { messages } from '../../../../../../messages';
7
7
  import AIIndicatorContainer from './ai-indicator-container';
8
8
  import AILearnMoreAnchor from './ai-learn-more-anchor';
9
- import { CONTENT_URL_AI_TROUBLESHOOTING } from '../../../../../../constants';
9
+ import { CONTENT_URL_ACCEPTABLE_USE_POLICY, CONTENT_URL_AI_TROUBLESHOOTING } from '../../../../../../constants';
10
10
  var contentStyles = xcss({
11
11
  color: 'color.text.subtle',
12
12
  fontSize: '11px',
@@ -14,9 +14,40 @@ var contentStyles = xcss({
14
14
  fontWeight: '400',
15
15
  lineHeight: '14px'
16
16
  });
17
- var AIStateError = function AIStateError(_ref) {
18
- var appearance = _ref.appearance,
19
- testId = _ref.testId;
17
+ var MessageWithAnchor = function MessageWithAnchor(_ref) {
18
+ var message = _ref.message,
19
+ url = _ref.url;
20
+ return /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, message, {
21
+ values: {
22
+ a: function a(chunks) {
23
+ return /*#__PURE__*/React.createElement(AILearnMoreAnchor, {
24
+ href: url
25
+ }, chunks);
26
+ }
27
+ }
28
+ }));
29
+ };
30
+ var getErrorMesssageProps = function getErrorMesssageProps(error) {
31
+ switch (error) {
32
+ case 'ACCEPTABLE_USE_VIOLATIONS':
33
+ return {
34
+ message: messages.ai_summary_error_acceptable_use_violation,
35
+ url: CONTENT_URL_ACCEPTABLE_USE_POLICY
36
+ };
37
+ default:
38
+ return {
39
+ message: messages.ai_summary_error_generic,
40
+ url: CONTENT_URL_AI_TROUBLESHOOTING
41
+ };
42
+ }
43
+ };
44
+ var AIStateError = function AIStateError(_ref2) {
45
+ var appearance = _ref2.appearance,
46
+ testId = _ref2.testId,
47
+ error = _ref2.error;
48
+ var _getErrorMesssageProp = getErrorMesssageProps(error),
49
+ message = _getErrorMesssageProp.message,
50
+ url = _getErrorMesssageProp.url;
20
51
  switch (appearance) {
21
52
  case 'icon-only':
22
53
  return null;
@@ -31,15 +62,10 @@ var AIStateError = function AIStateError(_ref) {
31
62
  content: /*#__PURE__*/React.createElement(Box, {
32
63
  testId: "".concat(testId, "-error-message"),
33
64
  xcss: contentStyles
34
- }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.ai_summary_error_generic, {
35
- values: {
36
- a: function a(chunks) {
37
- return /*#__PURE__*/React.createElement(AILearnMoreAnchor, {
38
- href: CONTENT_URL_AI_TROUBLESHOOTING
39
- }, chunks);
40
- }
41
- }
42
- }))),
65
+ }, /*#__PURE__*/React.createElement(MessageWithAnchor, {
66
+ message: message,
67
+ url: url
68
+ })),
43
69
  testId: "".concat(testId, "-error")
44
70
  });
45
71
  }
@@ -9,12 +9,14 @@ var AIStateIndicator = function AIStateIndicator(_ref) {
9
9
  _ref$appearance = _ref.appearance,
10
10
  appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
11
11
  _ref$testId = _ref.testId,
12
- testId = _ref$testId === void 0 ? 'ai-state-indicator' : _ref$testId;
12
+ testId = _ref$testId === void 0 ? 'ai-state-indicator' : _ref$testId,
13
+ error = _ref.error;
13
14
  switch (state) {
14
15
  case 'error':
15
16
  return jsx(AIStateError, {
16
17
  appearance: appearance,
17
- testId: testId
18
+ testId: testId,
19
+ error: error
18
20
  });
19
21
  case 'loading':
20
22
  return jsx(AIStateLoading, {
@@ -38,7 +38,8 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
38
38
  summariseUrl = _useAISummary.summariseUrl,
39
39
  _useAISummary$state = _useAISummary.state,
40
40
  content = _useAISummary$state.content,
41
- status = _useAISummary$state.status;
41
+ status = _useAISummary$state.status,
42
+ error = _useAISummary$state.error;
42
43
  var showAISummary = status === 'done' ||
43
44
  // We want to display the AI Summary component only when there is content available during the loading process.
44
45
  status === 'loading' && !!content;
@@ -109,7 +110,10 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
109
110
  size: size
110
111
  }))), showAISummaryErrorMessage && /*#__PURE__*/React.createElement(Inline, {
111
112
  grow: "fill"
112
- }, /*#__PURE__*/React.createElement(AIEventErrorViewed, null), /*#__PURE__*/React.createElement(AIStateIndicator, {
113
+ }, /*#__PURE__*/React.createElement(AIEventErrorViewed, {
114
+ reason: error
115
+ }), /*#__PURE__*/React.createElement(AIStateIndicator, {
116
+ error: error,
113
117
  state: status,
114
118
  testId: testId
115
119
  })));
@@ -36,7 +36,7 @@ var ConnectedAIPrismContainer = function ConnectedAIPrismContainer(_ref) {
36
36
  }, [status]);
37
37
  var container = jsx("div", _extends({
38
38
  className: hoverCardClassName,
39
- css: [HoverCardContainer, isAIEnabled && showPrism ? undefined : popupContainerStyles],
39
+ css: [HoverCardContainer, !isAIEnabled ? popupContainerStyles : undefined],
40
40
  "data-testid": testId
41
41
  }, props), children);
42
42
  return isAIEnabled ? jsx(AIPrism, {
@@ -1,5 +1,5 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
2
+ var _templateObject, _templateObject2;
3
3
  import { css } from '@emotion/react';
4
4
  import { loadingPlaceholderClassName } from '../../index';
5
5
  import { SmartLinkSize } from '../../constants';
@@ -16,18 +16,33 @@ export var flexibleUiOptions = {
16
16
  zIndex: HOVER_CARD_Z_INDEX + 1
17
17
  };
18
18
  export var CARD_WIDTH_REM = 24;
19
- export var NEW_CARD_WIDTH_REM = 28;
19
+ export var NEW_CARD_WIDTH_REM = 25;
20
20
  // gap between mouse cursor and hover card
21
21
  export var CARD_GAP_PX = 10;
22
22
  var blockGap = '0.5rem';
23
23
  var elementGap = '0.5rem';
24
- export var separatorCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n [data-separator] + [data-separator]:before {\n margin-right: ", ";\n }\n"])), elementGap);
25
- export var HoverCardContainer = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n background: none;\n border-width: 0;\n box-sizing: border-box;\n width: ", "rem;\n\n .", " {\n display: none;\n }\n"])), getBooleanFF('platform.linking-platform.smart-card.hover-card-ai-summaries') ? NEW_CARD_WIDTH_REM : CARD_WIDTH_REM, loadingPlaceholderClassName);
26
- export var titleBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n gap: ", ";\n\n ", "\n\n // title and subtitle element group\n [data-smart-element-group] {\n // gap between title and subtitle\n gap: 0.06rem;\n display: flex;\n /* subtitle element group */\n > [data-smart-element-group] {\n > span {\n margin-right: ", ";\n }\n }\n }\n\n [data-smart-element='Title'] {\n font-weight: 600;\n }\n"])), blockGap, separatorCss, elementGap);
24
+ export var separatorCss = css({
25
+ '[data-separator] + [data-separator]:before': {
26
+ marginRight: elementGap
27
+ }
28
+ });
29
+ export var HoverCardContainer = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: none;\n border-width: 0;\n box-sizing: border-box;\n width: ", "rem;\n\n .", " {\n display: none;\n }\n"])), getBooleanFF('platform.linking-platform.smart-card.hover-card-ai-summaries') ? NEW_CARD_WIDTH_REM : CARD_WIDTH_REM, loadingPlaceholderClassName);
30
+ export var titleBlockCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n gap: ", ";\n\n ", "\n\n // title and subtitle element group\n [data-smart-element-group] {\n // gap between title and subtitle\n gap: 0.06rem;\n display: flex;\n /* subtitle element group */\n > [data-smart-element-group] {\n > span {\n margin-right: ", ";\n }\n }\n }\n\n [data-smart-element='Title'] {\n font-weight: 600;\n }\n"])), blockGap, separatorCss, elementGap);
27
31
  export var getTransitionStyles = function getTransitionStyles(snippetHeight) {
28
- return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n transition: height 300ms ease-in-out;\n height: ", "px;\n"])), snippetHeight);
32
+ return css({
33
+ transition: 'height 300ms ease-in-out',
34
+ height: "".concat(snippetHeight, "px")
35
+ });
29
36
  };
30
- export var popupContainerStyles = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border-radius: ", ";\n background-color: ", ";\n box-shadow: ", ";\n"])), "var(--ds-border-radius-200, 8px)", "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))");
37
+ export var popupContainerStyles = css({
38
+ borderRadius: "var(--ds-border-radius-200, 8px)",
39
+ backgroundColor: "var(--ds-surface-raised, white)",
40
+ boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))"
41
+ });
31
42
  export var getPreviewBlockStyles = function getPreviewBlockStyles(previewHeight) {
32
- return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n margin-bottom: ", ";\n"])), previewHeight ? "height: ".concat(previewHeight, "px;") : '', "var(--ds-border-radius-200, 8px)", "var(--ds-border-radius-200, 8px)", blockGap);
43
+ return css(previewHeight ? "height: ".concat(previewHeight, "px;") : '', {
44
+ borderTopLeftRadius: "var(--ds-border-radius-200, 8px)",
45
+ borderTopRightRadius: "var(--ds-border-radius-200, 8px)",
46
+ marginBottom: blockGap
47
+ });
33
48
  };
@@ -10,7 +10,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
10
10
  import LinkWarningModal from './LinkWarningModal';
11
11
  var PACKAGE_DATA = {
12
12
  packageName: "@atlaskit/smart-card",
13
- packageVersion: "26.50.10",
13
+ packageVersion: "26.50.12",
14
14
  componentName: 'linkUrl'
15
15
  };
16
16
  var Link = withLinkClickedEvent('a');
@@ -1,11 +1,17 @@
1
1
  /** @jsx jsx */
2
2
  import { css, jsx } from '@emotion/react';
3
3
  import { useThemeObserver } from '@atlaskit/tokens';
4
- import { AI_BORDER_PALETTE, INNER_BORDER_RADIUS } from './constants';
4
+ import { AI_BORDER_PALETTE } from './constants';
5
5
  import AIGlowingBorder from './ai-glowing-border';
6
+ import { popupContainerStyles } from '../../HoverCard/styled';
6
7
  var contentStyles = css({
7
- backgroundColor: "var(--ds-surface-raised, white)",
8
- borderRadius: INNER_BORDER_RADIUS
8
+ transition: 'box-shadow 0.5s ease'
9
+ });
10
+ var contentStylesPrismVisible = css({
11
+ // intentionally set opacity to 0 to remove the shadow with fade out animation
12
+ boxShadow:
13
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
14
+ '0px 8px 12px rgba(9, 30, 66, 0),0px 0px 1px rgba(9, 30, 66, 0)'
9
15
  });
10
16
  var AIPrism = function AIPrism(_ref) {
11
17
  var _AI_BORDER_PALETTE$co;
@@ -22,7 +28,8 @@ var AIPrism = function AIPrism(_ref) {
22
28
  return jsx(AIGlowingBorder, {
23
29
  additionalCss: {
24
30
  animatedSvgContainer: css({
25
- opacity: isVisible ? 1 : 0
31
+ opacity: isVisible ? 1 : 0,
32
+ transition: 'opacity 0.5s ease'
26
33
  })
27
34
  },
28
35
  palette: (_AI_BORDER_PALETTE$co = AI_BORDER_PALETTE[colorMode]) !== null && _AI_BORDER_PALETTE$co !== void 0 ? _AI_BORDER_PALETTE$co : AI_BORDER_PALETTE.light,
@@ -30,7 +37,7 @@ var AIPrism = function AIPrism(_ref) {
30
37
  isMoving: isMoving,
31
38
  testId: testId
32
39
  }, jsx("div", {
33
- css: contentStyles
40
+ css: [popupContainerStyles, contentStyles, isVisible ? contentStylesPrismVisible : undefined]
34
41
  }, children));
35
42
  };
36
43
  export default AIPrism;
@@ -28,7 +28,9 @@ export type ButtonClickedAiSummaryAttributesType = {};
28
28
  export type SummaryViewedAttributesType = {
29
29
  fromCache: boolean | null;
30
30
  };
31
- export type ErrorViewedAiSummaryAttributesType = {};
31
+ export type ErrorViewedAiSummaryAttributesType = {
32
+ reason?: string;
33
+ };
32
34
  export type SummarySuccessAttributesType = {};
33
35
  export type SummaryFailedAttributesType = {
34
36
  reason: string | null;
@@ -2,6 +2,7 @@ export declare const CONTENT_URL_SECURITY_AND_PERMISSIONS = "https://support.atl
2
2
  export declare 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 declare const CONTENT_URL_AI = "https://www.atlassian.com/trust/atlassian-intelligence";
4
4
  export declare const CONTENT_URL_AI_TROUBLESHOOTING = "https://support.atlassian.com/organization-administration/docs/troubleshooting-for-atlassian-intelligence/";
5
+ export declare const CONTENT_URL_ACCEPTABLE_USE_POLICY = "https://www.atlassian.com/legal/acceptable-use-policy";
5
6
  /**
6
7
  * The alignment of Flexible UI component.
7
8
  */
@@ -1,6 +1,6 @@
1
1
  import { MessageDescriptor } from 'react-intl-next';
2
2
  export type RequestAccessMessageKey = 'click_to_join' | 'click_to_join_description' | 'forbidden_description' | 'request_access' | 'request_access_description' | 'request_access_pending' | 'request_access_pending_title' | 'request_access_pending_description' | 'request_denied_description' | 'default_no_access_title' | 'direct_access_title' | 'direct_access_description' | 'direct_access' | 'access_exists_description' | 'not_found_description' | 'not_found_title';
3
- export type MessageKey = 'assigned_to' | 'ai_summarize' | 'ai_summarized' | 'ai_summarized_abbreviation' | 'ai_summarized_info' | 'ai_summarizing' | 'ai_summary_error_generic' | 'beta' | 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'follow' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'learn_more_about_connecting_account' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview_improved' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'read_time' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'sent_on_relative' | 'sent_on_absolute' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'unauthorised_account_description' | 'unauthorised_account_description_no_provider' | 'unauthorised_account_name' | 'unauthorised_account_name_no_provider' | 'unassigned' | 'unfollow' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey | 'related_work_items_not_found' | 'last_mentioned_in' | 'related' | 'generic_error_message';
3
+ export type MessageKey = 'assigned_to' | 'ai_summarize' | 'ai_summarized' | 'ai_summarized_abbreviation' | 'ai_summarized_info' | 'ai_summarizing' | 'ai_summary_error_generic' | 'ai_summary_error_acceptable_use_violation' | 'beta' | 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'follow' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'learn_more_about_connecting_account' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview_improved' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'read_time' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'sent_on_relative' | 'sent_on_absolute' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'unauthorised_account_description' | 'unauthorised_account_description_no_provider' | 'unauthorised_account_name' | 'unauthorised_account_name_no_provider' | 'unassigned' | 'unfollow' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey | 'related_work_items_not_found' | 'last_mentioned_in' | 'related' | 'generic_error_message';
4
4
  type Messages = {
5
5
  [K in MessageKey]: MessageDescriptor;
6
6
  };
@@ -1,4 +1,4 @@
1
- import type { AISummaryServiceProps, AISummaryServiceInt, AISummaryState, StateSetter, SummaryStyle } from './types';
1
+ import { type AISummaryServiceProps, type AISummaryServiceInt, type AISummaryState, type StateSetter, type SummaryStyle } from './types';
2
2
  export declare class AISummaryService implements AISummaryServiceInt {
3
3
  state: AISummaryState;
4
4
  private config;
@@ -10,5 +10,6 @@ export declare class AISummaryService implements AISummaryServiceInt {
10
10
  constructor(props: AISummaryServiceProps);
11
11
  private fetchStream;
12
12
  summariseUrl(summaryStyle?: SummaryStyle): Promise<void>;
13
+ private isExpectedError;
13
14
  subscribe(stateSetter: StateSetter): () => void;
14
15
  }
@@ -29,9 +29,12 @@ export type AgentInput = {
29
29
  summary_style?: SummaryStyle;
30
30
  };
31
31
  export type SummaryStyle = 'short' | 'medium' | 'long';
32
+ export declare const errorMessages: readonly ["NETWORK_ERROR", "NO_ANSWER", "RATE_LIMIT", "NO_AGENT", "PLUGIN_ERRORED", "OPENAI_RATE_LIMIT_USER_ABUSE", "ACCEPTABLE_USE_VIOLATIONS", "AI_DISABLED", "UNEXPECTED"];
33
+ export type ErrorMessage = (typeof errorMessages)[number];
32
34
  export type AISummaryState = {
33
35
  content: string;
34
36
  status: AISummaryStatus;
37
+ error?: ErrorMessage;
35
38
  };
36
39
  export type StateSetter = (state: AISummaryState) => any;
37
40
  export type StreamMessage = StreamTrace | StreamAnswerPart | StreamResponse | StreamError;
@@ -50,7 +53,7 @@ export type StreamError = {
50
53
  message: {
51
54
  content: string;
52
55
  status_code?: number;
53
- message_template?: string;
56
+ message_template?: ErrorMessage;
54
57
  };
55
58
  millisOffset: number;
56
59
  metadata: null | {
@@ -1,8 +1,5 @@
1
- import type { AISummaryServiceProps, AISummaryStatus } from './ai-summary-service/types';
1
+ import type { AISummaryServiceProps, AISummaryState } from './ai-summary-service/types';
2
2
  export declare const useAISummary: (props: AISummaryServiceProps) => {
3
3
  summariseUrl: () => Promise<void> | undefined;
4
- state: {
5
- status: AISummaryStatus;
6
- content: string;
7
- };
4
+ state: AISummaryState;
8
5
  };
@@ -1,2 +1,4 @@
1
- declare const AIEventErrorViewed: () => null;
1
+ declare const AIEventErrorViewed: ({ reason }: {
2
+ reason?: string | undefined;
3
+ }) => null;
2
4
  export default AIEventErrorViewed;
@@ -1,12 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import type { XCSS } from '@atlaskit/primitives';
3
3
  import type { TooltipProps } from '@atlaskit/tooltip';
4
- import type { AISummaryStatus } from '../../../../../../state/hooks/use-ai-summary/ai-summary-service/types';
4
+ import type { AISummaryStatus, ErrorMessage } from '../../../../../../state/hooks/use-ai-summary/ai-summary-service/types';
5
5
  export type AIStateAppearance = 'default' | 'icon-only';
6
6
  export type AIStateIndicatorProps = {
7
7
  appearance?: AIStateAppearance;
8
8
  state: AISummaryStatus;
9
9
  testId?: string;
10
+ error?: ErrorMessage;
10
11
  };
11
12
  export type AIIndicatorContainerProps = {
12
13
  icon?: React.ReactNode;
@@ -11,7 +11,7 @@ export type TextProps = ElementProps & {
11
11
  */
12
12
  content?: string;
13
13
  /**
14
- * The maximum number of lines the text should span over. Maximum is 2.
14
+ * The maximum number of lines the text should span over. Maximum is 2 unless its an error message.
15
15
  */
16
16
  maxLines?: number;
17
17
  };
@@ -2,7 +2,7 @@ import { FlexibleUiOptions } from '../FlexibleCard/types';
2
2
  export declare const HOVER_CARD_Z_INDEX: 510;
3
3
  export declare const flexibleUiOptions: FlexibleUiOptions;
4
4
  export declare const CARD_WIDTH_REM = 24;
5
- export declare const NEW_CARD_WIDTH_REM = 28;
5
+ export declare const NEW_CARD_WIDTH_REM = 25;
6
6
  export declare const CARD_GAP_PX = 10;
7
7
  export declare const separatorCss: import("@emotion/react").SerializedStyles;
8
8
  export declare const HoverCardContainer: import("@emotion/react").SerializedStyles;