@atlaskit/smart-card 44.21.0 → 44.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/cjs/state/hooks/use-inline-tailored-action-experiment/index.js +55 -0
- package/dist/cjs/state/hooks/use-smart-link-cross-product-url-wrapper/index.js +18 -7
- 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/state/hooks/use-smart-link-cross-product-url-wrapper/index.js +13 -5
- 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/state/hooks/use-smart-link-cross-product-url-wrapper/index.js +17 -7
- 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 +6 -3
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import AiSearchIcon from '@atlaskit/icon-lab/core/ai-search';
|
|
3
|
+
import AiChatIcon from '@atlaskit/icon/core/ai-chat';
|
|
4
|
+
import AiGenerativeTextSummaryIcon from '@atlaskit/icon/core/ai-generative-text-summary';
|
|
5
|
+
import RovoChatIcon from '@atlaskit/icon/core/rovo-chat';
|
|
6
|
+
import { RovoIcon } from '@atlaskit/logo';
|
|
7
|
+
import { CardDisplay } from "../../../constants";
|
|
8
|
+
import { messages } from "../../../messages";
|
|
9
|
+
import { isBlockCardRovoActionExperimentEnabled } from "../../../state/hooks/use-block-card-rovo-action-experiment";
|
|
10
|
+
import AiChapterIcon from "../../FlexibleCard/assets/ai-chapter-icon";
|
|
11
|
+
import AIEditIcon from "../../FlexibleCard/assets/ai-edit-icon";
|
|
12
|
+
import AISearchIcon from "../../FlexibleCard/assets/ai-search-icon";
|
|
13
|
+
import htmlToAdf from "../../FlexibleCard/components/actions/rovo-chat-action/html-to-adf";
|
|
14
|
+
export let RovoChatPromptKey = /*#__PURE__*/function (RovoChatPromptKey) {
|
|
15
|
+
RovoChatPromptKey["RECOMMEND_OTHER_SOURCES"] = "recommend-other-sources";
|
|
16
|
+
RovoChatPromptKey["SHOW_OTHER_MENTIONS"] = "show-other-mentions";
|
|
17
|
+
RovoChatPromptKey["SUGGEST_IMPROVEMENT"] = "suggest-improvement";
|
|
18
|
+
RovoChatPromptKey["SUMMARIZE_LINK"] = "summarize-link";
|
|
19
|
+
RovoChatPromptKey["KEY_HIGHLIGHTS"] = "key-highlights";
|
|
20
|
+
RovoChatPromptKey["ASK_ROVO_ANYTHING"] = "ask-rovo-anything";
|
|
21
|
+
RovoChatPromptKey["IDENTIFY_KEY_POINTS"] = "identify-key-points";
|
|
22
|
+
RovoChatPromptKey["IDENTIFY_KEY_TRENDS"] = "identify-key-trends";
|
|
23
|
+
RovoChatPromptKey["FIND_OPEN_QUESTIONS"] = "find-open-questions";
|
|
24
|
+
RovoChatPromptKey["HIGHLIGHT_RELEVANT_CONTENT"] = "highlight-relevant-content";
|
|
25
|
+
RovoChatPromptKey["SUMMARIZE_THIS_FOR_ME"] = "summarize-this-for-me";
|
|
26
|
+
RovoChatPromptKey["ASK_A_SPECIFIC_QUESTION"] = "ask-a-specific-question";
|
|
27
|
+
RovoChatPromptKey["SHOW_ME_WHATS_RELEVANT"] = "show-me-whats-relevant";
|
|
28
|
+
return RovoChatPromptKey;
|
|
29
|
+
}({});
|
|
30
|
+
const getContext = (intl, product) => {
|
|
31
|
+
switch (product) {
|
|
32
|
+
case 'CONFLUENCE':
|
|
33
|
+
return {
|
|
34
|
+
contextLong: intl.formatMessage(messages.rovo_prompt_context_confluence_page),
|
|
35
|
+
contextShort: intl.formatMessage(messages.rovo_prompt_context_confluence_page_short)
|
|
36
|
+
};
|
|
37
|
+
case 'JSW':
|
|
38
|
+
case 'JWM':
|
|
39
|
+
case 'JSM':
|
|
40
|
+
case 'JPD':
|
|
41
|
+
return {
|
|
42
|
+
contextLong: intl.formatMessage(messages.rovo_prompt_context_jira_work_item),
|
|
43
|
+
contextShort: intl.formatMessage(messages.rovo_prompt_context_jira_work_item_short)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
export const getPromptAction = (promptKey, intl, url = '', product, iconSize, cardAppearance) => {
|
|
48
|
+
var _getContext;
|
|
49
|
+
const {
|
|
50
|
+
contextLong,
|
|
51
|
+
contextShort
|
|
52
|
+
} = (_getContext = getContext(intl, product)) !== null && _getContext !== void 0 ? _getContext : {
|
|
53
|
+
contextLong: intl.formatMessage(messages.rovo_prompt_context_generic),
|
|
54
|
+
contextShort: intl.formatMessage(messages.rovo_prompt_context_generic)
|
|
55
|
+
};
|
|
56
|
+
const isBlockCard3PExperimentEnabled = isBlockCardRovoActionExperimentEnabled(product);
|
|
57
|
+
switch (promptKey) {
|
|
58
|
+
case RovoChatPromptKey.RECOMMEND_OTHER_SOURCES:
|
|
59
|
+
const label_recommend = intl.formatMessage(messages.rovo_prompt_button_recommend_other_sources);
|
|
60
|
+
const html_recommend = intl.formatMessage(messages.rovo_prompt_message_recommend_other_sources, {
|
|
61
|
+
context: contextLong,
|
|
62
|
+
url
|
|
63
|
+
}, {
|
|
64
|
+
ignoreTag: true
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
icon: /*#__PURE__*/React.createElement(AIEditIcon, null),
|
|
68
|
+
content: label_recommend,
|
|
69
|
+
tooltipMessage: label_recommend,
|
|
70
|
+
data: {
|
|
71
|
+
name: label_recommend,
|
|
72
|
+
dialogues: [],
|
|
73
|
+
prompt: htmlToAdf(html_recommend)
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
case RovoChatPromptKey.SHOW_OTHER_MENTIONS:
|
|
77
|
+
const label_other_mentions = intl.formatMessage(messages.rovo_prompt_button_show_other_mentions);
|
|
78
|
+
const html_other_mentions = intl.formatMessage(messages.rovo_prompt_message_show_other_mentions, {
|
|
79
|
+
context: contextLong,
|
|
80
|
+
url
|
|
81
|
+
}, {
|
|
82
|
+
ignoreTag: true
|
|
83
|
+
});
|
|
84
|
+
return {
|
|
85
|
+
icon: /*#__PURE__*/React.createElement(AiChapterIcon, null),
|
|
86
|
+
content: label_other_mentions,
|
|
87
|
+
tooltipMessage: label_other_mentions,
|
|
88
|
+
data: {
|
|
89
|
+
name: label_other_mentions,
|
|
90
|
+
dialogues: [],
|
|
91
|
+
prompt: htmlToAdf(html_other_mentions)
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
case RovoChatPromptKey.SUGGEST_IMPROVEMENT:
|
|
95
|
+
const label_improvement = intl.formatMessage(messages.rovo_prompt_button_suggest_improvement, {
|
|
96
|
+
context: contextShort
|
|
97
|
+
});
|
|
98
|
+
const html_improvement = intl.formatMessage(messages.rovo_prompt_message_suggest_improvement, {
|
|
99
|
+
context: contextLong,
|
|
100
|
+
url
|
|
101
|
+
}, {
|
|
102
|
+
ignoreTag: true
|
|
103
|
+
});
|
|
104
|
+
return {
|
|
105
|
+
icon: /*#__PURE__*/React.createElement(AISearchIcon, null),
|
|
106
|
+
content: label_improvement,
|
|
107
|
+
tooltipMessage: label_improvement,
|
|
108
|
+
data: {
|
|
109
|
+
name: label_improvement,
|
|
110
|
+
dialogues: [],
|
|
111
|
+
prompt: htmlToAdf(html_improvement)
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
case RovoChatPromptKey.SUMMARIZE_LINK:
|
|
115
|
+
const label_summarize = intl.formatMessage(messages.ai_summarize);
|
|
116
|
+
const html_summarize = intl.formatMessage(messages.rovo_prompt_message_summarize, {
|
|
117
|
+
url
|
|
118
|
+
}, {
|
|
119
|
+
ignoreTag: true
|
|
120
|
+
});
|
|
121
|
+
return {
|
|
122
|
+
icon: cardAppearance === CardDisplay.Block && isBlockCard3PExperimentEnabled ? /*#__PURE__*/React.createElement(AiChatIcon, {
|
|
123
|
+
label: label_summarize,
|
|
124
|
+
size: iconSize
|
|
125
|
+
}) : /*#__PURE__*/React.createElement(AIEditIcon, null),
|
|
126
|
+
content: label_summarize,
|
|
127
|
+
tooltipMessage: label_summarize,
|
|
128
|
+
data: {
|
|
129
|
+
name: label_summarize,
|
|
130
|
+
dialogues: [],
|
|
131
|
+
prompt: htmlToAdf(html_summarize),
|
|
132
|
+
mode: {
|
|
133
|
+
fastModeEnabled: true
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
case RovoChatPromptKey.SUMMARIZE_THIS_FOR_ME:
|
|
138
|
+
const label_summarize_this_for_me = intl.formatMessage(messages.rovo_prompt_button_summarize_this);
|
|
139
|
+
const html_summarize_this_for_me = intl.formatMessage(messages.rovo_prompt_message_summarize, {
|
|
140
|
+
url
|
|
141
|
+
}, {
|
|
142
|
+
ignoreTag: true
|
|
143
|
+
});
|
|
144
|
+
return {
|
|
145
|
+
icon: /*#__PURE__*/React.createElement(AiGenerativeTextSummaryIcon, {
|
|
146
|
+
label: label_summarize_this_for_me
|
|
147
|
+
}),
|
|
148
|
+
content: label_summarize_this_for_me,
|
|
149
|
+
tooltipMessage: label_summarize_this_for_me,
|
|
150
|
+
data: {
|
|
151
|
+
name: label_summarize_this_for_me,
|
|
152
|
+
dialogues: [],
|
|
153
|
+
prompt: htmlToAdf(html_summarize_this_for_me),
|
|
154
|
+
mode: {
|
|
155
|
+
fastModeEnabled: true
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
case RovoChatPromptKey.HIGHLIGHT_RELEVANT_CONTENT:
|
|
160
|
+
const label_highlight_relevant_content = intl.formatMessage(messages.rovo_prompt_button_highlight_relevant_content);
|
|
161
|
+
const html_highlight_relevant_content = intl.formatMessage(messages.rovo_prompt_message_highlight_relevant_content, {
|
|
162
|
+
context: contextLong,
|
|
163
|
+
url
|
|
164
|
+
}, {
|
|
165
|
+
ignoreTag: true
|
|
166
|
+
});
|
|
167
|
+
return {
|
|
168
|
+
icon: /*#__PURE__*/React.createElement(AiChapterIcon, null),
|
|
169
|
+
content: label_highlight_relevant_content,
|
|
170
|
+
tooltipMessage: label_highlight_relevant_content,
|
|
171
|
+
data: {
|
|
172
|
+
name: label_highlight_relevant_content,
|
|
173
|
+
dialogues: [],
|
|
174
|
+
prompt: htmlToAdf(html_highlight_relevant_content),
|
|
175
|
+
mode: {
|
|
176
|
+
fastModeEnabled: true
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
case RovoChatPromptKey.ASK_ROVO_ANYTHING:
|
|
181
|
+
const label_ask_rovo_anything = intl.formatMessage(messages.rovo_prompt_button_ask_rovo_anything);
|
|
182
|
+
const prompt_ask_rovo_anything = intl.formatMessage(messages.rovo_prompt_message_ask_rovo_anything, {
|
|
183
|
+
url
|
|
184
|
+
});
|
|
185
|
+
return {
|
|
186
|
+
icon: cardAppearance === CardDisplay.Block && isBlockCard3PExperimentEnabled ? /*#__PURE__*/React.createElement(RovoIcon, {
|
|
187
|
+
label: label_ask_rovo_anything,
|
|
188
|
+
size: 'xxsmall',
|
|
189
|
+
shouldUseHexLogo: true
|
|
190
|
+
}) : /*#__PURE__*/React.createElement(AISearchIcon, null),
|
|
191
|
+
content: label_ask_rovo_anything,
|
|
192
|
+
tooltipMessage: label_ask_rovo_anything,
|
|
193
|
+
data: {
|
|
194
|
+
name: label_ask_rovo_anything,
|
|
195
|
+
dialogues: [],
|
|
196
|
+
prompt: prompt_ask_rovo_anything,
|
|
197
|
+
isPromptPlaceholder: true,
|
|
198
|
+
placeholderType: 'generic'
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
case RovoChatPromptKey.ASK_A_SPECIFIC_QUESTION:
|
|
202
|
+
const label_ask_a_specific_question = intl.formatMessage(messages.rovo_prompt_button_ask_a_specific_question);
|
|
203
|
+
const prompt_ask_a_specific_question = intl.formatMessage(messages.rovo_prompt_message_ask_rovo_anything, {
|
|
204
|
+
url
|
|
205
|
+
});
|
|
206
|
+
return {
|
|
207
|
+
icon: /*#__PURE__*/React.createElement(RovoChatIcon, {
|
|
208
|
+
label: label_ask_a_specific_question
|
|
209
|
+
}),
|
|
210
|
+
content: label_ask_a_specific_question,
|
|
211
|
+
tooltipMessage: label_ask_a_specific_question,
|
|
212
|
+
data: {
|
|
213
|
+
name: label_ask_a_specific_question,
|
|
214
|
+
dialogues: [],
|
|
215
|
+
prompt: prompt_ask_a_specific_question,
|
|
216
|
+
isPromptPlaceholder: true,
|
|
217
|
+
placeholderType: 'generic'
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
case RovoChatPromptKey.KEY_HIGHLIGHTS:
|
|
221
|
+
const label_key_highlights = intl.formatMessage(messages.rovo_prompt_button_key_highlights);
|
|
222
|
+
const html_key_highlights = intl.formatMessage(messages.rovo_prompt_message_key_highlights, {
|
|
223
|
+
context: contextLong,
|
|
224
|
+
url
|
|
225
|
+
}, {
|
|
226
|
+
ignoreTag: true
|
|
227
|
+
});
|
|
228
|
+
return {
|
|
229
|
+
icon: /*#__PURE__*/React.createElement(AiChatIcon, {
|
|
230
|
+
label: label_key_highlights,
|
|
231
|
+
size: iconSize
|
|
232
|
+
}),
|
|
233
|
+
content: label_key_highlights,
|
|
234
|
+
tooltipMessage: label_key_highlights,
|
|
235
|
+
data: {
|
|
236
|
+
name: label_key_highlights,
|
|
237
|
+
dialogues: [],
|
|
238
|
+
prompt: htmlToAdf(html_key_highlights)
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
case RovoChatPromptKey.SHOW_ME_WHATS_RELEVANT:
|
|
242
|
+
const label_show_me_whats_relevant = intl.formatMessage(messages.rovo_prompt_button_show_me_whats_relevant);
|
|
243
|
+
const html_show_me_whats_relevant = intl.formatMessage(messages.rovo_prompt_message_highlight_relevant_content, {
|
|
244
|
+
context: contextLong,
|
|
245
|
+
url
|
|
246
|
+
}, {
|
|
247
|
+
ignoreTag: true
|
|
248
|
+
});
|
|
249
|
+
return {
|
|
250
|
+
icon: /*#__PURE__*/React.createElement(AiSearchIcon, {
|
|
251
|
+
label: label_show_me_whats_relevant
|
|
252
|
+
}),
|
|
253
|
+
content: label_show_me_whats_relevant,
|
|
254
|
+
tooltipMessage: label_show_me_whats_relevant,
|
|
255
|
+
data: {
|
|
256
|
+
name: label_show_me_whats_relevant,
|
|
257
|
+
dialogues: [],
|
|
258
|
+
prompt: htmlToAdf(html_show_me_whats_relevant)
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
case RovoChatPromptKey.IDENTIFY_KEY_TRENDS:
|
|
262
|
+
const label_identify_key_trends = intl.formatMessage(messages.rovo_prompt_button_identify_key_trends);
|
|
263
|
+
const html_identify_key_trends = intl.formatMessage(messages.rovo_prompt_message_identify_key_trends, {
|
|
264
|
+
url
|
|
265
|
+
}, {
|
|
266
|
+
ignoreTag: true
|
|
267
|
+
});
|
|
268
|
+
return {
|
|
269
|
+
icon: /*#__PURE__*/React.createElement(AiChatIcon, {
|
|
270
|
+
label: label_identify_key_trends,
|
|
271
|
+
size: iconSize
|
|
272
|
+
}),
|
|
273
|
+
content: label_identify_key_trends,
|
|
274
|
+
tooltipMessage: label_identify_key_trends,
|
|
275
|
+
data: {
|
|
276
|
+
name: label_identify_key_trends,
|
|
277
|
+
dialogues: [],
|
|
278
|
+
prompt: htmlToAdf(html_identify_key_trends)
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
case RovoChatPromptKey.IDENTIFY_KEY_POINTS:
|
|
282
|
+
const label_identify_key_points = intl.formatMessage(messages.rovo_prompt_button_identify_key_points);
|
|
283
|
+
const html_identify_key_points = intl.formatMessage(messages.rovo_prompt_message_identify_key_points, {
|
|
284
|
+
url
|
|
285
|
+
}, {
|
|
286
|
+
ignoreTag: true
|
|
287
|
+
});
|
|
288
|
+
return {
|
|
289
|
+
icon: /*#__PURE__*/React.createElement(AiChatIcon, {
|
|
290
|
+
label: label_identify_key_points,
|
|
291
|
+
size: iconSize
|
|
292
|
+
}),
|
|
293
|
+
content: label_identify_key_points,
|
|
294
|
+
tooltipMessage: label_identify_key_points,
|
|
295
|
+
data: {
|
|
296
|
+
name: label_identify_key_points,
|
|
297
|
+
dialogues: [],
|
|
298
|
+
prompt: htmlToAdf(html_identify_key_points)
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
case RovoChatPromptKey.FIND_OPEN_QUESTIONS:
|
|
302
|
+
const label_find_open_questions = intl.formatMessage(messages.rovo_prompt_button_find_open_questions);
|
|
303
|
+
const html_find_open_questions = intl.formatMessage(messages.rovo_prompt_message_find_open_questions, {
|
|
304
|
+
url
|
|
305
|
+
}, {
|
|
306
|
+
ignoreTag: true
|
|
307
|
+
});
|
|
308
|
+
return {
|
|
309
|
+
icon: /*#__PURE__*/React.createElement(AiChatIcon, {
|
|
310
|
+
label: label_find_open_questions,
|
|
311
|
+
size: iconSize
|
|
312
|
+
}),
|
|
313
|
+
content: label_find_open_questions,
|
|
314
|
+
tooltipMessage: label_find_open_questions,
|
|
315
|
+
data: {
|
|
316
|
+
name: label_find_open_questions,
|
|
317
|
+
dialogues: [],
|
|
318
|
+
prompt: htmlToAdf(html_find_open_questions)
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { fg } from "@atlaskit/platform-feature-flags";
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
|
+
import { getIsRovoChatEnabled } from '../../../utils/rovo';
|
|
5
|
+
import { getExtensionKey } from '../../helpers';
|
|
6
|
+
import { useSmartCardState } from '../../store';
|
|
7
|
+
import useRovoConfig from '../use-rovo-config';
|
|
8
|
+
var ELIGIBLE_EXTENSION_KEYS = new Set(['slack-object-provider', 'google-object-provider', 'onedrive-object-provider', 'github-object-provider', 'ms-teams-object-provider', 'gitlab-object-provider', 'salesforce-object-provider']);
|
|
9
|
+
var NOT_ENABLED_RESULT = {
|
|
10
|
+
isEnabled: false
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Returns whether the platform_sl_3p_auth_inline_tailored_cta experiment
|
|
15
|
+
* is enabled for the current user and link context.
|
|
16
|
+
*
|
|
17
|
+
* All eligibility criteria are consolidated here:
|
|
18
|
+
* 1. Rovo chat must be enabled for the tenant.
|
|
19
|
+
* 2. The consumer must have opted in via actionOptions.rovoChatAction.optIn.
|
|
20
|
+
* 3. The link must support the RovoActions feature.
|
|
21
|
+
* 4. The extension key must be one of the supported options.
|
|
22
|
+
* 5. The experiment value must be true (via tmp-editor-statsig).
|
|
23
|
+
*
|
|
24
|
+
* The extension key is derived from the card store via the resolved URL,
|
|
25
|
+
* so callers don't need to thread it as a prop.
|
|
26
|
+
*/
|
|
27
|
+
var useInlineTailoredActionExperiment = function useInlineTailoredActionExperiment(url, showHoverPreview, actionOptions) {
|
|
28
|
+
var _actionOptions$rovoCh, _actionOptions$rovoCh2;
|
|
29
|
+
var _useRovoConfig = useRovoConfig(),
|
|
30
|
+
rovoConfig = _useRovoConfig.rovoOptions;
|
|
31
|
+
var isRovoChatEnabled = getIsRovoChatEnabled(rovoConfig);
|
|
32
|
+
var cardState = useSmartCardState(url !== null && url !== void 0 ? url : '');
|
|
33
|
+
var extensionKey = getExtensionKey(cardState.details);
|
|
34
|
+
var isRovoChatActionOptedIn = (_actionOptions$rovoCh = actionOptions === null || actionOptions === void 0 || (_actionOptions$rovoCh2 = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh2 === void 0 ? void 0 : _actionOptions$rovoCh2.optIn) !== null && _actionOptions$rovoCh !== void 0 ? _actionOptions$rovoCh : false;
|
|
35
|
+
return useMemo(function () {
|
|
36
|
+
if (!isRovoChatEnabled || !showHoverPreview || !url || !isRovoChatActionOptedIn) {
|
|
37
|
+
return NOT_ENABLED_RESULT;
|
|
38
|
+
}
|
|
39
|
+
if (!extensionKey || !ELIGIBLE_EXTENSION_KEYS.has(extensionKey)) {
|
|
40
|
+
return NOT_ENABLED_RESULT;
|
|
41
|
+
}
|
|
42
|
+
var isEnabled = fg('platform_sl_3p_auth_inline_tailored_cta_killswitch') && expValEquals('platform_sl_3p_auth_inline_tailored_cta', 'isEnabled', true);
|
|
43
|
+
return {
|
|
44
|
+
isEnabled: isEnabled
|
|
45
|
+
};
|
|
46
|
+
}, [isRovoChatEnabled, extensionKey, showHoverPreview, url, isRovoChatActionOptedIn]);
|
|
47
|
+
};
|
|
48
|
+
export default useInlineTailoredActionExperiment;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
3
|
+
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; }
|
|
1
4
|
import { useCallback } from 'react';
|
|
2
5
|
import { useCrossProductUrlWrapper } from '@atlaskit/analytics-cross-product/useCrossProductUrlWrapper';
|
|
3
6
|
import { useSmartLinkContext } from '@atlaskit/link-provider';
|
|
@@ -15,17 +18,24 @@ var useSmartLinkCrossProductUrlWrapperFallback = function useSmartLinkCrossProdu
|
|
|
15
18
|
return identityUrlWrapper;
|
|
16
19
|
};
|
|
17
20
|
var useSmartLinkCrossProductUrlWrapper = function useSmartLinkCrossProductUrlWrapper(_ref) {
|
|
18
|
-
var
|
|
21
|
+
var _effectiveProduct$toL;
|
|
19
22
|
var details = _ref.details;
|
|
20
23
|
var _useSmartLinkContext = useSmartLinkContext(),
|
|
21
24
|
product = _useSmartLinkContext.product,
|
|
22
|
-
bridgeProduct = _useSmartLinkContext.bridgeProduct
|
|
23
|
-
|
|
25
|
+
bridgeProduct = _useSmartLinkContext.bridgeProduct,
|
|
26
|
+
xpcProduct = _useSmartLinkContext.xpcProduct,
|
|
27
|
+
xpcSubProduct = _useSmartLinkContext.xpcSubProduct;
|
|
28
|
+
// xpcProduct takes precedence over product — it identifies the host product for XPC analytics
|
|
29
|
+
// without affecting link resolution (which uses the `product` prop separately).
|
|
30
|
+
var effectiveProduct = xpcProduct !== null && xpcProduct !== void 0 ? xpcProduct : product;
|
|
31
|
+
var wrapUrl = useCrossProductUrlWrapper(_objectSpread({
|
|
24
32
|
bridge: bridgeProduct !== null && bridgeProduct !== void 0 ? bridgeProduct : SMART_LINKS_XPC_BRIDGE,
|
|
25
|
-
product: (
|
|
26
|
-
}
|
|
33
|
+
product: (_effectiveProduct$toL = effectiveProduct === null || effectiveProduct === void 0 ? void 0 : effectiveProduct.toLowerCase()) !== null && _effectiveProduct$toL !== void 0 ? _effectiveProduct$toL : 'unknown'
|
|
34
|
+
}, xpcSubProduct ? {
|
|
35
|
+
subProduct: xpcSubProduct
|
|
36
|
+
} : {}));
|
|
27
37
|
return useCallback(function (url) {
|
|
28
|
-
if (!getIsFirstPartyLink(details) || !
|
|
38
|
+
if (!getIsFirstPartyLink(details) || !effectiveProduct) {
|
|
29
39
|
return url;
|
|
30
40
|
}
|
|
31
41
|
var parsedUrl;
|
|
@@ -38,6 +48,6 @@ var useSmartLinkCrossProductUrlWrapper = function useSmartLinkCrossProductUrlWra
|
|
|
38
48
|
return url;
|
|
39
49
|
}
|
|
40
50
|
return wrapUrl(url);
|
|
41
|
-
}, [details,
|
|
51
|
+
}, [details, effectiveProduct, wrapUrl]);
|
|
42
52
|
};
|
|
43
53
|
export var useSmartLinkCrossProductUrlWrapperGated = functionWithFG('platform_smartlink_xpc_url_wrapping', useSmartLinkCrossProductUrlWrapper, useSmartLinkCrossProductUrlWrapperFallback);
|
|
@@ -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.22.0" || ''
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -12,8 +12,8 @@ import extractRovoChatAction from '../../../extractors/flexible/actions/extract-
|
|
|
12
12
|
import { getExtensionKey } from '../../../state/helpers';
|
|
13
13
|
import useBlockCardRovoActionExperiment from '../../../state/hooks/use-block-card-rovo-action-experiment';
|
|
14
14
|
import useRovoConfig from '../../../state/hooks/use-rovo-config';
|
|
15
|
+
import { RovoChatPromptKey } from '../../common/rovo-chat-utils';
|
|
15
16
|
import FlexibleCard from '../../FlexibleCard';
|
|
16
|
-
import { RovoChatPromptKey } from '../../FlexibleCard/components/actions/rovo-chat-action';
|
|
17
17
|
import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock } from '../../FlexibleCard/components/blocks';
|
|
18
18
|
import { FlexibleCardUiOptions, getSimulatedBetterMetadata, PreviewBlockOptions, titleBlockOptions } from './utils';
|
|
19
19
|
import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
|