@atlaskit/smart-card 43.31.5 → 43.31.7
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/__tests__/vr-tests/__snapshots__/hover-card/hover-card-rovo-chat-action--default.png +2 -2
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/action-button.compiled.css +5 -0
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-stack-item/action-button.js +9 -2
- package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js +5 -2
- package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.js +5 -1
- package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.js +50 -3
- package/dist/cjs/view/FlexibleCard/components/blocks/action-block/index.js +6 -38
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/index.js +14 -33
- package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +43 -37
- package/dist/cjs/view/FlexibleCard/components/blocks/hover-card-footer-block/index.js +1 -1
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +2 -4
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +4 -8
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/__tests__/vr-tests/__snapshots__/hover-card/hover-card-rovo-chat-action--default.png +2 -2
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/action-button.compiled.css +5 -0
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-stack-item/action-button.js +9 -2
- package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js +5 -2
- package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.js +6 -2
- package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.js +31 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-block/index.js +6 -34
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/index.js +11 -29
- package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +44 -38
- package/dist/es2019/view/FlexibleCard/components/blocks/hover-card-footer-block/index.js +1 -1
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +2 -4
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +4 -8
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/__tests__/vr-tests/__snapshots__/hover-card/hover-card-rovo-chat-action--default.png +2 -2
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/action-button.compiled.css +5 -0
- package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/action-button.js +9 -2
- package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js +5 -2
- package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/ai-summary-action-component.js +6 -2
- package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.js +47 -1
- package/dist/esm/view/FlexibleCard/components/blocks/action-block/index.js +6 -38
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/index.js +13 -32
- package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +44 -38
- package/dist/esm/view/FlexibleCard/components/blocks/hover-card-footer-block/index.js +1 -1
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +2 -4
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +4 -8
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.d.ts +3 -0
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/index.d.ts +2 -10
- package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +4 -7
- package/dist/types/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/dist/types/view/HoverCard/components/views/resolved/types.d.ts +0 -1
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.d.ts +3 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/index.d.ts +2 -10
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +4 -7
- package/dist/types-ts4.5/view/HoverCard/components/views/resolved/index.d.ts +1 -1
- package/dist/types-ts4.5/view/HoverCard/components/views/resolved/types.d.ts +0 -1
- package/package.json +3 -4
package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js
CHANGED
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React, { useCallback } from 'react';
|
|
3
3
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
4
|
import AiIcon from '@atlaskit/icon/core/atlassian-intelligence';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
|
|
6
7
|
import { messages } from '../../../../../messages';
|
|
7
8
|
import Action from '../action';
|
|
@@ -35,11 +36,13 @@ export function AISummariseAction({
|
|
|
35
36
|
}, [fireEvent, onClickCallback, onCompleted, summariseUrl]);
|
|
36
37
|
return /*#__PURE__*/React.createElement(Action, _extends({
|
|
37
38
|
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summary_action),
|
|
38
|
-
icon: /*#__PURE__*/React.createElement(AiIcon, {
|
|
39
|
+
icon: /*#__PURE__*/React.createElement(AiIcon, _extends({
|
|
39
40
|
spacing: "spacious",
|
|
40
41
|
color: "currentColor",
|
|
41
42
|
label: "Summarise with AI"
|
|
42
|
-
})
|
|
43
|
+
}, fg('platform_sl_3p_auth_rovo_action_kill_switch') ? {
|
|
44
|
+
size: props.iconSize
|
|
45
|
+
} : {})),
|
|
43
46
|
onClick: handleActionClick,
|
|
44
47
|
testId: `${testId}-summarise-action`,
|
|
45
48
|
isLoading: status === 'loading',
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useEffect } from 'react';
|
|
3
3
|
import { di } from 'react-magnetic-di';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import useAISummaryAction from '../../../../../state/hooks/use-ai-summary-action';
|
|
5
6
|
import { AISummariseAction } from './ai-summarise-action';
|
|
6
|
-
import { CopySummaryAction } from './copy-summary-action';
|
|
7
|
+
import { CopySummaryAction, CopySummaryActionNew } from './copy-summary-action';
|
|
7
8
|
export const AISummaryActionComponent = props => {
|
|
8
9
|
const {
|
|
9
10
|
url,
|
|
@@ -20,7 +21,10 @@ export const AISummaryActionComponent = props => {
|
|
|
20
21
|
useEffect(() => {
|
|
21
22
|
onLoadingChange === null || onLoadingChange === void 0 ? void 0 : onLoadingChange(status === 'loading');
|
|
22
23
|
}, [onLoadingChange, status]);
|
|
23
|
-
return status === 'done' ? /*#__PURE__*/React.createElement(
|
|
24
|
+
return status === 'done' ? fg('platform_sl_3p_auth_rovo_action_kill_switch') ? /*#__PURE__*/React.createElement(CopySummaryActionNew, _extends({}, props, {
|
|
25
|
+
summary: content,
|
|
26
|
+
testId: testId
|
|
27
|
+
})) : /*#__PURE__*/React.createElement(CopySummaryAction, _extends({}, props, {
|
|
24
28
|
testId: testId,
|
|
25
29
|
content: content
|
|
26
30
|
})) : /*#__PURE__*/React.createElement(AISummariseAction, _extends({}, props, {
|
package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.js
CHANGED
|
@@ -34,4 +34,35 @@ export function CopySummaryAction({
|
|
|
34
34
|
tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, tooltipMessage),
|
|
35
35
|
tooltipOnHide: () => setTooltipMessage(messages.copy_summary_action_description)
|
|
36
36
|
}, props));
|
|
37
|
+
}
|
|
38
|
+
export function CopySummaryActionNew({
|
|
39
|
+
url,
|
|
40
|
+
onClick: onClickCallback,
|
|
41
|
+
summary = '',
|
|
42
|
+
testId,
|
|
43
|
+
...props
|
|
44
|
+
}) {
|
|
45
|
+
const {
|
|
46
|
+
fireEvent
|
|
47
|
+
} = useAnalyticsEvents();
|
|
48
|
+
const [tooltipMessage, setTooltipMessage] = useState(messages.copy_summary_action_description);
|
|
49
|
+
const handleCopySummaryClick = useCallback(async () => {
|
|
50
|
+
fireEvent('ui.button.clicked.copySummary', {});
|
|
51
|
+
await navigator.clipboard.writeText(summary);
|
|
52
|
+
setTooltipMessage(messages.copied_summary_action_description);
|
|
53
|
+
onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback();
|
|
54
|
+
}, [fireEvent, onClickCallback, summary]);
|
|
55
|
+
return /*#__PURE__*/React.createElement(Action, _extends({
|
|
56
|
+
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.copy_summary_action),
|
|
57
|
+
icon: /*#__PURE__*/React.createElement(CopyIcon, {
|
|
58
|
+
color: "currentColor",
|
|
59
|
+
spacing: "spacious",
|
|
60
|
+
label: "Copy Summary",
|
|
61
|
+
size: props.iconSize
|
|
62
|
+
}),
|
|
63
|
+
onClick: handleCopySummaryClick,
|
|
64
|
+
testId: `${testId}-copy-summary-action`,
|
|
65
|
+
tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, tooltipMessage),
|
|
66
|
+
tooltipOnHide: () => setTooltipMessage(messages.copy_summary_action_description)
|
|
67
|
+
}, props));
|
|
37
68
|
}
|
|
@@ -4,11 +4,9 @@ import * as React from 'react';
|
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { useCallback, useMemo, useState } from 'react';
|
|
6
6
|
import { di } from 'react-magnetic-di';
|
|
7
|
-
import { FadeIn, StaggeredEntrance } from '@atlaskit/motion';
|
|
8
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
8
|
import { InternalActionName, SmartLinkSize } from '../../../../../constants';
|
|
10
9
|
import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
|
|
11
|
-
import useAISummaryAction from '../../../../../state/hooks/use-ai-summary-action';
|
|
12
10
|
import * as Actions from '../../actions';
|
|
13
11
|
import { ActionFooter } from './action-footer';
|
|
14
12
|
const ignoreContainerPaddingStyles = null;
|
|
@@ -54,7 +52,6 @@ const ActionBlock = ({
|
|
|
54
52
|
var _context$actions;
|
|
55
53
|
const context = useFlexibleUiContext();
|
|
56
54
|
const ui = useFlexibleUiOptionContext();
|
|
57
|
-
const url = context === null || context === void 0 ? void 0 : context.url;
|
|
58
55
|
const isRovoChatActionAvailable = is3PAuthRovoActionsExperimentOn && fg('platform_sl_3p_auth_rovo_action_kill_switch') ? (context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[InternalActionName.RovoChatAction]) !== undefined : undefined;
|
|
59
56
|
const [message, setMessage] = useState();
|
|
60
57
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -75,17 +72,11 @@ const ActionBlock = ({
|
|
|
75
72
|
}
|
|
76
73
|
const arr = fg('platform_sl_3p_auth_rovo_action_kill_switch') ? isRovoChatActionAvailable ? [InternalActionName.RovoChatAction] : Object.keys(context.actions).filter(name => name !== InternalActionName.RovoChatAction) : Object.keys(context.actions);
|
|
77
74
|
arr.sort(sort);
|
|
78
|
-
const renderAction =
|
|
75
|
+
const renderAction = name => {
|
|
79
76
|
const Action = name in Actions ? Actions[name] : undefined;
|
|
80
77
|
if (!Action) {
|
|
81
78
|
return null;
|
|
82
79
|
}
|
|
83
|
-
const style = padding || motionStyle ? {
|
|
84
|
-
...(motionStyle || {}),
|
|
85
|
-
...(padding && {
|
|
86
|
-
paddingInline: padding
|
|
87
|
-
})
|
|
88
|
-
} : undefined;
|
|
89
80
|
return /*#__PURE__*/React.createElement(Action, {
|
|
90
81
|
as: "stack-item",
|
|
91
82
|
spaceInline: spaceInline,
|
|
@@ -94,35 +85,16 @@ const ActionBlock = ({
|
|
|
94
85
|
onError: onError,
|
|
95
86
|
onLoadingChange: onLoadingChange,
|
|
96
87
|
size: size || (ui === null || ui === void 0 ? void 0 : ui.size)
|
|
97
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
88
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
98
89
|
,
|
|
99
|
-
style:
|
|
90
|
+
style: padding && {
|
|
91
|
+
paddingInline: padding
|
|
92
|
+
},
|
|
100
93
|
hideTooltip: isLoading
|
|
101
94
|
});
|
|
102
95
|
};
|
|
103
|
-
return
|
|
104
|
-
columns: 1
|
|
105
|
-
}, arr.map((name, index) => /*#__PURE__*/React.createElement(FadeIn, {
|
|
106
|
-
duration: 'large',
|
|
107
|
-
key: index
|
|
108
|
-
}, motion => renderAction(name, motion.style)))) : arr.map(name => renderAction(name));
|
|
96
|
+
return arr.map(name => renderAction(name));
|
|
109
97
|
}, [context === null || context === void 0 ? void 0 : context.actions, isRovoChatActionAvailable, spaceInline, onError, onLoadingChange, size, ui === null || ui === void 0 ? void 0 : ui.size, padding, isLoading, onClick]);
|
|
110
|
-
const aiSummaryConfig = fg('platform_sl_3p_auth_rovo_action_kill_switch') ?
|
|
111
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
112
|
-
useAISummaryAction(url !== null && url !== void 0 ? url : '') : undefined;
|
|
113
|
-
if (fg('platform_sl_3p_auth_rovo_action_kill_switch')) {
|
|
114
|
-
const shouldShowActions = !isRovoChatActionAvailable || isRovoChatActionAvailable && ((aiSummaryConfig === null || aiSummaryConfig === void 0 ? void 0 : aiSummaryConfig.state.status) === 'done' || (aiSummaryConfig === null || aiSummaryConfig === void 0 ? void 0 : aiSummaryConfig.state.status) === 'error');
|
|
115
|
-
return actions && shouldShowActions ? /*#__PURE__*/React.createElement("div", {
|
|
116
|
-
ref: blockRef,
|
|
117
|
-
"data-testid": testId
|
|
118
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
|
|
119
|
-
,
|
|
120
|
-
className: ax(["_1e0c1txw _2lx21bp4 _vchhusvi _16jlkb7n _1bsb129b _18u01ivi _2hwxc10g", className])
|
|
121
|
-
}, actions, /*#__PURE__*/React.createElement(ActionFooter, {
|
|
122
|
-
message: message,
|
|
123
|
-
testId: testId
|
|
124
|
-
})) : null;
|
|
125
|
-
}
|
|
126
98
|
return actions ? /*#__PURE__*/React.createElement("div", {
|
|
127
99
|
ref: blockRef,
|
|
128
100
|
"data-testid": testId
|
|
@@ -11,10 +11,11 @@ import AISummaryBlockResolvedView, { RovoSummaryBlockResolvedView } from './reso
|
|
|
11
11
|
* @see Block
|
|
12
12
|
*/
|
|
13
13
|
const AISummaryBlock = ({
|
|
14
|
+
is3PAuthRovoActionsExperimentOn,
|
|
14
15
|
testId = 'smart-ai-summary-block',
|
|
15
16
|
...props
|
|
16
17
|
}) => {
|
|
17
|
-
var _context$actions, _props$
|
|
18
|
+
var _context$actions, _props$size2, _cardContext$ui2;
|
|
18
19
|
const cardContext = useFlexibleCardContext();
|
|
19
20
|
const context = useFlexibleUiContext();
|
|
20
21
|
const actionData = context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[InternalActionName.AISummaryAction];
|
|
@@ -24,37 +25,18 @@ const AISummaryBlock = ({
|
|
|
24
25
|
if (!(actionData !== null && actionData !== void 0 && actionData.url)) {
|
|
25
26
|
return null;
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Represents an AISummaryBlock, designed to summarising link resource
|
|
36
|
-
* content using AI.
|
|
37
|
-
* @public
|
|
38
|
-
* @param {RovoSummaryBlockProps} RovoSummaryBlock
|
|
39
|
-
* @see Block
|
|
40
|
-
*/
|
|
41
|
-
export const RovoSummaryBlock = ({
|
|
42
|
-
testId = 'smart-ai-summary-block',
|
|
43
|
-
url,
|
|
44
|
-
...props
|
|
45
|
-
}) => {
|
|
46
|
-
var _props$size2, _cardContext$ui2;
|
|
47
|
-
const cardContext = useFlexibleCardContext();
|
|
48
|
-
if ((cardContext === null || cardContext === void 0 ? void 0 : cardContext.status) !== SmartLinkStatus.Resolved) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
if (!url) {
|
|
52
|
-
return null;
|
|
28
|
+
if (is3PAuthRovoActionsExperimentOn) {
|
|
29
|
+
var _props$size, _cardContext$ui;
|
|
30
|
+
return /*#__PURE__*/React.createElement(RovoSummaryBlockResolvedView, _extends({}, props, {
|
|
31
|
+
size: (_props$size = props.size) !== null && _props$size !== void 0 ? _props$size : cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$ui = cardContext.ui) === null || _cardContext$ui === void 0 ? void 0 : _cardContext$ui.size,
|
|
32
|
+
testId: testId,
|
|
33
|
+
url: actionData.url
|
|
34
|
+
}));
|
|
53
35
|
}
|
|
54
|
-
return /*#__PURE__*/React.createElement(
|
|
36
|
+
return /*#__PURE__*/React.createElement(AISummaryBlockResolvedView, _extends({}, props, {
|
|
55
37
|
size: (_props$size2 = props.size) !== null && _props$size2 !== void 0 ? _props$size2 : cardContext === null || cardContext === void 0 ? void 0 : (_cardContext$ui2 = cardContext.ui) === null || _cardContext$ui2 === void 0 ? void 0 : _cardContext$ui2.size,
|
|
56
38
|
testId: testId,
|
|
57
|
-
url: url
|
|
39
|
+
url: actionData.url
|
|
58
40
|
}));
|
|
59
41
|
};
|
|
60
42
|
export default AISummaryBlock;
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
import "./index.compiled.css";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
-
import { Fragment,
|
|
6
|
+
import { Fragment, useRef } from 'react';
|
|
7
7
|
import { FormattedMessage } from 'react-intl-next';
|
|
8
8
|
import { di } from 'react-magnetic-di';
|
|
9
9
|
import { RovoIcon } from '@atlaskit/logo';
|
|
@@ -65,32 +65,54 @@ export const RovoSummaryBlockResolvedView = props => {
|
|
|
65
65
|
const {
|
|
66
66
|
testId,
|
|
67
67
|
aiSummaryMinHeight = 0,
|
|
68
|
+
placeholder,
|
|
68
69
|
url
|
|
69
70
|
} = props;
|
|
70
71
|
const {
|
|
71
72
|
state: {
|
|
72
73
|
content,
|
|
73
74
|
status
|
|
74
|
-
}
|
|
75
|
-
summariseUrl
|
|
75
|
+
}
|
|
76
76
|
} = useAISummaryAction(url);
|
|
77
|
-
const showAISummary = status === 'done' ||
|
|
78
|
-
// We want to display the AI Summary component only when there is content available during the loading process.
|
|
79
|
-
status === 'loading' && !!content;
|
|
80
77
|
const isSummarisedOnMountRef = useRef(status === 'done');
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
if (status !== 'ready' || isSummarisedOnMountRef.current) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
isSummarisedOnMountRef.current = true;
|
|
86
|
-
summariseUrl();
|
|
87
|
-
}, [status, summariseUrl]);
|
|
88
78
|
const minHeight = isSummarisedOnMountRef.current ? 0 : aiSummaryMinHeight;
|
|
89
79
|
if (status === 'error') {
|
|
90
80
|
return null;
|
|
91
81
|
}
|
|
92
|
-
|
|
93
|
-
|
|
82
|
+
|
|
83
|
+
// Show summary when there is content to display
|
|
84
|
+
if (content && content !== '') {
|
|
85
|
+
return /*#__PURE__*/React.createElement(Block, _extends({}, props, {
|
|
86
|
+
direction: SmartLinkDirection.Vertical,
|
|
87
|
+
testId: `${testId}-resolved-view`,
|
|
88
|
+
className: ax(["_1reoewfl _18m9ewfl"])
|
|
89
|
+
}), /*#__PURE__*/React.createElement(Inline, {
|
|
90
|
+
xcss: newStyles.summaryWrapper
|
|
91
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: ax([newStyles.iconWrapper])
|
|
93
|
+
}, /*#__PURE__*/React.createElement(RovoIcon, {
|
|
94
|
+
shouldUseHexLogo: true,
|
|
95
|
+
size: "xxsmall"
|
|
96
|
+
})), status === 'done' && /*#__PURE__*/React.createElement(AIEventSummaryViewed, {
|
|
97
|
+
fromCache: isSummarisedOnMountRef.current
|
|
98
|
+
}), /*#__PURE__*/React.createElement(MotionWrapper, {
|
|
99
|
+
minHeight: minHeight,
|
|
100
|
+
show: true,
|
|
101
|
+
showTransition: !isSummarisedOnMountRef.current
|
|
102
|
+
}, /*#__PURE__*/React.createElement(AISummary, {
|
|
103
|
+
testId: `${testId}-ai-summary`,
|
|
104
|
+
minHeight: minHeight,
|
|
105
|
+
content: content
|
|
106
|
+
}), status === 'done' && /*#__PURE__*/React.createElement(AIFooter, null))));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Show loading state on initial request where content hasn't returned yet.
|
|
110
|
+
if (status === 'loading') {
|
|
111
|
+
return /*#__PURE__*/React.createElement(MotionWrapper, {
|
|
112
|
+
minHeight: minHeight,
|
|
113
|
+
show: true,
|
|
114
|
+
showTransition: true
|
|
115
|
+
}, /*#__PURE__*/React.createElement(Inline, {
|
|
94
116
|
testId: `${testId}-placeholder`,
|
|
95
117
|
xcss: newStyles.placeholderWrapper
|
|
96
118
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -105,29 +127,13 @@ export const RovoSummaryBlockResolvedView = props => {
|
|
|
105
127
|
xcss: newStyles.ellipsesContainer
|
|
106
128
|
}, /*#__PURE__*/React.createElement(EllipsesAnimation, {
|
|
107
129
|
isAnimated: true
|
|
108
|
-
})));
|
|
130
|
+
}))));
|
|
109
131
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
117
|
-
className: ax([newStyles.iconWrapper])
|
|
118
|
-
}, /*#__PURE__*/React.createElement(RovoIcon, {
|
|
119
|
-
shouldUseHexLogo: true,
|
|
120
|
-
size: 'xxsmall'
|
|
121
|
-
})), status === 'done' && /*#__PURE__*/React.createElement(AIEventSummaryViewed, {
|
|
122
|
-
fromCache: isSummarisedOnMountRef.current
|
|
123
|
-
}), /*#__PURE__*/React.createElement(MotionWrapper, {
|
|
124
|
-
minHeight: minHeight,
|
|
125
|
-
show: showAISummary,
|
|
126
|
-
showTransition: !isSummarisedOnMountRef.current
|
|
127
|
-
}, /*#__PURE__*/React.createElement(AISummary, {
|
|
128
|
-
testId: `${testId}-ai-summary`,
|
|
129
|
-
minHeight: minHeight,
|
|
130
|
-
content: content
|
|
131
|
-
}), status === 'done' && /*#__PURE__*/React.createElement(AIFooter, null))));
|
|
132
|
+
|
|
133
|
+
// Otherwise, show placeholder if provided
|
|
134
|
+
if (placeholder) {
|
|
135
|
+
return /*#__PURE__*/React.createElement(Fragment, null, placeholder);
|
|
136
|
+
}
|
|
137
|
+
return null;
|
|
132
138
|
};
|
|
133
139
|
export default AISummaryBlockResolvedView;
|
|
@@ -14,7 +14,7 @@ import Block from '../block';
|
|
|
14
14
|
* Allowed footer actions for HoverCard, in display order. Fetched from context.
|
|
15
15
|
* @featureGate platform_sl_3p_auth_rovo_action_kill_switch
|
|
16
16
|
*/
|
|
17
|
-
const HIDDEN_HOVER_CARD_FOOTER_ACTIONS = [InternalActionName.
|
|
17
|
+
const HIDDEN_HOVER_CARD_FOOTER_ACTIONS = [InternalActionName.RovoChatAction];
|
|
18
18
|
const ignoreContainerMarginStyles = null;
|
|
19
19
|
const elevatedFooterStyles = null;
|
|
20
20
|
const providerStyles = null;
|
|
@@ -231,8 +231,7 @@ const HoverCardContent = ({
|
|
|
231
231
|
flexibleCardProps: flexibleCardProps,
|
|
232
232
|
isAISummaryEnabled: isAISummaryEnabled,
|
|
233
233
|
onActionClick: onActionClick,
|
|
234
|
-
titleBlockProps: titleBlockProps
|
|
235
|
-
url: url
|
|
234
|
+
titleBlockProps: titleBlockProps
|
|
236
235
|
}));
|
|
237
236
|
}
|
|
238
237
|
return null;
|
|
@@ -284,8 +283,7 @@ const HoverCardContent = ({
|
|
|
284
283
|
flexibleCardProps: flexibleCardProps,
|
|
285
284
|
isAISummaryEnabled: isAISummaryEnabled,
|
|
286
285
|
onActionClick: onActionClick,
|
|
287
|
-
titleBlockProps: titleBlockProps
|
|
288
|
-
url: url
|
|
286
|
+
titleBlockProps: titleBlockProps
|
|
289
287
|
}));
|
|
290
288
|
}
|
|
291
289
|
return null;
|
|
@@ -11,7 +11,6 @@ import { succeedUfoExperience } from '../../../../../state/analytics';
|
|
|
11
11
|
import useAISummaryAction from '../../../../../state/hooks/use-ai-summary-action';
|
|
12
12
|
import FlexibleCard from '../../../../FlexibleCard';
|
|
13
13
|
import { ActionBlock, AIFooterBlock, AISummaryBlock, ResolvedHoverCardFooterBlock, MetadataBlock, SnippetBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
|
|
14
|
-
import { RovoSummaryBlock } from '../../../../FlexibleCard/components/blocks/ai-summary-block';
|
|
15
14
|
import { getMetadata } from '../../../utils';
|
|
16
15
|
import ImagePreview from '../../ImagePreview';
|
|
17
16
|
const hiddenSnippetStyles = null;
|
|
@@ -26,8 +25,7 @@ const HoverCardResolvedView = ({
|
|
|
26
25
|
onActionClick,
|
|
27
26
|
showRovoResolvedView,
|
|
28
27
|
titleBlockProps,
|
|
29
|
-
id
|
|
30
|
-
url
|
|
28
|
+
id
|
|
31
29
|
}) => {
|
|
32
30
|
var _cardState$details;
|
|
33
31
|
const {
|
|
@@ -82,12 +80,10 @@ const HoverCardResolvedView = ({
|
|
|
82
80
|
secondary: secondary,
|
|
83
81
|
maxLines: 1,
|
|
84
82
|
size: SmartLinkSize.Medium
|
|
85
|
-
}),
|
|
83
|
+
}), isAISummaryEnabled ? /*#__PURE__*/React.createElement(AISummaryBlock, {
|
|
86
84
|
aiSummaryMinHeight: aiSummaryMinHeight,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
aiSummaryMinHeight: aiSummaryMinHeight,
|
|
90
|
-
placeholder: snippet
|
|
85
|
+
placeholder: snippet,
|
|
86
|
+
is3PAuthRovoActionsExperimentOn: is3PAuthRovoActionsExperimentOn
|
|
91
87
|
}) : snippet, /*#__PURE__*/React.createElement(SnippetBlock, {
|
|
92
88
|
testId: "hidden-snippet",
|
|
93
89
|
onRender: onSnippetRender,
|
|
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
12
12
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
13
13
|
const PACKAGE_DATA = {
|
|
14
14
|
packageName: "@atlaskit/smart-card",
|
|
15
|
-
packageVersion: "43.31.
|
|
15
|
+
packageVersion: "43.31.6",
|
|
16
16
|
componentName: 'linkUrl'
|
|
17
17
|
};
|
|
18
18
|
const Anchor = withLinkClickedEvent('a');
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
version https://git-lfs.github.com/spec/v1
|
|
2
|
-
oid sha256:
|
|
3
|
-
size
|
|
2
|
+
oid sha256:e1e36e1aa7f05bb230d6a7c63bbe6e7538b66e2f912f9eb7068e1a5880ddde9a
|
|
3
|
+
size 27485
|
|
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export var context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card",
|
|
7
|
-
packageVersion: "43.31.
|
|
7
|
+
packageVersion: "43.31.6"
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
._11c8wadc{font:var(--ds-font-body-small,normal 400 9pt/1pc "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
2
2
|
._19bv1b66{padding-left:var(--ds-space-050,4px)}
|
|
3
|
+
._1bah1h6o{justify-content:center}
|
|
3
4
|
._1bsb1osq{width:100%}
|
|
5
|
+
._1bsb1tcg{width:24px}
|
|
6
|
+
._1e0c116y{display:inline-flex}
|
|
7
|
+
._4cvr1h6o{align-items:center}
|
|
8
|
+
._4t3i1tcg{height:24px}
|
|
4
9
|
._bfhksm61{background-color:var(--ds-background-neutral-subtle,#00000000)}
|
|
5
10
|
._ca0q1b66{padding-top:var(--ds-space-050,4px)}
|
|
6
11
|
._n3td1b66{padding-bottom:var(--ds-space-050,4px)}
|
package/dist/esm/view/FlexibleCard/components/actions/action/action-stack-item/action-button.js
CHANGED
|
@@ -8,11 +8,13 @@ import { cx } from '@atlaskit/css';
|
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
9
|
import { Box, Inline, Pressable } from '@atlaskit/primitives/compiled';
|
|
10
10
|
import Spinner from '@atlaskit/spinner';
|
|
11
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
11
12
|
import { getPrimitivesInlineSpaceBySize } from '../../../utils';
|
|
12
13
|
import ActionIcon from '../action-icon';
|
|
13
14
|
var styles = {
|
|
14
15
|
button: "_bfhksm61 _ca0q1b66 _u5f31b66 _n3td1b66 _19bv1b66 _1bsb1osq _1ah31i6y _irr31dpa _1di6fcek",
|
|
15
|
-
content: "_11c8wadc _syazi7uo"
|
|
16
|
+
content: "_11c8wadc _syazi7uo",
|
|
17
|
+
spinner: "_1bsb1tcg _4t3i1tcg _1e0c116y _4cvr1h6o _1bah1h6o"
|
|
16
18
|
};
|
|
17
19
|
var ActionButton = function ActionButton(_ref) {
|
|
18
20
|
var content = _ref.content,
|
|
@@ -33,7 +35,12 @@ var ActionButton = function ActionButton(_ref) {
|
|
|
33
35
|
}
|
|
34
36
|
}, [isDisabled, isLoading, onClickCallback]);
|
|
35
37
|
var icon = iconOption && isLoading ? /*#__PURE__*/React.createElement(ActionIcon, {
|
|
36
|
-
icon: /*#__PURE__*/React.createElement(
|
|
38
|
+
icon: expValEqualsNoExposure('platform_sl_3p_auth_rovo_action', 'isEnabled', true) && fg('platform_sl_3p_auth_rovo_action_kill_switch') ? /*#__PURE__*/React.createElement(Box, {
|
|
39
|
+
xcss: styles.spinner
|
|
40
|
+
}, /*#__PURE__*/React.createElement(Spinner, {
|
|
41
|
+
size: 16,
|
|
42
|
+
testId: "".concat(testId, "-loading")
|
|
43
|
+
})) : /*#__PURE__*/React.createElement(Spinner, {
|
|
37
44
|
testId: "".concat(testId, "-loading")
|
|
38
45
|
})
|
|
39
46
|
}) : iconOption;
|
package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js
CHANGED
|
@@ -4,6 +4,7 @@ var _excluded = ["onClick", "onError", "testId", "status", "summariseUrl"];
|
|
|
4
4
|
import React, { useCallback } from 'react';
|
|
5
5
|
import { FormattedMessage } from 'react-intl-next';
|
|
6
6
|
import AiIcon from '@atlaskit/icon/core/atlassian-intelligence';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
|
|
8
9
|
import { messages } from '../../../../../messages';
|
|
9
10
|
import Action from '../action';
|
|
@@ -35,11 +36,13 @@ export function AISummariseAction(_ref) {
|
|
|
35
36
|
}, [fireEvent, onClickCallback, onCompleted, summariseUrl]);
|
|
36
37
|
return /*#__PURE__*/React.createElement(Action, _extends({
|
|
37
38
|
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summary_action),
|
|
38
|
-
icon: /*#__PURE__*/React.createElement(AiIcon, {
|
|
39
|
+
icon: /*#__PURE__*/React.createElement(AiIcon, _extends({
|
|
39
40
|
spacing: "spacious",
|
|
40
41
|
color: "currentColor",
|
|
41
42
|
label: "Summarise with AI"
|
|
42
|
-
})
|
|
43
|
+
}, fg('platform_sl_3p_auth_rovo_action_kill_switch') ? {
|
|
44
|
+
size: props.iconSize
|
|
45
|
+
} : {})),
|
|
43
46
|
onClick: handleActionClick,
|
|
44
47
|
testId: "".concat(testId, "-summarise-action"),
|
|
45
48
|
isLoading: status === 'loading',
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useEffect } from 'react';
|
|
3
3
|
import { di } from 'react-magnetic-di';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import useAISummaryAction from '../../../../../state/hooks/use-ai-summary-action';
|
|
5
6
|
import { AISummariseAction } from './ai-summarise-action';
|
|
6
|
-
import { CopySummaryAction } from './copy-summary-action';
|
|
7
|
+
import { CopySummaryAction, CopySummaryActionNew } from './copy-summary-action';
|
|
7
8
|
export var AISummaryActionComponent = function AISummaryActionComponent(props) {
|
|
8
9
|
var url = props.url,
|
|
9
10
|
onLoadingChange = props.onLoadingChange,
|
|
@@ -17,7 +18,10 @@ export var AISummaryActionComponent = function AISummaryActionComponent(props) {
|
|
|
17
18
|
useEffect(function () {
|
|
18
19
|
onLoadingChange === null || onLoadingChange === void 0 || onLoadingChange(status === 'loading');
|
|
19
20
|
}, [onLoadingChange, status]);
|
|
20
|
-
return status === 'done' ? /*#__PURE__*/React.createElement(
|
|
21
|
+
return status === 'done' ? fg('platform_sl_3p_auth_rovo_action_kill_switch') ? /*#__PURE__*/React.createElement(CopySummaryActionNew, _extends({}, props, {
|
|
22
|
+
summary: content,
|
|
23
|
+
testId: testId
|
|
24
|
+
})) : /*#__PURE__*/React.createElement(CopySummaryAction, _extends({}, props, {
|
|
21
25
|
testId: testId,
|
|
22
26
|
content: content
|
|
23
27
|
})) : /*#__PURE__*/React.createElement(AISummariseAction, _extends({}, props, {
|
package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/copy-summary-action.js
CHANGED
|
@@ -2,7 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["url", "onClick", "testId", "content"]
|
|
5
|
+
var _excluded = ["url", "onClick", "testId", "content"],
|
|
6
|
+
_excluded2 = ["url", "onClick", "summary", "testId"];
|
|
6
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
8
|
import React, { useCallback, useState } from 'react';
|
|
8
9
|
import { FormattedMessage } from 'react-intl-next';
|
|
@@ -52,4 +53,49 @@ export function CopySummaryAction(_ref) {
|
|
|
52
53
|
return setTooltipMessage(messages.copy_summary_action_description);
|
|
53
54
|
}
|
|
54
55
|
}, props));
|
|
56
|
+
}
|
|
57
|
+
export function CopySummaryActionNew(_ref3) {
|
|
58
|
+
var url = _ref3.url,
|
|
59
|
+
onClickCallback = _ref3.onClick,
|
|
60
|
+
_ref3$summary = _ref3.summary,
|
|
61
|
+
summary = _ref3$summary === void 0 ? '' : _ref3$summary,
|
|
62
|
+
testId = _ref3.testId,
|
|
63
|
+
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
64
|
+
var _useAnalyticsEvents2 = useAnalyticsEvents(),
|
|
65
|
+
fireEvent = _useAnalyticsEvents2.fireEvent;
|
|
66
|
+
var _useState3 = useState(messages.copy_summary_action_description),
|
|
67
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
68
|
+
tooltipMessage = _useState4[0],
|
|
69
|
+
setTooltipMessage = _useState4[1];
|
|
70
|
+
var handleCopySummaryClick = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
71
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
72
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
73
|
+
case 0:
|
|
74
|
+
fireEvent('ui.button.clicked.copySummary', {});
|
|
75
|
+
_context2.next = 3;
|
|
76
|
+
return navigator.clipboard.writeText(summary);
|
|
77
|
+
case 3:
|
|
78
|
+
setTooltipMessage(messages.copied_summary_action_description);
|
|
79
|
+
onClickCallback === null || onClickCallback === void 0 || onClickCallback();
|
|
80
|
+
case 5:
|
|
81
|
+
case "end":
|
|
82
|
+
return _context2.stop();
|
|
83
|
+
}
|
|
84
|
+
}, _callee2);
|
|
85
|
+
})), [fireEvent, onClickCallback, summary]);
|
|
86
|
+
return /*#__PURE__*/React.createElement(Action, _extends({
|
|
87
|
+
content: /*#__PURE__*/React.createElement(FormattedMessage, messages.copy_summary_action),
|
|
88
|
+
icon: /*#__PURE__*/React.createElement(CopyIcon, {
|
|
89
|
+
color: "currentColor",
|
|
90
|
+
spacing: "spacious",
|
|
91
|
+
label: "Copy Summary",
|
|
92
|
+
size: props.iconSize
|
|
93
|
+
}),
|
|
94
|
+
onClick: handleCopySummaryClick,
|
|
95
|
+
testId: "".concat(testId, "-copy-summary-action"),
|
|
96
|
+
tooltipMessage: /*#__PURE__*/React.createElement(FormattedMessage, tooltipMessage),
|
|
97
|
+
tooltipOnHide: function tooltipOnHide() {
|
|
98
|
+
return setTooltipMessage(messages.copy_summary_action_description);
|
|
99
|
+
}
|
|
100
|
+
}, props));
|
|
55
101
|
}
|