@atlaskit/smart-card 26.50.10 → 26.50.11
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.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/constants.js +2 -1
- package/dist/cjs/messages.js +5 -0
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +16 -5
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/types.js +7 -1
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/utils.js +47 -41
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-error-viewed/index.js +6 -3
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.js +38 -12
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +4 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +6 -2
- package/dist/cjs/view/HoverCard/components/ContentContainer.js +1 -1
- package/dist/cjs/view/HoverCard/styled.js +23 -8
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/common/ai-prism/index.js +11 -4
- package/dist/es2019/constants.js +1 -0
- package/dist/es2019/messages.js +5 -0
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +8 -2
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/types.js +1 -0
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/utils.js +16 -12
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-error-viewed/index.js +7 -3
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.js +35 -9
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +4 -2
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +6 -2
- package/dist/es2019/view/HoverCard/components/ContentContainer.js +1 -1
- package/dist/es2019/view/HoverCard/styled.js +19 -20
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/common/ai-prism/index.js +12 -5
- package/dist/esm/constants.js +1 -0
- package/dist/esm/messages.js +5 -0
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +16 -5
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/types.js +1 -0
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/utils.js +47 -41
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-error-viewed/index.js +6 -3
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.js +39 -13
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +4 -2
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +6 -2
- package/dist/esm/view/HoverCard/components/ContentContainer.js +1 -1
- package/dist/esm/view/HoverCard/styled.js +23 -8
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/common/ai-prism/index.js +12 -5
- package/dist/types/common/analytics/generated/analytics.types.d.ts +3 -1
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/state/hooks/use-ai-summary/ai-summary-service/index.d.ts +2 -1
- package/dist/types/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +4 -1
- package/dist/types/state/hooks/use-ai-summary/index.d.ts +2 -5
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-error-viewed/index.d.ts +3 -1
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +2 -1
- package/dist/types/view/HoverCard/styled.d.ts +1 -1
- package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +3 -1
- package/dist/types-ts4.5/constants.d.ts +1 -0
- package/dist/types-ts4.5/messages.d.ts +1 -1
- package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/index.d.ts +2 -1
- package/dist/types-ts4.5/state/hooks/use-ai-summary/ai-summary-service/types.d.ts +14 -1
- package/dist/types-ts4.5/state/hooks/use-ai-summary/index.d.ts +2 -5
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-error-viewed/index.d.ts +3 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +2 -1
- package/dist/types-ts4.5/view/HoverCard/styled.d.ts +1 -1
- package/package.json +4 -4
|
@@ -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
|
-
|
|
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(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
}
|
package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js
CHANGED
|
@@ -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,
|
|
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
|
|
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 =
|
|
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
|
-
|
|
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:
|
|
62
|
-
|
|
63
|
-
export const popupContainerStyles = css
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
export const getPreviewBlockStyles = previewHeight => css`
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
+
packageVersion: "26.50.11",
|
|
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
|
|
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
|
-
|
|
8
|
-
|
|
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;
|
package/dist/esm/constants.js
CHANGED
|
@@ -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.
|
package/dist/esm/messages.js
CHANGED
|
@@ -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 =
|
|
217
|
+
_context2.next = 51;
|
|
216
218
|
break;
|
|
217
219
|
case 46:
|
|
218
220
|
_context2.prev = 46;
|
|
219
221
|
_context2.t1 = _context2["catch"](5);
|
|
220
|
-
|
|
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
|
|
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
|
|
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'];
|
|
@@ -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,
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
_context.
|
|
19
|
+
chunkTypeErrorMessage = 'jsonChunkType error';
|
|
20
|
+
case 4:
|
|
21
|
+
_context.prev = 4;
|
|
22
|
+
_context.next = 7;
|
|
22
23
|
return _awaitAsyncGenerator(reader.read());
|
|
23
|
-
case
|
|
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 =
|
|
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 =
|
|
40
|
+
_context.next = 34;
|
|
41
41
|
break;
|
|
42
42
|
}
|
|
43
43
|
chunk = _step.value;
|
|
44
44
|
_context.prev = 19;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
|
51
|
-
_context.prev =
|
|
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
|
|
68
|
+
case 32:
|
|
56
69
|
_context.next = 17;
|
|
57
70
|
break;
|
|
58
|
-
case
|
|
59
|
-
_context.next =
|
|
71
|
+
case 34:
|
|
72
|
+
_context.next = 39;
|
|
60
73
|
break;
|
|
61
|
-
case
|
|
62
|
-
_context.prev =
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
case 43:
|
|
80
|
+
_iterator.f();
|
|
81
|
+
return _context.finish(39);
|
|
82
|
+
case 42:
|
|
78
83
|
_context.next = 52;
|
|
79
84
|
break;
|
|
80
|
-
case
|
|
81
|
-
_context.prev =
|
|
82
|
-
_context.
|
|
83
|
-
if (!(_context.
|
|
84
|
-
_context.next =
|
|
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
|
|
91
|
-
|
|
95
|
+
case 50:
|
|
96
|
+
reader.cancel();
|
|
97
|
+
throw _context.t2;
|
|
92
98
|
case 52:
|
|
93
99
|
if (!doneStreaming) {
|
|
94
|
-
_context.next =
|
|
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
|
-
|
|
103
|
-
throw
|
|
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, [[
|
|
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.
|
|
18
|
+
packageVersion: "26.50.11"
|
|
19
19
|
};
|
|
20
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
21
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-event-error-viewed/index.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
18
|
-
var
|
|
19
|
-
|
|
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(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
}
|
package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js
CHANGED
|
@@ -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,
|
|
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
|
|
39
|
+
css: [HoverCardContainer, !isAIEnabled ? popupContainerStyles : undefined],
|
|
40
40
|
"data-testid": testId
|
|
41
41
|
}, props), children);
|
|
42
42
|
return isAIEnabled ? jsx(AIPrism, {
|