@atlaskit/smart-card 44.21.0 → 44.22.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 +11 -0
- package/dist/cjs/state/hooks/use-inline-tailored-action-experiment/index.js +55 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/BlockCard/views/ResolvedView.js +6 -6
- package/dist/cjs/view/FlexibleCard/components/actions/rovo-chat-action/index.js +15 -337
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +3 -3
- package/dist/cjs/view/InlineCard/ResolvedView/InlineCardResolvedViewFunctional.js +10 -1
- package/dist/cjs/view/InlineCard/common/rovo-actions-cta/index.js +43 -5
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/common/rovo-chat-utils/index.js +332 -0
- package/dist/es2019/state/hooks/use-inline-tailored-action-experiment/index.js +49 -0
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/views/ResolvedView.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/rovo-chat-action/index.js +2 -321
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +1 -1
- package/dist/es2019/view/InlineCard/ResolvedView/InlineCardResolvedViewFunctional.js +12 -2
- package/dist/es2019/view/InlineCard/common/rovo-actions-cta/index.js +44 -3
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/common/rovo-chat-utils/index.js +322 -0
- package/dist/esm/state/hooks/use-inline-tailored-action-experiment/index.js +48 -0
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/views/ResolvedView.js +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/rovo-chat-action/index.js +13 -335
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +1 -1
- package/dist/esm/view/InlineCard/ResolvedView/InlineCardResolvedViewFunctional.js +11 -2
- package/dist/esm/view/InlineCard/common/rovo-actions-cta/index.js +41 -3
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/common/rovo-chat-utils/index.js +325 -0
- package/dist/types/state/hooks/use-inline-tailored-action-experiment/index.d.ts +24 -0
- package/dist/types/view/FlexibleCard/components/actions/rovo-chat-action/index.d.ts +1 -15
- package/dist/types/view/InlineCard/common/rovo-actions-cta/index.d.ts +4 -4
- package/dist/types/view/common/rovo-chat-utils/index.d.ts +25 -0
- package/dist/types-ts4.5/state/hooks/use-inline-tailored-action-experiment/index.d.ts +24 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/actions/rovo-chat-action/index.d.ts +1 -15
- package/dist/types-ts4.5/view/InlineCard/common/rovo-actions-cta/index.d.ts +4 -4
- package/dist/types-ts4.5/view/common/rovo-chat-utils/index.d.ts +25 -0
- package/package.json +5 -2
|
@@ -1,337 +1,18 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { useCallback, useMemo } from 'react';
|
|
3
3
|
import { useIntl } from 'react-intl';
|
|
4
|
-
import AiSearchIcon from '@atlaskit/icon-lab/core/ai-search';
|
|
5
|
-
import AiChatIcon from '@atlaskit/icon/core/ai-chat';
|
|
6
|
-
import AiGenerativeTextSummaryIcon from '@atlaskit/icon/core/ai-generative-text-summary';
|
|
7
|
-
import RovoChatIcon from '@atlaskit/icon/core/rovo-chat';
|
|
8
|
-
import { RovoIcon } from '@atlaskit/logo';
|
|
9
4
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
10
|
-
import { ActionName
|
|
11
|
-
import { messages } from '../../../../../messages';
|
|
5
|
+
import { ActionName } from '../../../../../constants';
|
|
12
6
|
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
13
|
-
import { isBlockCardRovoActionExperimentEnabled } from '../../../../../state/hooks/use-block-card-rovo-action-experiment';
|
|
14
7
|
import useInvokeClientAction from '../../../../../state/hooks/use-invoke-client-action';
|
|
15
8
|
import useRovoChat from '../../../../../state/hooks/use-rovo-chat';
|
|
16
|
-
import
|
|
17
|
-
import AIEditIcon from '../../../assets/ai-edit-icon';
|
|
18
|
-
import AISearchIcon from '../../../assets/ai-search-icon';
|
|
9
|
+
import { getPromptAction, RovoChatPromptKey } from "../../../../common/rovo-chat-utils";
|
|
19
10
|
import Action from '../action';
|
|
20
|
-
import htmlToAdf from './html-to-adf';
|
|
21
|
-
export let RovoChatPromptKey = /*#__PURE__*/function (RovoChatPromptKey) {
|
|
22
|
-
RovoChatPromptKey["RECOMMEND_OTHER_SOURCES"] = "recommend-other-sources";
|
|
23
|
-
RovoChatPromptKey["SHOW_OTHER_MENTIONS"] = "show-other-mentions";
|
|
24
|
-
RovoChatPromptKey["SUGGEST_IMPROVEMENT"] = "suggest-improvement";
|
|
25
|
-
RovoChatPromptKey["SUMMARIZE_LINK"] = "summarize-link";
|
|
26
|
-
RovoChatPromptKey["KEY_HIGHLIGHTS"] = "key-highlights";
|
|
27
|
-
RovoChatPromptKey["ASK_ROVO_ANYTHING"] = "ask-rovo-anything";
|
|
28
|
-
RovoChatPromptKey["IDENTIFY_KEY_POINTS"] = "identify-key-points";
|
|
29
|
-
RovoChatPromptKey["IDENTIFY_KEY_TRENDS"] = "identify-key-trends";
|
|
30
|
-
RovoChatPromptKey["FIND_OPEN_QUESTIONS"] = "find-open-questions";
|
|
31
|
-
RovoChatPromptKey["HIGHLIGHT_RELEVANT_CONTENT"] = "highlight-relevant-content";
|
|
32
|
-
RovoChatPromptKey["SUMMARIZE_THIS_FOR_ME"] = "summarize-this-for-me";
|
|
33
|
-
RovoChatPromptKey["ASK_A_SPECIFIC_QUESTION"] = "ask-a-specific-question";
|
|
34
|
-
RovoChatPromptKey["SHOW_ME_WHATS_RELEVANT"] = "show-me-whats-relevant";
|
|
35
|
-
return RovoChatPromptKey;
|
|
36
|
-
}({});
|
|
37
11
|
const GOOGLE_PROMPTS = [RovoChatPromptKey.RECOMMEND_OTHER_SOURCES, RovoChatPromptKey.SHOW_OTHER_MENTIONS, RovoChatPromptKey.SUGGEST_IMPROVEMENT];
|
|
38
12
|
const GENERIC_3P_PROMPTS = [
|
|
39
13
|
// For rovogrowth-640-inline-action-nudge-exp only
|
|
40
14
|
RovoChatPromptKey.SHOW_ME_WHATS_RELEVANT, RovoChatPromptKey.SUMMARIZE_THIS_FOR_ME, RovoChatPromptKey.ASK_A_SPECIFIC_QUESTION];
|
|
41
15
|
const DEFAULT_PROMPTS = GOOGLE_PROMPTS;
|
|
42
|
-
const getContext = (intl, product) => {
|
|
43
|
-
switch (product) {
|
|
44
|
-
case 'CONFLUENCE':
|
|
45
|
-
return {
|
|
46
|
-
contextLong: intl.formatMessage(messages.rovo_prompt_context_confluence_page),
|
|
47
|
-
contextShort: intl.formatMessage(messages.rovo_prompt_context_confluence_page_short)
|
|
48
|
-
};
|
|
49
|
-
case 'JSW':
|
|
50
|
-
case 'JWM':
|
|
51
|
-
case 'JSM':
|
|
52
|
-
case 'JPD':
|
|
53
|
-
return {
|
|
54
|
-
contextLong: intl.formatMessage(messages.rovo_prompt_context_jira_work_item),
|
|
55
|
-
contextShort: intl.formatMessage(messages.rovo_prompt_context_jira_work_item_short)
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
const getPromptAction = (promptKey, intl, url = '', product, iconSize, cardAppearance) => {
|
|
60
|
-
var _getContext;
|
|
61
|
-
const {
|
|
62
|
-
contextLong,
|
|
63
|
-
contextShort
|
|
64
|
-
} = (_getContext = getContext(intl, product)) !== null && _getContext !== void 0 ? _getContext : {
|
|
65
|
-
contextLong: intl.formatMessage(messages.rovo_prompt_context_generic),
|
|
66
|
-
contextShort: intl.formatMessage(messages.rovo_prompt_context_generic)
|
|
67
|
-
};
|
|
68
|
-
const isBlockCard3PExperimentEnabled = isBlockCardRovoActionExperimentEnabled(product);
|
|
69
|
-
switch (promptKey) {
|
|
70
|
-
case RovoChatPromptKey.RECOMMEND_OTHER_SOURCES:
|
|
71
|
-
const label_recommend = intl.formatMessage(messages.rovo_prompt_button_recommend_other_sources);
|
|
72
|
-
const html_recommend = intl.formatMessage(messages.rovo_prompt_message_recommend_other_sources, {
|
|
73
|
-
context: contextLong,
|
|
74
|
-
url
|
|
75
|
-
}, {
|
|
76
|
-
ignoreTag: true
|
|
77
|
-
});
|
|
78
|
-
return {
|
|
79
|
-
icon: /*#__PURE__*/React.createElement(AIEditIcon, null),
|
|
80
|
-
content: label_recommend,
|
|
81
|
-
tooltipMessage: label_recommend,
|
|
82
|
-
data: {
|
|
83
|
-
name: label_recommend,
|
|
84
|
-
dialogues: [],
|
|
85
|
-
prompt: htmlToAdf(html_recommend)
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
case RovoChatPromptKey.SHOW_OTHER_MENTIONS:
|
|
89
|
-
const label_other_mentions = intl.formatMessage(messages.rovo_prompt_button_show_other_mentions);
|
|
90
|
-
const html_other_mentions = intl.formatMessage(messages.rovo_prompt_message_show_other_mentions, {
|
|
91
|
-
context: contextLong,
|
|
92
|
-
url
|
|
93
|
-
}, {
|
|
94
|
-
ignoreTag: true
|
|
95
|
-
});
|
|
96
|
-
return {
|
|
97
|
-
icon: /*#__PURE__*/React.createElement(AiChapterIcon, null),
|
|
98
|
-
content: label_other_mentions,
|
|
99
|
-
tooltipMessage: label_other_mentions,
|
|
100
|
-
data: {
|
|
101
|
-
name: label_other_mentions,
|
|
102
|
-
dialogues: [],
|
|
103
|
-
prompt: htmlToAdf(html_other_mentions)
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
case RovoChatPromptKey.SUGGEST_IMPROVEMENT:
|
|
107
|
-
const label_improvement = intl.formatMessage(messages.rovo_prompt_button_suggest_improvement, {
|
|
108
|
-
context: contextShort
|
|
109
|
-
});
|
|
110
|
-
const html_improvement = intl.formatMessage(messages.rovo_prompt_message_suggest_improvement, {
|
|
111
|
-
context: contextLong,
|
|
112
|
-
url
|
|
113
|
-
}, {
|
|
114
|
-
ignoreTag: true
|
|
115
|
-
});
|
|
116
|
-
return {
|
|
117
|
-
icon: /*#__PURE__*/React.createElement(AISearchIcon, null),
|
|
118
|
-
content: label_improvement,
|
|
119
|
-
tooltipMessage: label_improvement,
|
|
120
|
-
data: {
|
|
121
|
-
name: label_improvement,
|
|
122
|
-
dialogues: [],
|
|
123
|
-
prompt: htmlToAdf(html_improvement)
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
case RovoChatPromptKey.SUMMARIZE_LINK:
|
|
127
|
-
const label_summarize = intl.formatMessage(messages.ai_summarize);
|
|
128
|
-
const html_summarize = intl.formatMessage(messages.rovo_prompt_message_summarize, {
|
|
129
|
-
url
|
|
130
|
-
}, {
|
|
131
|
-
ignoreTag: true
|
|
132
|
-
});
|
|
133
|
-
return {
|
|
134
|
-
icon: cardAppearance === CardDisplay.Block && isBlockCard3PExperimentEnabled ? /*#__PURE__*/React.createElement(AiChatIcon, {
|
|
135
|
-
label: label_summarize,
|
|
136
|
-
size: iconSize
|
|
137
|
-
}) : /*#__PURE__*/React.createElement(AIEditIcon, null),
|
|
138
|
-
content: label_summarize,
|
|
139
|
-
tooltipMessage: label_summarize,
|
|
140
|
-
data: {
|
|
141
|
-
name: label_summarize,
|
|
142
|
-
dialogues: [],
|
|
143
|
-
prompt: htmlToAdf(html_summarize),
|
|
144
|
-
mode: {
|
|
145
|
-
fastModeEnabled: true
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
case RovoChatPromptKey.SUMMARIZE_THIS_FOR_ME:
|
|
150
|
-
const label_summarize_this_for_me = intl.formatMessage(messages.rovo_prompt_button_summarize_this);
|
|
151
|
-
const html_summarize_this_for_me = intl.formatMessage(messages.rovo_prompt_message_summarize, {
|
|
152
|
-
url
|
|
153
|
-
}, {
|
|
154
|
-
ignoreTag: true
|
|
155
|
-
});
|
|
156
|
-
return {
|
|
157
|
-
icon: /*#__PURE__*/React.createElement(AiGenerativeTextSummaryIcon, {
|
|
158
|
-
label: label_summarize_this_for_me
|
|
159
|
-
}),
|
|
160
|
-
content: label_summarize_this_for_me,
|
|
161
|
-
tooltipMessage: label_summarize_this_for_me,
|
|
162
|
-
data: {
|
|
163
|
-
name: label_summarize_this_for_me,
|
|
164
|
-
dialogues: [],
|
|
165
|
-
prompt: htmlToAdf(html_summarize_this_for_me),
|
|
166
|
-
mode: {
|
|
167
|
-
fastModeEnabled: true
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
case RovoChatPromptKey.HIGHLIGHT_RELEVANT_CONTENT:
|
|
172
|
-
const label_highlight_relevant_content = intl.formatMessage(messages.rovo_prompt_button_highlight_relevant_content);
|
|
173
|
-
const html_highlight_relevant_content = intl.formatMessage(messages.rovo_prompt_message_highlight_relevant_content, {
|
|
174
|
-
context: contextLong,
|
|
175
|
-
url
|
|
176
|
-
}, {
|
|
177
|
-
ignoreTag: true
|
|
178
|
-
});
|
|
179
|
-
return {
|
|
180
|
-
icon: /*#__PURE__*/React.createElement(AiChapterIcon, null),
|
|
181
|
-
content: label_highlight_relevant_content,
|
|
182
|
-
tooltipMessage: label_highlight_relevant_content,
|
|
183
|
-
data: {
|
|
184
|
-
name: label_highlight_relevant_content,
|
|
185
|
-
dialogues: [],
|
|
186
|
-
prompt: htmlToAdf(html_highlight_relevant_content),
|
|
187
|
-
mode: {
|
|
188
|
-
fastModeEnabled: true
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
case RovoChatPromptKey.ASK_ROVO_ANYTHING:
|
|
193
|
-
const label_ask_rovo_anything = intl.formatMessage(messages.rovo_prompt_button_ask_rovo_anything);
|
|
194
|
-
const prompt_ask_rovo_anything = intl.formatMessage(messages.rovo_prompt_message_ask_rovo_anything, {
|
|
195
|
-
url
|
|
196
|
-
});
|
|
197
|
-
return {
|
|
198
|
-
icon: cardAppearance === CardDisplay.Block && isBlockCard3PExperimentEnabled ? /*#__PURE__*/React.createElement(RovoIcon, {
|
|
199
|
-
label: label_ask_rovo_anything,
|
|
200
|
-
size: 'xxsmall',
|
|
201
|
-
shouldUseHexLogo: true
|
|
202
|
-
}) : /*#__PURE__*/React.createElement(AISearchIcon, null),
|
|
203
|
-
content: label_ask_rovo_anything,
|
|
204
|
-
tooltipMessage: label_ask_rovo_anything,
|
|
205
|
-
data: {
|
|
206
|
-
name: label_ask_rovo_anything,
|
|
207
|
-
dialogues: [],
|
|
208
|
-
prompt: prompt_ask_rovo_anything,
|
|
209
|
-
isPromptPlaceholder: true,
|
|
210
|
-
placeholderType: 'generic'
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
case RovoChatPromptKey.ASK_A_SPECIFIC_QUESTION:
|
|
214
|
-
const label_ask_a_specific_question = intl.formatMessage(messages.rovo_prompt_button_ask_a_specific_question);
|
|
215
|
-
const prompt_ask_a_specific_question = intl.formatMessage(messages.rovo_prompt_message_ask_rovo_anything, {
|
|
216
|
-
url
|
|
217
|
-
});
|
|
218
|
-
return {
|
|
219
|
-
icon: /*#__PURE__*/React.createElement(RovoChatIcon, {
|
|
220
|
-
label: label_ask_a_specific_question
|
|
221
|
-
}),
|
|
222
|
-
content: label_ask_a_specific_question,
|
|
223
|
-
tooltipMessage: label_ask_a_specific_question,
|
|
224
|
-
data: {
|
|
225
|
-
name: label_ask_a_specific_question,
|
|
226
|
-
dialogues: [],
|
|
227
|
-
prompt: prompt_ask_a_specific_question,
|
|
228
|
-
isPromptPlaceholder: true,
|
|
229
|
-
placeholderType: 'generic'
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
case RovoChatPromptKey.KEY_HIGHLIGHTS:
|
|
233
|
-
const label_key_highlights = intl.formatMessage(messages.rovo_prompt_button_key_highlights);
|
|
234
|
-
const html_key_highlights = intl.formatMessage(messages.rovo_prompt_message_key_highlights, {
|
|
235
|
-
context: contextLong,
|
|
236
|
-
url
|
|
237
|
-
}, {
|
|
238
|
-
ignoreTag: true
|
|
239
|
-
});
|
|
240
|
-
return {
|
|
241
|
-
icon: /*#__PURE__*/React.createElement(AiChatIcon, {
|
|
242
|
-
label: label_key_highlights,
|
|
243
|
-
size: iconSize
|
|
244
|
-
}),
|
|
245
|
-
content: label_key_highlights,
|
|
246
|
-
tooltipMessage: label_key_highlights,
|
|
247
|
-
data: {
|
|
248
|
-
name: label_key_highlights,
|
|
249
|
-
dialogues: [],
|
|
250
|
-
prompt: htmlToAdf(html_key_highlights)
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
case RovoChatPromptKey.SHOW_ME_WHATS_RELEVANT:
|
|
254
|
-
const label_show_me_whats_relevant = intl.formatMessage(messages.rovo_prompt_button_show_me_whats_relevant);
|
|
255
|
-
const html_show_me_whats_relevant = intl.formatMessage(messages.rovo_prompt_message_highlight_relevant_content, {
|
|
256
|
-
context: contextLong,
|
|
257
|
-
url
|
|
258
|
-
}, {
|
|
259
|
-
ignoreTag: true
|
|
260
|
-
});
|
|
261
|
-
return {
|
|
262
|
-
icon: /*#__PURE__*/React.createElement(AiSearchIcon, {
|
|
263
|
-
label: label_show_me_whats_relevant
|
|
264
|
-
}),
|
|
265
|
-
content: label_show_me_whats_relevant,
|
|
266
|
-
tooltipMessage: label_show_me_whats_relevant,
|
|
267
|
-
data: {
|
|
268
|
-
name: label_show_me_whats_relevant,
|
|
269
|
-
dialogues: [],
|
|
270
|
-
prompt: htmlToAdf(html_show_me_whats_relevant)
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
case RovoChatPromptKey.IDENTIFY_KEY_TRENDS:
|
|
274
|
-
const label_identify_key_trends = intl.formatMessage(messages.rovo_prompt_button_identify_key_trends);
|
|
275
|
-
const html_identify_key_trends = intl.formatMessage(messages.rovo_prompt_message_identify_key_trends, {
|
|
276
|
-
url
|
|
277
|
-
}, {
|
|
278
|
-
ignoreTag: true
|
|
279
|
-
});
|
|
280
|
-
return {
|
|
281
|
-
icon: /*#__PURE__*/React.createElement(AiChatIcon, {
|
|
282
|
-
label: label_identify_key_trends,
|
|
283
|
-
size: iconSize
|
|
284
|
-
}),
|
|
285
|
-
content: label_identify_key_trends,
|
|
286
|
-
tooltipMessage: label_identify_key_trends,
|
|
287
|
-
data: {
|
|
288
|
-
name: label_identify_key_trends,
|
|
289
|
-
dialogues: [],
|
|
290
|
-
prompt: htmlToAdf(html_identify_key_trends)
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
case RovoChatPromptKey.IDENTIFY_KEY_POINTS:
|
|
294
|
-
const label_identify_key_points = intl.formatMessage(messages.rovo_prompt_button_identify_key_points);
|
|
295
|
-
const html_identify_key_points = intl.formatMessage(messages.rovo_prompt_message_identify_key_points, {
|
|
296
|
-
url
|
|
297
|
-
}, {
|
|
298
|
-
ignoreTag: true
|
|
299
|
-
});
|
|
300
|
-
return {
|
|
301
|
-
icon: /*#__PURE__*/React.createElement(AiChatIcon, {
|
|
302
|
-
label: label_identify_key_points,
|
|
303
|
-
size: iconSize
|
|
304
|
-
}),
|
|
305
|
-
content: label_identify_key_points,
|
|
306
|
-
tooltipMessage: label_identify_key_points,
|
|
307
|
-
data: {
|
|
308
|
-
name: label_identify_key_points,
|
|
309
|
-
dialogues: [],
|
|
310
|
-
prompt: htmlToAdf(html_identify_key_points)
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
case RovoChatPromptKey.FIND_OPEN_QUESTIONS:
|
|
314
|
-
const label_find_open_questions = intl.formatMessage(messages.rovo_prompt_button_find_open_questions);
|
|
315
|
-
const html_find_open_questions = intl.formatMessage(messages.rovo_prompt_message_find_open_questions, {
|
|
316
|
-
url
|
|
317
|
-
}, {
|
|
318
|
-
ignoreTag: true
|
|
319
|
-
});
|
|
320
|
-
return {
|
|
321
|
-
icon: /*#__PURE__*/React.createElement(AiChatIcon, {
|
|
322
|
-
label: label_find_open_questions,
|
|
323
|
-
size: iconSize
|
|
324
|
-
}),
|
|
325
|
-
content: label_find_open_questions,
|
|
326
|
-
tooltipMessage: label_find_open_questions,
|
|
327
|
-
data: {
|
|
328
|
-
name: label_find_open_questions,
|
|
329
|
-
dialogues: [],
|
|
330
|
-
prompt: htmlToAdf(html_find_open_questions)
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
16
|
const RovoChatAction = ({
|
|
336
17
|
onClick: onClickCallback,
|
|
337
18
|
prompts,
|
|
@@ -18,7 +18,7 @@ import { messages } from '../../../../../messages';
|
|
|
18
18
|
import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
|
|
19
19
|
import { isBlockCardRovoActionExperimentEnabled } from '../../../../../state/hooks/use-block-card-rovo-action-experiment';
|
|
20
20
|
import useRovoConfig from '../../../../../state/hooks/use-rovo-config';
|
|
21
|
-
import { RovoChatPromptKey } from '
|
|
21
|
+
import { RovoChatPromptKey } from '../../../../common/rovo-chat-utils';
|
|
22
22
|
import { sizeToButtonSpacing } from '../../utils';
|
|
23
23
|
import { filterActionItems } from '../utils';
|
|
24
24
|
import ActionGroupItem from './action-group-item';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { fg } from "@atlaskit/platform-feature-flags";
|
|
2
3
|
import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
|
|
3
4
|
import useInlineActionNudgeExperiment from '../../../state/hooks/use-inline-action-nudge-experiment';
|
|
5
|
+
import useInlineTailoredActionExperiment from '../../../state/hooks/use-inline-tailored-action-experiment';
|
|
4
6
|
import { HoverCard } from '../../HoverCard';
|
|
5
|
-
import { RovoActionsCta } from '../common/rovo-actions-cta';
|
|
7
|
+
import { RovoActionsCta, InlineRovoActionButton } from '../common/rovo-actions-cta';
|
|
6
8
|
import { Frame } from '../Frame';
|
|
7
9
|
import { IconAndTitleLayout } from '../IconAndTitleLayout';
|
|
8
10
|
import { renderLozenge } from './renderLozenge';
|
|
@@ -78,6 +80,9 @@ export function InlineCardResolvedViewFunctionalWithRovoActions({
|
|
|
78
80
|
const {
|
|
79
81
|
isEnabled
|
|
80
82
|
} = useInlineActionNudgeExperiment(link, showHoverPreview, actionOptions);
|
|
83
|
+
const {
|
|
84
|
+
isEnabled: isInlineTailoredRovoActionEnabled
|
|
85
|
+
} = useInlineTailoredActionExperiment(link, showHoverPreview, actionOptions);
|
|
81
86
|
|
|
82
87
|
// TODO https://hello.jira.atlassian.cloud/browse/NAVX-4436: fire analytics with cohort
|
|
83
88
|
const frame = /*#__PURE__*/React.createElement(Frame, {
|
|
@@ -96,8 +101,11 @@ export function InlineCardResolvedViewFunctionalWithRovoActions({
|
|
|
96
101
|
titleTextColor: titleTextColor,
|
|
97
102
|
type: type,
|
|
98
103
|
hideIconLoadingSkeleton: hideIconLoadingSkeleton
|
|
99
|
-
}), renderLozenge(lozenge), isEnabled && /*#__PURE__*/React.createElement(RovoActionsCta, {
|
|
104
|
+
}), renderLozenge(lozenge), isEnabled && !fg('platform_sl_3p_auth_inline_tailored_cta_killswitch') && /*#__PURE__*/React.createElement(RovoActionsCta, {
|
|
100
105
|
testId: `${testId}-rovo-actions-cta`
|
|
106
|
+
}), isInlineTailoredRovoActionEnabled && /*#__PURE__*/React.createElement(InlineRovoActionButton, {
|
|
107
|
+
testId: `${testId}-rovo-actions-cta`,
|
|
108
|
+
url: link
|
|
101
109
|
}));
|
|
102
110
|
if (!showHoverPreview || !link) {
|
|
103
111
|
return frame;
|
|
@@ -109,4 +117,6 @@ export function InlineCardResolvedViewFunctionalWithRovoActions({
|
|
|
109
117
|
hoverPreviewOptions: hoverPreviewOptions
|
|
110
118
|
}, frame);
|
|
111
119
|
}
|
|
120
|
+
|
|
121
|
+
// Todo: replace with platform_sl_3p_auth_inline_tailored_cta_killswitch after cleanup of rovogrowth-640-inline-action-nudge-fg
|
|
112
122
|
export const InlineCardResolvedViewFunctional = componentWithFG('rovogrowth-640-inline-action-nudge-fg', InlineCardResolvedViewFunctionalWithRovoActions, InlineCardResolvedViewBase);
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
/* index.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
2
|
import "./index.compiled.css";
|
|
3
|
-
import * as React from 'react';
|
|
4
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React, { useCallback } from 'react';
|
|
5
|
+
import { useIntl } from "react-intl";
|
|
5
6
|
import { cx } from '@atlaskit/css';
|
|
7
|
+
import AiGenerativeTextSummaryIcon from '@atlaskit/icon/core/ai-generative-text-summary';
|
|
6
8
|
import RovoChatIcon from '@atlaskit/icon/core/rovo-chat';
|
|
7
|
-
import { Box } from '@atlaskit/primitives/compiled';
|
|
9
|
+
import { Box, Text } from '@atlaskit/primitives/compiled';
|
|
10
|
+
import useRovoChat from "../../../../state/hooks/use-rovo-chat";
|
|
11
|
+
import { getPromptAction, RovoChatPromptKey } from "../../../common/rovo-chat-utils";
|
|
12
|
+
import { ActionButton } from "../action-button";
|
|
8
13
|
const styles = {
|
|
9
14
|
innerContainer: "_1e0c1nu9 _1y1m1u8q _16d9qvcn _19bv12x7 _u5f312x7",
|
|
10
|
-
rovoIcon: "_syaz15cr _80omtlke _bfhkjmqp _qrwqlb4i _1o0zlb4i _ca0qv77o _n3tdv77o"
|
|
15
|
+
rovoIcon: "_syaz15cr _80omtlke _bfhkjmqp _qrwqlb4i _1o0zlb4i _ca0qv77o _n3tdv77o",
|
|
16
|
+
text: "_1e0c1nu9 _19bv12x7"
|
|
11
17
|
};
|
|
12
18
|
export const RovoActionsCta = ({
|
|
13
19
|
testId
|
|
@@ -20,4 +26,39 @@ export const RovoActionsCta = ({
|
|
|
20
26
|
color: "var(--ds-icon-inverse, #FFFFFF)",
|
|
21
27
|
size: "small"
|
|
22
28
|
}));
|
|
29
|
+
};
|
|
30
|
+
export const InlineRovoActionButton = ({
|
|
31
|
+
testId,
|
|
32
|
+
url
|
|
33
|
+
}) => {
|
|
34
|
+
const {
|
|
35
|
+
sendPromptMessage,
|
|
36
|
+
isRovoChatEnabled
|
|
37
|
+
} = useRovoChat();
|
|
38
|
+
const intl = useIntl();
|
|
39
|
+
|
|
40
|
+
// TODO: NAVX-5109 implement tailored rovo chat actions here
|
|
41
|
+
const {
|
|
42
|
+
data: promptData,
|
|
43
|
+
content
|
|
44
|
+
} = getPromptAction(RovoChatPromptKey.SUMMARIZE_LINK, intl, url) || {};
|
|
45
|
+
const handleClick = useCallback(event => {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
event.stopPropagation();
|
|
48
|
+
if (isRovoChatEnabled && promptData) {
|
|
49
|
+
sendPromptMessage(promptData);
|
|
50
|
+
}
|
|
51
|
+
}, [sendPromptMessage, isRovoChatEnabled, promptData]);
|
|
52
|
+
return promptData && content ? /*#__PURE__*/React.createElement(ActionButton, {
|
|
53
|
+
onClick: handleClick,
|
|
54
|
+
testId: testId
|
|
55
|
+
}, /*#__PURE__*/React.createElement(AiGenerativeTextSummaryIcon, {
|
|
56
|
+
label: "Rovo",
|
|
57
|
+
color: "var(--ds-icon, #292A2E)",
|
|
58
|
+
size: "small"
|
|
59
|
+
}), /*#__PURE__*/React.createElement(Box, {
|
|
60
|
+
xcss: styles.text
|
|
61
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
62
|
+
size: "small"
|
|
63
|
+
}, content))) : null;
|
|
23
64
|
};
|
|
@@ -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.21.0",
|
|
13
13
|
componentName: 'linkUrl'
|
|
14
14
|
};
|
|
15
15
|
const LinkUrl = ({
|