@atlaskit/smart-card 46.22.2 → 46.23.0
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 +27 -0
- package/analytics.spec.yaml +23 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-remix-action-and-rovo-chat-action-opted-out--default.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-remix-action-experiment-on---default.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-remix-action-and-rovo-chat-action-opted-out--default.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-remix-action-experiment-on---default.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-remix-action-and-rovo-chat-action-opted-out--default.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-remix-action-experiment-on---default.png +3 -0
- package/dist/cjs/constants.js +2 -0
- package/dist/cjs/extractors/flexible/actions/extract-remix-action.js +53 -0
- package/dist/cjs/extractors/flexible/actions/index.js +11 -2
- package/dist/cjs/extractors/flexible/index.js +7 -3
- package/dist/cjs/messages.js +4 -9
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/is-remix-action-enabled.js +48 -0
- package/dist/cjs/utils/use-remix-action-exposure.js +16 -0
- package/dist/cjs/view/BlockCard/views/ResolvedView.js +18 -13
- package/dist/cjs/view/EmbedCard/components/rovo-actions-footer/index.js +58 -10
- package/dist/cjs/view/EmbedCard/index.js +2 -0
- package/dist/cjs/view/EmbedCard/views/ResolvedView.js +23 -7
- package/dist/cjs/view/FlexibleCard/components/actions/remix-action/index.js +81 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/action-block/index.js +3 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +2 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +5 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +10 -3
- package/dist/cjs/view/FlexibleCard/components/blocks/hover-card-footer-block/index.js +1 -1
- package/dist/cjs/view/FlexibleCard/index.js +9 -3
- package/dist/cjs/view/InlineCard/ResolvedView/InlineCardResolvedViewFunctional.js +9 -1
- package/dist/cjs/view/InlineCard/common/inline-card-action/index.js +70 -0
- package/dist/cjs/view/InlineCard/common/remix-action/index.compiled.css +5 -0
- package/dist/cjs/view/InlineCard/common/remix-action/index.js +77 -0
- package/dist/cjs/view/InlineCard/common/rovo-actions-cta/index.js +1 -24
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/common/rovo-chat-utils/index.js +0 -28
- package/dist/cjs/view/common/rovo-post-auth-prompts/index.js +1 -16
- package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-remix-action-and-rovo-chat-action-opted-out--default.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-remix-action-experiment-on---default.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-remix-action-and-rovo-chat-action-opted-out--default.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-remix-action-experiment-on---default.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-remix-action-and-rovo-chat-action-opted-out--default.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-remix-action-experiment-on---default.png +3 -0
- package/dist/es2019/constants.js +2 -0
- package/dist/es2019/extractors/flexible/actions/extract-remix-action.js +48 -0
- package/dist/es2019/extractors/flexible/actions/index.js +12 -0
- package/dist/es2019/extractors/flexible/index.js +4 -0
- package/dist/es2019/messages.js +4 -9
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/utils/is-remix-action-enabled.js +39 -0
- package/dist/es2019/utils/use-remix-action-exposure.js +11 -0
- package/dist/es2019/view/BlockCard/views/ResolvedView.js +19 -14
- package/dist/es2019/view/EmbedCard/components/rovo-actions-footer/index.js +43 -11
- package/dist/es2019/view/EmbedCard/index.js +2 -0
- package/dist/es2019/view/EmbedCard/views/ResolvedView.js +22 -7
- package/dist/es2019/view/FlexibleCard/components/actions/remix-action/index.js +54 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-block/index.js +3 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +4 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +9 -4
- package/dist/es2019/view/FlexibleCard/components/blocks/hover-card-footer-block/index.js +1 -1
- package/dist/es2019/view/FlexibleCard/index.js +8 -1
- package/dist/es2019/view/InlineCard/ResolvedView/InlineCardResolvedViewFunctional.js +9 -1
- package/dist/es2019/view/InlineCard/common/inline-card-action/index.js +61 -0
- package/dist/es2019/view/InlineCard/common/remix-action/index.compiled.css +5 -0
- package/dist/es2019/view/InlineCard/common/remix-action/index.js +50 -0
- package/dist/es2019/view/InlineCard/common/rovo-actions-cta/index.js +1 -24
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/common/rovo-chat-utils/index.js +0 -26
- package/dist/es2019/view/common/rovo-post-auth-prompts/index.js +1 -15
- package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-remix-action-and-rovo-chat-action-opted-out--default.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-remix-action-experiment-on---default.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-remix-action-and-rovo-chat-action-opted-out--default.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-remix-action-experiment-on---default.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-remix-action-and-rovo-chat-action-opted-out--default.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-remix-action-experiment-on---default.png +3 -0
- package/dist/esm/constants.js +2 -0
- package/dist/esm/extractors/flexible/actions/extract-remix-action.js +47 -0
- package/dist/esm/extractors/flexible/actions/index.js +11 -2
- package/dist/esm/extractors/flexible/index.js +7 -3
- package/dist/esm/messages.js +4 -9
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/is-remix-action-enabled.js +42 -0
- package/dist/esm/utils/use-remix-action-exposure.js +11 -0
- package/dist/esm/view/BlockCard/views/ResolvedView.js +19 -14
- package/dist/esm/view/EmbedCard/components/rovo-actions-footer/index.js +59 -11
- package/dist/esm/view/EmbedCard/index.js +2 -0
- package/dist/esm/view/EmbedCard/views/ResolvedView.js +23 -7
- package/dist/esm/view/FlexibleCard/components/actions/remix-action/index.js +72 -0
- package/dist/esm/view/FlexibleCard/components/blocks/action-block/index.js +3 -2
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +2 -1
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +5 -1
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +11 -4
- package/dist/esm/view/FlexibleCard/components/blocks/hover-card-footer-block/index.js +1 -1
- package/dist/esm/view/FlexibleCard/index.js +9 -3
- package/dist/esm/view/InlineCard/ResolvedView/InlineCardResolvedViewFunctional.js +9 -1
- package/dist/esm/view/InlineCard/common/inline-card-action/index.js +61 -0
- package/dist/esm/view/InlineCard/common/remix-action/index.compiled.css +5 -0
- package/dist/esm/view/InlineCard/common/remix-action/index.js +70 -0
- package/dist/esm/view/InlineCard/common/rovo-actions-cta/index.js +1 -24
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/common/rovo-chat-utils/index.js +0 -28
- package/dist/esm/view/common/rovo-post-auth-prompts/index.js +1 -16
- package/dist/types/common/analytics/generated/analytics.types.d.ts +17 -2
- package/dist/types/constants.d.ts +2 -0
- package/dist/types/extractors/flexible/actions/extract-remix-action.d.ts +15 -0
- package/dist/types/extractors/flexible/actions/index.d.ts +3 -1
- package/dist/types/extractors/flexible/index.d.ts +1 -1
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/state/flexible-ui-context/types.d.ts +5 -0
- package/dist/types/state/hooks/use-invoke-client-action/types.d.ts +1 -1
- package/dist/types/utils/is-remix-action-enabled.d.ts +15 -0
- package/dist/types/utils/use-remix-action-exposure.d.ts +2 -0
- package/dist/types/view/Card/types.d.ts +10 -1
- package/dist/types/view/EmbedCard/components/rovo-actions-footer/index.d.ts +5 -4
- package/dist/types/view/EmbedCard/views/ResolvedView.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/remix-action/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-group/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/action-group/types.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +8 -2
- package/dist/types/view/FlexibleCard/types.d.ts +2 -1
- package/dist/types/view/InlineCard/common/inline-card-action/index.d.ts +11 -0
- package/dist/types/view/InlineCard/common/remix-action/index.d.ts +9 -0
- package/dist/types/view/common/rovo-chat-utils/index.d.ts +1 -2
- package/dist/types/view/common/rovo-post-auth-prompts/index.d.ts +1 -10
- package/package.json +2 -2
- package/dist/cjs/__tests__/vr-tests/__snapshots__/embed-card/embed-card-forbidden-view--default.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/embed-card/embed-card-not-found-default--default.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/inline-card/inline-card-forbidden-view-with-default-legacy-icon--default.png +0 -3
- package/dist/cjs/utils/is-rovo-chat-action-visualize-enabled.js +0 -43
- package/dist/es2019/__tests__/vr-tests/__snapshots__/embed-card/embed-card-forbidden-view--default.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/embed-card/embed-card-not-found-default--default.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/inline-card/inline-card-forbidden-view-with-default-legacy-icon--default.png +0 -3
- package/dist/es2019/utils/is-rovo-chat-action-visualize-enabled.js +0 -34
- package/dist/esm/__tests__/vr-tests/__snapshots__/embed-card/embed-card-forbidden-view--default.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/embed-card/embed-card-not-found-default--default.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/inline-card/inline-card-forbidden-view-with-default-legacy-icon--default.png +0 -3
- package/dist/esm/utils/is-rovo-chat-action-visualize-enabled.js +0 -37
- package/dist/types/utils/is-rovo-chat-action-visualize-enabled.d.ts +0 -18
- /package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/{block-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png → block-card-google-sheets-without-remix-action-experiment-off---default.png} +0 -0
- /package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/{embed-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png → embed-card-google-sheets-without-remix-action-experiment-off---default.png} +0 -0
- /package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/{inline-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png → inline-card-google-sheets-without-remix-action-experiment-off---default.png} +0 -0
- /package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/{block-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png → block-card-google-sheets-without-remix-action-experiment-off---default.png} +0 -0
- /package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/{embed-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png → embed-card-google-sheets-without-remix-action-experiment-off---default.png} +0 -0
- /package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/{inline-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png → inline-card-google-sheets-without-remix-action-experiment-off---default.png} +0 -0
- /package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/{block-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png → block-card-google-sheets-without-remix-action-experiment-off---default.png} +0 -0
- /package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/{embed-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png → embed-card-google-sheets-without-remix-action-experiment-off---default.png} +0 -0
- /package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/{inline-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png → inline-card-google-sheets-without-remix-action-experiment-off---default.png} +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useCallback } from 'react';
|
|
3
|
+
import { useIntl } from 'react-intl';
|
|
4
|
+
import AiGenerativeRemixIcon from '@atlaskit/icon-lab/core/ai-generative-remix';
|
|
5
|
+
import { usePlugins } from '@atlaskit/link-provider/use-plugins';
|
|
6
|
+
import { InternalActionName } from '../../../../../constants';
|
|
7
|
+
import { messages } from '../../../../../messages';
|
|
8
|
+
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context/useFlexibleUiContext';
|
|
9
|
+
import useInvokeClientAction from '../../../../../state/hooks/use-invoke-client-action';
|
|
10
|
+
import { useRemixActionExposure } from '../../../../../utils/use-remix-action-exposure';
|
|
11
|
+
import Action from '../action';
|
|
12
|
+
const RemixAction = ({
|
|
13
|
+
onClick: onClickCallback,
|
|
14
|
+
...props
|
|
15
|
+
}) => {
|
|
16
|
+
var _context$actions;
|
|
17
|
+
const intl = useIntl();
|
|
18
|
+
const context = useFlexibleUiContext();
|
|
19
|
+
const {
|
|
20
|
+
remix
|
|
21
|
+
} = usePlugins();
|
|
22
|
+
const invoke = useInvokeClientAction({});
|
|
23
|
+
const data = context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[InternalActionName.RemixAction];
|
|
24
|
+
const actionMessage = intl.formatMessage(messages.rovo_prompt_button_remix);
|
|
25
|
+
const isRemixVisible = Boolean(data && remix);
|
|
26
|
+
useRemixActionExposure(isRemixVisible);
|
|
27
|
+
const onClick = useCallback(() => {
|
|
28
|
+
if (data !== null && data !== void 0 && data.invokeAction && remix) {
|
|
29
|
+
const {
|
|
30
|
+
url
|
|
31
|
+
} = data;
|
|
32
|
+
invoke({
|
|
33
|
+
...data.invokeAction,
|
|
34
|
+
actionFn: async () => remix.open({
|
|
35
|
+
url
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback();
|
|
39
|
+
}
|
|
40
|
+
}, [data, invoke, onClickCallback, remix]);
|
|
41
|
+
return isRemixVisible ? /*#__PURE__*/React.createElement(Action, _extends({
|
|
42
|
+
ariaLabel: actionMessage,
|
|
43
|
+
content: actionMessage,
|
|
44
|
+
icon: /*#__PURE__*/React.createElement(AiGenerativeRemixIcon, {
|
|
45
|
+
color: "currentColor",
|
|
46
|
+
label: "",
|
|
47
|
+
size: props.iconSize
|
|
48
|
+
}),
|
|
49
|
+
onClick: onClick,
|
|
50
|
+
testId: "smart-action-remix-action",
|
|
51
|
+
tooltipMessage: actionMessage
|
|
52
|
+
}, props)) : null;
|
|
53
|
+
};
|
|
54
|
+
export default RemixAction;
|
|
@@ -17,6 +17,7 @@ import DownloadAction from '../../actions/download-action';
|
|
|
17
17
|
import EditAction from '../../actions/edit-action';
|
|
18
18
|
import FollowAction from '../../actions/follow-action';
|
|
19
19
|
import PreviewAction from '../../actions/preview-action';
|
|
20
|
+
import RemixAction from '../../actions/remix-action';
|
|
20
21
|
import RovoChatAction from '../../actions/rovo-chat-action';
|
|
21
22
|
import ViewRelatedLinksAction from '../../actions/view-related-links-action';
|
|
22
23
|
import { ActionFooter } from './action-footer';
|
|
@@ -33,6 +34,7 @@ const Actions = {
|
|
|
33
34
|
[ActionName.PreviewAction]: PreviewAction,
|
|
34
35
|
[ActionName.RovoChatAction]: RovoChatAction,
|
|
35
36
|
[InternalActionName.AISummaryAction]: AISummaryAction,
|
|
37
|
+
[InternalActionName.RemixAction]: RemixAction,
|
|
36
38
|
[InternalActionName.UnresolvedAction]: CustomUnresolvedAction,
|
|
37
39
|
[InternalActionName.ViewRelatedLinksAction]: ViewRelatedLinksAction
|
|
38
40
|
};
|
|
@@ -75,7 +77,7 @@ const ActionBlock = ({
|
|
|
75
77
|
if (!(context !== null && context !== void 0 && context.actions)) {
|
|
76
78
|
return;
|
|
77
79
|
}
|
|
78
|
-
const arr = Object.keys(context.actions).filter(name => name !== ActionName.RovoChatAction);
|
|
80
|
+
const arr = Object.keys(context.actions).filter(name => name !== ActionName.RovoChatAction && name !== InternalActionName.RemixAction);
|
|
79
81
|
arr.sort(sort);
|
|
80
82
|
const renderAction = name => {
|
|
81
83
|
const Action = name in Actions ? Actions[name] : undefined;
|
package/dist/es2019/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import DownloadAction from '../../../actions/download-action';
|
|
|
11
11
|
import EditAction from '../../../actions/edit-action';
|
|
12
12
|
import FollowAction from '../../../actions/follow-action';
|
|
13
13
|
import PreviewAction from '../../../actions/preview-action';
|
|
14
|
+
import RemixAction from '../../../actions/remix-action';
|
|
14
15
|
import RovoChatAction from '../../../actions/rovo-chat-action';
|
|
15
16
|
import ViewRelatedLinksAction from '../../../actions/view-related-links-action';
|
|
16
17
|
const Actions = {
|
|
@@ -24,6 +25,7 @@ const Actions = {
|
|
|
24
25
|
[ActionName.PreviewAction]: PreviewAction,
|
|
25
26
|
[ActionName.RovoChatAction]: RovoChatAction,
|
|
26
27
|
[InternalActionName.AISummaryAction]: AISummaryAction,
|
|
28
|
+
[InternalActionName.RemixAction]: RemixAction,
|
|
27
29
|
[InternalActionName.UnresolvedAction]: CustomUnresolvedAction,
|
|
28
30
|
[InternalActionName.ViewRelatedLinksAction]: ViewRelatedLinksAction
|
|
29
31
|
};
|
|
@@ -47,6 +47,7 @@ const ActionGroup = ({
|
|
|
47
47
|
size = SmartLinkSize.Medium,
|
|
48
48
|
appearance,
|
|
49
49
|
visibleButtonsNum = 2,
|
|
50
|
+
showRemainingActionsInOverflow = false,
|
|
50
51
|
onDropdownOpenChange,
|
|
51
52
|
containerWidth = Infinity
|
|
52
53
|
}) => {
|
|
@@ -115,6 +116,8 @@ const ActionGroup = ({
|
|
|
115
116
|
}];
|
|
116
117
|
} else if (isRovoActionsEnabled && containerWidth < REDUCED_ACTIONS_SIZE) {
|
|
117
118
|
actionItems = renderableActionItems;
|
|
119
|
+
} else if (isRovoActionsEnabled && showRemainingActionsInOverflow) {
|
|
120
|
+
actionItems = renderableActionItems.slice(visibleButtonsNum - 1);
|
|
118
121
|
} else {
|
|
119
122
|
actionItems = isMoreThenTwoItems ? renderableActionItems.slice(visibleButtonsNum - 1) : [];
|
|
120
123
|
}
|
|
@@ -147,7 +150,7 @@ const ActionGroup = ({
|
|
|
147
150
|
}, renderActionItems(actionItems, size, appearance, true, onActionItemClick));
|
|
148
151
|
}
|
|
149
152
|
return null;
|
|
150
|
-
}, [appearance, isMoreThenTwoItems, isOpen, onActionItemClick, onOpenChange, renderableActionItems, size, ui === null || ui === void 0 ? void 0 : ui.zIndex, visibleButtonsNum, isRovoActionsEnabled, containerWidth]);
|
|
153
|
+
}, [appearance, isMoreThenTwoItems, isOpen, onActionItemClick, onOpenChange, renderableActionItems, showRemainingActionsInOverflow, size, ui === null || ui === void 0 ? void 0 : ui.zIndex, visibleButtonsNum, isRovoActionsEnabled, containerWidth]);
|
|
151
154
|
return renderableActionItems.length > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
152
155
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
153
156
|
className: ax(["_1e0c116y _dzc21h6o _1ilq1i6y", "actions-button-group"]),
|
|
@@ -5,8 +5,9 @@ import * as React from 'react';
|
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
6
|
import { useCallback, useMemo, useState } from 'react';
|
|
7
7
|
import { browser } from '@atlaskit/linking-common/user-agent';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
8
9
|
import { WidthObserver } from '@atlaskit/width-detector/width-observer';
|
|
9
|
-
import { ActionName, SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
|
|
10
|
+
import { ActionName, InternalActionName, SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
|
|
10
11
|
import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context/useFlexibleUiContext';
|
|
11
12
|
import { default as Provider } from '../../../elements/provider-element';
|
|
12
13
|
import ActionGroup from '../../action-group';
|
|
@@ -18,7 +19,7 @@ const safariStyles = null;
|
|
|
18
19
|
const providerStyles = null;
|
|
19
20
|
const rovoActionStyles = null;
|
|
20
21
|
const FooterBlockResolvedView = props => {
|
|
21
|
-
var _context$actions;
|
|
22
|
+
var _context$actions, _context$actions2;
|
|
22
23
|
const {
|
|
23
24
|
actions,
|
|
24
25
|
testId,
|
|
@@ -32,6 +33,7 @@ const FooterBlockResolvedView = props => {
|
|
|
32
33
|
const isRovoActionsEnabled = useMemo(() => {
|
|
33
34
|
return !!rovoChatAction && rovoChatAction.product === 'CONFLUENCE' && (actions === null || actions === void 0 ? void 0 : actions.some(action => action.name === 'RovoChatAction'));
|
|
34
35
|
}, [rovoChatAction, actions]);
|
|
36
|
+
const hasExtraActionSlot = isRovoActionsEnabled && !!(context !== null && context !== void 0 && (_context$actions2 = context.actions) !== null && _context$actions2 !== void 0 && _context$actions2[InternalActionName.RemixAction]) && !!(actions !== null && actions !== void 0 && actions.some(action => action.name === InternalActionName.RemixAction)) && fg('platform_sl_3p_auth_visualize_killswitch');
|
|
35
37
|
const hasPreview = isRovoActionsEnabled && !!(context !== null && context !== void 0 && context.preview) && !isPreviewBlockErrored;
|
|
36
38
|
const hasActions = useMemo(() => {
|
|
37
39
|
var _filterActionItems;
|
|
@@ -68,12 +70,15 @@ const FooterBlockResolvedView = props => {
|
|
|
68
70
|
}, !!rovoChatAction && (rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.product) === 'CONFLUENCE' && /*#__PURE__*/React.createElement(WidthObserver, {
|
|
69
71
|
setWidth: setContainerWidth,
|
|
70
72
|
offscreen: true
|
|
71
|
-
}), /*#__PURE__*/React.createElement(ActionGroup, {
|
|
73
|
+
}), /*#__PURE__*/React.createElement(ActionGroup, _extends({}, fg('platform_sl_3p_auth_visualize_killswitch') ? {
|
|
74
|
+
visibleButtonsNum: hasExtraActionSlot ? 3 : undefined,
|
|
75
|
+
showRemainingActionsInOverflow: hasExtraActionSlot
|
|
76
|
+
} : undefined, {
|
|
72
77
|
onDropdownOpenChange: onDropdownOpenChange,
|
|
73
78
|
items: actions,
|
|
74
79
|
appearance: isRovoActionsEnabled ? 'subtle' : 'default',
|
|
75
80
|
size: isRovoActionsEnabled ? SmartLinkSize.Small : size,
|
|
76
81
|
containerWidth: isRovoActionsEnabled ? containerWidth : undefined
|
|
77
|
-
})) : null);
|
|
82
|
+
}))) : null);
|
|
78
83
|
};
|
|
79
84
|
export default FooterBlockResolvedView;
|
|
@@ -21,7 +21,7 @@ import Block from '../block';
|
|
|
21
21
|
/**
|
|
22
22
|
* Allowed footer actions for HoverCard, in display order. Fetched from context.
|
|
23
23
|
*/
|
|
24
|
-
const HIDDEN_HOVER_CARD_FOOTER_ACTIONS = [ActionName.RovoChatAction];
|
|
24
|
+
const HIDDEN_HOVER_CARD_FOOTER_ACTIONS = [ActionName.RovoChatAction, InternalActionName.RemixAction];
|
|
25
25
|
const Actions = {
|
|
26
26
|
[ActionName.AutomationAction]: AutomationAction,
|
|
27
27
|
[ActionName.CopyLinkAction]: CopyLinkAction,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
3
|
+
import { usePlugins } from '@atlaskit/link-provider/use-plugins';
|
|
3
4
|
import { useSmartLinkContext } from '@atlaskit/link-provider/use-smart-link-context';
|
|
4
5
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
6
|
import UFOHoldLoad from '@atlaskit/react-ufo/load-hold';
|
|
@@ -54,6 +55,9 @@ const FlexibleCard = ({
|
|
|
54
55
|
product
|
|
55
56
|
} = useSmartLinkContext();
|
|
56
57
|
const rovoConfig = useRovoConfig();
|
|
58
|
+
const {
|
|
59
|
+
remix
|
|
60
|
+
} = usePlugins();
|
|
57
61
|
const {
|
|
58
62
|
fireEvent
|
|
59
63
|
} = useAnalyticsEvents();
|
|
@@ -86,6 +90,9 @@ const FlexibleCard = ({
|
|
|
86
90
|
resolve,
|
|
87
91
|
product,
|
|
88
92
|
rovoConfig,
|
|
93
|
+
...(fg('platform_sl_3p_auth_visualize_killswitch') ? {
|
|
94
|
+
remix
|
|
95
|
+
} : undefined),
|
|
89
96
|
actionOptions,
|
|
90
97
|
status: placeholderCardState ? placeHolderStatus : status,
|
|
91
98
|
url,
|
|
@@ -95,7 +102,7 @@ const FlexibleCard = ({
|
|
|
95
102
|
} : undefined),
|
|
96
103
|
openPreviewPanel,
|
|
97
104
|
transformUrl
|
|
98
|
-
}), [aiSummaryConfig, appearance, actionOptions, details, id, isPreviewPanelAvailable, isPreviewRestricted, onAuthorize, onClick, onAuxClick, onContextMenu, openPreviewPanel, origin, placeholderCardState, placeHolderStatus, product, renderers, resolve, rovoConfig, status, transformUrl, url, fireEvent]);
|
|
105
|
+
}), [aiSummaryConfig, appearance, actionOptions, details, id, isPreviewPanelAvailable, isPreviewRestricted, onAuthorize, onClick, onAuxClick, onContextMenu, openPreviewPanel, origin, placeholderCardState, placeHolderStatus, product, renderers, resolve, rovoConfig, remix, status, transformUrl, url, fireEvent]);
|
|
99
106
|
const flexibleCardContext = useMemo(() => ({
|
|
100
107
|
data: context,
|
|
101
108
|
navigation: context ? navigation : undefined,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
3
|
import useInlineTailoredAction from '../../../state/hooks/use-inline-tailored-actions';
|
|
3
4
|
import { HoverCard } from '../../HoverCard';
|
|
5
|
+
import { InlineCardAction } from '../common/inline-card-action';
|
|
4
6
|
import { InlineRovoActionButton } from '../common/rovo-actions-cta';
|
|
5
7
|
import { Frame } from '../Frame';
|
|
6
8
|
import { IconAndTitleLayout } from '../IconAndTitleLayout';
|
|
@@ -47,7 +49,13 @@ export function InlineCardResolvedViewFunctional({
|
|
|
47
49
|
titleTextColor: titleTextColor,
|
|
48
50
|
type: type,
|
|
49
51
|
hideIconLoadingSkeleton: hideIconLoadingSkeleton
|
|
50
|
-
}), renderLozenge(lozenge),
|
|
52
|
+
}), renderLozenge(lozenge), fg('platform_sl_3p_auth_visualize_killswitch') ? /*#__PURE__*/React.createElement(InlineCardAction, {
|
|
53
|
+
id: id,
|
|
54
|
+
testId: testId,
|
|
55
|
+
url: link,
|
|
56
|
+
actionOptions: actionOptions,
|
|
57
|
+
showHoverPreview: showHoverPreview
|
|
58
|
+
}) : isInlineTailoredRovoActionEnabled && /*#__PURE__*/React.createElement(InlineRovoActionButton, {
|
|
51
59
|
testId: `${testId}-rovo-actions-cta`,
|
|
52
60
|
url: link,
|
|
53
61
|
actionOptions: actionOptions
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import { usePlugins } from '@atlaskit/link-provider/use-plugins';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
|
+
import extractRemixAction from '../../../../extractors/flexible/actions/extract-remix-action';
|
|
6
|
+
import useInlineTailoredAction from '../../../../state/hooks/use-inline-tailored-actions';
|
|
7
|
+
import { useSmartCardState } from '../../../../state/store';
|
|
8
|
+
import InlineRemixAction from '../remix-action';
|
|
9
|
+
import { InlineRovoActionButton } from '../rovo-actions-cta';
|
|
10
|
+
const InlineChatAction = ({
|
|
11
|
+
actionOptions,
|
|
12
|
+
showHoverPreview,
|
|
13
|
+
testId,
|
|
14
|
+
url
|
|
15
|
+
}) => {
|
|
16
|
+
const {
|
|
17
|
+
isEnabled
|
|
18
|
+
} = useInlineTailoredAction(url, showHoverPreview, actionOptions);
|
|
19
|
+
return isEnabled ? /*#__PURE__*/React.createElement(InlineRovoActionButton, {
|
|
20
|
+
actionOptions: actionOptions,
|
|
21
|
+
testId: `${testId}-rovo-actions-cta`,
|
|
22
|
+
url: url
|
|
23
|
+
}) : null;
|
|
24
|
+
};
|
|
25
|
+
const InlineCardActionWithRemix = props => {
|
|
26
|
+
const {
|
|
27
|
+
actionOptions,
|
|
28
|
+
id,
|
|
29
|
+
testId,
|
|
30
|
+
url
|
|
31
|
+
} = props;
|
|
32
|
+
const {
|
|
33
|
+
remix
|
|
34
|
+
} = usePlugins();
|
|
35
|
+
const {
|
|
36
|
+
details
|
|
37
|
+
} = useSmartCardState(url !== null && url !== void 0 ? url : '');
|
|
38
|
+
const data = useMemo(() => details ? extractRemixAction({
|
|
39
|
+
response: details,
|
|
40
|
+
url,
|
|
41
|
+
actionOptions,
|
|
42
|
+
remix,
|
|
43
|
+
appearance: 'inline',
|
|
44
|
+
id
|
|
45
|
+
}) : undefined, [details, url, actionOptions, remix, id]);
|
|
46
|
+
|
|
47
|
+
// Inline cards have one action slot. Eligible Remix takes priority over chat.
|
|
48
|
+
return data && remix ? /*#__PURE__*/React.createElement(InlineRemixAction, {
|
|
49
|
+
data: data,
|
|
50
|
+
remix: remix,
|
|
51
|
+
testId: `${testId}-remix-action`
|
|
52
|
+
}) : /*#__PURE__*/React.createElement(InlineChatAction, props);
|
|
53
|
+
};
|
|
54
|
+
export const InlineCardAction = ({
|
|
55
|
+
testId = 'inline-card',
|
|
56
|
+
...props
|
|
57
|
+
}) => fg('platform_sl_3p_auth_visualize_killswitch') ? /*#__PURE__*/React.createElement(InlineCardActionWithRemix, _extends({}, props, {
|
|
58
|
+
testId: testId
|
|
59
|
+
})) : /*#__PURE__*/React.createElement(InlineChatAction, _extends({}, props, {
|
|
60
|
+
testId: testId
|
|
61
|
+
}));
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v3.0.4 */
|
|
2
|
+
import "./index.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useIntl } from 'react-intl';
|
|
6
|
+
import RemixIcon from '@atlaskit/icon-lab/core/ai-generative-remix';
|
|
7
|
+
import { Box } from '@atlaskit/primitives/compiled/box';
|
|
8
|
+
import { Text } from '@atlaskit/primitives/compiled/text';
|
|
9
|
+
import { messages } from '../../../../messages';
|
|
10
|
+
import useInvokeClientAction from '../../../../state/hooks/use-invoke-client-action';
|
|
11
|
+
import { useRemixActionExposure } from '../../../../utils/use-remix-action-exposure';
|
|
12
|
+
import { ActionButton } from '../action-button';
|
|
13
|
+
const styles = {
|
|
14
|
+
text: "_19bv12x7 _1e0c116y _4cvr1h6o _s7n4nkob _19pk1i6y"
|
|
15
|
+
};
|
|
16
|
+
const InlineRemixAction = ({
|
|
17
|
+
data,
|
|
18
|
+
remix,
|
|
19
|
+
testId = 'inline-remix-action'
|
|
20
|
+
}) => {
|
|
21
|
+
const intl = useIntl();
|
|
22
|
+
const invoke = useInvokeClientAction({});
|
|
23
|
+
const label = intl.formatMessage(messages.rovo_prompt_button_remix);
|
|
24
|
+
useRemixActionExposure(true);
|
|
25
|
+
return /*#__PURE__*/React.createElement(ActionButton, {
|
|
26
|
+
"aria-label": label,
|
|
27
|
+
testId: testId,
|
|
28
|
+
onClick: event => {
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
event.stopPropagation();
|
|
31
|
+
const anchorElement = event.currentTarget;
|
|
32
|
+
void invoke({
|
|
33
|
+
...data.invokeAction,
|
|
34
|
+
actionFn: async () => remix.open({
|
|
35
|
+
anchorElement,
|
|
36
|
+
url: data.url
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}, /*#__PURE__*/React.createElement(RemixIcon, {
|
|
41
|
+
label: "",
|
|
42
|
+
size: "small"
|
|
43
|
+
}), /*#__PURE__*/React.createElement(Box, {
|
|
44
|
+
as: "span",
|
|
45
|
+
xcss: styles.text
|
|
46
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
47
|
+
size: "small"
|
|
48
|
+
}, label)));
|
|
49
|
+
};
|
|
50
|
+
export default InlineRemixAction;
|
|
@@ -13,7 +13,6 @@ import useInvokeClientAction from '../../../../state/hooks/use-invoke-client-act
|
|
|
13
13
|
import useRovoChat from '../../../../state/hooks/use-rovo-chat';
|
|
14
14
|
import useRovoConfig from '../../../../state/hooks/use-rovo-config';
|
|
15
15
|
import { useSmartCardState } from '../../../../state/store';
|
|
16
|
-
import { isRovoChatActionVisualizeEnabled } from '../../../../utils/is-rovo-chat-action-visualize-enabled';
|
|
17
16
|
import { getPromptAction, RovoChatPromptKey } from '../../../common/rovo-chat-utils';
|
|
18
17
|
import { ActionButton } from '../action-button';
|
|
19
18
|
import { OneClickChatSpotlightLoader } from '../one-click-chat-spotlight/async';
|
|
@@ -52,14 +51,6 @@ const InlineRovoActionButtonLegacy = ({
|
|
|
52
51
|
switch (extensionKey) {
|
|
53
52
|
case 'google-object-provider':
|
|
54
53
|
if ((_cardState$details = cardState.details) !== null && _cardState$details !== void 0 && (_cardState$details$da = _cardState$details.data) !== null && _cardState$details$da !== void 0 && (_cardState$details$da2 = _cardState$details$da['@type']) !== null && _cardState$details$da2 !== void 0 && _cardState$details$da2.includes('schema:SpreadsheetDigitalDocument')) {
|
|
55
|
-
// Only evaluate Visualize (and fire exposure) when the Rovo chat action is available.
|
|
56
|
-
if (rovoChatAction && isRovoChatActionVisualizeEnabled({
|
|
57
|
-
extensionKey,
|
|
58
|
-
product: rovoConfig === null || rovoConfig === void 0 ? void 0 : rovoConfig.product,
|
|
59
|
-
response: cardState.details
|
|
60
|
-
})) {
|
|
61
|
-
return RovoChatPromptKey.VISUALIZE;
|
|
62
|
-
}
|
|
63
54
|
return;
|
|
64
55
|
}
|
|
65
56
|
if ((_cardState$details2 = cardState.details) !== null && _cardState$details2 !== void 0 && (_cardState$details2$d = _cardState$details2.data) !== null && _cardState$details2$d !== void 0 && (_cardState$details2$d2 = _cardState$details2$d['@type']) !== null && _cardState$details2$d2 !== void 0 && _cardState$details2$d2.includes('schema:PresentationDigitalDocument')) {
|
|
@@ -136,14 +127,6 @@ const InlineRovoActionButtonWithSpotlight = ({
|
|
|
136
127
|
const promptKey = useMemo(() => {
|
|
137
128
|
var _cardState$details3, _cardState$details3$d, _cardState$details3$d2, _cardState$details4, _cardState$details4$d, _cardState$details4$d2;
|
|
138
129
|
if (extensionKey === 'google-object-provider' && (_cardState$details3 = cardState.details) !== null && _cardState$details3 !== void 0 && (_cardState$details3$d = _cardState$details3.data) !== null && _cardState$details3$d !== void 0 && (_cardState$details3$d2 = _cardState$details3$d['@type']) !== null && _cardState$details3$d2 !== void 0 && _cardState$details3$d2.includes('schema:SpreadsheetDigitalDocument')) {
|
|
139
|
-
// Only evaluate Visualize (and fire exposure) when the Rovo chat action is available.
|
|
140
|
-
if (rovoChatAction && isRovoChatActionVisualizeEnabled({
|
|
141
|
-
extensionKey,
|
|
142
|
-
product: rovoConfig === null || rovoConfig === void 0 ? void 0 : rovoConfig.product,
|
|
143
|
-
response: cardState.details
|
|
144
|
-
})) {
|
|
145
|
-
return RovoChatPromptKey.VISUALIZE;
|
|
146
|
-
}
|
|
147
130
|
return;
|
|
148
131
|
}
|
|
149
132
|
switch (extensionKey) {
|
|
@@ -189,7 +172,7 @@ const InlineRovoActionButtonWithSpotlight = ({
|
|
|
189
172
|
event.preventDefault();
|
|
190
173
|
event.stopPropagation();
|
|
191
174
|
invokePrompt();
|
|
192
|
-
}, [invokePrompt]);
|
|
175
|
+
}, [invokePrompt, promptKey]);
|
|
193
176
|
const button = promptData && content ? /*#__PURE__*/React.createElement(ActionButton, {
|
|
194
177
|
onClick: handleClick,
|
|
195
178
|
testId: testId
|
|
@@ -198,12 +181,6 @@ const InlineRovoActionButtonWithSpotlight = ({
|
|
|
198
181
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
199
182
|
size: "small"
|
|
200
183
|
}, content))) : null;
|
|
201
|
-
|
|
202
|
-
// Visualize is not part of the spotlight: its copy is generic ("See takeaways") and Sheets
|
|
203
|
-
// links are excluded from the spotlight experiment, so render the plain button.
|
|
204
|
-
if (promptKey === RovoChatPromptKey.VISUALIZE) {
|
|
205
|
-
return button;
|
|
206
|
-
}
|
|
207
184
|
return button && isRovoChatEnabled && rovoChatAction !== null && rovoChatAction !== void 0 && rovoChatAction.invokeAction ? /*#__PURE__*/React.createElement(OneClickChatSpotlightLoader, {
|
|
208
185
|
key: url,
|
|
209
186
|
url: url,
|
|
@@ -9,7 +9,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
9
9
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
10
10
|
const PACKAGE_DATA = {
|
|
11
11
|
packageName: "@atlaskit/smart-card",
|
|
12
|
-
packageVersion: "46.22.
|
|
12
|
+
packageVersion: "46.22.3",
|
|
13
13
|
componentName: 'linkUrl'
|
|
14
14
|
};
|
|
15
15
|
const LinkUrl = ({
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import AiSearchIcon from '@atlaskit/icon-lab/core/ai-search';
|
|
3
3
|
import AiChatIcon from '@atlaskit/icon/core/ai-chat';
|
|
4
4
|
import AiGenerativeTextSummaryIcon from '@atlaskit/icon/core/ai-generative-text-summary';
|
|
5
|
-
import ChartBarIcon from '@atlaskit/icon/core/chart-bar';
|
|
6
5
|
import RovoChatIcon from '@atlaskit/icon/core/rovo-chat';
|
|
7
6
|
import { RovoIcon } from '@atlaskit/logo/rovo/icon';
|
|
8
7
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
@@ -27,7 +26,6 @@ export let RovoChatPromptKey = /*#__PURE__*/function (RovoChatPromptKey) {
|
|
|
27
26
|
RovoChatPromptKey["EXPLAIN_CODE"] = "explain-code";
|
|
28
27
|
RovoChatPromptKey["CATCH_UP"] = "catch-up";
|
|
29
28
|
RovoChatPromptKey["SALESFORCE_PREP"] = "salesforce-prep";
|
|
30
|
-
RovoChatPromptKey["VISUALIZE"] = "visualize";
|
|
31
29
|
return RovoChatPromptKey;
|
|
32
30
|
}({});
|
|
33
31
|
const getContext = (intl, product) => {
|
|
@@ -371,29 +369,5 @@ export const getPromptAction = ({
|
|
|
371
369
|
size: iconSize
|
|
372
370
|
})
|
|
373
371
|
};
|
|
374
|
-
case RovoChatPromptKey.VISUALIZE:
|
|
375
|
-
const label_visualize = intl.formatMessage(messages.rovo_prompt_button_visualize);
|
|
376
|
-
const html_visualize = intl.formatMessage(messages.rovo_prompt_message_visualize, {
|
|
377
|
-
url
|
|
378
|
-
}, {
|
|
379
|
-
ignoreTag: true
|
|
380
|
-
});
|
|
381
|
-
const visualizeIconProps = {
|
|
382
|
-
label: label_visualize,
|
|
383
|
-
size: iconSize,
|
|
384
|
-
...(cardAppearance === CardDisplay.HoverCardPreview ? {
|
|
385
|
-
spacing: 'spacious'
|
|
386
|
-
} : {})
|
|
387
|
-
};
|
|
388
|
-
return {
|
|
389
|
-
content: label_visualize,
|
|
390
|
-
tooltipMessage: label_visualize,
|
|
391
|
-
data: {
|
|
392
|
-
name: label_visualize,
|
|
393
|
-
dialogues: [],
|
|
394
|
-
prompt: htmlToAdf(html_visualize)
|
|
395
|
-
},
|
|
396
|
-
icon: /*#__PURE__*/React.createElement(ChartBarIcon, visualizeIconProps)
|
|
397
|
-
};
|
|
398
372
|
}
|
|
399
373
|
};
|
|
@@ -1,24 +1,10 @@
|
|
|
1
|
-
import { isRovoChatActionVisualizeEnabled } from '../../../utils/is-rovo-chat-action-visualize-enabled';
|
|
2
1
|
import { RovoChatPromptKey } from '../rovo-chat-utils';
|
|
3
2
|
export const getRovoPostAuthPromptKeys = ({
|
|
4
|
-
extensionKey
|
|
5
|
-
isRovoChatActionShown = false,
|
|
6
|
-
product,
|
|
7
|
-
response
|
|
3
|
+
extensionKey
|
|
8
4
|
}) => {
|
|
9
5
|
const defaultPrompts = [RovoChatPromptKey.KEY_HIGHLIGHTS];
|
|
10
6
|
if (extensionKey === 'github-object-provider' || extensionKey === 'gitlab-object-provider') {
|
|
11
7
|
return [RovoChatPromptKey.EXPLAIN_CODE, ...defaultPrompts];
|
|
12
8
|
}
|
|
13
|
-
if (isRovoChatActionShown && isRovoChatActionVisualizeEnabled({
|
|
14
|
-
extensionKey,
|
|
15
|
-
product,
|
|
16
|
-
response
|
|
17
|
-
})) {
|
|
18
|
-
// Visualize goes first (PM decision). The embed Rovo actions footer hides every prompt after
|
|
19
|
-
// the first below 320px (HIDE_SECONDARY_ACTIONS_WIDTH), so this keeps Visualize visible on
|
|
20
|
-
// narrow embeds whenever exposure fires.
|
|
21
|
-
return [RovoChatPromptKey.VISUALIZE, RovoChatPromptKey.SUMMARIZE_DOCUMENT, ...defaultPrompts];
|
|
22
|
-
}
|
|
23
9
|
return [RovoChatPromptKey.SUMMARIZE_DOCUMENT, ...defaultPrompts];
|
|
24
10
|
};
|
package/dist/esm/constants.js
CHANGED
|
@@ -164,6 +164,7 @@ export var ActionName = /*#__PURE__*/function (ActionName) {
|
|
|
164
164
|
}({});
|
|
165
165
|
export var InternalActionName = /*#__PURE__*/function (InternalActionName) {
|
|
166
166
|
InternalActionName["AISummaryAction"] = "AISummaryAction";
|
|
167
|
+
InternalActionName["RemixAction"] = "RemixAction";
|
|
167
168
|
InternalActionName["UnresolvedAction"] = "UnresolvedAction";
|
|
168
169
|
InternalActionName["ViewRelatedLinksAction"] = "ViewRelatedLinksAction";
|
|
169
170
|
return InternalActionName;
|
|
@@ -267,6 +268,7 @@ export var CardAction = /*#__PURE__*/function (CardAction) {
|
|
|
267
268
|
CardAction["DownloadAction"] = "DownloadAction";
|
|
268
269
|
CardAction["FollowAction"] = "FollowAction";
|
|
269
270
|
CardAction["PreviewAction"] = "PreviewAction";
|
|
271
|
+
CardAction["RemixAction"] = "RemixAction";
|
|
270
272
|
CardAction["RovoChatAction"] = "RovoChatAction";
|
|
271
273
|
CardAction["ViewAction"] = "ViewAction";
|
|
272
274
|
return CardAction;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { extractSmartLinkUrl } from '@atlaskit/link-extractors/extract-smart-link-url';
|
|
2
|
+
import { CardAction, InternalActionName } from '../../../constants';
|
|
3
|
+
import { getDefinitionId } from '../../../state/getDefinitionId';
|
|
4
|
+
import { getExtensionKey } from '../../../state/getExtensionKey';
|
|
5
|
+
import { getResourceType } from '../../../state/getResourceType';
|
|
6
|
+
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
7
|
+
import { isRemixActionEnabled } from '../../../utils/is-remix-action-enabled';
|
|
8
|
+
var extractRemixAction = function extractRemixAction(_ref) {
|
|
9
|
+
var _actionOptions$remixA, _extractSmartLinkUrl;
|
|
10
|
+
var actionOptions = _ref.actionOptions,
|
|
11
|
+
appearance = _ref.appearance,
|
|
12
|
+
id = _ref.id,
|
|
13
|
+
remix = _ref.remix,
|
|
14
|
+
response = _ref.response,
|
|
15
|
+
url = _ref.url;
|
|
16
|
+
if (!canShowAction(CardAction.RemixAction, actionOptions)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (!(actionOptions !== null && actionOptions !== void 0 && (_actionOptions$remixA = actionOptions.remixAction) !== null && _actionOptions$remixA !== void 0 && _actionOptions$remixA.optIn)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
var remixUrl = (_extractSmartLinkUrl = extractSmartLinkUrl(response)) !== null && _extractSmartLinkUrl !== void 0 ? _extractSmartLinkUrl : url;
|
|
23
|
+
if (!remixUrl) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
var extensionKey = getExtensionKey(response);
|
|
27
|
+
if (!isRemixActionEnabled({
|
|
28
|
+
extensionKey: extensionKey,
|
|
29
|
+
remix: remix,
|
|
30
|
+
response: response
|
|
31
|
+
})) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
invokeAction: {
|
|
36
|
+
actionSubjectId: 'remix',
|
|
37
|
+
actionType: InternalActionName.RemixAction,
|
|
38
|
+
definitionId: getDefinitionId(response),
|
|
39
|
+
display: appearance,
|
|
40
|
+
extensionKey: extensionKey,
|
|
41
|
+
id: id,
|
|
42
|
+
resourceType: getResourceType(response)
|
|
43
|
+
},
|
|
44
|
+
url: remixUrl
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export default extractRemixAction;
|
|
@@ -9,6 +9,7 @@ import { extractCopyLinkClientAction } from './extract-copy-link-action';
|
|
|
9
9
|
import { extractDownloadClientAction } from './extract-download-action';
|
|
10
10
|
import extractFollowAction from './extract-follow-action';
|
|
11
11
|
import { extractPreviewClientAction } from './extract-preview-action';
|
|
12
|
+
import extractRemixAction from './extract-remix-action';
|
|
12
13
|
import extractRovoChatAction from './extract-rovo-chat-action';
|
|
13
14
|
import { extractViewRelatedLinksAction } from './extract-view-related-links-action';
|
|
14
15
|
export var extractFlexibleCardActions = function extractFlexibleCardActions(_ref) {
|
|
@@ -19,6 +20,7 @@ export var extractFlexibleCardActions = function extractFlexibleCardActions(_ref
|
|
|
19
20
|
id = _ref.id,
|
|
20
21
|
origin = _ref.origin,
|
|
21
22
|
product = _ref.product,
|
|
23
|
+
remix = _ref.remix,
|
|
22
24
|
response = _ref.response,
|
|
23
25
|
rovoConfig = _ref.rovoConfig,
|
|
24
26
|
transformUrl = _ref.transformUrl,
|
|
@@ -26,7 +28,7 @@ export var extractFlexibleCardActions = function extractFlexibleCardActions(_ref
|
|
|
26
28
|
isPreviewPanelAvailable = _ref.isPreviewPanelAvailable,
|
|
27
29
|
isPreviewRestricted = _ref.isPreviewRestricted,
|
|
28
30
|
openPreviewPanel = _ref.openPreviewPanel;
|
|
29
|
-
var action =
|
|
31
|
+
var action = _objectSpread(_objectSpread(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ActionName.CopyLinkAction, extractCopyLinkClientAction({
|
|
30
32
|
actionOptions: actionOptions,
|
|
31
33
|
appearance: appearance,
|
|
32
34
|
id: id,
|
|
@@ -56,7 +58,14 @@ export var extractFlexibleCardActions = function extractFlexibleCardActions(_ref
|
|
|
56
58
|
product: product,
|
|
57
59
|
response: response,
|
|
58
60
|
rovoConfig: rovoConfig
|
|
59
|
-
})), InternalActionName.
|
|
61
|
+
})), fg('platform_sl_3p_auth_visualize_killswitch') ? _defineProperty({}, InternalActionName.RemixAction, extractRemixAction({
|
|
62
|
+
actionOptions: actionOptions,
|
|
63
|
+
appearance: appearance,
|
|
64
|
+
id: id,
|
|
65
|
+
remix: remix,
|
|
66
|
+
response: response,
|
|
67
|
+
url: url
|
|
68
|
+
})) : undefined), {}, _defineProperty({}, InternalActionName.ViewRelatedLinksAction, extractViewRelatedLinksAction(response)));
|
|
60
69
|
return Object.values(action).some(function (value) {
|
|
61
70
|
return Boolean(value);
|
|
62
71
|
}) ? action : undefined;
|