@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
|
@@ -32,6 +32,11 @@ var RovoChatPromptKey = exports.RovoChatPromptKey = /*#__PURE__*/function (RovoC
|
|
|
32
32
|
RovoChatPromptKey["SUMMARIZE_THIS_FOR_ME"] = "summarize-this-for-me";
|
|
33
33
|
RovoChatPromptKey["ASK_A_SPECIFIC_QUESTION"] = "ask-a-specific-question";
|
|
34
34
|
RovoChatPromptKey["SHOW_ME_WHATS_RELEVANT"] = "show-me-whats-relevant";
|
|
35
|
+
RovoChatPromptKey["SUMMARIZE_DOCUMENT"] = "summarize-document";
|
|
36
|
+
RovoChatPromptKey["SUMMARIZE_PRESENTATION"] = "summarize-presentation";
|
|
37
|
+
RovoChatPromptKey["EXPLAIN_CODE"] = "explain-code";
|
|
38
|
+
RovoChatPromptKey["CATCH_UP"] = "catch-up";
|
|
39
|
+
RovoChatPromptKey["SALESFORCE_PREP"] = "salesforce-prep";
|
|
35
40
|
return RovoChatPromptKey;
|
|
36
41
|
}({});
|
|
37
42
|
var getContext = function getContext(intl, product) {
|
|
@@ -51,18 +56,22 @@ var getContext = function getContext(intl, product) {
|
|
|
51
56
|
};
|
|
52
57
|
}
|
|
53
58
|
};
|
|
54
|
-
var getPromptAction = exports.getPromptAction = function getPromptAction(
|
|
59
|
+
var getPromptAction = exports.getPromptAction = function getPromptAction(_ref) {
|
|
55
60
|
var _getContext;
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
var promptKey = _ref.promptKey,
|
|
62
|
+
intl = _ref.intl,
|
|
63
|
+
_ref$url = _ref.url,
|
|
64
|
+
url = _ref$url === void 0 ? '' : _ref$url,
|
|
65
|
+
product = _ref.product,
|
|
66
|
+
iconSize = _ref.iconSize,
|
|
67
|
+
cardAppearance = _ref.cardAppearance,
|
|
68
|
+
provider = _ref.provider;
|
|
69
|
+
var _ref2 = (_getContext = getContext(intl, product)) !== null && _getContext !== void 0 ? _getContext : {
|
|
61
70
|
contextLong: intl.formatMessage(_messages.messages.rovo_prompt_context_generic),
|
|
62
71
|
contextShort: intl.formatMessage(_messages.messages.rovo_prompt_context_generic)
|
|
63
72
|
},
|
|
64
|
-
contextLong =
|
|
65
|
-
contextShort =
|
|
73
|
+
contextLong = _ref2.contextLong,
|
|
74
|
+
contextShort = _ref2.contextShort;
|
|
66
75
|
var isBlockCard3PExperimentEnabled = (0, _useBlockCardRovoActionExperiment.isBlockCardRovoActionExperimentEnabled)(product);
|
|
67
76
|
switch (promptKey) {
|
|
68
77
|
case RovoChatPromptKey.RECOMMEND_OTHER_SOURCES:
|
|
@@ -328,5 +337,106 @@ var getPromptAction = exports.getPromptAction = function getPromptAction(promptK
|
|
|
328
337
|
prompt: (0, _htmlToAdf.default)(html_find_open_questions)
|
|
329
338
|
}
|
|
330
339
|
};
|
|
340
|
+
case RovoChatPromptKey.SUMMARIZE_DOCUMENT:
|
|
341
|
+
var label_summarize_document = intl.formatMessage(_messages.messages.ai_summarize);
|
|
342
|
+
var html_summarize_document = intl.formatMessage(_messages.messages.rovo_prompt_message_summarize_document, {
|
|
343
|
+
url: url
|
|
344
|
+
}, {
|
|
345
|
+
ignoreTag: true
|
|
346
|
+
});
|
|
347
|
+
return {
|
|
348
|
+
content: label_summarize_document,
|
|
349
|
+
tooltipMessage: label_summarize_document,
|
|
350
|
+
data: {
|
|
351
|
+
name: label_summarize_document,
|
|
352
|
+
dialogues: [],
|
|
353
|
+
prompt: (0, _htmlToAdf.default)(html_summarize_document)
|
|
354
|
+
},
|
|
355
|
+
icon: /*#__PURE__*/_react.default.createElement(_aiGenerativeTextSummary.default, {
|
|
356
|
+
label: label_summarize_document,
|
|
357
|
+
size: iconSize
|
|
358
|
+
})
|
|
359
|
+
};
|
|
360
|
+
case RovoChatPromptKey.SUMMARIZE_PRESENTATION:
|
|
361
|
+
var label_summarize_presentation = intl.formatMessage(_messages.messages.ai_summarize);
|
|
362
|
+
var html_summarize_presentation = intl.formatMessage(_messages.messages.rovo_prompt_message_summarize_presentation, {
|
|
363
|
+
url: url
|
|
364
|
+
}, {
|
|
365
|
+
ignoreTag: true
|
|
366
|
+
});
|
|
367
|
+
return {
|
|
368
|
+
content: label_summarize_presentation,
|
|
369
|
+
tooltipMessage: label_summarize_presentation,
|
|
370
|
+
data: {
|
|
371
|
+
name: label_summarize_presentation,
|
|
372
|
+
dialogues: [],
|
|
373
|
+
prompt: (0, _htmlToAdf.default)(html_summarize_presentation)
|
|
374
|
+
},
|
|
375
|
+
icon: /*#__PURE__*/_react.default.createElement(_aiGenerativeTextSummary.default, {
|
|
376
|
+
label: label_summarize_presentation,
|
|
377
|
+
size: iconSize
|
|
378
|
+
})
|
|
379
|
+
};
|
|
380
|
+
case RovoChatPromptKey.EXPLAIN_CODE:
|
|
381
|
+
var label_explain_code = intl.formatMessage(_messages.messages.rovo_prompt_button_explain_code);
|
|
382
|
+
var html_explain_code = intl.formatMessage(_messages.messages.rovo_prompt_message_explain_code, {
|
|
383
|
+
url: url
|
|
384
|
+
}, {
|
|
385
|
+
ignoreTag: true
|
|
386
|
+
});
|
|
387
|
+
return {
|
|
388
|
+
content: label_explain_code,
|
|
389
|
+
tooltipMessage: label_explain_code,
|
|
390
|
+
data: {
|
|
391
|
+
name: label_explain_code,
|
|
392
|
+
dialogues: [],
|
|
393
|
+
prompt: (0, _htmlToAdf.default)(html_explain_code)
|
|
394
|
+
},
|
|
395
|
+
icon: /*#__PURE__*/_react.default.createElement(_aiGenerativeTextSummary.default, {
|
|
396
|
+
label: label_explain_code,
|
|
397
|
+
size: iconSize
|
|
398
|
+
})
|
|
399
|
+
};
|
|
400
|
+
case RovoChatPromptKey.CATCH_UP:
|
|
401
|
+
var label_catch_up = intl.formatMessage(_messages.messages.rovo_prompt_button_catch_up);
|
|
402
|
+
var html_catch_up = intl.formatMessage(_messages.messages.rovo_prompt_message_catch_up, {
|
|
403
|
+
url: url,
|
|
404
|
+
provider: provider
|
|
405
|
+
}, {
|
|
406
|
+
ignoreTag: true
|
|
407
|
+
});
|
|
408
|
+
return {
|
|
409
|
+
content: label_catch_up,
|
|
410
|
+
tooltipMessage: label_catch_up,
|
|
411
|
+
data: {
|
|
412
|
+
name: label_catch_up,
|
|
413
|
+
dialogues: [],
|
|
414
|
+
prompt: (0, _htmlToAdf.default)(html_catch_up)
|
|
415
|
+
},
|
|
416
|
+
icon: /*#__PURE__*/_react.default.createElement(_aiGenerativeTextSummary.default, {
|
|
417
|
+
label: label_catch_up,
|
|
418
|
+
size: iconSize
|
|
419
|
+
})
|
|
420
|
+
};
|
|
421
|
+
case RovoChatPromptKey.SALESFORCE_PREP:
|
|
422
|
+
var label_overview = intl.formatMessage(_messages.messages.rovo_prompt_button_salesforce_prep);
|
|
423
|
+
var html_overview = intl.formatMessage(_messages.messages.rovo_prompt_message_salesforce_prep, {
|
|
424
|
+
url: url
|
|
425
|
+
}, {
|
|
426
|
+
ignoreTag: true
|
|
427
|
+
});
|
|
428
|
+
return {
|
|
429
|
+
content: label_overview,
|
|
430
|
+
tooltipMessage: label_overview,
|
|
431
|
+
data: {
|
|
432
|
+
name: label_overview,
|
|
433
|
+
dialogues: [],
|
|
434
|
+
prompt: (0, _htmlToAdf.default)(html_overview)
|
|
435
|
+
},
|
|
436
|
+
icon: /*#__PURE__*/_react.default.createElement(_aiGenerativeTextSummary.default, {
|
|
437
|
+
label: label_overview,
|
|
438
|
+
size: iconSize
|
|
439
|
+
})
|
|
440
|
+
};
|
|
331
441
|
}
|
|
332
442
|
};
|
|
@@ -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/es2019/messages.js
CHANGED
|
@@ -1081,6 +1081,46 @@ export const 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–10 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> — What problem does it solve or what goal does it achieve?</li><li><strong>How it works</strong> — High-level mechanics (no implementation detail unless critical to understanding).</li><li><strong>Why</strong> — Motivation for the change or design choice.</li><li><strong>Impact</strong> — Key behavior changes, risks, or downstream effects worth noting.</li></ol><p>Constraints:</p><ul><li>3–5 sentences or 100–150 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 — ideally 80–150 words or a short set of 3–5 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,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";
|
|
@@ -102,6 +102,21 @@ function Component({
|
|
|
102
102
|
|
|
103
103
|
// Shared scope guard for all 3P-click handlers.
|
|
104
104
|
const shouldFire3PClickEvent = thirdPartyARI && thirdPartyARI.startsWith(thirdPartyARIPrefix) && getClickUrl(url, state.details) === url && fire3PClickEvent && fg('platform_smartlink_3pclick_analytics');
|
|
105
|
+
const getDestinationUrl = useCallback(() => {
|
|
106
|
+
var _getClickUrl, _appendCrossProductAn;
|
|
107
|
+
const preferredUrl = (_getClickUrl = getClickUrl(url, state.details)) !== null && _getClickUrl !== void 0 ? _getClickUrl : url;
|
|
108
|
+
return (_appendCrossProductAn = appendCrossProductAnalyticsParams(preferredUrl)) !== null && _appendCrossProductAn !== void 0 ? _appendCrossProductAn : preferredUrl;
|
|
109
|
+
}, [appendCrossProductAnalyticsParams, state.details, url]);
|
|
110
|
+
const updateAnchorHref = useCallback((event, destinationUrl) => {
|
|
111
|
+
if (!(event.currentTarget instanceof HTMLAnchorElement)) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// FIXME: destinationUrl should be rendered in the DOM anchor href instead of derived at click time
|
|
116
|
+
// href is only defined when currentTarget is an anchor element.
|
|
117
|
+
// Update the anchor href so the browser context menu uses the decorated URL.
|
|
118
|
+
event.currentTarget.href = destinationUrl;
|
|
119
|
+
}, []);
|
|
105
120
|
|
|
106
121
|
// Setup UI handlers.
|
|
107
122
|
const handleClickWrapper = useCallback(event => {
|
|
@@ -121,7 +136,6 @@ function Component({
|
|
|
121
136
|
exposure: true
|
|
122
137
|
});
|
|
123
138
|
if (fg('platform_smartlink_xpc_url_wrapping')) {
|
|
124
|
-
var _appendCrossProductAn;
|
|
125
139
|
// FIXME: InlineCard, BlockCard and EmbedCard call event.preventDefault() internally
|
|
126
140
|
// before the event bubbles up to this handler. This forces us to snapshot
|
|
127
141
|
// event.defaultPrevented before calling onClick to detect whether the consumer
|
|
@@ -153,6 +167,8 @@ function Component({
|
|
|
153
167
|
});
|
|
154
168
|
return;
|
|
155
169
|
}
|
|
170
|
+
const destinationUrl = getDestinationUrl();
|
|
171
|
+
updateAnchorHref(event, destinationUrl);
|
|
156
172
|
|
|
157
173
|
// For FlexibleCard, read target from the clicked anchor element (e.g. _blank for links
|
|
158
174
|
// rendered with explicit target). For classic cards, default to _self
|
|
@@ -160,10 +176,6 @@ function Component({
|
|
|
160
176
|
target: anchorTarget
|
|
161
177
|
} = getAnchorAttributesFromEvent(event);
|
|
162
178
|
const 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
|
-
const preferredUrl = getClickUrl(url, state.details);
|
|
166
|
-
const destinationUrl = (_appendCrossProductAn = appendCrossProductAnalyticsParams(preferredUrl)) !== null && _appendCrossProductAn !== void 0 ? _appendCrossProductAn : preferredUrl;
|
|
167
179
|
onClick === null || onClick === void 0 ? void 0 : onClick(event, {
|
|
168
180
|
url,
|
|
169
181
|
destinationUrl
|
|
@@ -235,7 +247,7 @@ function Component({
|
|
|
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(() => {
|
|
@@ -247,23 +259,32 @@ function Component({
|
|
|
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
|
const handleFrameAuxClick = useCallback(event => {
|
|
262
|
+
if (fg('platform_smartlink_xpc_url_wrapping')) {
|
|
263
|
+
const 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 ? 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
|
-
const handleFrameContextMenu = useCallback(
|
|
277
|
+
const handleFrameContextMenu = useCallback(event => {
|
|
278
|
+
if (fg('platform_smartlink_xpc_url_wrapping')) {
|
|
279
|
+
const 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 ? void 0 : fire3PClickEvent({
|
|
263
284
|
isContextMenu: true
|
|
264
285
|
});
|
|
265
286
|
}
|
|
266
|
-
}, [fire3PClickEvent, shouldFire3PClickEvent]);
|
|
287
|
+
}, [fire3PClickEvent, getDestinationUrl, shouldFire3PClickEvent, updateAnchorHref]);
|
|
267
288
|
const {
|
|
268
289
|
reload
|
|
269
290
|
} = actions;
|
|
@@ -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,
|
|
@@ -214,6 +214,12 @@ export const HoverCardComponent = ({
|
|
|
214
214
|
const trigger = useCallback(({
|
|
215
215
|
'aria-haspopup': _ariaHasPopup,
|
|
216
216
|
'aria-expanded': _ariaExpanded,
|
|
217
|
+
// `aria-controls` is also stripped because the trigger wrapper renders
|
|
218
|
+
// with `role="none"`. axe's `aria-valid-attr-value` rule flags any
|
|
219
|
+
// `aria-controls` value sitting on a presentational element, since the
|
|
220
|
+
// element has no semantic role to control. Removing the attribute
|
|
221
|
+
// keeps the trigger semantically inert without losing functionality.
|
|
222
|
+
'aria-controls': _ariaControls,
|
|
217
223
|
...triggerProps
|
|
218
224
|
}) => /*#__PURE__*/React.createElement("span", {
|
|
219
225
|
ref: parentSpan
|
|
@@ -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 = ({
|