@atlaskit/smart-card 44.26.1 → 44.28.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 +28 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/inline-card/inline-card-resolved-view-with-rovo-actions-cta-treatment---default.png +2 -2
- package/dist/cjs/messages.js +40 -0
- package/dist/cjs/state/actions/index.js +16 -20
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/rovo-chat-action/index.js +8 -1
- package/dist/cjs/view/HoverCard/components/HoverCardContent.js +4 -12
- package/dist/cjs/view/InlineCard/ResolvedView/InlineCardResolvedViewFunctional.js +2 -3
- package/dist/cjs/view/InlineCard/common/rovo-actions-cta/index.js +82 -14
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/common/rovo-chat-utils/index.js +118 -8
- package/dist/es2019/__tests__/vr-tests/__snapshots__/inline-card/inline-card-resolved-view-with-rovo-actions-cta-treatment---default.png +2 -2
- package/dist/es2019/messages.js +40 -0
- package/dist/es2019/state/actions/index.js +17 -21
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/rovo-chat-action/index.js +8 -1
- package/dist/es2019/view/HoverCard/components/HoverCardContent.js +1 -7
- package/dist/es2019/view/InlineCard/ResolvedView/InlineCardResolvedViewFunctional.js +2 -3
- package/dist/es2019/view/InlineCard/common/rovo-actions-cta/index.js +63 -15
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/common/rovo-chat-utils/index.js +115 -1
- package/dist/esm/__tests__/vr-tests/__snapshots__/inline-card/inline-card-resolved-view-with-rovo-actions-cta-treatment---default.png +2 -2
- package/dist/esm/messages.js +40 -0
- package/dist/esm/state/actions/index.js +17 -21
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/rovo-chat-action/index.js +8 -1
- package/dist/esm/view/HoverCard/components/HoverCardContent.js +4 -12
- package/dist/esm/view/InlineCard/ResolvedView/InlineCardResolvedViewFunctional.js +2 -3
- package/dist/esm/view/InlineCard/common/rovo-actions-cta/index.js +83 -15
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/common/rovo-chat-utils/index.js +118 -8
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/view/InlineCard/common/rovo-actions-cta/index.d.ts +3 -1
- package/dist/types/view/common/rovo-chat-utils/index.d.ts +17 -2
- package/dist/types-ts4.5/messages.d.ts +1 -1
- package/dist/types-ts4.5/view/InlineCard/common/rovo-actions-cta/index.d.ts +3 -1
- package/dist/types-ts4.5/view/common/rovo-chat-utils/index.d.ts +17 -2
- package/package.json +5 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useMemo, useRef } from 'react';
|
|
2
|
-
import { extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
2
|
+
import { extractSmartLinkProvider, extractSmartLinkTitle } from '@atlaskit/link-extractors';
|
|
3
3
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
4
4
|
import { ACTION_RESOLVING, ACTION_UPDATE_METADATA_STATUS, cardAction } from '@atlaskit/linking-common';
|
|
5
5
|
import { auth } from '@atlaskit/outbound-auth-flow-client';
|
|
@@ -17,7 +17,9 @@ import useActionFlags from '../hooks/use-action-flags';
|
|
|
17
17
|
import useInvokeClientAction from '../hooks/use-invoke-client-action';
|
|
18
18
|
import useResolve from '../hooks/use-resolve';
|
|
19
19
|
const POST_AUTH_CHAT_EXTENSION_KEY = 'google-object-provider';
|
|
20
|
-
|
|
20
|
+
// Smart Card resolver key differs from the consumer-facing Rovo payload key.
|
|
21
|
+
const POST_AUTH_CHAT_PAYLOAD_EXTENSION_KEY = 'google-drive';
|
|
22
|
+
const SMART_LINK_3P_POST_AUTH_SOURCE = 'smart-link-3p-post-auth';
|
|
21
23
|
const getPostAuthChatPayloadId = () => {
|
|
22
24
|
if (typeof crypto !== 'undefined') {
|
|
23
25
|
if (typeof crypto.randomUUID === 'function') {
|
|
@@ -31,31 +33,25 @@ const getPostAuthChatPayloadId = () => {
|
|
|
31
33
|
}
|
|
32
34
|
return `smart-link-post-auth-chat-${Date.now()}`;
|
|
33
35
|
};
|
|
34
|
-
const sendPostAuthChatOpenMessage = url => {
|
|
36
|
+
const sendPostAuthChatOpenMessage = (url, documentTitle) => {
|
|
35
37
|
var _window$parent;
|
|
36
38
|
if (typeof window === 'undefined' || typeof ((_window$parent = window.parent) === null || _window$parent === void 0 ? void 0 : _window$parent.postMessage) !== 'function') {
|
|
37
39
|
return;
|
|
38
40
|
}
|
|
39
41
|
const payload = {
|
|
40
|
-
type: 'chat-
|
|
41
|
-
source:
|
|
42
|
+
type: 'chat-smartlink-3p-post-auth-launch',
|
|
43
|
+
source: SMART_LINK_3P_POST_AUTH_SOURCE,
|
|
44
|
+
openChat: true,
|
|
45
|
+
openChatMode: 'mini-modal',
|
|
42
46
|
data: {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
projectId: url,
|
|
50
|
-
// Use the URL as projectName to avoid introducing a hardcoded
|
|
51
|
-
// user-facing provider label in Smart Card.
|
|
52
|
-
projectName: url,
|
|
53
|
-
projectUrl: url
|
|
54
|
-
}
|
|
47
|
+
extensionKey: POST_AUTH_CHAT_PAYLOAD_EXTENSION_KEY,
|
|
48
|
+
provider: 'Google Drive',
|
|
49
|
+
projectContext: {
|
|
50
|
+
projectId: url,
|
|
51
|
+
projectName: documentTitle !== null && documentTitle !== void 0 ? documentTitle : 'Google Drive',
|
|
52
|
+
projectUrl: url
|
|
55
53
|
}
|
|
56
|
-
}
|
|
57
|
-
openChat: true,
|
|
58
|
-
openChatMode: 'mini-modal'
|
|
54
|
+
}
|
|
59
55
|
};
|
|
60
56
|
window.parent.postMessage({
|
|
61
57
|
eventType: ROVO_POST_MESSAGE_EVENT_TYPE,
|
|
@@ -266,7 +262,7 @@ export const useSmartCardActions = (id, url) => {
|
|
|
266
262
|
}
|
|
267
263
|
reload();
|
|
268
264
|
if (isPostAuthChatTreatment) {
|
|
269
|
-
sendPostAuthChatOpenMessage(url);
|
|
265
|
+
sendPostAuthChatOpenMessage(url, extractSmartLinkTitle(details));
|
|
270
266
|
}
|
|
271
267
|
}, err => {
|
|
272
268
|
var _err$type;
|
|
@@ -2,7 +2,7 @@ export const ANALYTICS_CHANNEL = 'media';
|
|
|
2
2
|
export const context = {
|
|
3
3
|
componentName: 'smart-cards',
|
|
4
4
|
packageName: "@atlaskit/smart-card" || '',
|
|
5
|
-
packageVersion: "44.
|
|
5
|
+
packageVersion: "44.27.1" || ''
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -47,7 +47,14 @@ const RovoChatAction = ({
|
|
|
47
47
|
content,
|
|
48
48
|
tooltipMessage,
|
|
49
49
|
data: promptData
|
|
50
|
-
} = getPromptAction(
|
|
50
|
+
} = getPromptAction({
|
|
51
|
+
promptKey,
|
|
52
|
+
intl,
|
|
53
|
+
url: data === null || data === void 0 ? void 0 : data.url,
|
|
54
|
+
product: data === null || data === void 0 ? void 0 : data.product,
|
|
55
|
+
iconSize: props.iconSize,
|
|
56
|
+
cardAppearance: props.cardAppearance
|
|
57
|
+
}) || {};
|
|
51
58
|
return promptData ? /*#__PURE__*/React.createElement(Action, _extends({
|
|
52
59
|
content: content,
|
|
53
60
|
icon: icon,
|
|
@@ -164,18 +164,12 @@ const HoverCardContent = ({
|
|
|
164
164
|
subtitle
|
|
165
165
|
} = getMetadata(extensionKey, data);
|
|
166
166
|
const titleMaxLines = subtitle && subtitle.length > 0 ? 1 : 2;
|
|
167
|
-
|
|
168
|
-
// Platform apps (Home, Goals, Projects, and Teams) should by default open in the same tab when the FF is enabled.
|
|
169
|
-
const isSameTabAlignmentEnabled = fg('townsquare-same-tab-alignment-gcko-849');
|
|
170
|
-
const anchorTarget = product === 'ATLAS' && isSameTabAlignmentEnabled ? '_self' : undefined;
|
|
171
167
|
const titleBlockProps = {
|
|
172
168
|
maxLines: titleMaxLines,
|
|
173
169
|
size: SmartLinkSize.Large,
|
|
174
170
|
position: SmartLinkPosition.Center,
|
|
175
171
|
subtitle: subtitle,
|
|
176
|
-
|
|
177
|
-
anchorTarget
|
|
178
|
-
} : undefined)
|
|
172
|
+
anchorTarget: product === 'ATLAS' ? '_self' : undefined
|
|
179
173
|
};
|
|
180
174
|
const uiOptions = flexibleUiOptions;
|
|
181
175
|
uiOptions.enableSnippetRenderer = true;
|
|
@@ -98,7 +98,8 @@ export function InlineCardResolvedViewFunctionalWithRovoActions({
|
|
|
98
98
|
hideIconLoadingSkeleton: hideIconLoadingSkeleton
|
|
99
99
|
}), renderLozenge(lozenge), isInlineTailoredRovoActionEnabled && /*#__PURE__*/React.createElement(InlineRovoActionButton, {
|
|
100
100
|
testId: `${testId}-rovo-actions-cta`,
|
|
101
|
-
url: link
|
|
101
|
+
url: link,
|
|
102
|
+
actionOptions: actionOptions
|
|
102
103
|
}));
|
|
103
104
|
if (!showHoverPreview || !link) {
|
|
104
105
|
return frame;
|
|
@@ -110,6 +111,4 @@ export function InlineCardResolvedViewFunctionalWithRovoActions({
|
|
|
110
111
|
hoverPreviewOptions: hoverPreviewOptions
|
|
111
112
|
}, frame);
|
|
112
113
|
}
|
|
113
|
-
|
|
114
|
-
// Todo: replace with platform_sl_3p_auth_inline_tailored_cta_killswitch after cleanup of rovogrowth-640-inline-action-nudge-fg
|
|
115
114
|
export const InlineCardResolvedViewFunctional = componentWithFG('platform_sl_3p_auth_inline_tailored_cta_killswitch', InlineCardResolvedViewFunctionalWithRovoActions, InlineCardResolvedViewBase);
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
/* index.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
2
|
import "./index.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
-
import React, { useCallback } from 'react';
|
|
4
|
+
import React, { useCallback, useMemo } from 'react';
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
6
|
import { cx } from '@atlaskit/css';
|
|
7
|
-
import AiGenerativeTextSummaryIcon from '@atlaskit/icon/core/ai-generative-text-summary';
|
|
8
7
|
import RovoChatIcon from '@atlaskit/icon/core/rovo-chat';
|
|
8
|
+
import { extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
9
9
|
import { Box, Text } from '@atlaskit/primitives/compiled';
|
|
10
|
+
import extractRovoChatAction from "../../../../extractors/flexible/actions/extract-rovo-chat-action";
|
|
11
|
+
import { getExtensionKey } from "../../../../state/helpers";
|
|
12
|
+
import useInvokeClientAction from "../../../../state/hooks/use-invoke-client-action";
|
|
10
13
|
import useRovoChat from "../../../../state/hooks/use-rovo-chat";
|
|
14
|
+
import useRovoConfig from "../../../../state/hooks/use-rovo-config";
|
|
15
|
+
import { useSmartCardState } from "../../../../state/store";
|
|
11
16
|
import { getPromptAction, RovoChatPromptKey } from "../../../common/rovo-chat-utils";
|
|
12
17
|
import { ActionButton } from "../action-button";
|
|
13
18
|
const styles = {
|
|
@@ -29,34 +34,77 @@ export const RovoActionsCta = ({
|
|
|
29
34
|
};
|
|
30
35
|
export const InlineRovoActionButton = ({
|
|
31
36
|
testId,
|
|
32
|
-
url
|
|
37
|
+
url,
|
|
38
|
+
actionOptions
|
|
33
39
|
}) => {
|
|
34
40
|
const {
|
|
35
41
|
sendPromptMessage,
|
|
36
42
|
isRovoChatEnabled
|
|
37
43
|
} = useRovoChat();
|
|
38
44
|
const intl = useIntl();
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
const cardState = useSmartCardState(url !== null && url !== void 0 ? url : '');
|
|
46
|
+
const extensionKey = getExtensionKey(cardState.details);
|
|
47
|
+
const rovoConfig = useRovoConfig();
|
|
48
|
+
const rovoChatAction = useMemo(() => {
|
|
49
|
+
return cardState.details && extractRovoChatAction({
|
|
50
|
+
response: cardState.details,
|
|
51
|
+
actionOptions,
|
|
52
|
+
rovoConfig
|
|
53
|
+
});
|
|
54
|
+
}, [cardState.details, rovoConfig, actionOptions]);
|
|
55
|
+
const provider = useMemo(() => {
|
|
56
|
+
return cardState.details && extractSmartLinkProvider(cardState.details);
|
|
57
|
+
}, [cardState.details]);
|
|
58
|
+
const invoke = useInvokeClientAction({});
|
|
59
|
+
const promptKey = useMemo(() => {
|
|
60
|
+
var _cardState$details, _cardState$details$da, _cardState$details$da2, _cardState$details2, _cardState$details2$d, _cardState$details2$d2;
|
|
61
|
+
if (extensionKey === 'google-object-provider' && (_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')) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
switch (extensionKey) {
|
|
65
|
+
case 'google-object-provider':
|
|
66
|
+
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')) {
|
|
67
|
+
return RovoChatPromptKey.SUMMARIZE_PRESENTATION;
|
|
68
|
+
}
|
|
69
|
+
return RovoChatPromptKey.SUMMARIZE_DOCUMENT;
|
|
70
|
+
case 'onedrive-object-provider':
|
|
71
|
+
return RovoChatPromptKey.SUMMARIZE_DOCUMENT;
|
|
72
|
+
case 'github-object-provider':
|
|
73
|
+
case 'gitlab-object-provider':
|
|
74
|
+
return RovoChatPromptKey.EXPLAIN_CODE;
|
|
75
|
+
case 'slack-object-provider':
|
|
76
|
+
case 'ms-teams-object-provider':
|
|
77
|
+
return RovoChatPromptKey.CATCH_UP;
|
|
78
|
+
case 'salesforce-object-provider':
|
|
79
|
+
return RovoChatPromptKey.SALESFORCE_PREP;
|
|
80
|
+
}
|
|
81
|
+
}, [extensionKey, cardState]);
|
|
41
82
|
const {
|
|
42
83
|
data: promptData,
|
|
43
|
-
content
|
|
44
|
-
|
|
84
|
+
content,
|
|
85
|
+
icon
|
|
86
|
+
} = promptKey ? getPromptAction({
|
|
87
|
+
promptKey,
|
|
88
|
+
intl,
|
|
89
|
+
url,
|
|
90
|
+
iconSize: 'small',
|
|
91
|
+
provider: provider === null || provider === void 0 ? void 0 : provider.text
|
|
92
|
+
}) || {} : {};
|
|
45
93
|
const handleClick = useCallback(event => {
|
|
46
94
|
event.preventDefault();
|
|
47
95
|
event.stopPropagation();
|
|
48
|
-
if (isRovoChatEnabled && promptData) {
|
|
49
|
-
|
|
96
|
+
if (isRovoChatEnabled && promptData && rovoChatAction !== null && rovoChatAction !== void 0 && rovoChatAction.invokeAction) {
|
|
97
|
+
invoke({
|
|
98
|
+
...(rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.invokeAction),
|
|
99
|
+
actionFn: async () => sendPromptMessage(promptData),
|
|
100
|
+
prompt: promptKey
|
|
101
|
+
});
|
|
50
102
|
}
|
|
51
|
-
}, [sendPromptMessage, isRovoChatEnabled, promptData]);
|
|
103
|
+
}, [sendPromptMessage, isRovoChatEnabled, promptData, rovoChatAction, promptKey, invoke]);
|
|
52
104
|
return promptData && content ? /*#__PURE__*/React.createElement(ActionButton, {
|
|
53
105
|
onClick: handleClick,
|
|
54
106
|
testId: testId
|
|
55
|
-
}, /*#__PURE__*/React.createElement(
|
|
56
|
-
label: "Rovo",
|
|
57
|
-
color: "var(--ds-icon, #292A2E)",
|
|
58
|
-
size: "small"
|
|
59
|
-
}), /*#__PURE__*/React.createElement(Box, {
|
|
107
|
+
}, icon, /*#__PURE__*/React.createElement(Box, {
|
|
60
108
|
xcss: styles.text
|
|
61
109
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
62
110
|
size: "small"
|
|
@@ -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: "44.
|
|
12
|
+
packageVersion: "44.27.1",
|
|
13
13
|
componentName: 'linkUrl'
|
|
14
14
|
};
|
|
15
15
|
const LinkUrl = ({
|
|
@@ -25,6 +25,11 @@ export let RovoChatPromptKey = /*#__PURE__*/function (RovoChatPromptKey) {
|
|
|
25
25
|
RovoChatPromptKey["SUMMARIZE_THIS_FOR_ME"] = "summarize-this-for-me";
|
|
26
26
|
RovoChatPromptKey["ASK_A_SPECIFIC_QUESTION"] = "ask-a-specific-question";
|
|
27
27
|
RovoChatPromptKey["SHOW_ME_WHATS_RELEVANT"] = "show-me-whats-relevant";
|
|
28
|
+
RovoChatPromptKey["SUMMARIZE_DOCUMENT"] = "summarize-document";
|
|
29
|
+
RovoChatPromptKey["SUMMARIZE_PRESENTATION"] = "summarize-presentation";
|
|
30
|
+
RovoChatPromptKey["EXPLAIN_CODE"] = "explain-code";
|
|
31
|
+
RovoChatPromptKey["CATCH_UP"] = "catch-up";
|
|
32
|
+
RovoChatPromptKey["SALESFORCE_PREP"] = "salesforce-prep";
|
|
28
33
|
return RovoChatPromptKey;
|
|
29
34
|
}({});
|
|
30
35
|
const getContext = (intl, product) => {
|
|
@@ -44,7 +49,15 @@ const getContext = (intl, product) => {
|
|
|
44
49
|
};
|
|
45
50
|
}
|
|
46
51
|
};
|
|
47
|
-
export const getPromptAction = (
|
|
52
|
+
export const getPromptAction = ({
|
|
53
|
+
promptKey,
|
|
54
|
+
intl,
|
|
55
|
+
url = '',
|
|
56
|
+
product,
|
|
57
|
+
iconSize,
|
|
58
|
+
cardAppearance,
|
|
59
|
+
provider
|
|
60
|
+
}) => {
|
|
48
61
|
var _getContext;
|
|
49
62
|
const {
|
|
50
63
|
contextLong,
|
|
@@ -318,5 +331,106 @@ export const getPromptAction = (promptKey, intl, url = '', product, iconSize, ca
|
|
|
318
331
|
prompt: htmlToAdf(html_find_open_questions)
|
|
319
332
|
}
|
|
320
333
|
};
|
|
334
|
+
case RovoChatPromptKey.SUMMARIZE_DOCUMENT:
|
|
335
|
+
const label_summarize_document = intl.formatMessage(messages.ai_summarize);
|
|
336
|
+
const html_summarize_document = intl.formatMessage(messages.rovo_prompt_message_summarize_document, {
|
|
337
|
+
url
|
|
338
|
+
}, {
|
|
339
|
+
ignoreTag: true
|
|
340
|
+
});
|
|
341
|
+
return {
|
|
342
|
+
content: label_summarize_document,
|
|
343
|
+
tooltipMessage: label_summarize_document,
|
|
344
|
+
data: {
|
|
345
|
+
name: label_summarize_document,
|
|
346
|
+
dialogues: [],
|
|
347
|
+
prompt: htmlToAdf(html_summarize_document)
|
|
348
|
+
},
|
|
349
|
+
icon: /*#__PURE__*/React.createElement(AiGenerativeTextSummaryIcon, {
|
|
350
|
+
label: label_summarize_document,
|
|
351
|
+
size: iconSize
|
|
352
|
+
})
|
|
353
|
+
};
|
|
354
|
+
case RovoChatPromptKey.SUMMARIZE_PRESENTATION:
|
|
355
|
+
const label_summarize_presentation = intl.formatMessage(messages.ai_summarize);
|
|
356
|
+
const html_summarize_presentation = intl.formatMessage(messages.rovo_prompt_message_summarize_presentation, {
|
|
357
|
+
url
|
|
358
|
+
}, {
|
|
359
|
+
ignoreTag: true
|
|
360
|
+
});
|
|
361
|
+
return {
|
|
362
|
+
content: label_summarize_presentation,
|
|
363
|
+
tooltipMessage: label_summarize_presentation,
|
|
364
|
+
data: {
|
|
365
|
+
name: label_summarize_presentation,
|
|
366
|
+
dialogues: [],
|
|
367
|
+
prompt: htmlToAdf(html_summarize_presentation)
|
|
368
|
+
},
|
|
369
|
+
icon: /*#__PURE__*/React.createElement(AiGenerativeTextSummaryIcon, {
|
|
370
|
+
label: label_summarize_presentation,
|
|
371
|
+
size: iconSize
|
|
372
|
+
})
|
|
373
|
+
};
|
|
374
|
+
case RovoChatPromptKey.EXPLAIN_CODE:
|
|
375
|
+
const label_explain_code = intl.formatMessage(messages.rovo_prompt_button_explain_code);
|
|
376
|
+
const html_explain_code = intl.formatMessage(messages.rovo_prompt_message_explain_code, {
|
|
377
|
+
url
|
|
378
|
+
}, {
|
|
379
|
+
ignoreTag: true
|
|
380
|
+
});
|
|
381
|
+
return {
|
|
382
|
+
content: label_explain_code,
|
|
383
|
+
tooltipMessage: label_explain_code,
|
|
384
|
+
data: {
|
|
385
|
+
name: label_explain_code,
|
|
386
|
+
dialogues: [],
|
|
387
|
+
prompt: htmlToAdf(html_explain_code)
|
|
388
|
+
},
|
|
389
|
+
icon: /*#__PURE__*/React.createElement(AiGenerativeTextSummaryIcon, {
|
|
390
|
+
label: label_explain_code,
|
|
391
|
+
size: iconSize
|
|
392
|
+
})
|
|
393
|
+
};
|
|
394
|
+
case RovoChatPromptKey.CATCH_UP:
|
|
395
|
+
const label_catch_up = intl.formatMessage(messages.rovo_prompt_button_catch_up);
|
|
396
|
+
const html_catch_up = intl.formatMessage(messages.rovo_prompt_message_catch_up, {
|
|
397
|
+
url,
|
|
398
|
+
provider
|
|
399
|
+
}, {
|
|
400
|
+
ignoreTag: true
|
|
401
|
+
});
|
|
402
|
+
return {
|
|
403
|
+
content: label_catch_up,
|
|
404
|
+
tooltipMessage: label_catch_up,
|
|
405
|
+
data: {
|
|
406
|
+
name: label_catch_up,
|
|
407
|
+
dialogues: [],
|
|
408
|
+
prompt: htmlToAdf(html_catch_up)
|
|
409
|
+
},
|
|
410
|
+
icon: /*#__PURE__*/React.createElement(AiGenerativeTextSummaryIcon, {
|
|
411
|
+
label: label_catch_up,
|
|
412
|
+
size: iconSize
|
|
413
|
+
})
|
|
414
|
+
};
|
|
415
|
+
case RovoChatPromptKey.SALESFORCE_PREP:
|
|
416
|
+
const label_overview = intl.formatMessage(messages.rovo_prompt_button_salesforce_prep);
|
|
417
|
+
const html_overview = intl.formatMessage(messages.rovo_prompt_message_salesforce_prep, {
|
|
418
|
+
url
|
|
419
|
+
}, {
|
|
420
|
+
ignoreTag: true
|
|
421
|
+
});
|
|
422
|
+
return {
|
|
423
|
+
content: label_overview,
|
|
424
|
+
tooltipMessage: label_overview,
|
|
425
|
+
data: {
|
|
426
|
+
name: label_overview,
|
|
427
|
+
dialogues: [],
|
|
428
|
+
prompt: htmlToAdf(html_overview)
|
|
429
|
+
},
|
|
430
|
+
icon: /*#__PURE__*/React.createElement(AiGenerativeTextSummaryIcon, {
|
|
431
|
+
label: label_overview,
|
|
432
|
+
size: iconSize
|
|
433
|
+
})
|
|
434
|
+
};
|
|
321
435
|
}
|
|
322
436
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
version https://git-lfs.github.com/spec/v1
|
|
2
|
-
oid sha256:
|
|
3
|
-
size
|
|
2
|
+
oid sha256:aa200619a891e5d125bc1afc6e360cd61508fef825ffeb5fa88c30f5df2bbefa
|
|
3
|
+
size 21197
|
package/dist/esm/messages.js
CHANGED
|
@@ -1081,6 +1081,46 @@ export var messages = defineMessages({
|
|
|
1081
1081
|
defaultMessage: "Show me what's relevant",
|
|
1082
1082
|
description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
|
|
1083
1083
|
},
|
|
1084
|
+
rovo_prompt_message_summarize_document: {
|
|
1085
|
+
id: 'fabric.linking.rovo_prompt_message_summarize_document.non-final',
|
|
1086
|
+
defaultMessage: "Summarize this doc {url} into a concise, easy-to-scan overview. Adapt to whatever the content is and focus on the main ideas, important decisions, key updates, and next steps, only include these if they exist; don't mention their absence. Avoid unnecessary detail, repetition, or formatting commentary. Write in plain language and optimize for a quick 5\u201310 second read",
|
|
1087
|
+
description: 'The prompt message to send to Rovo Chat. {url} refers to Smart Link that the user triggers this action from.'
|
|
1088
|
+
},
|
|
1089
|
+
rovo_prompt_message_summarize_presentation: {
|
|
1090
|
+
id: 'fabric.linking.rovo_prompt_message_summarize_presentation.non-final',
|
|
1091
|
+
defaultMessage: "Summarize this Google Slides deck {url} into a concise executive overview. Focus on the tldr, key findings, decisions, metrics, risks, and next steps, if there are any. Use a short executive summary followed by 2-3 bullet points. Avoid slide-by-slide narration, design details, repetition, and filler.",
|
|
1092
|
+
description: 'The prompt message to send to Rovo Chat. {url} refers to Smart Link that the user triggers this action from.'
|
|
1093
|
+
},
|
|
1094
|
+
rovo_prompt_button_explain_code: {
|
|
1095
|
+
id: 'fabric.linking.rovo_prompt_button_explain_code.non-final',
|
|
1096
|
+
defaultMessage: "Explain",
|
|
1097
|
+
description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
|
|
1098
|
+
},
|
|
1099
|
+
rovo_prompt_message_explain_code: {
|
|
1100
|
+
id: 'fabric.linking.rovo_prompt_message_explain_code.non-final',
|
|
1101
|
+
defaultMessage: "<p>Explain this code, pull request, or commit {url} in clear, plain language for a non-technical audience.</p><p>Cover:</p><ol><li><strong>Purpose</strong> \u2014 What problem does it solve or what goal does it achieve?</li><li><strong>How it works</strong> \u2014 High-level mechanics (no implementation detail unless critical to understanding).</li><li><strong>Why</strong> \u2014 Motivation for the change or design choice.</li><li><strong>Impact</strong> \u2014 Key behavior changes, risks, or downstream effects worth noting.</li></ol><p>Constraints:</p><ul><li>3\u20135 sentences or 100\u2013150 words max.</li><li>Omit sections with nothing meaningful to say.</li><li>Prefer concrete language over abstract descriptions (e.g., \"speeds up page load by caching results\" over \"improves performance\").</li></ul>",
|
|
1102
|
+
description: 'The prompt message to send to Rovo Chat. {url} refers to Smart Link that the user triggers this action from. (Please make sure all html tags remain the same.)'
|
|
1103
|
+
},
|
|
1104
|
+
rovo_prompt_button_catch_up: {
|
|
1105
|
+
id: 'fabric.linking.rovo_prompt_button_catch_up.non-final',
|
|
1106
|
+
defaultMessage: "Catch up",
|
|
1107
|
+
description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
|
|
1108
|
+
},
|
|
1109
|
+
rovo_prompt_message_catch_up: {
|
|
1110
|
+
id: 'fabric.linking.rovo_prompt_message_catch_up.non-final',
|
|
1111
|
+
defaultMessage: "Catch me up on the latest {provider} conversations or channel activity in {url} from the last two weeks. If there's no activity in the past two weeks, expand the window to the most recent 30 days (or until meaningful activity is found). Summarize the most important updates, decisions, and discussions so the user can quickly understand what they missed. Focus on key changes, unresolved questions, and any action items or follow-ups. Prioritize recent messages with the most activity. Keep the response concise \u2014 ideally 80\u2013150 words or a short set of 3\u20135 key bullets.",
|
|
1112
|
+
description: 'The prompt message to send to Rovo Chat. {url} refers to Smart Link that the user triggers this action from. {provider} is the 3P app name (Please make sure all html tags remain the same.)'
|
|
1113
|
+
},
|
|
1114
|
+
rovo_prompt_button_salesforce_prep: {
|
|
1115
|
+
id: 'fabric.linking.rovo_prompt_button_salesforce_prep.non-final',
|
|
1116
|
+
defaultMessage: "Prep",
|
|
1117
|
+
description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
|
|
1118
|
+
},
|
|
1119
|
+
rovo_prompt_message_salesforce_prep: {
|
|
1120
|
+
id: 'fabric.linking.rovo_prompt_message_salesforce_prep.non-final',
|
|
1121
|
+
defaultMessage: "Prep me for this Salesforce record {url}. What's the current state, what's the recent activity, what risks or opportunities should I be aware of, and what would be useful to know before a conversation about it?",
|
|
1122
|
+
description: 'The prompt message to send to Rovo Chat. {url} refers to Smart Link that the user triggers this action from'
|
|
1123
|
+
},
|
|
1084
1124
|
// TODO: remove when social-proof-3p-unauth-block-fg is cleaned up
|
|
1085
1125
|
pre_auth_block_social_proof_not_low: {
|
|
1086
1126
|
id: 'fabric.linking.pre_auth_block_social_proof_not_low',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { useCallback, useMemo, useRef } from 'react';
|
|
4
|
-
import { extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
4
|
+
import { extractSmartLinkProvider, extractSmartLinkTitle } from '@atlaskit/link-extractors';
|
|
5
5
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
6
6
|
import { ACTION_RESOLVING, ACTION_UPDATE_METADATA_STATUS, cardAction } from '@atlaskit/linking-common';
|
|
7
7
|
import { auth } from '@atlaskit/outbound-auth-flow-client';
|
|
@@ -19,7 +19,9 @@ import useActionFlags from '../hooks/use-action-flags';
|
|
|
19
19
|
import useInvokeClientAction from '../hooks/use-invoke-client-action';
|
|
20
20
|
import useResolve from '../hooks/use-resolve';
|
|
21
21
|
var POST_AUTH_CHAT_EXTENSION_KEY = 'google-object-provider';
|
|
22
|
-
|
|
22
|
+
// Smart Card resolver key differs from the consumer-facing Rovo payload key.
|
|
23
|
+
var POST_AUTH_CHAT_PAYLOAD_EXTENSION_KEY = 'google-drive';
|
|
24
|
+
var SMART_LINK_3P_POST_AUTH_SOURCE = 'smart-link-3p-post-auth';
|
|
23
25
|
var getPostAuthChatPayloadId = function getPostAuthChatPayloadId() {
|
|
24
26
|
if (typeof crypto !== 'undefined') {
|
|
25
27
|
if (typeof crypto.randomUUID === 'function') {
|
|
@@ -35,31 +37,25 @@ var getPostAuthChatPayloadId = function getPostAuthChatPayloadId() {
|
|
|
35
37
|
}
|
|
36
38
|
return "smart-link-post-auth-chat-".concat(Date.now());
|
|
37
39
|
};
|
|
38
|
-
var sendPostAuthChatOpenMessage = function sendPostAuthChatOpenMessage(url) {
|
|
40
|
+
var sendPostAuthChatOpenMessage = function sendPostAuthChatOpenMessage(url, documentTitle) {
|
|
39
41
|
var _window$parent;
|
|
40
42
|
if (typeof window === 'undefined' || typeof ((_window$parent = window.parent) === null || _window$parent === void 0 ? void 0 : _window$parent.postMessage) !== 'function') {
|
|
41
43
|
return;
|
|
42
44
|
}
|
|
43
45
|
var payload = {
|
|
44
|
-
type: 'chat-
|
|
45
|
-
source:
|
|
46
|
+
type: 'chat-smartlink-3p-post-auth-launch',
|
|
47
|
+
source: SMART_LINK_3P_POST_AUTH_SOURCE,
|
|
48
|
+
openChat: true,
|
|
49
|
+
openChatMode: 'mini-modal',
|
|
46
50
|
data: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
projectId: url,
|
|
54
|
-
// Use the URL as projectName to avoid introducing a hardcoded
|
|
55
|
-
// user-facing provider label in Smart Card.
|
|
56
|
-
projectName: url,
|
|
57
|
-
projectUrl: url
|
|
58
|
-
}
|
|
51
|
+
extensionKey: POST_AUTH_CHAT_PAYLOAD_EXTENSION_KEY,
|
|
52
|
+
provider: 'Google Drive',
|
|
53
|
+
projectContext: {
|
|
54
|
+
projectId: url,
|
|
55
|
+
projectName: documentTitle !== null && documentTitle !== void 0 ? documentTitle : 'Google Drive',
|
|
56
|
+
projectUrl: url
|
|
59
57
|
}
|
|
60
|
-
}
|
|
61
|
-
openChat: true,
|
|
62
|
-
openChatMode: 'mini-modal'
|
|
58
|
+
}
|
|
63
59
|
};
|
|
64
60
|
window.parent.postMessage({
|
|
65
61
|
eventType: ROVO_POST_MESSAGE_EVENT_TYPE,
|
|
@@ -295,7 +291,7 @@ export var useSmartCardActions = function useSmartCardActions(id, url) {
|
|
|
295
291
|
}
|
|
296
292
|
reload();
|
|
297
293
|
if (isPostAuthChatTreatment) {
|
|
298
|
-
sendPostAuthChatOpenMessage(url);
|
|
294
|
+
sendPostAuthChatOpenMessage(url, extractSmartLinkTitle(details));
|
|
299
295
|
}
|
|
300
296
|
}, function (err) {
|
|
301
297
|
var _err$type;
|
|
@@ -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: "44.
|
|
7
|
+
packageVersion: "44.27.1" || ''
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -63,7 +63,14 @@ var RovoChatAction = function RovoChatAction(_ref) {
|
|
|
63
63
|
}, [data === null || data === void 0 ? void 0 : data.invokeAction, invoke, onClickCallback, sendPromptMessage]);
|
|
64
64
|
var promptActions = useMemo(function () {
|
|
65
65
|
return resolvedPrompts.map(function (promptKey, idx) {
|
|
66
|
-
var _ref2 = getPromptAction(
|
|
66
|
+
var _ref2 = getPromptAction({
|
|
67
|
+
promptKey: promptKey,
|
|
68
|
+
intl: intl,
|
|
69
|
+
url: data === null || data === void 0 ? void 0 : data.url,
|
|
70
|
+
product: data === null || data === void 0 ? void 0 : data.product,
|
|
71
|
+
iconSize: props.iconSize,
|
|
72
|
+
cardAppearance: props.cardAppearance
|
|
73
|
+
}) || {},
|
|
67
74
|
icon = _ref2.icon,
|
|
68
75
|
content = _ref2.content,
|
|
69
76
|
tooltipMessage = _ref2.tooltipMessage,
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
2
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
6
3
|
import { AnalyticsContext, useAnalyticsEvents as useAnalyticsEventsNext } from '@atlaskit/analytics-next';
|
|
7
4
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
@@ -163,18 +160,13 @@ var HoverCardContent = function HoverCardContent(_ref4) {
|
|
|
163
160
|
var _getMetadata = getMetadata(extensionKey, data),
|
|
164
161
|
subtitle = _getMetadata.subtitle;
|
|
165
162
|
var titleMaxLines = subtitle && subtitle.length > 0 ? 1 : 2;
|
|
166
|
-
|
|
167
|
-
// Platform apps (Home, Goals, Projects, and Teams) should by default open in the same tab when the FF is enabled.
|
|
168
|
-
var isSameTabAlignmentEnabled = fg('townsquare-same-tab-alignment-gcko-849');
|
|
169
|
-
var anchorTarget = product === 'ATLAS' && isSameTabAlignmentEnabled ? '_self' : undefined;
|
|
170
|
-
var titleBlockProps = _objectSpread({
|
|
163
|
+
var titleBlockProps = {
|
|
171
164
|
maxLines: titleMaxLines,
|
|
172
165
|
size: SmartLinkSize.Large,
|
|
173
166
|
position: SmartLinkPosition.Center,
|
|
174
|
-
subtitle: subtitle
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
} : undefined);
|
|
167
|
+
subtitle: subtitle,
|
|
168
|
+
anchorTarget: product === 'ATLAS' ? '_self' : undefined
|
|
169
|
+
};
|
|
178
170
|
var uiOptions = flexibleUiOptions;
|
|
179
171
|
uiOptions.enableSnippetRenderer = true;
|
|
180
172
|
var flexibleCardProps = {
|
|
@@ -101,7 +101,8 @@ export function InlineCardResolvedViewFunctionalWithRovoActions(_ref2) {
|
|
|
101
101
|
hideIconLoadingSkeleton: hideIconLoadingSkeleton
|
|
102
102
|
}), renderLozenge(lozenge), isInlineTailoredRovoActionEnabled && /*#__PURE__*/React.createElement(InlineRovoActionButton, {
|
|
103
103
|
testId: "".concat(testId, "-rovo-actions-cta"),
|
|
104
|
-
url: link
|
|
104
|
+
url: link,
|
|
105
|
+
actionOptions: actionOptions
|
|
105
106
|
}));
|
|
106
107
|
if (!showHoverPreview || !link) {
|
|
107
108
|
return frame;
|
|
@@ -113,6 +114,4 @@ export function InlineCardResolvedViewFunctionalWithRovoActions(_ref2) {
|
|
|
113
114
|
hoverPreviewOptions: hoverPreviewOptions
|
|
114
115
|
}, frame);
|
|
115
116
|
}
|
|
116
|
-
|
|
117
|
-
// Todo: replace with platform_sl_3p_auth_inline_tailored_cta_killswitch after cleanup of rovogrowth-640-inline-action-nudge-fg
|
|
118
117
|
export var InlineCardResolvedViewFunctional = componentWithFG('platform_sl_3p_auth_inline_tailored_cta_killswitch', InlineCardResolvedViewFunctionalWithRovoActions, InlineCardResolvedViewBase);
|