@atlaskit/smart-card 44.26.0 → 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 +39 -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/CardWithUrl/component.js +30 -9
- package/dist/cjs/view/FlexibleCard/components/actions/rovo-chat-action/index.js +8 -1
- package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +2 -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/CardWithUrl/component.js +30 -9
- package/dist/es2019/view/FlexibleCard/components/actions/rovo-chat-action/index.js +8 -1
- package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +6 -0
- 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/CardWithUrl/component.js +30 -9
- package/dist/esm/view/FlexibleCard/components/actions/rovo-chat-action/index.js +8 -1
- package/dist/esm/view/HoverCard/components/HoverCardComponent.js +2 -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 +6 -9
|
@@ -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";
|
|
@@ -103,6 +103,21 @@ function Component(_ref) {
|
|
|
103
103
|
|
|
104
104
|
// Shared scope guard for all 3P-click handlers.
|
|
105
105
|
var shouldFire3PClickEvent = thirdPartyARI && thirdPartyARI.startsWith(thirdPartyARIPrefix) && getClickUrl(url, state.details) === url && fire3PClickEvent && fg('platform_smartlink_3pclick_analytics');
|
|
106
|
+
var getDestinationUrl = useCallback(function () {
|
|
107
|
+
var _getClickUrl, _appendCrossProductAn;
|
|
108
|
+
var preferredUrl = (_getClickUrl = getClickUrl(url, state.details)) !== null && _getClickUrl !== void 0 ? _getClickUrl : url;
|
|
109
|
+
return (_appendCrossProductAn = appendCrossProductAnalyticsParams(preferredUrl)) !== null && _appendCrossProductAn !== void 0 ? _appendCrossProductAn : preferredUrl;
|
|
110
|
+
}, [appendCrossProductAnalyticsParams, state.details, url]);
|
|
111
|
+
var updateAnchorHref = useCallback(function (event, destinationUrl) {
|
|
112
|
+
if (!(event.currentTarget instanceof HTMLAnchorElement)) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// FIXME: destinationUrl should be rendered in the DOM anchor href instead of derived at click time
|
|
117
|
+
// href is only defined when currentTarget is an anchor element.
|
|
118
|
+
// Update the anchor href so the browser context menu uses the decorated URL.
|
|
119
|
+
event.currentTarget.href = destinationUrl;
|
|
120
|
+
}, []);
|
|
106
121
|
|
|
107
122
|
// Setup UI handlers.
|
|
108
123
|
var handleClickWrapper = useCallback(function (event) {
|
|
@@ -122,7 +137,6 @@ function Component(_ref) {
|
|
|
122
137
|
exposure: true
|
|
123
138
|
});
|
|
124
139
|
if (fg('platform_smartlink_xpc_url_wrapping')) {
|
|
125
|
-
var _appendCrossProductAn;
|
|
126
140
|
// FIXME: InlineCard, BlockCard and EmbedCard call event.preventDefault() internally
|
|
127
141
|
// before the event bubbles up to this handler. This forces us to snapshot
|
|
128
142
|
// event.defaultPrevented before calling onClick to detect whether the consumer
|
|
@@ -154,16 +168,14 @@ function Component(_ref) {
|
|
|
154
168
|
});
|
|
155
169
|
return;
|
|
156
170
|
}
|
|
171
|
+
var destinationUrl = getDestinationUrl();
|
|
172
|
+
updateAnchorHref(event, destinationUrl);
|
|
157
173
|
|
|
158
174
|
// For FlexibleCard, read target from the clicked anchor element (e.g. _blank for links
|
|
159
175
|
// rendered with explicit target). For classic cards, default to _self
|
|
160
176
|
var _getAnchorAttributesF = getAnchorAttributesFromEvent(event),
|
|
161
177
|
anchorTarget = _getAnchorAttributesF.target;
|
|
162
178
|
var target = isSpecialEvent(event) ? '_blank' : isFlexibleUi ? anchorTarget : '_self';
|
|
163
|
-
|
|
164
|
-
// FIXME: preferredUrl should be rendered in the DOM anchor href instead of derived at click time
|
|
165
|
-
var preferredUrl = getClickUrl(url, state.details);
|
|
166
|
-
var destinationUrl = (_appendCrossProductAn = appendCrossProductAnalyticsParams(preferredUrl)) !== null && _appendCrossProductAn !== void 0 ? _appendCrossProductAn : preferredUrl;
|
|
167
179
|
onClick === null || onClick === void 0 || onClick(event, {
|
|
168
180
|
url: url,
|
|
169
181
|
destinationUrl: destinationUrl
|
|
@@ -235,7 +247,7 @@ function Component(_ref) {
|
|
|
235
247
|
fireLinkClickedEvent(createAnalyticsEvent)(event);
|
|
236
248
|
}
|
|
237
249
|
}
|
|
238
|
-
}, [fireEvent, id, isFlexibleUi, appearance, definitionId, onClick, url,
|
|
250
|
+
}, [fireEvent, id, isFlexibleUi, appearance, definitionId, getDestinationUrl, onClick, url, updateAnchorHref, state.details, ari, name, fire3PClickEvent, shouldFire3PClickEvent, isPreviewPanelAvailable, openPreviewPanel, createAnalyticsEvent, disablePreviewPanel]);
|
|
239
251
|
|
|
240
252
|
// Exposure fires once per eligible mount; click-time reads use no-exposure variant.
|
|
241
253
|
useEffect(function () {
|
|
@@ -247,23 +259,32 @@ function Component(_ref) {
|
|
|
247
259
|
// Middle-click handler to trigger fire3PClickEvent on middle-clicks.
|
|
248
260
|
// Scope is limited to 3P click analytics to keep the experiment focused.
|
|
249
261
|
var handleFrameAuxClick = useCallback(function (event) {
|
|
262
|
+
if (fg('platform_smartlink_xpc_url_wrapping')) {
|
|
263
|
+
var destinationUrl = getDestinationUrl();
|
|
264
|
+
updateAnchorHref(event, destinationUrl);
|
|
265
|
+
}
|
|
266
|
+
|
|
250
267
|
// isAuxClick filters Windows right-clicks (button === 2) that also fire onAuxClick.
|
|
251
268
|
if (isAuxClick(event) && shouldFire3PClickEvent && expValEqualsNoExposure(TRACK_NON_PRIMARY_3P_CLICKS_EXPERIMENT, 'isEnabled', true)) {
|
|
252
269
|
fire3PClickEvent === null || fire3PClickEvent === void 0 || fire3PClickEvent({
|
|
253
270
|
isAuxClick: true
|
|
254
271
|
});
|
|
255
272
|
}
|
|
256
|
-
}, [fire3PClickEvent, shouldFire3PClickEvent]);
|
|
273
|
+
}, [fire3PClickEvent, getDestinationUrl, shouldFire3PClickEvent, updateAnchorHref]);
|
|
257
274
|
|
|
258
275
|
// Right-click handler to trigger fire3PClickEvent on right-clicks.
|
|
259
276
|
// Scope is limited to 3P click analytics to keep the experiment focused.
|
|
260
|
-
var handleFrameContextMenu = useCallback(function (
|
|
277
|
+
var handleFrameContextMenu = useCallback(function (event) {
|
|
278
|
+
if (fg('platform_smartlink_xpc_url_wrapping')) {
|
|
279
|
+
var destinationUrl = getDestinationUrl();
|
|
280
|
+
updateAnchorHref(event, destinationUrl);
|
|
281
|
+
}
|
|
261
282
|
if (shouldFire3PClickEvent && expValEqualsNoExposure(TRACK_NON_PRIMARY_3P_CLICKS_EXPERIMENT, 'isEnabled', true)) {
|
|
262
283
|
fire3PClickEvent === null || fire3PClickEvent === void 0 || fire3PClickEvent({
|
|
263
284
|
isContextMenu: true
|
|
264
285
|
});
|
|
265
286
|
}
|
|
266
|
-
}, [fire3PClickEvent, shouldFire3PClickEvent]);
|
|
287
|
+
}, [fire3PClickEvent, getDestinationUrl, shouldFire3PClickEvent, updateAnchorHref]);
|
|
267
288
|
var reload = actions.reload;
|
|
268
289
|
var handleAuthorize = useCallback(function () {
|
|
269
290
|
return actions.authorize(appearance);
|
|
@@ -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,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
-
var _excluded = ["aria-haspopup", "aria-expanded"];
|
|
4
|
+
var _excluded = ["aria-haspopup", "aria-expanded", "aria-controls"];
|
|
5
5
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import Popup from '@atlaskit/popup';
|
|
@@ -231,6 +231,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
|
|
|
231
231
|
var trigger = useCallback(function (_ref3) {
|
|
232
232
|
var _ariaHasPopup = _ref3['aria-haspopup'],
|
|
233
233
|
_ariaExpanded = _ref3['aria-expanded'],
|
|
234
|
+
_ariaControls = _ref3['aria-controls'],
|
|
234
235
|
triggerProps = _objectWithoutProperties(_ref3, _excluded);
|
|
235
236
|
return /*#__PURE__*/React.createElement("span", {
|
|
236
237
|
ref: parentSpan
|
|
@@ -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);
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
/* index.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
4
|
import "./index.compiled.css";
|
|
3
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
-
import
|
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
9
|
+
import React, { useCallback, useMemo } from 'react';
|
|
5
10
|
import { useIntl } from "react-intl";
|
|
6
11
|
import { cx } from '@atlaskit/css';
|
|
7
|
-
import AiGenerativeTextSummaryIcon from '@atlaskit/icon/core/ai-generative-text-summary';
|
|
8
12
|
import RovoChatIcon from '@atlaskit/icon/core/rovo-chat';
|
|
13
|
+
import { extractSmartLinkProvider } from '@atlaskit/link-extractors';
|
|
9
14
|
import { Box, Text } from '@atlaskit/primitives/compiled';
|
|
15
|
+
import extractRovoChatAction from "../../../../extractors/flexible/actions/extract-rovo-chat-action";
|
|
16
|
+
import { getExtensionKey } from "../../../../state/helpers";
|
|
17
|
+
import useInvokeClientAction from "../../../../state/hooks/use-invoke-client-action";
|
|
10
18
|
import useRovoChat from "../../../../state/hooks/use-rovo-chat";
|
|
19
|
+
import useRovoConfig from "../../../../state/hooks/use-rovo-config";
|
|
20
|
+
import { useSmartCardState } from "../../../../state/store";
|
|
11
21
|
import { getPromptAction, RovoChatPromptKey } from "../../../common/rovo-chat-utils";
|
|
12
22
|
import { ActionButton } from "../action-button";
|
|
13
23
|
var styles = {
|
|
@@ -28,31 +38,89 @@ export var RovoActionsCta = function RovoActionsCta(_ref) {
|
|
|
28
38
|
};
|
|
29
39
|
export var InlineRovoActionButton = function InlineRovoActionButton(_ref2) {
|
|
30
40
|
var testId = _ref2.testId,
|
|
31
|
-
url = _ref2.url
|
|
41
|
+
url = _ref2.url,
|
|
42
|
+
actionOptions = _ref2.actionOptions;
|
|
32
43
|
var _useRovoChat = useRovoChat(),
|
|
33
44
|
sendPromptMessage = _useRovoChat.sendPromptMessage,
|
|
34
45
|
isRovoChatEnabled = _useRovoChat.isRovoChatEnabled;
|
|
35
46
|
var intl = useIntl();
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var
|
|
47
|
+
var cardState = useSmartCardState(url !== null && url !== void 0 ? url : '');
|
|
48
|
+
var extensionKey = getExtensionKey(cardState.details);
|
|
49
|
+
var rovoConfig = useRovoConfig();
|
|
50
|
+
var rovoChatAction = useMemo(function () {
|
|
51
|
+
return cardState.details && extractRovoChatAction({
|
|
52
|
+
response: cardState.details,
|
|
53
|
+
actionOptions: actionOptions,
|
|
54
|
+
rovoConfig: rovoConfig
|
|
55
|
+
});
|
|
56
|
+
}, [cardState.details, rovoConfig, actionOptions]);
|
|
57
|
+
var provider = useMemo(function () {
|
|
58
|
+
return cardState.details && extractSmartLinkProvider(cardState.details);
|
|
59
|
+
}, [cardState.details]);
|
|
60
|
+
var invoke = useInvokeClientAction({});
|
|
61
|
+
var promptKey = useMemo(function () {
|
|
62
|
+
var _cardState$details, _cardState$details2;
|
|
63
|
+
if (extensionKey === 'google-object-provider' && (_cardState$details = cardState.details) !== null && _cardState$details !== void 0 && (_cardState$details = _cardState$details.data) !== null && _cardState$details !== void 0 && (_cardState$details = _cardState$details['@type']) !== null && _cardState$details !== void 0 && _cardState$details.includes('schema:SpreadsheetDigitalDocument')) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
switch (extensionKey) {
|
|
67
|
+
case 'google-object-provider':
|
|
68
|
+
if ((_cardState$details2 = cardState.details) !== null && _cardState$details2 !== void 0 && (_cardState$details2 = _cardState$details2.data) !== null && _cardState$details2 !== void 0 && (_cardState$details2 = _cardState$details2['@type']) !== null && _cardState$details2 !== void 0 && _cardState$details2.includes('schema:PresentationDigitalDocument')) {
|
|
69
|
+
return RovoChatPromptKey.SUMMARIZE_PRESENTATION;
|
|
70
|
+
}
|
|
71
|
+
return RovoChatPromptKey.SUMMARIZE_DOCUMENT;
|
|
72
|
+
case 'onedrive-object-provider':
|
|
73
|
+
return RovoChatPromptKey.SUMMARIZE_DOCUMENT;
|
|
74
|
+
case 'github-object-provider':
|
|
75
|
+
case 'gitlab-object-provider':
|
|
76
|
+
return RovoChatPromptKey.EXPLAIN_CODE;
|
|
77
|
+
case 'slack-object-provider':
|
|
78
|
+
case 'ms-teams-object-provider':
|
|
79
|
+
return RovoChatPromptKey.CATCH_UP;
|
|
80
|
+
case 'salesforce-object-provider':
|
|
81
|
+
return RovoChatPromptKey.SALESFORCE_PREP;
|
|
82
|
+
}
|
|
83
|
+
}, [extensionKey, cardState]);
|
|
84
|
+
var _ref3 = promptKey ? getPromptAction({
|
|
85
|
+
promptKey: promptKey,
|
|
86
|
+
intl: intl,
|
|
87
|
+
url: url,
|
|
88
|
+
iconSize: 'small',
|
|
89
|
+
provider: provider === null || provider === void 0 ? void 0 : provider.text
|
|
90
|
+
}) || {} : {},
|
|
39
91
|
promptData = _ref3.data,
|
|
40
|
-
content = _ref3.content
|
|
92
|
+
content = _ref3.content,
|
|
93
|
+
icon = _ref3.icon;
|
|
41
94
|
var handleClick = useCallback(function (event) {
|
|
42
95
|
event.preventDefault();
|
|
43
96
|
event.stopPropagation();
|
|
44
|
-
if (isRovoChatEnabled && promptData) {
|
|
45
|
-
|
|
97
|
+
if (isRovoChatEnabled && promptData && rovoChatAction !== null && rovoChatAction !== void 0 && rovoChatAction.invokeAction) {
|
|
98
|
+
invoke(_objectSpread(_objectSpread({}, rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.invokeAction), {}, {
|
|
99
|
+
actionFn: function () {
|
|
100
|
+
var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
101
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
102
|
+
while (1) switch (_context.prev = _context.next) {
|
|
103
|
+
case 0:
|
|
104
|
+
return _context.abrupt("return", sendPromptMessage(promptData));
|
|
105
|
+
case 1:
|
|
106
|
+
case "end":
|
|
107
|
+
return _context.stop();
|
|
108
|
+
}
|
|
109
|
+
}, _callee);
|
|
110
|
+
}));
|
|
111
|
+
function actionFn() {
|
|
112
|
+
return _actionFn.apply(this, arguments);
|
|
113
|
+
}
|
|
114
|
+
return actionFn;
|
|
115
|
+
}(),
|
|
116
|
+
prompt: promptKey
|
|
117
|
+
}));
|
|
46
118
|
}
|
|
47
|
-
}, [sendPromptMessage, isRovoChatEnabled, promptData]);
|
|
119
|
+
}, [sendPromptMessage, isRovoChatEnabled, promptData, rovoChatAction, promptKey, invoke]);
|
|
48
120
|
return promptData && content ? /*#__PURE__*/React.createElement(ActionButton, {
|
|
49
121
|
onClick: handleClick,
|
|
50
122
|
testId: testId
|
|
51
|
-
}, /*#__PURE__*/React.createElement(
|
|
52
|
-
label: "Rovo",
|
|
53
|
-
color: "var(--ds-icon, #292A2E)",
|
|
54
|
-
size: "small"
|
|
55
|
-
}), /*#__PURE__*/React.createElement(Box, {
|
|
123
|
+
}, icon, /*#__PURE__*/React.createElement(Box, {
|
|
56
124
|
xcss: styles.text
|
|
57
125
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
58
126
|
size: "small"
|
|
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
12
12
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
13
13
|
var PACKAGE_DATA = {
|
|
14
14
|
packageName: "@atlaskit/smart-card",
|
|
15
|
-
packageVersion: "44.
|
|
15
|
+
packageVersion: "44.27.1",
|
|
16
16
|
componentName: 'linkUrl'
|
|
17
17
|
};
|
|
18
18
|
var LinkUrl = function LinkUrl(_ref) {
|