@atlaskit/smart-card 26.48.4 → 26.48.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/constants.js +3 -1
- package/dist/cjs/messages.js +5 -0
- package/dist/cjs/state/hooks/use-ai-summary/ai-summary-service/index.js +37 -26
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +11 -5
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +6 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.js +54 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.js +6 -7
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +6 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +21 -11
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/common/ai-summary/index.js +23 -5
- package/dist/es2019/constants.js +2 -0
- package/dist/es2019/messages.js +5 -0
- package/dist/es2019/state/hooks/use-ai-summary/ai-summary-service/index.js +21 -14
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +11 -10
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +6 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.js +46 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.js +6 -7
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +6 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +25 -14
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/common/ai-summary/index.js +19 -9
- package/dist/esm/constants.js +2 -0
- package/dist/esm/messages.js +5 -0
- package/dist/esm/state/hooks/use-ai-summary/ai-summary-service/index.js +37 -26
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.js +1 -1
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +11 -5
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +6 -1
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.js +47 -0
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.js +6 -7
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +6 -0
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +23 -13
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/common/ai-summary/index.js +22 -5
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +2 -0
- package/dist/types/view/common/ai-summary/index.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/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-error.d.ts +4 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +2 -0
- package/dist/types-ts4.5/view/common/ai-summary/index.d.ts +3 -1
- package/package.json +5 -4
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
4
|
+
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
5
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
6
|
+
import { messages } from '../../../../../../messages';
|
|
7
|
+
import AIIndicatorContainer from './ai-indicator-container';
|
|
8
|
+
import AILearnMoreAnchor from './ai-learn-more-anchor';
|
|
9
|
+
import { CONTENT_URL_AI_TROUBLESHOOTING } from '../../../../../../constants';
|
|
10
|
+
const contentStyles = xcss({
|
|
11
|
+
color: 'color.text.subtle',
|
|
12
|
+
fontSize: '11px',
|
|
13
|
+
fontStyle: 'normal',
|
|
14
|
+
fontWeight: '400',
|
|
15
|
+
lineHeight: '14px'
|
|
16
|
+
});
|
|
17
|
+
const AIStateError = ({
|
|
18
|
+
appearance,
|
|
19
|
+
testId
|
|
20
|
+
}) => {
|
|
21
|
+
switch (appearance) {
|
|
22
|
+
case 'icon-only':
|
|
23
|
+
return null;
|
|
24
|
+
default:
|
|
25
|
+
return /*#__PURE__*/React.createElement(AIIndicatorContainer, {
|
|
26
|
+
icon: /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
27
|
+
primaryColor: "var(--ds-icon-danger, #C9372C)",
|
|
28
|
+
label: "AI",
|
|
29
|
+
size: "small",
|
|
30
|
+
testId: `${testId}-error-icon`
|
|
31
|
+
}),
|
|
32
|
+
content: /*#__PURE__*/React.createElement(Box, {
|
|
33
|
+
testId: `${testId}-error-message`,
|
|
34
|
+
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
|
+
}))),
|
|
42
|
+
testId: `${testId}-error`
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
export default AIStateError;
|
|
@@ -8,17 +8,16 @@ const AIStateLoading = ({
|
|
|
8
8
|
appearance,
|
|
9
9
|
testId
|
|
10
10
|
}) => {
|
|
11
|
-
const icon = /*#__PURE__*/React.createElement(AIIconLoading, {
|
|
12
|
-
label: "AI",
|
|
13
|
-
size: "small",
|
|
14
|
-
testId: `${testId}-loading-icon`
|
|
15
|
-
});
|
|
16
11
|
switch (appearance) {
|
|
17
12
|
case 'icon-only':
|
|
18
|
-
return
|
|
13
|
+
return null;
|
|
19
14
|
default:
|
|
20
15
|
return /*#__PURE__*/React.createElement(AIIndicatorContainer, {
|
|
21
|
-
icon:
|
|
16
|
+
icon: /*#__PURE__*/React.createElement(AIIconLoading, {
|
|
17
|
+
label: "AI",
|
|
18
|
+
size: "small",
|
|
19
|
+
testId: `${testId}-loading-icon`
|
|
20
|
+
}),
|
|
22
21
|
content: /*#__PURE__*/React.createElement(Box, {
|
|
23
22
|
testId: `${testId}-loading-message`
|
|
24
23
|
}, /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summarizing)),
|
package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js
CHANGED
|
@@ -3,12 +3,18 @@ import { jsx } from '@emotion/react';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import AIStateLoading from './ai-state-loading';
|
|
5
5
|
import AIStateDone from './ai-state-done';
|
|
6
|
+
import AIStateError from './ai-state-error';
|
|
6
7
|
const AIStateIndicator = ({
|
|
7
8
|
state,
|
|
8
9
|
appearance = 'default',
|
|
9
10
|
testId = 'ai-state-indicator'
|
|
10
11
|
}) => {
|
|
11
12
|
switch (state) {
|
|
13
|
+
case 'error':
|
|
14
|
+
return jsx(AIStateError, {
|
|
15
|
+
appearance: appearance,
|
|
16
|
+
testId: testId
|
|
17
|
+
});
|
|
12
18
|
case 'loading':
|
|
13
19
|
return jsx(AIStateLoading, {
|
|
14
20
|
appearance: appearance,
|
|
@@ -2,25 +2,25 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
3
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
4
|
import { Box, Inline } from '@atlaskit/primitives';
|
|
5
|
-
import { ActionName, SmartLinkSize, SmartLinkWidth
|
|
5
|
+
import { ActionName, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
|
|
6
6
|
import ActionGroup from '../../action-group';
|
|
7
7
|
import Block from '../../block';
|
|
8
8
|
import ElementGroup from '../../element-group';
|
|
9
9
|
import AIStateIndicator from '../ai-state-indicator';
|
|
10
10
|
import { renderElementItems } from '../../utils';
|
|
11
11
|
import { messages } from '../../../../../../messages';
|
|
12
|
-
import AiIcon from '../../../../../common/ai-icon';
|
|
13
|
-
import AISummary from '../../../../../common/ai-summary';
|
|
14
12
|
import { useAISummary } from '../../../../../../state/hooks/use-ai-summary';
|
|
15
13
|
import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context';
|
|
14
|
+
import AIIcon from '../../../../../common/ai-icon';
|
|
15
|
+
import AISummary from '../../../../../common/ai-summary';
|
|
16
16
|
const AISummaryBlockResolvedView = props => {
|
|
17
17
|
const {
|
|
18
18
|
actions = [],
|
|
19
19
|
metadata,
|
|
20
|
-
testId,
|
|
21
20
|
onActionMenuOpenChange,
|
|
22
21
|
onAIActionChange,
|
|
23
|
-
size = SmartLinkSize.Medium
|
|
22
|
+
size = SmartLinkSize.Medium,
|
|
23
|
+
testId
|
|
24
24
|
} = props;
|
|
25
25
|
const [aiState, setAIState] = useState('ready');
|
|
26
26
|
const metadataElements = renderElementItems(metadata);
|
|
@@ -30,8 +30,12 @@ const AISummaryBlockResolvedView = props => {
|
|
|
30
30
|
url
|
|
31
31
|
});
|
|
32
32
|
const {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
state: {
|
|
34
|
+
content,
|
|
35
|
+
status
|
|
36
|
+
},
|
|
37
|
+
isSummarisedOnMount
|
|
38
|
+
} = aiSummary;
|
|
35
39
|
const onAIActionClick = useCallback(() => {
|
|
36
40
|
setAIState('loading');
|
|
37
41
|
if (onAIActionChange) {
|
|
@@ -45,8 +49,8 @@ const AISummaryBlockResolvedView = props => {
|
|
|
45
49
|
name: ActionName.CustomAction,
|
|
46
50
|
onClick: onAIActionClick,
|
|
47
51
|
testId: `${testId}-ai-summary-action`,
|
|
48
|
-
icon: /*#__PURE__*/React.createElement(
|
|
49
|
-
label: "
|
|
52
|
+
icon: /*#__PURE__*/React.createElement(AIIcon, {
|
|
53
|
+
label: "AIIcon"
|
|
50
54
|
})
|
|
51
55
|
};
|
|
52
56
|
return [aiAction, ...actions];
|
|
@@ -64,22 +68,29 @@ const AISummaryBlockResolvedView = props => {
|
|
|
64
68
|
direction: SmartLinkDirection.Vertical,
|
|
65
69
|
testId: `${testId}-resolved-view`
|
|
66
70
|
}), /*#__PURE__*/React.createElement(AISummary, {
|
|
67
|
-
content: content
|
|
71
|
+
content: content,
|
|
72
|
+
showIcon: isSummarisedOnMount
|
|
68
73
|
}), /*#__PURE__*/React.createElement(Inline, {
|
|
69
74
|
alignBlock: "center",
|
|
70
75
|
alignInline: "end",
|
|
71
76
|
grow: "fill",
|
|
72
77
|
spread: "space-between"
|
|
73
|
-
}, /*#__PURE__*/React.createElement(Box, null, aiState === 'loading' || aiState === 'done' ? /*#__PURE__*/React.createElement(AIStateIndicator, {
|
|
78
|
+
}, /*#__PURE__*/React.createElement(Box, null, !isSummarisedOnMount && (aiState === 'loading' || aiState === 'done') ? /*#__PURE__*/React.createElement(AIStateIndicator, {
|
|
74
79
|
state: aiState,
|
|
75
|
-
testId: testId
|
|
80
|
+
testId: `${testId}-state-indicator`
|
|
76
81
|
}) : /*#__PURE__*/React.createElement(ElementGroup, {
|
|
77
|
-
width: SmartLinkWidth.FitToContent
|
|
82
|
+
width: SmartLinkWidth.FitToContent,
|
|
83
|
+
testId: `${testId}-metadata-group`
|
|
78
84
|
}, metadataElements)), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(ActionGroup, {
|
|
79
85
|
onDropdownOpenChange: onDropdownOpenChange,
|
|
80
86
|
items: combinedActions,
|
|
81
87
|
appearance: "default",
|
|
82
88
|
size: size
|
|
83
|
-
})))
|
|
89
|
+
}))), status === 'error' && /*#__PURE__*/React.createElement(Inline, {
|
|
90
|
+
grow: "fill"
|
|
91
|
+
}, /*#__PURE__*/React.createElement(AIStateIndicator, {
|
|
92
|
+
state: status,
|
|
93
|
+
testId: testId
|
|
94
|
+
})));
|
|
84
95
|
};
|
|
85
96
|
export default AISummaryBlockResolvedView;
|
|
@@ -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.48.
|
|
10
|
+
packageVersion: "26.48.6",
|
|
11
11
|
componentName: 'linkUrl'
|
|
12
12
|
};
|
|
13
13
|
const Link = withLinkClickedEvent('a');
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import Markdown from 'markdown-to-jsx';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
import AIStateIndicator from '../../FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator';
|
|
6
|
+
const AITooltipIcon = () => jsx(AIStateIndicator, {
|
|
7
|
+
appearance: "icon-only",
|
|
8
|
+
state: "done",
|
|
9
|
+
testId: "ai-tooltip"
|
|
10
|
+
});
|
|
11
|
+
const AISummaryCSS = css({
|
|
12
|
+
fontSize: '0.75rem',
|
|
13
|
+
lineHeight: '1rem',
|
|
14
|
+
wordWrap: 'break-word',
|
|
15
|
+
whiteSpace: 'normal'
|
|
16
|
+
});
|
|
12
17
|
/**
|
|
13
18
|
* A component to render a response from AI in markdown text.
|
|
14
19
|
* @internal
|
|
@@ -17,6 +22,8 @@ const AISummaryCSS = css`
|
|
|
17
22
|
|
|
18
23
|
const AISummary = ({
|
|
19
24
|
content,
|
|
25
|
+
showIcon = false,
|
|
26
|
+
iconComponent,
|
|
20
27
|
overrideCss,
|
|
21
28
|
testId = 'ai-summary'
|
|
22
29
|
}) => {
|
|
@@ -26,9 +33,12 @@ const AISummary = ({
|
|
|
26
33
|
return jsx(Markdown, {
|
|
27
34
|
"data-testid": testId,
|
|
28
35
|
css: [AISummaryCSS, overrideCss],
|
|
29
|
-
children: content,
|
|
36
|
+
children: showIcon ? `${content} <Icon />` : content,
|
|
30
37
|
options: {
|
|
31
|
-
forceWrapper: true
|
|
38
|
+
forceWrapper: true,
|
|
39
|
+
overrides: {
|
|
40
|
+
Icon: iconComponent !== null && iconComponent !== void 0 ? iconComponent : AITooltipIcon
|
|
41
|
+
}
|
|
32
42
|
}
|
|
33
43
|
});
|
|
34
44
|
};
|
package/dist/esm/constants.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export var CONTENT_URL_SECURITY_AND_PERMISSIONS = 'https://support.atlassian.com/confluence-cloud/docs/insert-links-and-anchors/#Smart-links';
|
|
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
|
+
export var CONTENT_URL_AI_TROUBLESHOOTING = 'https://support.atlassian.com/organization-administration/docs/troubleshooting-for-atlassian-intelligence/';
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* The alignment of Flexible UI component.
|
|
6
8
|
*/
|
package/dist/esm/messages.js
CHANGED
|
@@ -30,6 +30,11 @@ export var messages = defineMessages({
|
|
|
30
30
|
defaultMessage: 'Atlassian Intelligence is working...',
|
|
31
31
|
description: 'Shown when AI summary is summarising the link resource content.'
|
|
32
32
|
},
|
|
33
|
+
ai_summary_error_generic: {
|
|
34
|
+
id: 'fabric.linking.ai_summary_error_generic',
|
|
35
|
+
defaultMessage: "Atlassian Intelligence can't provide a response right now. Read more <a>in our support documentation</a>.",
|
|
36
|
+
description: 'Shown when AI summary is summarising the link resource content.'
|
|
37
|
+
},
|
|
33
38
|
assigned_to: {
|
|
34
39
|
id: 'fabric.linking.assigned_to',
|
|
35
40
|
defaultMessage: 'Assigned to {context}',
|
|
@@ -111,21 +111,22 @@ export var AISummaryService = /*#__PURE__*/function () {
|
|
|
111
111
|
} finally {
|
|
112
112
|
_iterator2.f();
|
|
113
113
|
}
|
|
114
|
-
_context2.
|
|
114
|
+
_context2.prev = 4;
|
|
115
|
+
_context2.next = 7;
|
|
115
116
|
return this.fetchStream(summaryStyle);
|
|
116
|
-
case
|
|
117
|
+
case 7:
|
|
117
118
|
stream = _context2.sent;
|
|
118
119
|
bufferContent = '';
|
|
119
120
|
_iteratorAbruptCompletion = false;
|
|
120
121
|
_didIteratorError = false;
|
|
121
|
-
_context2.prev =
|
|
122
|
+
_context2.prev = 11;
|
|
122
123
|
_iterator = _asyncIterator(stream);
|
|
123
|
-
case
|
|
124
|
-
_context2.next =
|
|
124
|
+
case 13:
|
|
125
|
+
_context2.next = 15;
|
|
125
126
|
return _iterator.next();
|
|
126
|
-
case
|
|
127
|
+
case 15:
|
|
127
128
|
if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
|
|
128
|
-
_context2.next =
|
|
129
|
+
_context2.next = 21;
|
|
129
130
|
break;
|
|
130
131
|
}
|
|
131
132
|
chunk = _step.value;
|
|
@@ -145,43 +146,53 @@ export var AISummaryService = /*#__PURE__*/function () {
|
|
|
145
146
|
_iterator3.f();
|
|
146
147
|
}
|
|
147
148
|
}
|
|
148
|
-
case
|
|
149
|
+
case 18:
|
|
149
150
|
_iteratorAbruptCompletion = false;
|
|
150
|
-
_context2.next =
|
|
151
|
+
_context2.next = 13;
|
|
151
152
|
break;
|
|
152
|
-
case
|
|
153
|
-
_context2.next =
|
|
153
|
+
case 21:
|
|
154
|
+
_context2.next = 27;
|
|
154
155
|
break;
|
|
155
|
-
case
|
|
156
|
-
_context2.prev =
|
|
157
|
-
_context2.t0 = _context2["catch"](
|
|
156
|
+
case 23:
|
|
157
|
+
_context2.prev = 23;
|
|
158
|
+
_context2.t0 = _context2["catch"](11);
|
|
158
159
|
_didIteratorError = true;
|
|
159
160
|
_iteratorError = _context2.t0;
|
|
160
|
-
case
|
|
161
|
-
_context2.prev = 26;
|
|
161
|
+
case 27:
|
|
162
162
|
_context2.prev = 27;
|
|
163
|
+
_context2.prev = 28;
|
|
163
164
|
if (!(_iteratorAbruptCompletion && _iterator.return != null)) {
|
|
164
|
-
_context2.next =
|
|
165
|
+
_context2.next = 32;
|
|
165
166
|
break;
|
|
166
167
|
}
|
|
167
|
-
_context2.next =
|
|
168
|
+
_context2.next = 32;
|
|
168
169
|
return _iterator.return();
|
|
169
|
-
case
|
|
170
|
-
_context2.prev =
|
|
170
|
+
case 32:
|
|
171
|
+
_context2.prev = 32;
|
|
171
172
|
if (!_didIteratorError) {
|
|
172
|
-
_context2.next =
|
|
173
|
+
_context2.next = 35;
|
|
173
174
|
break;
|
|
174
175
|
}
|
|
175
176
|
throw _iteratorError;
|
|
176
|
-
case 34:
|
|
177
|
-
return _context2.finish(31);
|
|
178
177
|
case 35:
|
|
179
|
-
return _context2.finish(
|
|
178
|
+
return _context2.finish(32);
|
|
180
179
|
case 36:
|
|
180
|
+
return _context2.finish(27);
|
|
181
|
+
case 37:
|
|
181
182
|
this.state = {
|
|
182
183
|
status: 'done',
|
|
183
184
|
content: bufferContent
|
|
184
185
|
};
|
|
186
|
+
_context2.next = 43;
|
|
187
|
+
break;
|
|
188
|
+
case 40:
|
|
189
|
+
_context2.prev = 40;
|
|
190
|
+
_context2.t1 = _context2["catch"](4);
|
|
191
|
+
this.state = {
|
|
192
|
+
status: 'error',
|
|
193
|
+
content: ''
|
|
194
|
+
};
|
|
195
|
+
case 43:
|
|
185
196
|
_iterator4 = _createForOfIteratorHelper(this.subscribedStateSetters);
|
|
186
197
|
try {
|
|
187
198
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
@@ -193,11 +204,11 @@ export var AISummaryService = /*#__PURE__*/function () {
|
|
|
193
204
|
} finally {
|
|
194
205
|
_iterator4.f();
|
|
195
206
|
}
|
|
196
|
-
case
|
|
207
|
+
case 45:
|
|
197
208
|
case "end":
|
|
198
209
|
return _context2.stop();
|
|
199
210
|
}
|
|
200
|
-
}, _callee2, this, [[
|
|
211
|
+
}, _callee2, this, [[4, 40], [11, 23, 27, 37], [28,, 32, 36]]);
|
|
201
212
|
}));
|
|
202
213
|
function summariseUrl() {
|
|
203
214
|
return _summariseUrl.apply(this, arguments);
|
|
@@ -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.48.
|
|
18
|
+
packageVersion: "26.48.6"
|
|
19
19
|
};
|
|
20
20
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
21
21
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -11,7 +11,7 @@ var AIIndicatorContainer = function AIIndicatorContainer(_ref) {
|
|
|
11
11
|
content = _ref.content,
|
|
12
12
|
testId = _ref.testId;
|
|
13
13
|
return /*#__PURE__*/React.createElement(Inline, {
|
|
14
|
-
alignBlock: "
|
|
14
|
+
alignBlock: "start",
|
|
15
15
|
alignInline: "start",
|
|
16
16
|
space: "space.050",
|
|
17
17
|
xcss: contentStyles,
|
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
3
|
-
var _templateObject;
|
|
4
2
|
import React from 'react';
|
|
5
3
|
import styled from '@emotion/styled';
|
|
6
4
|
import Tooltip, { TooltipPrimitive } from '@atlaskit/tooltip';
|
|
7
5
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
8
|
-
var AIIndicatorTooltipPrimitive = styled(TooltipPrimitive)(
|
|
6
|
+
var AIIndicatorTooltipPrimitive = styled(TooltipPrimitive)({
|
|
7
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
8
|
+
backgroundColor: "var(--ds-surface-raised, white)",
|
|
9
|
+
boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))",
|
|
10
|
+
boxSizing: 'content-box',
|
|
11
|
+
padding: "var(--ds-space-200, 16px)",
|
|
12
|
+
maxWidth: '350px'
|
|
13
|
+
});
|
|
9
14
|
var triggerStyles = xcss({
|
|
10
15
|
display: 'inline-flex'
|
|
11
16
|
});
|
|
12
17
|
var AIIndicatorTooltip = function AIIndicatorTooltip(_ref) {
|
|
13
18
|
var content = _ref.content,
|
|
14
|
-
trigger = _ref.trigger
|
|
19
|
+
trigger = _ref.trigger,
|
|
20
|
+
overrideXcss = _ref.xcss;
|
|
15
21
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
16
22
|
component: AIIndicatorTooltipPrimitive,
|
|
17
23
|
content: content,
|
|
18
24
|
tag: "span"
|
|
19
25
|
}, function (tooltipProps) {
|
|
20
26
|
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
21
|
-
xcss: triggerStyles
|
|
27
|
+
xcss: [triggerStyles, overrideXcss]
|
|
22
28
|
}, tooltipProps), trigger);
|
|
23
29
|
});
|
|
24
30
|
};
|
|
@@ -41,6 +41,10 @@ var iconTooltipDescStyles = xcss({
|
|
|
41
41
|
fontWeight: '400',
|
|
42
42
|
lineHeight: '14px'
|
|
43
43
|
});
|
|
44
|
+
var iconTooltipTriggerStyles = xcss({
|
|
45
|
+
position: 'relative',
|
|
46
|
+
bottom: 'space.negative.050'
|
|
47
|
+
});
|
|
44
48
|
var AIStateDone = function AIStateDone(_ref) {
|
|
45
49
|
var appearance = _ref.appearance,
|
|
46
50
|
testId = _ref.testId;
|
|
@@ -73,7 +77,8 @@ var AIStateDone = function AIStateDone(_ref) {
|
|
|
73
77
|
}
|
|
74
78
|
}
|
|
75
79
|
}))))),
|
|
76
|
-
trigger: icon
|
|
80
|
+
trigger: icon,
|
|
81
|
+
xcss: iconTooltipTriggerStyles
|
|
77
82
|
});
|
|
78
83
|
default:
|
|
79
84
|
return jsx(AIIndicatorContainer, {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FormattedMessage } from 'react-intl-next';
|
|
4
|
+
import ErrorIcon from '@atlaskit/icon/glyph/error';
|
|
5
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
6
|
+
import { messages } from '../../../../../../messages';
|
|
7
|
+
import AIIndicatorContainer from './ai-indicator-container';
|
|
8
|
+
import AILearnMoreAnchor from './ai-learn-more-anchor';
|
|
9
|
+
import { CONTENT_URL_AI_TROUBLESHOOTING } from '../../../../../../constants';
|
|
10
|
+
var contentStyles = xcss({
|
|
11
|
+
color: 'color.text.subtle',
|
|
12
|
+
fontSize: '11px',
|
|
13
|
+
fontStyle: 'normal',
|
|
14
|
+
fontWeight: '400',
|
|
15
|
+
lineHeight: '14px'
|
|
16
|
+
});
|
|
17
|
+
var AIStateError = function AIStateError(_ref) {
|
|
18
|
+
var appearance = _ref.appearance,
|
|
19
|
+
testId = _ref.testId;
|
|
20
|
+
switch (appearance) {
|
|
21
|
+
case 'icon-only':
|
|
22
|
+
return null;
|
|
23
|
+
default:
|
|
24
|
+
return /*#__PURE__*/React.createElement(AIIndicatorContainer, {
|
|
25
|
+
icon: /*#__PURE__*/React.createElement(ErrorIcon, {
|
|
26
|
+
primaryColor: "var(--ds-icon-danger, #C9372C)",
|
|
27
|
+
label: "AI",
|
|
28
|
+
size: "small",
|
|
29
|
+
testId: "".concat(testId, "-error-icon")
|
|
30
|
+
}),
|
|
31
|
+
content: /*#__PURE__*/React.createElement(Box, {
|
|
32
|
+
testId: "".concat(testId, "-error-message"),
|
|
33
|
+
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
|
+
}))),
|
|
43
|
+
testId: "".concat(testId, "-error")
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
export default AIStateError;
|
|
@@ -7,17 +7,16 @@ import AIIndicatorContainer from './ai-indicator-container';
|
|
|
7
7
|
var AIStateLoading = function AIStateLoading(_ref) {
|
|
8
8
|
var appearance = _ref.appearance,
|
|
9
9
|
testId = _ref.testId;
|
|
10
|
-
var icon = /*#__PURE__*/React.createElement(AIIconLoading, {
|
|
11
|
-
label: "AI",
|
|
12
|
-
size: "small",
|
|
13
|
-
testId: "".concat(testId, "-loading-icon")
|
|
14
|
-
});
|
|
15
10
|
switch (appearance) {
|
|
16
11
|
case 'icon-only':
|
|
17
|
-
return
|
|
12
|
+
return null;
|
|
18
13
|
default:
|
|
19
14
|
return /*#__PURE__*/React.createElement(AIIndicatorContainer, {
|
|
20
|
-
icon:
|
|
15
|
+
icon: /*#__PURE__*/React.createElement(AIIconLoading, {
|
|
16
|
+
label: "AI",
|
|
17
|
+
size: "small",
|
|
18
|
+
testId: "".concat(testId, "-loading-icon")
|
|
19
|
+
}),
|
|
21
20
|
content: /*#__PURE__*/React.createElement(Box, {
|
|
22
21
|
testId: "".concat(testId, "-loading-message")
|
|
23
22
|
}, /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summarizing)),
|
package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { jsx } from '@emotion/react';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import AIStateLoading from './ai-state-loading';
|
|
5
5
|
import AIStateDone from './ai-state-done';
|
|
6
|
+
import AIStateError from './ai-state-error';
|
|
6
7
|
var AIStateIndicator = function AIStateIndicator(_ref) {
|
|
7
8
|
var state = _ref.state,
|
|
8
9
|
_ref$appearance = _ref.appearance,
|
|
@@ -10,6 +11,11 @@ var AIStateIndicator = function AIStateIndicator(_ref) {
|
|
|
10
11
|
_ref$testId = _ref.testId,
|
|
11
12
|
testId = _ref$testId === void 0 ? 'ai-state-indicator' : _ref$testId;
|
|
12
13
|
switch (state) {
|
|
14
|
+
case 'error':
|
|
15
|
+
return jsx(AIStateError, {
|
|
16
|
+
appearance: appearance,
|
|
17
|
+
testId: testId
|
|
18
|
+
});
|
|
13
19
|
case 'loading':
|
|
14
20
|
return jsx(AIStateLoading, {
|
|
15
21
|
appearance: appearance,
|
|
@@ -4,26 +4,26 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
4
4
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
5
5
|
import { FormattedMessage } from 'react-intl-next';
|
|
6
6
|
import { Box, Inline } from '@atlaskit/primitives';
|
|
7
|
-
import { ActionName, SmartLinkSize, SmartLinkWidth
|
|
7
|
+
import { ActionName, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
|
|
8
8
|
import ActionGroup from '../../action-group';
|
|
9
9
|
import Block from '../../block';
|
|
10
10
|
import ElementGroup from '../../element-group';
|
|
11
11
|
import AIStateIndicator from '../ai-state-indicator';
|
|
12
12
|
import { renderElementItems } from '../../utils';
|
|
13
13
|
import { messages } from '../../../../../../messages';
|
|
14
|
-
import AiIcon from '../../../../../common/ai-icon';
|
|
15
|
-
import AISummary from '../../../../../common/ai-summary';
|
|
16
14
|
import { useAISummary } from '../../../../../../state/hooks/use-ai-summary';
|
|
17
15
|
import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context';
|
|
16
|
+
import AIIcon from '../../../../../common/ai-icon';
|
|
17
|
+
import AISummary from '../../../../../common/ai-summary';
|
|
18
18
|
var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
19
19
|
var _props$actions = props.actions,
|
|
20
20
|
actions = _props$actions === void 0 ? [] : _props$actions,
|
|
21
21
|
metadata = props.metadata,
|
|
22
|
-
testId = props.testId,
|
|
23
22
|
onActionMenuOpenChange = props.onActionMenuOpenChange,
|
|
24
23
|
onAIActionChange = props.onAIActionChange,
|
|
25
24
|
_props$size = props.size,
|
|
26
|
-
size = _props$size === void 0 ? SmartLinkSize.Medium : _props$size
|
|
25
|
+
size = _props$size === void 0 ? SmartLinkSize.Medium : _props$size,
|
|
26
|
+
testId = props.testId;
|
|
27
27
|
var _useState = useState('ready'),
|
|
28
28
|
_useState2 = _slicedToArray(_useState, 2),
|
|
29
29
|
aiState = _useState2[0],
|
|
@@ -34,7 +34,10 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
34
34
|
var aiSummary = useAISummary({
|
|
35
35
|
url: url
|
|
36
36
|
});
|
|
37
|
-
var
|
|
37
|
+
var _aiSummary$state = aiSummary.state,
|
|
38
|
+
content = _aiSummary$state.content,
|
|
39
|
+
status = _aiSummary$state.status,
|
|
40
|
+
isSummarisedOnMount = aiSummary.isSummarisedOnMount;
|
|
38
41
|
var onAIActionClick = useCallback(function () {
|
|
39
42
|
setAIState('loading');
|
|
40
43
|
if (onAIActionChange) {
|
|
@@ -48,8 +51,8 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
48
51
|
name: ActionName.CustomAction,
|
|
49
52
|
onClick: onAIActionClick,
|
|
50
53
|
testId: "".concat(testId, "-ai-summary-action"),
|
|
51
|
-
icon: /*#__PURE__*/React.createElement(
|
|
52
|
-
label: "
|
|
54
|
+
icon: /*#__PURE__*/React.createElement(AIIcon, {
|
|
55
|
+
label: "AIIcon"
|
|
53
56
|
})
|
|
54
57
|
};
|
|
55
58
|
return [aiAction].concat(_toConsumableArray(actions));
|
|
@@ -67,22 +70,29 @@ var AISummaryBlockResolvedView = function AISummaryBlockResolvedView(props) {
|
|
|
67
70
|
direction: SmartLinkDirection.Vertical,
|
|
68
71
|
testId: "".concat(testId, "-resolved-view")
|
|
69
72
|
}), /*#__PURE__*/React.createElement(AISummary, {
|
|
70
|
-
content: content
|
|
73
|
+
content: content,
|
|
74
|
+
showIcon: isSummarisedOnMount
|
|
71
75
|
}), /*#__PURE__*/React.createElement(Inline, {
|
|
72
76
|
alignBlock: "center",
|
|
73
77
|
alignInline: "end",
|
|
74
78
|
grow: "fill",
|
|
75
79
|
spread: "space-between"
|
|
76
|
-
}, /*#__PURE__*/React.createElement(Box, null, aiState === 'loading' || aiState === 'done' ? /*#__PURE__*/React.createElement(AIStateIndicator, {
|
|
80
|
+
}, /*#__PURE__*/React.createElement(Box, null, !isSummarisedOnMount && (aiState === 'loading' || aiState === 'done') ? /*#__PURE__*/React.createElement(AIStateIndicator, {
|
|
77
81
|
state: aiState,
|
|
78
|
-
testId: testId
|
|
82
|
+
testId: "".concat(testId, "-state-indicator")
|
|
79
83
|
}) : /*#__PURE__*/React.createElement(ElementGroup, {
|
|
80
|
-
width: SmartLinkWidth.FitToContent
|
|
84
|
+
width: SmartLinkWidth.FitToContent,
|
|
85
|
+
testId: "".concat(testId, "-metadata-group")
|
|
81
86
|
}, metadataElements)), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(ActionGroup, {
|
|
82
87
|
onDropdownOpenChange: onDropdownOpenChange,
|
|
83
88
|
items: combinedActions,
|
|
84
89
|
appearance: "default",
|
|
85
90
|
size: size
|
|
86
|
-
})))
|
|
91
|
+
}))), status === 'error' && /*#__PURE__*/React.createElement(Inline, {
|
|
92
|
+
grow: "fill"
|
|
93
|
+
}, /*#__PURE__*/React.createElement(AIStateIndicator, {
|
|
94
|
+
state: status,
|
|
95
|
+
testId: testId
|
|
96
|
+
})));
|
|
87
97
|
};
|
|
88
98
|
export default AISummaryBlockResolvedView;
|
|
@@ -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.48.
|
|
13
|
+
packageVersion: "26.48.6",
|
|
14
14
|
componentName: 'linkUrl'
|
|
15
15
|
};
|
|
16
16
|
var Link = withLinkClickedEvent('a');
|