@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
|
@@ -6,26 +6,64 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
|
-
exports.RovoActionsCta = void 0;
|
|
9
|
+
exports.RovoActionsCta = exports.InlineRovoActionButton = void 0;
|
|
10
10
|
require("./index.compiled.css");
|
|
11
|
-
var React = _interopRequireWildcard(require("react"));
|
|
12
11
|
var _runtime = require("@compiled/react/runtime");
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _reactIntl = require("react-intl");
|
|
13
14
|
var _css = require("@atlaskit/css");
|
|
15
|
+
var _aiGenerativeTextSummary = _interopRequireDefault(require("@atlaskit/icon/core/ai-generative-text-summary"));
|
|
14
16
|
var _rovoChat = _interopRequireDefault(require("@atlaskit/icon/core/rovo-chat"));
|
|
15
17
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
18
|
+
var _useRovoChat2 = _interopRequireDefault(require("../../../../state/hooks/use-rovo-chat"));
|
|
19
|
+
var _rovoChatUtils = require("../../../common/rovo-chat-utils");
|
|
20
|
+
var _actionButton = require("../action-button");
|
|
16
21
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
22
|
var styles = {
|
|
18
23
|
innerContainer: "_1e0c1nu9 _1y1m1u8q _16d9qvcn _19bv12x7 _u5f312x7",
|
|
19
|
-
rovoIcon: "_syaz15cr _80omtlke _bfhkjmqp _qrwqlb4i _1o0zlb4i _ca0qv77o _n3tdv77o"
|
|
24
|
+
rovoIcon: "_syaz15cr _80omtlke _bfhkjmqp _qrwqlb4i _1o0zlb4i _ca0qv77o _n3tdv77o",
|
|
25
|
+
text: "_1e0c1nu9 _19bv12x7"
|
|
20
26
|
};
|
|
21
27
|
var RovoActionsCta = exports.RovoActionsCta = function RovoActionsCta(_ref) {
|
|
22
28
|
var testId = _ref.testId;
|
|
23
|
-
return /*#__PURE__*/
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
24
30
|
xcss: (0, _css.cx)(styles.innerContainer, styles.rovoIcon),
|
|
25
31
|
testId: testId
|
|
26
|
-
}, /*#__PURE__*/
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement(_rovoChat.default, {
|
|
27
33
|
label: "Rovo",
|
|
28
34
|
color: "var(--ds-icon-inverse, #FFFFFF)",
|
|
29
35
|
size: "small"
|
|
30
36
|
}));
|
|
37
|
+
};
|
|
38
|
+
var InlineRovoActionButton = exports.InlineRovoActionButton = function InlineRovoActionButton(_ref2) {
|
|
39
|
+
var testId = _ref2.testId,
|
|
40
|
+
url = _ref2.url;
|
|
41
|
+
var _useRovoChat = (0, _useRovoChat2.default)(),
|
|
42
|
+
sendPromptMessage = _useRovoChat.sendPromptMessage,
|
|
43
|
+
isRovoChatEnabled = _useRovoChat.isRovoChatEnabled;
|
|
44
|
+
var intl = (0, _reactIntl.useIntl)();
|
|
45
|
+
|
|
46
|
+
// TODO: NAVX-5109 implement tailored rovo chat actions here
|
|
47
|
+
var _ref3 = (0, _rovoChatUtils.getPromptAction)(_rovoChatUtils.RovoChatPromptKey.SUMMARIZE_LINK, intl, url) || {},
|
|
48
|
+
promptData = _ref3.data,
|
|
49
|
+
content = _ref3.content;
|
|
50
|
+
var handleClick = (0, _react.useCallback)(function (event) {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
event.stopPropagation();
|
|
53
|
+
if (isRovoChatEnabled && promptData) {
|
|
54
|
+
sendPromptMessage(promptData);
|
|
55
|
+
}
|
|
56
|
+
}, [sendPromptMessage, isRovoChatEnabled, promptData]);
|
|
57
|
+
return promptData && content ? /*#__PURE__*/_react.default.createElement(_actionButton.ActionButton, {
|
|
58
|
+
onClick: handleClick,
|
|
59
|
+
testId: testId
|
|
60
|
+
}, /*#__PURE__*/_react.default.createElement(_aiGenerativeTextSummary.default, {
|
|
61
|
+
label: "Rovo",
|
|
62
|
+
color: "var(--ds-icon, #292A2E)",
|
|
63
|
+
size: "small"
|
|
64
|
+
}), /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
65
|
+
xcss: styles.text
|
|
66
|
+
}, /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
67
|
+
size: "small"
|
|
68
|
+
}, content))) : null;
|
|
31
69
|
};
|
|
@@ -19,7 +19,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
|
|
|
19
19
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
20
20
|
var PACKAGE_DATA = {
|
|
21
21
|
packageName: "@atlaskit/smart-card",
|
|
22
|
-
packageVersion: "44.
|
|
22
|
+
packageVersion: "44.22.0",
|
|
23
23
|
componentName: 'linkUrl'
|
|
24
24
|
};
|
|
25
25
|
var LinkUrl = function LinkUrl(_ref) {
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getPromptAction = exports.RovoChatPromptKey = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _aiSearch = _interopRequireDefault(require("@atlaskit/icon-lab/core/ai-search"));
|
|
10
|
+
var _aiChat = _interopRequireDefault(require("@atlaskit/icon/core/ai-chat"));
|
|
11
|
+
var _aiGenerativeTextSummary = _interopRequireDefault(require("@atlaskit/icon/core/ai-generative-text-summary"));
|
|
12
|
+
var _rovoChat = _interopRequireDefault(require("@atlaskit/icon/core/rovo-chat"));
|
|
13
|
+
var _logo = require("@atlaskit/logo");
|
|
14
|
+
var _constants = require("../../../constants");
|
|
15
|
+
var _messages = require("../../../messages");
|
|
16
|
+
var _useBlockCardRovoActionExperiment = require("../../../state/hooks/use-block-card-rovo-action-experiment");
|
|
17
|
+
var _aiChapterIcon = _interopRequireDefault(require("../../FlexibleCard/assets/ai-chapter-icon"));
|
|
18
|
+
var _aiEditIcon = _interopRequireDefault(require("../../FlexibleCard/assets/ai-edit-icon"));
|
|
19
|
+
var _aiSearchIcon = _interopRequireDefault(require("../../FlexibleCard/assets/ai-search-icon"));
|
|
20
|
+
var _htmlToAdf = _interopRequireDefault(require("../../FlexibleCard/components/actions/rovo-chat-action/html-to-adf"));
|
|
21
|
+
var RovoChatPromptKey = exports.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
|
+
var getContext = function getContext(intl, product) {
|
|
38
|
+
switch (product) {
|
|
39
|
+
case 'CONFLUENCE':
|
|
40
|
+
return {
|
|
41
|
+
contextLong: intl.formatMessage(_messages.messages.rovo_prompt_context_confluence_page),
|
|
42
|
+
contextShort: intl.formatMessage(_messages.messages.rovo_prompt_context_confluence_page_short)
|
|
43
|
+
};
|
|
44
|
+
case 'JSW':
|
|
45
|
+
case 'JWM':
|
|
46
|
+
case 'JSM':
|
|
47
|
+
case 'JPD':
|
|
48
|
+
return {
|
|
49
|
+
contextLong: intl.formatMessage(_messages.messages.rovo_prompt_context_jira_work_item),
|
|
50
|
+
contextShort: intl.formatMessage(_messages.messages.rovo_prompt_context_jira_work_item_short)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var getPromptAction = exports.getPromptAction = function getPromptAction(promptKey, intl) {
|
|
55
|
+
var _getContext;
|
|
56
|
+
var url = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
57
|
+
var product = arguments.length > 3 ? arguments[3] : undefined;
|
|
58
|
+
var iconSize = arguments.length > 4 ? arguments[4] : undefined;
|
|
59
|
+
var cardAppearance = arguments.length > 5 ? arguments[5] : undefined;
|
|
60
|
+
var _ref = (_getContext = getContext(intl, product)) !== null && _getContext !== void 0 ? _getContext : {
|
|
61
|
+
contextLong: intl.formatMessage(_messages.messages.rovo_prompt_context_generic),
|
|
62
|
+
contextShort: intl.formatMessage(_messages.messages.rovo_prompt_context_generic)
|
|
63
|
+
},
|
|
64
|
+
contextLong = _ref.contextLong,
|
|
65
|
+
contextShort = _ref.contextShort;
|
|
66
|
+
var isBlockCard3PExperimentEnabled = (0, _useBlockCardRovoActionExperiment.isBlockCardRovoActionExperimentEnabled)(product);
|
|
67
|
+
switch (promptKey) {
|
|
68
|
+
case RovoChatPromptKey.RECOMMEND_OTHER_SOURCES:
|
|
69
|
+
var label_recommend = intl.formatMessage(_messages.messages.rovo_prompt_button_recommend_other_sources);
|
|
70
|
+
var html_recommend = intl.formatMessage(_messages.messages.rovo_prompt_message_recommend_other_sources, {
|
|
71
|
+
context: contextLong,
|
|
72
|
+
url: url
|
|
73
|
+
}, {
|
|
74
|
+
ignoreTag: true
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
icon: /*#__PURE__*/_react.default.createElement(_aiEditIcon.default, null),
|
|
78
|
+
content: label_recommend,
|
|
79
|
+
tooltipMessage: label_recommend,
|
|
80
|
+
data: {
|
|
81
|
+
name: label_recommend,
|
|
82
|
+
dialogues: [],
|
|
83
|
+
prompt: (0, _htmlToAdf.default)(html_recommend)
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
case RovoChatPromptKey.SHOW_OTHER_MENTIONS:
|
|
87
|
+
var label_other_mentions = intl.formatMessage(_messages.messages.rovo_prompt_button_show_other_mentions);
|
|
88
|
+
var html_other_mentions = intl.formatMessage(_messages.messages.rovo_prompt_message_show_other_mentions, {
|
|
89
|
+
context: contextLong,
|
|
90
|
+
url: url
|
|
91
|
+
}, {
|
|
92
|
+
ignoreTag: true
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
icon: /*#__PURE__*/_react.default.createElement(_aiChapterIcon.default, null),
|
|
96
|
+
content: label_other_mentions,
|
|
97
|
+
tooltipMessage: label_other_mentions,
|
|
98
|
+
data: {
|
|
99
|
+
name: label_other_mentions,
|
|
100
|
+
dialogues: [],
|
|
101
|
+
prompt: (0, _htmlToAdf.default)(html_other_mentions)
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
case RovoChatPromptKey.SUGGEST_IMPROVEMENT:
|
|
105
|
+
var label_improvement = intl.formatMessage(_messages.messages.rovo_prompt_button_suggest_improvement, {
|
|
106
|
+
context: contextShort
|
|
107
|
+
});
|
|
108
|
+
var html_improvement = intl.formatMessage(_messages.messages.rovo_prompt_message_suggest_improvement, {
|
|
109
|
+
context: contextLong,
|
|
110
|
+
url: url
|
|
111
|
+
}, {
|
|
112
|
+
ignoreTag: true
|
|
113
|
+
});
|
|
114
|
+
return {
|
|
115
|
+
icon: /*#__PURE__*/_react.default.createElement(_aiSearchIcon.default, null),
|
|
116
|
+
content: label_improvement,
|
|
117
|
+
tooltipMessage: label_improvement,
|
|
118
|
+
data: {
|
|
119
|
+
name: label_improvement,
|
|
120
|
+
dialogues: [],
|
|
121
|
+
prompt: (0, _htmlToAdf.default)(html_improvement)
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
case RovoChatPromptKey.SUMMARIZE_LINK:
|
|
125
|
+
var label_summarize = intl.formatMessage(_messages.messages.ai_summarize);
|
|
126
|
+
var html_summarize = intl.formatMessage(_messages.messages.rovo_prompt_message_summarize, {
|
|
127
|
+
url: url
|
|
128
|
+
}, {
|
|
129
|
+
ignoreTag: true
|
|
130
|
+
});
|
|
131
|
+
return {
|
|
132
|
+
icon: cardAppearance === _constants.CardDisplay.Block && isBlockCard3PExperimentEnabled ? /*#__PURE__*/_react.default.createElement(_aiChat.default, {
|
|
133
|
+
label: label_summarize,
|
|
134
|
+
size: iconSize
|
|
135
|
+
}) : /*#__PURE__*/_react.default.createElement(_aiEditIcon.default, null),
|
|
136
|
+
content: label_summarize,
|
|
137
|
+
tooltipMessage: label_summarize,
|
|
138
|
+
data: {
|
|
139
|
+
name: label_summarize,
|
|
140
|
+
dialogues: [],
|
|
141
|
+
prompt: (0, _htmlToAdf.default)(html_summarize),
|
|
142
|
+
mode: {
|
|
143
|
+
fastModeEnabled: true
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
case RovoChatPromptKey.SUMMARIZE_THIS_FOR_ME:
|
|
148
|
+
var label_summarize_this_for_me = intl.formatMessage(_messages.messages.rovo_prompt_button_summarize_this);
|
|
149
|
+
var html_summarize_this_for_me = intl.formatMessage(_messages.messages.rovo_prompt_message_summarize, {
|
|
150
|
+
url: url
|
|
151
|
+
}, {
|
|
152
|
+
ignoreTag: true
|
|
153
|
+
});
|
|
154
|
+
return {
|
|
155
|
+
icon: /*#__PURE__*/_react.default.createElement(_aiGenerativeTextSummary.default, {
|
|
156
|
+
label: label_summarize_this_for_me
|
|
157
|
+
}),
|
|
158
|
+
content: label_summarize_this_for_me,
|
|
159
|
+
tooltipMessage: label_summarize_this_for_me,
|
|
160
|
+
data: {
|
|
161
|
+
name: label_summarize_this_for_me,
|
|
162
|
+
dialogues: [],
|
|
163
|
+
prompt: (0, _htmlToAdf.default)(html_summarize_this_for_me),
|
|
164
|
+
mode: {
|
|
165
|
+
fastModeEnabled: true
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
case RovoChatPromptKey.HIGHLIGHT_RELEVANT_CONTENT:
|
|
170
|
+
var label_highlight_relevant_content = intl.formatMessage(_messages.messages.rovo_prompt_button_highlight_relevant_content);
|
|
171
|
+
var html_highlight_relevant_content = intl.formatMessage(_messages.messages.rovo_prompt_message_highlight_relevant_content, {
|
|
172
|
+
context: contextLong,
|
|
173
|
+
url: url
|
|
174
|
+
}, {
|
|
175
|
+
ignoreTag: true
|
|
176
|
+
});
|
|
177
|
+
return {
|
|
178
|
+
icon: /*#__PURE__*/_react.default.createElement(_aiChapterIcon.default, null),
|
|
179
|
+
content: label_highlight_relevant_content,
|
|
180
|
+
tooltipMessage: label_highlight_relevant_content,
|
|
181
|
+
data: {
|
|
182
|
+
name: label_highlight_relevant_content,
|
|
183
|
+
dialogues: [],
|
|
184
|
+
prompt: (0, _htmlToAdf.default)(html_highlight_relevant_content),
|
|
185
|
+
mode: {
|
|
186
|
+
fastModeEnabled: true
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
case RovoChatPromptKey.ASK_ROVO_ANYTHING:
|
|
191
|
+
var label_ask_rovo_anything = intl.formatMessage(_messages.messages.rovo_prompt_button_ask_rovo_anything);
|
|
192
|
+
var prompt_ask_rovo_anything = intl.formatMessage(_messages.messages.rovo_prompt_message_ask_rovo_anything, {
|
|
193
|
+
url: url
|
|
194
|
+
});
|
|
195
|
+
return {
|
|
196
|
+
icon: cardAppearance === _constants.CardDisplay.Block && isBlockCard3PExperimentEnabled ? /*#__PURE__*/_react.default.createElement(_logo.RovoIcon, {
|
|
197
|
+
label: label_ask_rovo_anything,
|
|
198
|
+
size: 'xxsmall',
|
|
199
|
+
shouldUseHexLogo: true
|
|
200
|
+
}) : /*#__PURE__*/_react.default.createElement(_aiSearchIcon.default, null),
|
|
201
|
+
content: label_ask_rovo_anything,
|
|
202
|
+
tooltipMessage: label_ask_rovo_anything,
|
|
203
|
+
data: {
|
|
204
|
+
name: label_ask_rovo_anything,
|
|
205
|
+
dialogues: [],
|
|
206
|
+
prompt: prompt_ask_rovo_anything,
|
|
207
|
+
isPromptPlaceholder: true,
|
|
208
|
+
placeholderType: 'generic'
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
case RovoChatPromptKey.ASK_A_SPECIFIC_QUESTION:
|
|
212
|
+
var label_ask_a_specific_question = intl.formatMessage(_messages.messages.rovo_prompt_button_ask_a_specific_question);
|
|
213
|
+
var prompt_ask_a_specific_question = intl.formatMessage(_messages.messages.rovo_prompt_message_ask_rovo_anything, {
|
|
214
|
+
url: url
|
|
215
|
+
});
|
|
216
|
+
return {
|
|
217
|
+
icon: /*#__PURE__*/_react.default.createElement(_rovoChat.default, {
|
|
218
|
+
label: label_ask_a_specific_question
|
|
219
|
+
}),
|
|
220
|
+
content: label_ask_a_specific_question,
|
|
221
|
+
tooltipMessage: label_ask_a_specific_question,
|
|
222
|
+
data: {
|
|
223
|
+
name: label_ask_a_specific_question,
|
|
224
|
+
dialogues: [],
|
|
225
|
+
prompt: prompt_ask_a_specific_question,
|
|
226
|
+
isPromptPlaceholder: true,
|
|
227
|
+
placeholderType: 'generic'
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
case RovoChatPromptKey.KEY_HIGHLIGHTS:
|
|
231
|
+
var label_key_highlights = intl.formatMessage(_messages.messages.rovo_prompt_button_key_highlights);
|
|
232
|
+
var html_key_highlights = intl.formatMessage(_messages.messages.rovo_prompt_message_key_highlights, {
|
|
233
|
+
context: contextLong,
|
|
234
|
+
url: url
|
|
235
|
+
}, {
|
|
236
|
+
ignoreTag: true
|
|
237
|
+
});
|
|
238
|
+
return {
|
|
239
|
+
icon: /*#__PURE__*/_react.default.createElement(_aiChat.default, {
|
|
240
|
+
label: label_key_highlights,
|
|
241
|
+
size: iconSize
|
|
242
|
+
}),
|
|
243
|
+
content: label_key_highlights,
|
|
244
|
+
tooltipMessage: label_key_highlights,
|
|
245
|
+
data: {
|
|
246
|
+
name: label_key_highlights,
|
|
247
|
+
dialogues: [],
|
|
248
|
+
prompt: (0, _htmlToAdf.default)(html_key_highlights)
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
case RovoChatPromptKey.SHOW_ME_WHATS_RELEVANT:
|
|
252
|
+
var label_show_me_whats_relevant = intl.formatMessage(_messages.messages.rovo_prompt_button_show_me_whats_relevant);
|
|
253
|
+
var html_show_me_whats_relevant = intl.formatMessage(_messages.messages.rovo_prompt_message_highlight_relevant_content, {
|
|
254
|
+
context: contextLong,
|
|
255
|
+
url: url
|
|
256
|
+
}, {
|
|
257
|
+
ignoreTag: true
|
|
258
|
+
});
|
|
259
|
+
return {
|
|
260
|
+
icon: /*#__PURE__*/_react.default.createElement(_aiSearch.default, {
|
|
261
|
+
label: label_show_me_whats_relevant
|
|
262
|
+
}),
|
|
263
|
+
content: label_show_me_whats_relevant,
|
|
264
|
+
tooltipMessage: label_show_me_whats_relevant,
|
|
265
|
+
data: {
|
|
266
|
+
name: label_show_me_whats_relevant,
|
|
267
|
+
dialogues: [],
|
|
268
|
+
prompt: (0, _htmlToAdf.default)(html_show_me_whats_relevant)
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
case RovoChatPromptKey.IDENTIFY_KEY_TRENDS:
|
|
272
|
+
var label_identify_key_trends = intl.formatMessage(_messages.messages.rovo_prompt_button_identify_key_trends);
|
|
273
|
+
var html_identify_key_trends = intl.formatMessage(_messages.messages.rovo_prompt_message_identify_key_trends, {
|
|
274
|
+
url: url
|
|
275
|
+
}, {
|
|
276
|
+
ignoreTag: true
|
|
277
|
+
});
|
|
278
|
+
return {
|
|
279
|
+
icon: /*#__PURE__*/_react.default.createElement(_aiChat.default, {
|
|
280
|
+
label: label_identify_key_trends,
|
|
281
|
+
size: iconSize
|
|
282
|
+
}),
|
|
283
|
+
content: label_identify_key_trends,
|
|
284
|
+
tooltipMessage: label_identify_key_trends,
|
|
285
|
+
data: {
|
|
286
|
+
name: label_identify_key_trends,
|
|
287
|
+
dialogues: [],
|
|
288
|
+
prompt: (0, _htmlToAdf.default)(html_identify_key_trends)
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
case RovoChatPromptKey.IDENTIFY_KEY_POINTS:
|
|
292
|
+
var label_identify_key_points = intl.formatMessage(_messages.messages.rovo_prompt_button_identify_key_points);
|
|
293
|
+
var html_identify_key_points = intl.formatMessage(_messages.messages.rovo_prompt_message_identify_key_points, {
|
|
294
|
+
url: url
|
|
295
|
+
}, {
|
|
296
|
+
ignoreTag: true
|
|
297
|
+
});
|
|
298
|
+
return {
|
|
299
|
+
icon: /*#__PURE__*/_react.default.createElement(_aiChat.default, {
|
|
300
|
+
label: label_identify_key_points,
|
|
301
|
+
size: iconSize
|
|
302
|
+
}),
|
|
303
|
+
content: label_identify_key_points,
|
|
304
|
+
tooltipMessage: label_identify_key_points,
|
|
305
|
+
data: {
|
|
306
|
+
name: label_identify_key_points,
|
|
307
|
+
dialogues: [],
|
|
308
|
+
prompt: (0, _htmlToAdf.default)(html_identify_key_points)
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
case RovoChatPromptKey.FIND_OPEN_QUESTIONS:
|
|
312
|
+
var label_find_open_questions = intl.formatMessage(_messages.messages.rovo_prompt_button_find_open_questions);
|
|
313
|
+
var html_find_open_questions = intl.formatMessage(_messages.messages.rovo_prompt_message_find_open_questions, {
|
|
314
|
+
url: url
|
|
315
|
+
}, {
|
|
316
|
+
ignoreTag: true
|
|
317
|
+
});
|
|
318
|
+
return {
|
|
319
|
+
icon: /*#__PURE__*/_react.default.createElement(_aiChat.default, {
|
|
320
|
+
label: label_find_open_questions,
|
|
321
|
+
size: iconSize
|
|
322
|
+
}),
|
|
323
|
+
content: label_find_open_questions,
|
|
324
|
+
tooltipMessage: label_find_open_questions,
|
|
325
|
+
data: {
|
|
326
|
+
name: label_find_open_questions,
|
|
327
|
+
dialogues: [],
|
|
328
|
+
prompt: (0, _htmlToAdf.default)(html_find_open_questions)
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
const 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
|
+
const 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
|
+
const useInlineTailoredActionExperiment = (url, showHoverPreview, actionOptions) => {
|
|
28
|
+
var _actionOptions$rovoCh, _actionOptions$rovoCh2;
|
|
29
|
+
const {
|
|
30
|
+
rovoOptions: rovoConfig
|
|
31
|
+
} = useRovoConfig();
|
|
32
|
+
const isRovoChatEnabled = getIsRovoChatEnabled(rovoConfig);
|
|
33
|
+
const cardState = useSmartCardState(url !== null && url !== void 0 ? url : '');
|
|
34
|
+
const extensionKey = getExtensionKey(cardState.details);
|
|
35
|
+
const isRovoChatActionOptedIn = (_actionOptions$rovoCh = actionOptions === null || actionOptions === void 0 ? void 0 : (_actionOptions$rovoCh2 = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh2 === void 0 ? void 0 : _actionOptions$rovoCh2.optIn) !== null && _actionOptions$rovoCh !== void 0 ? _actionOptions$rovoCh : false;
|
|
36
|
+
return useMemo(() => {
|
|
37
|
+
if (!isRovoChatEnabled || !showHoverPreview || !url || !isRovoChatActionOptedIn) {
|
|
38
|
+
return NOT_ENABLED_RESULT;
|
|
39
|
+
}
|
|
40
|
+
if (!extensionKey || !ELIGIBLE_EXTENSION_KEYS.has(extensionKey)) {
|
|
41
|
+
return NOT_ENABLED_RESULT;
|
|
42
|
+
}
|
|
43
|
+
const isEnabled = fg('platform_sl_3p_auth_inline_tailored_cta_killswitch') && expValEquals('platform_sl_3p_auth_inline_tailored_cta', 'isEnabled', true);
|
|
44
|
+
return {
|
|
45
|
+
isEnabled
|
|
46
|
+
};
|
|
47
|
+
}, [isRovoChatEnabled, extensionKey, showHoverPreview, url, isRovoChatActionOptedIn]);
|
|
48
|
+
};
|
|
49
|
+
export default useInlineTailoredActionExperiment;
|
|
@@ -13,17 +13,25 @@ const useSmartLinkCrossProductUrlWrapperFallback = _args => identityUrlWrapper;
|
|
|
13
13
|
const useSmartLinkCrossProductUrlWrapper = ({
|
|
14
14
|
details
|
|
15
15
|
}) => {
|
|
16
|
-
var
|
|
16
|
+
var _effectiveProduct$toL;
|
|
17
17
|
const {
|
|
18
18
|
product,
|
|
19
|
-
bridgeProduct
|
|
19
|
+
bridgeProduct,
|
|
20
|
+
xpcProduct,
|
|
21
|
+
xpcSubProduct
|
|
20
22
|
} = useSmartLinkContext();
|
|
23
|
+
// xpcProduct takes precedence over product — it identifies the host product for XPC analytics
|
|
24
|
+
// without affecting link resolution (which uses the `product` prop separately).
|
|
25
|
+
const effectiveProduct = xpcProduct !== null && xpcProduct !== void 0 ? xpcProduct : product;
|
|
21
26
|
const wrapUrl = useCrossProductUrlWrapper({
|
|
22
27
|
bridge: bridgeProduct !== null && bridgeProduct !== void 0 ? bridgeProduct : SMART_LINKS_XPC_BRIDGE,
|
|
23
|
-
product: (
|
|
28
|
+
product: (_effectiveProduct$toL = effectiveProduct === null || effectiveProduct === void 0 ? void 0 : effectiveProduct.toLowerCase()) !== null && _effectiveProduct$toL !== void 0 ? _effectiveProduct$toL : 'unknown',
|
|
29
|
+
...(xpcSubProduct ? {
|
|
30
|
+
subProduct: xpcSubProduct
|
|
31
|
+
} : {})
|
|
24
32
|
});
|
|
25
33
|
return useCallback(url => {
|
|
26
|
-
if (!getIsFirstPartyLink(details) || !
|
|
34
|
+
if (!getIsFirstPartyLink(details) || !effectiveProduct) {
|
|
27
35
|
return url;
|
|
28
36
|
}
|
|
29
37
|
let parsedUrl;
|
|
@@ -36,6 +44,6 @@ const useSmartLinkCrossProductUrlWrapper = ({
|
|
|
36
44
|
return url;
|
|
37
45
|
}
|
|
38
46
|
return wrapUrl(url);
|
|
39
|
-
}, [details,
|
|
47
|
+
}, [details, effectiveProduct, wrapUrl]);
|
|
40
48
|
};
|
|
41
49
|
export const useSmartLinkCrossProductUrlWrapperGated = functionWithFG('platform_smartlink_xpc_url_wrapping', useSmartLinkCrossProductUrlWrapper, useSmartLinkCrossProductUrlWrapperFallback);
|
|
@@ -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.22.0" || ''
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -11,8 +11,8 @@ import extractRovoChatAction from '../../../extractors/flexible/actions/extract-
|
|
|
11
11
|
import { getExtensionKey } from '../../../state/helpers';
|
|
12
12
|
import useBlockCardRovoActionExperiment from '../../../state/hooks/use-block-card-rovo-action-experiment';
|
|
13
13
|
import useRovoConfig from '../../../state/hooks/use-rovo-config';
|
|
14
|
+
import { RovoChatPromptKey } from '../../common/rovo-chat-utils';
|
|
14
15
|
import FlexibleCard from '../../FlexibleCard';
|
|
15
|
-
import { RovoChatPromptKey } from '../../FlexibleCard/components/actions/rovo-chat-action';
|
|
16
16
|
import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock, TitleBlock } from '../../FlexibleCard/components/blocks';
|
|
17
17
|
import { FlexibleCardUiOptions, getSimulatedBetterMetadata, PreviewBlockOptions, titleBlockOptions } from './utils';
|
|
18
18
|
import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
|