@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
@@ -40,6 +40,11 @@ export const messages = defineMessages({
40
40
  defaultMessage: "Atlassian Intelligence can't provide a response right now. Read more <a>in our support documentation</a>.",
41
41
  description: 'Shown when AI summary is summarising the link resource content.'
42
42
  },
43
+ ai_summary_error_acceptable_use_violation: {
44
+ id: 'fabric.linking.ai_summary_error_acceptable_use_violation',
45
+ defaultMessage: "We cannot show the results of this summary as it goes against <a>Atlassian's Acceptable Use Policy</a>.",
46
+ description: 'Shown when AI summary is summarising the link resource content and the content violates atlassians acceptable use policy.'
47
+ },
43
48
  assigned_to: {
44
49
  id: 'fabric.linking.assigned_to',
45
50
  defaultMessage: 'Assigned to {context}',
@@ -1,5 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import uuid from 'uuid';
3
+ import { errorMessages } from './types';
3
4
  import { readStream, addPath } from './utils';
4
5
  export class AISummaryService {
5
6
  constructor(props) {
@@ -91,16 +92,21 @@ export class AISummaryService {
91
92
  };
92
93
  } catch (err) {
93
94
  var _this$onError;
94
- (_this$onError = this.onError) === null || _this$onError === void 0 ? void 0 : _this$onError.call(this, id, 'generic');
95
+ let message = err instanceof Error && this.isExpectedError(err.message) ? err.message : 'UNEXPECTED';
96
+ (_this$onError = this.onError) === null || _this$onError === void 0 ? void 0 : _this$onError.call(this, id, message);
95
97
  this.state = {
96
98
  status: 'error',
97
- content: ''
99
+ content: '',
100
+ error: message
98
101
  };
99
102
  }
100
103
  for (const subscriber of this.subscribedStateSetters) {
101
104
  subscriber(this.state);
102
105
  }
103
106
  }
107
+ isExpectedError(value) {
108
+ return typeof value === 'string' && errorMessages.some(a => a === value);
109
+ }
104
110
  subscribe(stateSetter) {
105
111
  this.subscribedStateSetters.add(stateSetter);
106
112
  return () => {
@@ -0,0 +1 @@
1
+ export const errorMessages = ['NETWORK_ERROR', 'NO_ANSWER', 'RATE_LIMIT', 'NO_AGENT', 'PLUGIN_ERRORED', 'OPENAI_RATE_LIMIT_USER_ABUSE', 'ACCEPTABLE_USE_VIOLATIONS', 'AI_DISABLED', 'UNEXPECTED'];
@@ -2,6 +2,7 @@ export async function* readStream(response) {
2
2
  const reader = getBufferReader(response);
3
3
  let doneStreaming = false;
4
4
  let chunkBuffer = '';
5
+ const chunkTypeErrorMessage = 'jsonChunkType error';
5
6
  do {
6
7
  try {
7
8
  const {
@@ -10,21 +11,23 @@ export async function* readStream(response) {
10
11
  } = await reader.read();
11
12
  doneStreaming = done;
12
13
  if (value) {
13
- try {
14
- const processedChunks = `${chunkBuffer}${value}`.split('\n'); // assumes that all JSON chunks are separated by a new-line;
14
+ const processedChunks = `${chunkBuffer}${value}`.split('\n'); // assumes that all JSON chunks are separated by a new-line;
15
15
 
16
- chunkBuffer = '';
17
- for (let chunk of processedChunks) {
18
- try {
19
- yield JSON.parse(chunk);
20
- } catch (e) {
21
- // the chunk may be incomplete, so we'll save it for the next iteration.
22
- chunkBuffer = chunk;
16
+ chunkBuffer = '';
17
+ for (let chunk of processedChunks) {
18
+ try {
19
+ const jsonChunk = JSON.parse(chunk);
20
+ if (jsonChunk.type === 'ERROR') {
21
+ throw new Error(chunkTypeErrorMessage);
23
22
  }
23
+ yield jsonChunk;
24
+ } catch (e) {
25
+ if (e instanceof Error && e.message === chunkTypeErrorMessage) {
26
+ throw e;
27
+ }
28
+ // the chunk may be incomplete, so we'll save it for the next iteration.
29
+ chunkBuffer = chunk;
24
30
  }
25
- } catch (e) {
26
- const error = new Error(`Error Processing Stream Data: ${value}`);
27
- throw error;
28
31
  }
29
32
  }
30
33
  } catch (e) {
@@ -32,6 +35,7 @@ export async function* readStream(response) {
32
35
  if (e instanceof DOMException && e.name === 'AbortError') {
33
36
  doneStreaming = true;
34
37
  } else {
38
+ reader.cancel();
35
39
  throw e;
36
40
  }
37
41
  }
@@ -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.50.10"
7
+ packageVersion: "26.50.12"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -28,6 +28,7 @@ const FlexibleErroredView = ({
28
28
  primaryColor: `var(--ds-icon-warning, ${R300})`,
29
29
  testId: `${testId}-warning-icon`
30
30
  }), /*#__PURE__*/React.createElement(Text, {
31
+ maxLines: 3,
31
32
  message: {
32
33
  descriptor: messages.could_not_load_link
33
34
  }
@@ -84,7 +84,7 @@ const FlexibleForbiddenView = ({
84
84
  primaryColor: `var(--ds-icon-danger, ${R300})`,
85
85
  testId: `${testId}-lock-icon`
86
86
  }), /*#__PURE__*/React.createElement(Text, {
87
- maxLines: 2,
87
+ maxLines: 3,
88
88
  message: {
89
89
  descriptor: toMessage(messages.invalid_permissions_description, requestAccessContext === null || requestAccessContext === void 0 ? void 0 : requestAccessContext.descriptiveMessageKey),
90
90
  values: messageContext
@@ -46,7 +46,8 @@ const FlexibleNotFoundView = ({
46
46
  testId: `${testId}-lock-icon`
47
47
  }), /*#__PURE__*/React.createElement(Text, {
48
48
  message: description,
49
- testId: `${testId}-message`
49
+ testId: `${testId}-message`,
50
+ maxLines: 3
50
51
  }));
51
52
  };
52
53
  export default withFlexibleUIBlockCardStyle(FlexibleNotFoundView);
@@ -3,40 +3,34 @@ import { N40 } from '@atlaskit/theme/colors';
3
3
 
4
4
  // in editor prosemirror adds padding-left so we need to overwrite it
5
5
  // renderer overwrites the margin-right so we need to add it here
6
- export const metadataBlockCss = css`
7
- /* primary element group */
8
- span[data-smart-element-avatar-group] {
9
- > ul {
10
- padding-left: 0px;
11
- margin-right: 0.5rem;
6
+ export const metadataBlockCss = css({
7
+ 'span[data-smart-element-avatar-group]': {
8
+ '> ul': {
9
+ paddingLeft: '0px',
10
+ marginRight: "var(--ds-space-100, 0.5rem)"
12
11
  }
12
+ },
13
+ '[data-smart-element-group]': {
14
+ lineHeight: '1rem'
13
15
  }
14
- [data-smart-element-group] {
15
- line-height: 1rem;
16
+ });
17
+ export const titleBlockCss = css({
18
+ gap: "var(--ds-space-100, 0.5em)",
19
+ "[data-smart-element='Title']": {
20
+ fontWeight: 600
16
21
  }
17
- `;
18
- export const titleBlockCss = css`
19
- gap: 0.5em;
20
-
21
- [data-smart-element='Title'] {
22
- font-weight: 600;
23
- }
24
- `;
25
- export const footerBlockCss = css`
26
- height: 1.5rem;
27
-
28
- .actions-button-group {
29
- button,
30
- button:hover,
31
- button:focus,
32
- button:active {
33
- font-size: 0.875rem;
22
+ });
23
+ export const footerBlockCss = css({
24
+ height: '1.5rem',
25
+ '.actions-button-group': {
26
+ 'button, button:hover, button:focus, button:active': {
27
+ fontSize: '0.875rem'
34
28
  }
35
29
  }
36
- `;
37
- export const flexibleBlockCardStyle = css`
38
- & > div {
39
- border-radius: ${"var(--ds-border-radius-200, 8px)"};
40
- border: 1px solid ${`var(--ds-border, ${N40})`};
30
+ });
31
+ export const flexibleBlockCardStyle = css({
32
+ '& > div': {
33
+ borderRadius: "var(--ds-border-radius-200, 8px)",
34
+ border: `1px solid ${`var(--ds-border, ${N40})`}`
41
35
  }
42
- `;
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
+ const customBlockStyles = css({
9
+ alignItems: 'flex-start'
10
+ });
7
11
  const UnresolvedView = ({
8
12
  actions,
9
13
  cardState,
@@ -27,7 +31,9 @@ const UnresolvedView = ({
27
31
  }, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockOptions, {
28
32
  hideIcon: !!title,
29
33
  text: title
30
- })), /*#__PURE__*/React.createElement(CustomBlock, null, children), showPreview && /*#__PURE__*/React.createElement(PreviewBlock, PreviewBlockOptions), /*#__PURE__*/React.createElement(InternalFooterBlock, _extends({}, FooterBlockOptions, {
34
+ })), /*#__PURE__*/React.createElement(CustomBlock, {
35
+ overrideCss: customBlockStyles
36
+ }, children), showPreview && /*#__PURE__*/React.createElement(PreviewBlock, PreviewBlockOptions), /*#__PURE__*/React.createElement(InternalFooterBlock, _extends({}, FooterBlockOptions, {
31
37
  actions: actions,
32
38
  testId: "smart-block-card-footer"
33
39
  })));
@@ -1,12 +1,16 @@
1
1
  import { useEffect } from 'react';
2
2
  import { useAnalyticsEvents } from '../../../../../../common/analytics/generated/use-analytics-events';
3
- const AIEventErrorViewed = () => {
3
+ const AIEventErrorViewed = ({
4
+ reason
5
+ }) => {
4
6
  const {
5
7
  fireEvent
6
8
  } = useAnalyticsEvents();
7
9
  useEffect(() => {
8
- fireEvent('ui.error.viewed.aiSummary', {});
9
- }, [fireEvent]);
10
+ fireEvent('ui.error.viewed.aiSummary', {
11
+ reason
12
+ });
13
+ }, [fireEvent, reason]);
10
14
  return null;
11
15
  };
12
16
  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
  const contentStyles = xcss({
11
11
  color: 'color.text.subtle',
12
12
  fontSize: '11px',
@@ -14,10 +14,39 @@ const contentStyles = xcss({
14
14
  fontWeight: '400',
15
15
  lineHeight: '14px'
16
16
  });
17
+ const MessageWithAnchor = ({
18
+ message,
19
+ url
20
+ }) => /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, message, {
21
+ values: {
22
+ a: chunks => /*#__PURE__*/React.createElement(AILearnMoreAnchor, {
23
+ href: url
24
+ }, chunks)
25
+ }
26
+ }));
27
+ const getErrorMesssageProps = error => {
28
+ switch (error) {
29
+ case 'ACCEPTABLE_USE_VIOLATIONS':
30
+ return {
31
+ message: messages.ai_summary_error_acceptable_use_violation,
32
+ url: CONTENT_URL_ACCEPTABLE_USE_POLICY
33
+ };
34
+ default:
35
+ return {
36
+ message: messages.ai_summary_error_generic,
37
+ url: CONTENT_URL_AI_TROUBLESHOOTING
38
+ };
39
+ }
40
+ };
17
41
  const AIStateError = ({
18
42
  appearance,
19
- testId
43
+ testId,
44
+ error
20
45
  }) => {
46
+ const {
47
+ message,
48
+ url
49
+ } = getErrorMesssageProps(error);
21
50
  switch (appearance) {
22
51
  case 'icon-only':
23
52
  return null;
@@ -32,13 +61,10 @@ const AIStateError = ({
32
61
  content: /*#__PURE__*/React.createElement(Box, {
33
62
  testId: `${testId}-error-message`,
34
63
  xcss: contentStyles
35
- }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.ai_summary_error_generic, {
36
- values: {
37
- a: chunks => /*#__PURE__*/React.createElement(AILearnMoreAnchor, {
38
- href: CONTENT_URL_AI_TROUBLESHOOTING
39
- }, chunks)
40
- }
41
- }))),
64
+ }, /*#__PURE__*/React.createElement(MessageWithAnchor, {
65
+ message: message,
66
+ url: url
67
+ })),
42
68
  testId: `${testId}-error`
43
69
  });
44
70
  }
@@ -7,13 +7,15 @@ import AIStateError from './ai-state-error';
7
7
  const AIStateIndicator = ({
8
8
  state,
9
9
  appearance = 'default',
10
- testId = 'ai-state-indicator'
10
+ testId = 'ai-state-indicator',
11
+ error
11
12
  }) => {
12
13
  switch (state) {
13
14
  case 'error':
14
15
  return jsx(AIStateError, {
15
16
  appearance: appearance,
16
- testId: testId
17
+ testId: testId,
18
+ error: error
17
19
  });
18
20
  case 'loading':
19
21
  return jsx(AIStateLoading, {
@@ -35,7 +35,8 @@ const AISummaryBlockResolvedView = props => {
35
35
  summariseUrl,
36
36
  state: {
37
37
  content,
38
- status
38
+ status,
39
+ error
39
40
  }
40
41
  } = useAISummary({
41
42
  url
@@ -107,7 +108,10 @@ const AISummaryBlockResolvedView = props => {
107
108
  size: size
108
109
  }))), showAISummaryErrorMessage && /*#__PURE__*/React.createElement(Inline, {
109
110
  grow: "fill"
110
- }, /*#__PURE__*/React.createElement(AIEventErrorViewed, null), /*#__PURE__*/React.createElement(AIStateIndicator, {
111
+ }, /*#__PURE__*/React.createElement(AIEventErrorViewed, {
112
+ reason: error
113
+ }), /*#__PURE__*/React.createElement(AIStateIndicator, {
114
+ error: error,
111
115
  state: status,
112
116
  testId: testId
113
117
  })));
@@ -32,7 +32,7 @@ const ConnectedAIPrismContainer = ({
32
32
  }, [status]);
33
33
  const container = jsx("div", _extends({
34
34
  className: hoverCardClassName,
35
- css: [HoverCardContainer, isAIEnabled && showPrism ? undefined : popupContainerStyles],
35
+ css: [HoverCardContainer, !isAIEnabled ? popupContainerStyles : undefined],
36
36
  "data-testid": testId
37
37
  }, props), children);
38
38
  return isAIEnabled ? jsx(AIPrism, {
@@ -14,16 +14,16 @@ export const flexibleUiOptions = {
14
14
  zIndex: HOVER_CARD_Z_INDEX + 1
15
15
  };
16
16
  export const CARD_WIDTH_REM = 24;
17
- export const NEW_CARD_WIDTH_REM = 28;
17
+ export const NEW_CARD_WIDTH_REM = 25;
18
18
  // gap between mouse cursor and hover card
19
19
  export const CARD_GAP_PX = 10;
20
20
  const blockGap = '0.5rem';
21
21
  const elementGap = '0.5rem';
22
- export const separatorCss = css`
23
- [data-separator] + [data-separator]:before {
24
- margin-right: ${elementGap};
22
+ export const separatorCss = css({
23
+ '[data-separator] + [data-separator]:before': {
24
+ marginRight: elementGap
25
25
  }
26
- `;
26
+ });
27
27
  export const HoverCardContainer = css`
28
28
  background: none;
29
29
  border-width: 0;
@@ -56,18 +56,17 @@ export const titleBlockCss = css`
56
56
  font-weight: 600;
57
57
  }
58
58
  `;
59
- export const getTransitionStyles = snippetHeight => css`
60
- transition: height 300ms ease-in-out;
61
- height: ${snippetHeight}px;
62
- `;
63
- export const popupContainerStyles = css`
64
- border-radius: ${"var(--ds-border-radius-200, 8px)"};
65
- background-color: ${"var(--ds-surface-raised, white)"};
66
- box-shadow: ${"var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))"};
67
- `;
68
- export const getPreviewBlockStyles = previewHeight => css`
69
- ${previewHeight ? `height: ${previewHeight}px;` : ''}
70
- border-top-left-radius: ${"var(--ds-border-radius-200, 8px)"};
71
- border-top-right-radius: ${"var(--ds-border-radius-200, 8px)"};
72
- margin-bottom: ${blockGap};
73
- `;
59
+ export const getTransitionStyles = snippetHeight => css({
60
+ transition: 'height 300ms ease-in-out',
61
+ height: `${snippetHeight}px`
62
+ });
63
+ export const popupContainerStyles = css({
64
+ borderRadius: "var(--ds-border-radius-200, 8px)",
65
+ backgroundColor: "var(--ds-surface-raised, white)",
66
+ boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))"
67
+ });
68
+ export const getPreviewBlockStyles = previewHeight => css(previewHeight ? `height: ${previewHeight}px;` : '', {
69
+ borderTopLeftRadius: "var(--ds-border-radius-200, 8px)",
70
+ borderTopRightRadius: "var(--ds-border-radius-200, 8px)",
71
+ marginBottom: blockGap
72
+ });
@@ -7,7 +7,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
7
7
  import LinkWarningModal from './LinkWarningModal';
8
8
  const PACKAGE_DATA = {
9
9
  packageName: "@atlaskit/smart-card",
10
- packageVersion: "26.50.10",
10
+ packageVersion: "26.50.12",
11
11
  componentName: 'linkUrl'
12
12
  };
13
13
  const 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
  const contentStyles = css({
7
- backgroundColor: "var(--ds-surface-raised, white)",
8
- borderRadius: INNER_BORDER_RADIUS
8
+ transition: 'box-shadow 0.5s ease'
9
+ });
10
+ const 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
  const AIPrism = ({
11
17
  children,
@@ -21,7 +27,8 @@ const AIPrism = ({
21
27
  return jsx(AIGlowingBorder, {
22
28
  additionalCss: {
23
29
  animatedSvgContainer: css({
24
- opacity: isVisible ? 1 : 0
30
+ opacity: isVisible ? 1 : 0,
31
+ transition: 'opacity 0.5s ease'
25
32
  })
26
33
  },
27
34
  palette: (_AI_BORDER_PALETTE$co = AI_BORDER_PALETTE[colorMode]) !== null && _AI_BORDER_PALETTE$co !== void 0 ? _AI_BORDER_PALETTE$co : AI_BORDER_PALETTE.light,
@@ -29,7 +36,7 @@ const AIPrism = ({
29
36
  isMoving: isMoving,
30
37
  testId: testId
31
38
  }, jsx("div", {
32
- css: contentStyles
39
+ css: [popupContainerStyles, contentStyles, isVisible ? contentStylesPrismVisible : undefined]
33
40
  }, children));
34
41
  };
35
42
  export default AIPrism;
@@ -2,6 +2,7 @@ export var CONTENT_URL_SECURITY_AND_PERMISSIONS = 'https://support.atlassian.com
2
2
  export var 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 var CONTENT_URL_AI = 'https://www.atlassian.com/trust/atlassian-intelligence';
4
4
  export var CONTENT_URL_AI_TROUBLESHOOTING = 'https://support.atlassian.com/organization-administration/docs/troubleshooting-for-atlassian-intelligence/';
5
+ export var CONTENT_URL_ACCEPTABLE_USE_POLICY = 'https://www.atlassian.com/legal/acceptable-use-policy';
5
6
 
6
7
  /**
7
8
  * The alignment of Flexible UI component.
@@ -40,6 +40,11 @@ export var messages = defineMessages({
40
40
  defaultMessage: "Atlassian Intelligence can't provide a response right now. Read more <a>in our support documentation</a>.",
41
41
  description: 'Shown when AI summary is summarising the link resource content.'
42
42
  },
43
+ ai_summary_error_acceptable_use_violation: {
44
+ id: 'fabric.linking.ai_summary_error_acceptable_use_violation',
45
+ defaultMessage: "We cannot show the results of this summary as it goes against <a>Atlassian's Acceptable Use Policy</a>.",
46
+ description: 'Shown when AI summary is summarising the link resource content and the content violates atlassians acceptable use policy.'
47
+ },
43
48
  assigned_to: {
44
49
  id: 'fabric.linking.assigned_to',
45
50
  defaultMessage: 'Assigned to {context}',
@@ -11,6 +11,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
11
11
  function _asyncIterator(r) { var n, t, o, e = 2; for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { if (t && null != (n = r[t])) return n.call(r); if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r)); t = "@@asyncIterator", o = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
12
12
  function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function _return(r) { var n = this.s.return; return void 0 === n ? Promise.resolve({ value: r, done: !0 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, throw: function _throw(r) { var n = this.s.return; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); }
13
13
  import uuid from 'uuid';
14
+ import { errorMessages } from './types';
14
15
  import { readStream, addPath } from './utils';
15
16
  export var AISummaryService = /*#__PURE__*/function () {
16
17
  function AISummaryService(props) {
@@ -104,6 +105,7 @@ export var AISummaryService = /*#__PURE__*/function () {
104
105
  subscriber,
105
106
  _chunk$message,
106
107
  _this$onError,
108
+ message,
107
109
  _iterator4,
108
110
  _step4,
109
111
  _subscriber2,
@@ -212,17 +214,19 @@ export var AISummaryService = /*#__PURE__*/function () {
212
214
  status: 'done',
213
215
  content: bufferContent
214
216
  };
215
- _context2.next = 50;
217
+ _context2.next = 51;
216
218
  break;
217
219
  case 46:
218
220
  _context2.prev = 46;
219
221
  _context2.t1 = _context2["catch"](5);
220
- (_this$onError = this.onError) === null || _this$onError === void 0 || _this$onError.call(this, id, 'generic');
222
+ message = _context2.t1 instanceof Error && this.isExpectedError(_context2.t1.message) ? _context2.t1.message : 'UNEXPECTED';
223
+ (_this$onError = this.onError) === null || _this$onError === void 0 || _this$onError.call(this, id, message);
221
224
  this.state = {
222
225
  status: 'error',
223
- content: ''
226
+ content: '',
227
+ error: message
224
228
  };
225
- case 50:
229
+ case 51:
226
230
  _iterator4 = _createForOfIteratorHelper(this.subscribedStateSetters);
227
231
  try {
228
232
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
@@ -234,7 +238,7 @@ export var AISummaryService = /*#__PURE__*/function () {
234
238
  } finally {
235
239
  _iterator4.f();
236
240
  }
237
- case 52:
241
+ case 53:
238
242
  case "end":
239
243
  return _context2.stop();
240
244
  }
@@ -245,6 +249,13 @@ export var AISummaryService = /*#__PURE__*/function () {
245
249
  }
246
250
  return summariseUrl;
247
251
  }()
252
+ }, {
253
+ key: "isExpectedError",
254
+ value: function isExpectedError(value) {
255
+ return typeof value === 'string' && errorMessages.some(function (a) {
256
+ return a === value;
257
+ });
258
+ }
248
259
  }, {
249
260
  key: "subscribe",
250
261
  value: function subscribe(stateSetter) {
@@ -0,0 +1 @@
1
+ export var errorMessages = ['NETWORK_ERROR', 'NO_ANSWER', 'RATE_LIMIT', 'NO_AGENT', 'PLUGIN_ERRORED', 'OPENAI_RATE_LIMIT_USER_ABUSE', 'ACCEPTABLE_USE_VIOLATIONS', 'AI_DISABLED', 'UNEXPECTED'];