@atlaskit/smart-card 43.26.4 → 43.26.5
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 +8 -0
- package/analytics.spec.yaml +9 -0
- package/dist/cjs/extractors/flexible/actions/extract-rovo-chat-action.js +17 -1
- package/dist/cjs/extractors/flexible/actions/index.js +8 -1
- package/dist/cjs/state/hooks/use-invoke-client-action/index.js +4 -3
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/FlexibleCard/components/actions/rovo-chat-action/index.js +31 -8
- package/dist/cjs/view/HoverCard/components/views/resolved/index.js +5 -1
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/extractors/flexible/actions/extract-rovo-chat-action.js +19 -2
- package/dist/es2019/extractors/flexible/actions/index.js +8 -1
- package/dist/es2019/state/hooks/use-invoke-client-action/index.js +3 -1
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/FlexibleCard/components/actions/rovo-chat-action/index.js +11 -8
- package/dist/es2019/view/HoverCard/components/views/resolved/index.js +5 -1
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/extractors/flexible/actions/extract-rovo-chat-action.js +18 -2
- package/dist/esm/extractors/flexible/actions/index.js +8 -1
- package/dist/esm/state/hooks/use-invoke-client-action/index.js +4 -3
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/FlexibleCard/components/actions/rovo-chat-action/index.js +31 -8
- package/dist/esm/view/HoverCard/components/views/resolved/index.js +5 -1
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/common/analytics/generated/analytics.types.d.ts +12 -1
- package/dist/types/extractors/flexible/actions/extract-rovo-chat-action.d.ts +10 -1
- package/dist/types/state/flexible-ui-context/types.d.ts +1 -0
- package/dist/types/state/hooks/use-invoke-client-action/types.d.ts +6 -2
- package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +12 -1
- package/dist/types-ts4.5/extractors/flexible/actions/extract-rovo-chat-action.d.ts +10 -1
- package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +1 -0
- package/dist/types-ts4.5/state/hooks/use-invoke-client-action/types.d.ts +6 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 43.26.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`3b6aa90b87394`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3b6aa90b87394) -
|
|
8
|
+
Send analytics event on RovoChatAction clicked
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 43.26.4
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/analytics.spec.yaml
CHANGED
|
@@ -202,6 +202,15 @@ events:
|
|
|
202
202
|
description: fired when an ai summary is clicked
|
|
203
203
|
attributes:
|
|
204
204
|
<<: [*PackageMetaDataContext, *ResolvedContext]
|
|
205
|
+
- button clicked (rovoChatPrompt):
|
|
206
|
+
type: ui
|
|
207
|
+
description: Fired when sending prompt to RovoChat via click
|
|
208
|
+
attributes:
|
|
209
|
+
<<: [ *PackageMetaDataContext, *ResolvedContext, *ClientActionAttributes ]
|
|
210
|
+
prompt:
|
|
211
|
+
required: false
|
|
212
|
+
type: string
|
|
213
|
+
description: Key for RovoChat prompts
|
|
205
214
|
|
|
206
215
|
- button clicked (copySummary):
|
|
207
216
|
type: ui
|
|
@@ -5,12 +5,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _linkExtractors = require("@atlaskit/link-extractors");
|
|
8
|
+
var _constants = require("../../../constants");
|
|
8
9
|
var _helpers = require("../../../state/helpers");
|
|
9
10
|
var _canShowAction = require("../../../utils/actions/can-show-action");
|
|
10
11
|
var _rovo = require("../../../utils/rovo");
|
|
11
12
|
var _types = require("../../../view/Card/types");
|
|
12
|
-
var extractRovoChatAction = function extractRovoChatAction(
|
|
13
|
+
var extractRovoChatAction = function extractRovoChatAction(_ref) {
|
|
13
14
|
var _actionOptions$rovoCh;
|
|
15
|
+
var actionOptions = _ref.actionOptions,
|
|
16
|
+
appearance = _ref.appearance,
|
|
17
|
+
id = _ref.id,
|
|
18
|
+
product = _ref.product,
|
|
19
|
+
response = _ref.response,
|
|
20
|
+
rovoConfig = _ref.rovoConfig;
|
|
14
21
|
if (!(0, _canShowAction.canShowAction)(_types.CardAction.RovoChatAction, actionOptions)) {
|
|
15
22
|
return;
|
|
16
23
|
}
|
|
@@ -25,6 +32,15 @@ var extractRovoChatAction = function extractRovoChatAction(response, rovoConfig,
|
|
|
25
32
|
var isOptIn = (actionOptions === null || actionOptions === void 0 || (_actionOptions$rovoCh = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh === void 0 ? void 0 : _actionOptions$rovoCh.optIn) === true;
|
|
26
33
|
var url = (0, _linkExtractors.extractSmartLinkUrl)(response);
|
|
27
34
|
return isSupportedFeature && isOptIn ? {
|
|
35
|
+
invokeAction: {
|
|
36
|
+
actionSubjectId: 'rovoChatPrompt',
|
|
37
|
+
actionType: _constants.InternalActionName.RovoChatAction,
|
|
38
|
+
definitionId: (0, _helpers.getDefinitionId)(response),
|
|
39
|
+
display: appearance,
|
|
40
|
+
extensionKey: (0, _helpers.getExtensionKey)(response),
|
|
41
|
+
id: id,
|
|
42
|
+
resourceType: (0, _helpers.getResourceType)(response)
|
|
43
|
+
},
|
|
28
44
|
product: product,
|
|
29
45
|
url: url
|
|
30
46
|
} : undefined;
|
|
@@ -50,7 +50,14 @@ var extractFlexibleCardActions = exports.extractFlexibleCardActions = function e
|
|
|
50
50
|
response: response,
|
|
51
51
|
isPreviewPanelAvailable: isPreviewPanelAvailable,
|
|
52
52
|
openPreviewPanel: openPreviewPanel
|
|
53
|
-
})), _constants.ActionName.AutomationAction, (0, _extractAutomationAction.extractAutomationAction)(response)), _constants.InternalActionName.AISummaryAction, (0, _extractAiSummaryAction.extractAISummaryAction)(response, url, actionOptions, aiSummaryConfig)), (0, _platformFeatureFlags.fg)('platform_sl_3p_auth_rovo_action_kill_switch') ? (0, _defineProperty2.default)({}, _constants.InternalActionName.RovoChatAction, (0, _extractRovoChatAction.default)(
|
|
53
|
+
})), _constants.ActionName.AutomationAction, (0, _extractAutomationAction.extractAutomationAction)(response)), _constants.InternalActionName.AISummaryAction, (0, _extractAiSummaryAction.extractAISummaryAction)(response, url, actionOptions, aiSummaryConfig)), (0, _platformFeatureFlags.fg)('platform_sl_3p_auth_rovo_action_kill_switch') ? (0, _defineProperty2.default)({}, _constants.InternalActionName.RovoChatAction, (0, _extractRovoChatAction.default)({
|
|
54
|
+
actionOptions: actionOptions,
|
|
55
|
+
appearance: appearance,
|
|
56
|
+
id: id,
|
|
57
|
+
product: product,
|
|
58
|
+
response: response,
|
|
59
|
+
rovoConfig: rovoConfig
|
|
60
|
+
})) : undefined), {}, (0, _defineProperty2.default)({}, _constants.InternalActionName.ViewRelatedLinksAction, (0, _extractViewRelatedLinksAction.extractViewRelatedLinksAction)(response)));
|
|
54
61
|
return Object.values(action).some(function (value) {
|
|
55
62
|
return Boolean(value);
|
|
56
63
|
}) ? action : undefined;
|
|
@@ -28,11 +28,11 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
28
28
|
var fireEvent = fireEventProp !== null && fireEventProp !== void 0 ? fireEventProp : defaultFireEvent;
|
|
29
29
|
return (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
30
30
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref2) {
|
|
31
|
-
var actionSubjectId, actionType, actionFn, _ref2$definitionId, definitionId, extensionKey, display, id, _ref2$resourceType, resourceType, experienceId, markName, _measure$getMeasure$d, _measure$getMeasure, result, _measure$getMeasure$d2, _measure$getMeasure2, reason;
|
|
31
|
+
var actionSubjectId, actionType, actionFn, _ref2$definitionId, definitionId, extensionKey, display, id, prompt, _ref2$resourceType, resourceType, experienceId, markName, _measure$getMeasure$d, _measure$getMeasure, result, _measure$getMeasure$d2, _measure$getMeasure2, reason;
|
|
32
32
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
33
33
|
while (1) switch (_context.prev = _context.next) {
|
|
34
34
|
case 0:
|
|
35
|
-
actionSubjectId = _ref2.actionSubjectId, actionType = _ref2.actionType, actionFn = _ref2.actionFn, _ref2$definitionId = _ref2.definitionId, definitionId = _ref2$definitionId === void 0 ? null : _ref2$definitionId, extensionKey = _ref2.extensionKey, display = _ref2.display, id = _ref2.id, _ref2$resourceType = _ref2.resourceType, resourceType = _ref2$resourceType === void 0 ? null : _ref2$resourceType;
|
|
35
|
+
actionSubjectId = _ref2.actionSubjectId, actionType = _ref2.actionType, actionFn = _ref2.actionFn, _ref2$definitionId = _ref2.definitionId, definitionId = _ref2$definitionId === void 0 ? null : _ref2$definitionId, extensionKey = _ref2.extensionKey, display = _ref2.display, id = _ref2.id, prompt = _ref2.prompt, _ref2$resourceType = _ref2.resourceType, resourceType = _ref2$resourceType === void 0 ? null : _ref2$resourceType;
|
|
36
36
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
37
37
|
experienceId = (0, _uuid.default)(); // Begin performance instrumentation.
|
|
38
38
|
markName = "".concat(experienceId, "-").concat(actionType);
|
|
@@ -53,7 +53,8 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
53
53
|
definitionId: definitionId,
|
|
54
54
|
display: display !== null && display !== void 0 ? display : null,
|
|
55
55
|
id: id !== null && id !== void 0 ? id : experienceId,
|
|
56
|
-
resourceType: resourceType
|
|
56
|
+
resourceType: resourceType,
|
|
57
|
+
prompt: prompt
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
60
|
// Invoke action
|
|
@@ -11,7 +11,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
11
11
|
var context = exports.context = {
|
|
12
12
|
componentName: 'smart-cards',
|
|
13
13
|
packageName: "@atlaskit/smart-card",
|
|
14
|
-
packageVersion: "
|
|
14
|
+
packageVersion: "0.0.0-development"
|
|
15
15
|
};
|
|
16
16
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
17
17
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -6,13 +6,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = exports.RovoChatPromptKey = void 0;
|
|
9
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
13
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
15
|
var _reactIntlNext = require("react-intl-next");
|
|
13
16
|
var _constants = require("../../../../../constants");
|
|
14
17
|
var _messages = require("../../../../../messages");
|
|
15
18
|
var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
|
|
19
|
+
var _useInvokeClientAction = _interopRequireDefault(require("../../../../../state/hooks/use-invoke-client-action"));
|
|
16
20
|
var _useRovoChat2 = _interopRequireDefault(require("../../../../../state/hooks/use-rovo-chat"));
|
|
17
21
|
var _aiChapterIcon = _interopRequireDefault(require("../../../assets/ai-chapter-icon"));
|
|
18
22
|
var _aiEditIcon = _interopRequireDefault(require("../../../assets/ai-edit-icon"));
|
|
@@ -21,6 +25,8 @@ var _action = _interopRequireDefault(require("../action"));
|
|
|
21
25
|
var _htmlToAdf = _interopRequireDefault(require("./html-to-adf"));
|
|
22
26
|
var _excluded = ["onClick", "prompts", "testId"];
|
|
23
27
|
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); }
|
|
28
|
+
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; }
|
|
29
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
24
30
|
var RovoChatPromptKey = exports.RovoChatPromptKey = /*#__PURE__*/function (RovoChatPromptKey) {
|
|
25
31
|
RovoChatPromptKey["RECOMMEND_OTHER_SOURCES"] = "recommend-other-sources";
|
|
26
32
|
RovoChatPromptKey["SHOW_OTHER_MENTIONS"] = "show-other-mentions";
|
|
@@ -128,15 +134,32 @@ var RovoChatAction = function RovoChatAction(_ref2) {
|
|
|
128
134
|
sendPromptMessage = _useRovoChat.sendPromptMessage;
|
|
129
135
|
var context = (0, _flexibleUiContext.useFlexibleUiContext)();
|
|
130
136
|
var data = context === null || context === void 0 || (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[_constants.InternalActionName.RovoChatAction];
|
|
131
|
-
var
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
var invoke = (0, _useInvokeClientAction.default)({});
|
|
138
|
+
var _onClick = (0, _react.useCallback)(function (promptData, promptKey) {
|
|
139
|
+
if (promptData && data !== null && data !== void 0 && data.invokeAction) {
|
|
140
|
+
invoke(_objectSpread(_objectSpread({}, data === null || data === void 0 ? void 0 : data.invokeAction), {}, {
|
|
141
|
+
actionFn: function () {
|
|
142
|
+
var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
143
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
144
|
+
while (1) switch (_context.prev = _context.next) {
|
|
145
|
+
case 0:
|
|
146
|
+
return _context.abrupt("return", sendPromptMessage(promptData));
|
|
147
|
+
case 1:
|
|
148
|
+
case "end":
|
|
149
|
+
return _context.stop();
|
|
150
|
+
}
|
|
151
|
+
}, _callee);
|
|
152
|
+
}));
|
|
153
|
+
function actionFn() {
|
|
154
|
+
return _actionFn.apply(this, arguments);
|
|
155
|
+
}
|
|
156
|
+
return actionFn;
|
|
157
|
+
}(),
|
|
158
|
+
prompt: promptKey
|
|
159
|
+
}));
|
|
137
160
|
onClickCallback === null || onClickCallback === void 0 || onClickCallback();
|
|
138
161
|
}
|
|
139
|
-
}, [onClickCallback, sendPromptMessage]);
|
|
162
|
+
}, [data === null || data === void 0 ? void 0 : data.invokeAction, invoke, onClickCallback, sendPromptMessage]);
|
|
140
163
|
var promptActions = (0, _react.useMemo)(function () {
|
|
141
164
|
return prompts.map(function (promptKey, idx) {
|
|
142
165
|
var _ref3 = getPromptAction(promptKey, intl, data === null || data === void 0 ? void 0 : data.url, data === null || data === void 0 ? void 0 : data.product) || {},
|
|
@@ -149,7 +172,7 @@ var RovoChatAction = function RovoChatAction(_ref2) {
|
|
|
149
172
|
icon: icon,
|
|
150
173
|
key: promptKey,
|
|
151
174
|
onClick: function onClick() {
|
|
152
|
-
return _onClick(promptData);
|
|
175
|
+
return _onClick(promptData, promptKey);
|
|
153
176
|
},
|
|
154
177
|
testId: "".concat(testId, "-").concat(idx + 1),
|
|
155
178
|
tooltipMessage: tooltipMessage
|
|
@@ -48,7 +48,11 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
48
48
|
var isRovoSummaryEnabled = (0, _platformFeatureFlags.fg)('platform_sl_3p_auth_rovo_action_kill_switch') ?
|
|
49
49
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
50
50
|
(0, _react.useMemo)(function () {
|
|
51
|
-
return (cardState === null || cardState === void 0 ? void 0 : cardState.details) && (0, _extractRovoChatAction.default)(
|
|
51
|
+
return (cardState === null || cardState === void 0 ? void 0 : cardState.details) && (0, _extractRovoChatAction.default)({
|
|
52
|
+
response: cardState.details,
|
|
53
|
+
rovoConfig: rovoConfig,
|
|
54
|
+
actionOptions: actionOptions
|
|
55
|
+
}) !== undefined;
|
|
52
56
|
}, [actionOptions, cardState === null || cardState === void 0 ? void 0 : cardState.details, rovoConfig]) : false;
|
|
53
57
|
(0, _react.useEffect)(function () {
|
|
54
58
|
// Since this hover view is only rendered on resolved status,
|
|
@@ -22,7 +22,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
|
|
|
22
22
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
23
23
|
var PACKAGE_DATA = {
|
|
24
24
|
packageName: "@atlaskit/smart-card",
|
|
25
|
-
packageVersion: "
|
|
25
|
+
packageVersion: "0.0.0-development",
|
|
26
26
|
componentName: 'linkUrl'
|
|
27
27
|
};
|
|
28
28
|
var Anchor = (0, _click.withLinkClickedEvent)('a');
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { extractSmartLinkUrl } from '@atlaskit/link-extractors';
|
|
2
|
-
import {
|
|
2
|
+
import { InternalActionName } from '../../../constants';
|
|
3
|
+
import { getDefinitionId, getExtensionKey, getResourceType } from '../../../state/helpers';
|
|
3
4
|
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
4
5
|
import { getIsRovoChatEnabled } from '../../../utils/rovo';
|
|
5
6
|
import { CardAction } from '../../../view/Card/types';
|
|
6
|
-
const extractRovoChatAction = (
|
|
7
|
+
const extractRovoChatAction = ({
|
|
8
|
+
actionOptions,
|
|
9
|
+
appearance,
|
|
10
|
+
id,
|
|
11
|
+
product,
|
|
12
|
+
response,
|
|
13
|
+
rovoConfig
|
|
14
|
+
}) => {
|
|
7
15
|
var _actionOptions$rovoCh;
|
|
8
16
|
if (!canShowAction(CardAction.RovoChatAction, actionOptions)) {
|
|
9
17
|
return;
|
|
@@ -19,6 +27,15 @@ const extractRovoChatAction = (response, rovoConfig, actionOptions, product) =>
|
|
|
19
27
|
const isOptIn = (actionOptions === null || actionOptions === void 0 ? void 0 : (_actionOptions$rovoCh = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh === void 0 ? void 0 : _actionOptions$rovoCh.optIn) === true;
|
|
20
28
|
const url = extractSmartLinkUrl(response);
|
|
21
29
|
return isSupportedFeature && isOptIn ? {
|
|
30
|
+
invokeAction: {
|
|
31
|
+
actionSubjectId: 'rovoChatPrompt',
|
|
32
|
+
actionType: InternalActionName.RovoChatAction,
|
|
33
|
+
definitionId: getDefinitionId(response),
|
|
34
|
+
display: appearance,
|
|
35
|
+
extensionKey: getExtensionKey(response),
|
|
36
|
+
id,
|
|
37
|
+
resourceType: getResourceType(response)
|
|
38
|
+
},
|
|
22
39
|
product,
|
|
23
40
|
url
|
|
24
41
|
} : undefined;
|
|
@@ -49,7 +49,14 @@ export const extractFlexibleCardActions = ({
|
|
|
49
49
|
[ActionName.AutomationAction]: extractAutomationAction(response),
|
|
50
50
|
[InternalActionName.AISummaryAction]: extractAISummaryAction(response, url, actionOptions, aiSummaryConfig),
|
|
51
51
|
...(fg('platform_sl_3p_auth_rovo_action_kill_switch') ? {
|
|
52
|
-
[InternalActionName.RovoChatAction]: extractRovoChatAction(
|
|
52
|
+
[InternalActionName.RovoChatAction]: extractRovoChatAction({
|
|
53
|
+
actionOptions,
|
|
54
|
+
appearance,
|
|
55
|
+
id,
|
|
56
|
+
product,
|
|
57
|
+
response,
|
|
58
|
+
rovoConfig
|
|
59
|
+
})
|
|
53
60
|
} : undefined),
|
|
54
61
|
[InternalActionName.ViewRelatedLinksAction]: extractViewRelatedLinksAction(response)
|
|
55
62
|
};
|
|
@@ -25,6 +25,7 @@ const useInvokeClientAction = ({
|
|
|
25
25
|
extensionKey,
|
|
26
26
|
display,
|
|
27
27
|
id,
|
|
28
|
+
prompt,
|
|
28
29
|
resourceType = null
|
|
29
30
|
}) => {
|
|
30
31
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
@@ -50,7 +51,8 @@ const useInvokeClientAction = ({
|
|
|
50
51
|
definitionId,
|
|
51
52
|
display: display !== null && display !== void 0 ? display : null,
|
|
52
53
|
id: id !== null && id !== void 0 ? id : experienceId,
|
|
53
|
-
resourceType
|
|
54
|
+
resourceType,
|
|
55
|
+
prompt
|
|
54
56
|
});
|
|
55
57
|
}
|
|
56
58
|
// Invoke action
|
|
@@ -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: "
|
|
5
|
+
packageVersion: "0.0.0-development"
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -4,6 +4,7 @@ import { useIntl } from 'react-intl-next';
|
|
|
4
4
|
import { InternalActionName } from '../../../../../constants';
|
|
5
5
|
import { messages } from '../../../../../messages';
|
|
6
6
|
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
7
|
+
import useInvokeClientAction from '../../../../../state/hooks/use-invoke-client-action';
|
|
7
8
|
import useRovoChat from '../../../../../state/hooks/use-rovo-chat';
|
|
8
9
|
import AiChapterIcon from '../../../assets/ai-chapter-icon';
|
|
9
10
|
import AIEditIcon from '../../../assets/ai-edit-icon';
|
|
@@ -116,15 +117,17 @@ const RovoChatAction = ({
|
|
|
116
117
|
} = useRovoChat();
|
|
117
118
|
const context = useFlexibleUiContext();
|
|
118
119
|
const data = context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[InternalActionName.RovoChatAction];
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
const invoke = useInvokeClientAction({});
|
|
121
|
+
const onClick = useCallback((promptData, promptKey) => {
|
|
122
|
+
if (promptData && data !== null && data !== void 0 && data.invokeAction) {
|
|
123
|
+
invoke({
|
|
124
|
+
...(data === null || data === void 0 ? void 0 : data.invokeAction),
|
|
125
|
+
actionFn: async () => sendPromptMessage(promptData),
|
|
126
|
+
prompt: promptKey
|
|
127
|
+
});
|
|
125
128
|
onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback();
|
|
126
129
|
}
|
|
127
|
-
}, [onClickCallback, sendPromptMessage]);
|
|
130
|
+
}, [data === null || data === void 0 ? void 0 : data.invokeAction, invoke, onClickCallback, sendPromptMessage]);
|
|
128
131
|
const promptActions = useMemo(() => {
|
|
129
132
|
return prompts.map((promptKey, idx) => {
|
|
130
133
|
const {
|
|
@@ -137,7 +140,7 @@ const RovoChatAction = ({
|
|
|
137
140
|
content: content,
|
|
138
141
|
icon: icon,
|
|
139
142
|
key: promptKey,
|
|
140
|
-
onClick: () => onClick(promptData),
|
|
143
|
+
onClick: () => onClick(promptData, promptKey),
|
|
141
144
|
testId: `${testId}-${idx + 1}`,
|
|
142
145
|
tooltipMessage: tooltipMessage
|
|
143
146
|
}, props)) : null;
|
|
@@ -40,7 +40,11 @@ const HoverCardResolvedView = ({
|
|
|
40
40
|
useRovoConfig() : undefined;
|
|
41
41
|
const isRovoSummaryEnabled = fg('platform_sl_3p_auth_rovo_action_kill_switch') ?
|
|
42
42
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
43
|
-
useMemo(() => (cardState === null || cardState === void 0 ? void 0 : cardState.details) && extractRovoChatAction(
|
|
43
|
+
useMemo(() => (cardState === null || cardState === void 0 ? void 0 : cardState.details) && extractRovoChatAction({
|
|
44
|
+
response: cardState.details,
|
|
45
|
+
rovoConfig,
|
|
46
|
+
actionOptions
|
|
47
|
+
}) !== undefined, [actionOptions, cardState === null || cardState === void 0 ? void 0 : cardState.details, rovoConfig]) : false;
|
|
44
48
|
useEffect(() => {
|
|
45
49
|
// Since this hover view is only rendered on resolved status,
|
|
46
50
|
// there is no need to check for statuses.
|
|
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
12
12
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
13
13
|
const PACKAGE_DATA = {
|
|
14
14
|
packageName: "@atlaskit/smart-card",
|
|
15
|
-
packageVersion: "
|
|
15
|
+
packageVersion: "0.0.0-development",
|
|
16
16
|
componentName: 'linkUrl'
|
|
17
17
|
};
|
|
18
18
|
const Anchor = withLinkClickedEvent('a');
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { extractSmartLinkUrl } from '@atlaskit/link-extractors';
|
|
2
|
-
import {
|
|
2
|
+
import { InternalActionName } from '../../../constants';
|
|
3
|
+
import { getDefinitionId, getExtensionKey, getResourceType } from '../../../state/helpers';
|
|
3
4
|
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
4
5
|
import { getIsRovoChatEnabled } from '../../../utils/rovo';
|
|
5
6
|
import { CardAction } from '../../../view/Card/types';
|
|
6
|
-
var extractRovoChatAction = function extractRovoChatAction(
|
|
7
|
+
var extractRovoChatAction = function extractRovoChatAction(_ref) {
|
|
7
8
|
var _actionOptions$rovoCh;
|
|
9
|
+
var actionOptions = _ref.actionOptions,
|
|
10
|
+
appearance = _ref.appearance,
|
|
11
|
+
id = _ref.id,
|
|
12
|
+
product = _ref.product,
|
|
13
|
+
response = _ref.response,
|
|
14
|
+
rovoConfig = _ref.rovoConfig;
|
|
8
15
|
if (!canShowAction(CardAction.RovoChatAction, actionOptions)) {
|
|
9
16
|
return;
|
|
10
17
|
}
|
|
@@ -19,6 +26,15 @@ var extractRovoChatAction = function extractRovoChatAction(response, rovoConfig,
|
|
|
19
26
|
var isOptIn = (actionOptions === null || actionOptions === void 0 || (_actionOptions$rovoCh = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh === void 0 ? void 0 : _actionOptions$rovoCh.optIn) === true;
|
|
20
27
|
var url = extractSmartLinkUrl(response);
|
|
21
28
|
return isSupportedFeature && isOptIn ? {
|
|
29
|
+
invokeAction: {
|
|
30
|
+
actionSubjectId: 'rovoChatPrompt',
|
|
31
|
+
actionType: InternalActionName.RovoChatAction,
|
|
32
|
+
definitionId: getDefinitionId(response),
|
|
33
|
+
display: appearance,
|
|
34
|
+
extensionKey: getExtensionKey(response),
|
|
35
|
+
id: id,
|
|
36
|
+
resourceType: getResourceType(response)
|
|
37
|
+
},
|
|
22
38
|
product: product,
|
|
23
39
|
url: url
|
|
24
40
|
} : undefined;
|
|
@@ -43,7 +43,14 @@ export var extractFlexibleCardActions = function extractFlexibleCardActions(_ref
|
|
|
43
43
|
response: response,
|
|
44
44
|
isPreviewPanelAvailable: isPreviewPanelAvailable,
|
|
45
45
|
openPreviewPanel: openPreviewPanel
|
|
46
|
-
})), ActionName.AutomationAction, extractAutomationAction(response)), InternalActionName.AISummaryAction, extractAISummaryAction(response, url, actionOptions, aiSummaryConfig)), fg('platform_sl_3p_auth_rovo_action_kill_switch') ? _defineProperty({}, InternalActionName.RovoChatAction, extractRovoChatAction(
|
|
46
|
+
})), ActionName.AutomationAction, extractAutomationAction(response)), InternalActionName.AISummaryAction, extractAISummaryAction(response, url, actionOptions, aiSummaryConfig)), fg('platform_sl_3p_auth_rovo_action_kill_switch') ? _defineProperty({}, InternalActionName.RovoChatAction, extractRovoChatAction({
|
|
47
|
+
actionOptions: actionOptions,
|
|
48
|
+
appearance: appearance,
|
|
49
|
+
id: id,
|
|
50
|
+
product: product,
|
|
51
|
+
response: response,
|
|
52
|
+
rovoConfig: rovoConfig
|
|
53
|
+
})) : undefined), {}, _defineProperty({}, InternalActionName.ViewRelatedLinksAction, extractViewRelatedLinksAction(response)));
|
|
47
54
|
return Object.values(action).some(function (value) {
|
|
48
55
|
return Boolean(value);
|
|
49
56
|
}) ? action : undefined;
|
|
@@ -19,11 +19,11 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
19
19
|
var fireEvent = fireEventProp !== null && fireEventProp !== void 0 ? fireEventProp : defaultFireEvent;
|
|
20
20
|
return useCallback( /*#__PURE__*/function () {
|
|
21
21
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
|
|
22
|
-
var actionSubjectId, actionType, actionFn, _ref2$definitionId, definitionId, extensionKey, display, id, _ref2$resourceType, resourceType, experienceId, markName, _measure$getMeasure$d, _measure$getMeasure, result, _measure$getMeasure$d2, _measure$getMeasure2, reason;
|
|
22
|
+
var actionSubjectId, actionType, actionFn, _ref2$definitionId, definitionId, extensionKey, display, id, prompt, _ref2$resourceType, resourceType, experienceId, markName, _measure$getMeasure$d, _measure$getMeasure, result, _measure$getMeasure$d2, _measure$getMeasure2, reason;
|
|
23
23
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
24
24
|
while (1) switch (_context.prev = _context.next) {
|
|
25
25
|
case 0:
|
|
26
|
-
actionSubjectId = _ref2.actionSubjectId, actionType = _ref2.actionType, actionFn = _ref2.actionFn, _ref2$definitionId = _ref2.definitionId, definitionId = _ref2$definitionId === void 0 ? null : _ref2$definitionId, extensionKey = _ref2.extensionKey, display = _ref2.display, id = _ref2.id, _ref2$resourceType = _ref2.resourceType, resourceType = _ref2$resourceType === void 0 ? null : _ref2$resourceType;
|
|
26
|
+
actionSubjectId = _ref2.actionSubjectId, actionType = _ref2.actionType, actionFn = _ref2.actionFn, _ref2$definitionId = _ref2.definitionId, definitionId = _ref2$definitionId === void 0 ? null : _ref2$definitionId, extensionKey = _ref2.extensionKey, display = _ref2.display, id = _ref2.id, prompt = _ref2.prompt, _ref2$resourceType = _ref2.resourceType, resourceType = _ref2$resourceType === void 0 ? null : _ref2$resourceType;
|
|
27
27
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
28
28
|
experienceId = uuid(); // Begin performance instrumentation.
|
|
29
29
|
markName = "".concat(experienceId, "-").concat(actionType);
|
|
@@ -44,7 +44,8 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
|
|
|
44
44
|
definitionId: definitionId,
|
|
45
45
|
display: display !== null && display !== void 0 ? display : null,
|
|
46
46
|
id: id !== null && id !== void 0 ? id : experienceId,
|
|
47
|
-
resourceType: resourceType
|
|
47
|
+
resourceType: resourceType,
|
|
48
|
+
prompt: prompt
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
// Invoke action
|
|
@@ -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: "
|
|
7
|
+
packageVersion: "0.0.0-development"
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
5
|
var _excluded = ["onClick", "prompts", "testId"];
|
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
9
|
import React, { useCallback, useMemo } from 'react';
|
|
5
10
|
import { useIntl } from 'react-intl-next';
|
|
6
11
|
import { InternalActionName } from '../../../../../constants';
|
|
7
12
|
import { messages } from '../../../../../messages';
|
|
8
13
|
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
|
|
14
|
+
import useInvokeClientAction from '../../../../../state/hooks/use-invoke-client-action';
|
|
9
15
|
import useRovoChat from '../../../../../state/hooks/use-rovo-chat';
|
|
10
16
|
import AiChapterIcon from '../../../assets/ai-chapter-icon';
|
|
11
17
|
import AIEditIcon from '../../../assets/ai-edit-icon';
|
|
@@ -119,15 +125,32 @@ var RovoChatAction = function RovoChatAction(_ref2) {
|
|
|
119
125
|
sendPromptMessage = _useRovoChat.sendPromptMessage;
|
|
120
126
|
var context = useFlexibleUiContext();
|
|
121
127
|
var data = context === null || context === void 0 || (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[InternalActionName.RovoChatAction];
|
|
122
|
-
var
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
+
var invoke = useInvokeClientAction({});
|
|
129
|
+
var _onClick = useCallback(function (promptData, promptKey) {
|
|
130
|
+
if (promptData && data !== null && data !== void 0 && data.invokeAction) {
|
|
131
|
+
invoke(_objectSpread(_objectSpread({}, data === null || data === void 0 ? void 0 : data.invokeAction), {}, {
|
|
132
|
+
actionFn: function () {
|
|
133
|
+
var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
134
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
135
|
+
while (1) switch (_context.prev = _context.next) {
|
|
136
|
+
case 0:
|
|
137
|
+
return _context.abrupt("return", sendPromptMessage(promptData));
|
|
138
|
+
case 1:
|
|
139
|
+
case "end":
|
|
140
|
+
return _context.stop();
|
|
141
|
+
}
|
|
142
|
+
}, _callee);
|
|
143
|
+
}));
|
|
144
|
+
function actionFn() {
|
|
145
|
+
return _actionFn.apply(this, arguments);
|
|
146
|
+
}
|
|
147
|
+
return actionFn;
|
|
148
|
+
}(),
|
|
149
|
+
prompt: promptKey
|
|
150
|
+
}));
|
|
128
151
|
onClickCallback === null || onClickCallback === void 0 || onClickCallback();
|
|
129
152
|
}
|
|
130
|
-
}, [onClickCallback, sendPromptMessage]);
|
|
153
|
+
}, [data === null || data === void 0 ? void 0 : data.invokeAction, invoke, onClickCallback, sendPromptMessage]);
|
|
131
154
|
var promptActions = useMemo(function () {
|
|
132
155
|
return prompts.map(function (promptKey, idx) {
|
|
133
156
|
var _ref3 = getPromptAction(promptKey, intl, data === null || data === void 0 ? void 0 : data.url, data === null || data === void 0 ? void 0 : data.product) || {},
|
|
@@ -140,7 +163,7 @@ var RovoChatAction = function RovoChatAction(_ref2) {
|
|
|
140
163
|
icon: icon,
|
|
141
164
|
key: promptKey,
|
|
142
165
|
onClick: function onClick() {
|
|
143
|
-
return _onClick(promptData);
|
|
166
|
+
return _onClick(promptData, promptKey);
|
|
144
167
|
},
|
|
145
168
|
testId: "".concat(testId, "-").concat(idx + 1),
|
|
146
169
|
tooltipMessage: tooltipMessage
|
|
@@ -39,7 +39,11 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
|
|
|
39
39
|
var isRovoSummaryEnabled = fg('platform_sl_3p_auth_rovo_action_kill_switch') ?
|
|
40
40
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
41
41
|
useMemo(function () {
|
|
42
|
-
return (cardState === null || cardState === void 0 ? void 0 : cardState.details) && extractRovoChatAction(
|
|
42
|
+
return (cardState === null || cardState === void 0 ? void 0 : cardState.details) && extractRovoChatAction({
|
|
43
|
+
response: cardState.details,
|
|
44
|
+
rovoConfig: rovoConfig,
|
|
45
|
+
actionOptions: actionOptions
|
|
46
|
+
}) !== undefined;
|
|
43
47
|
}, [actionOptions, cardState === null || cardState === void 0 ? void 0 : cardState.details, rovoConfig]) : false;
|
|
44
48
|
useEffect(function () {
|
|
45
49
|
// Since this hover view is only rendered on resolved status,
|
|
@@ -15,7 +15,7 @@ import LinkWarningModal from './LinkWarningModal';
|
|
|
15
15
|
import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
|
|
16
16
|
var PACKAGE_DATA = {
|
|
17
17
|
packageName: "@atlaskit/smart-card",
|
|
18
|
-
packageVersion: "
|
|
18
|
+
packageVersion: "0.0.0-development",
|
|
19
19
|
componentName: 'linkUrl'
|
|
20
20
|
};
|
|
21
21
|
var Anchor = withLinkClickedEvent('a');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::ba09a8b50ef409ef59594023566396c8>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen smart-card
|
|
8
8
|
*/
|
|
9
9
|
export type PackageMetaDataContextType = {
|
|
@@ -69,6 +69,14 @@ export type ButtonClickedIssueStatusUpdateAttributesType = {
|
|
|
69
69
|
resourceType: string | null;
|
|
70
70
|
};
|
|
71
71
|
export type ButtonClickedAiSummaryAttributesType = {};
|
|
72
|
+
export type ButtonClickedRovoChatPromptAttributesType = {
|
|
73
|
+
actionType: string | null;
|
|
74
|
+
id: string | null;
|
|
75
|
+
definitionId: string | null;
|
|
76
|
+
display: 'inline' | 'block' | 'embed' | 'embedPreview' | 'flexible' | 'hoverCardPreview' | 'url' | null;
|
|
77
|
+
resourceType: string | null;
|
|
78
|
+
prompt: string | null;
|
|
79
|
+
};
|
|
72
80
|
export type ButtonClickedCopySummaryAttributesType = {};
|
|
73
81
|
export type SummaryViewedAttributesType = {
|
|
74
82
|
fromCache: boolean | null;
|
|
@@ -274,6 +282,9 @@ export type AnalyticsEventAttributes = {
|
|
|
274
282
|
/**
|
|
275
283
|
* fired when an ai summary is clicked */
|
|
276
284
|
'ui.button.clicked.aiSummary': ButtonClickedAiSummaryAttributesType;
|
|
285
|
+
/**
|
|
286
|
+
* Fired when sending prompt to RovoChat via click */
|
|
287
|
+
'ui.button.clicked.rovoChatPrompt': ButtonClickedRovoChatPromptAttributesType;
|
|
277
288
|
/**
|
|
278
289
|
* fired when the copy ai summary button is clicked */
|
|
279
290
|
'ui.button.clicked.copySummary': ButtonClickedCopySummaryAttributesType;
|
|
@@ -3,5 +3,14 @@ import type { ProductType } from '@atlaskit/linking-common';
|
|
|
3
3
|
import type { RovoChatActionData } from '../../../state/flexible-ui-context/types';
|
|
4
4
|
import type { RovoConfig } from '../../../state/hooks/use-rovo-config';
|
|
5
5
|
import { type InternalCardActionOptions as CardActionOptions } from '../../../view/Card/types';
|
|
6
|
-
|
|
6
|
+
import type { FlexibleCardProps } from '../../../view/FlexibleCard/types';
|
|
7
|
+
type ExtractInvokeRovoChatActionParam = {
|
|
8
|
+
actionOptions?: CardActionOptions;
|
|
9
|
+
appearance?: FlexibleCardProps['appearance'];
|
|
10
|
+
id?: string;
|
|
11
|
+
product?: ProductType;
|
|
12
|
+
response: JsonLd.Response;
|
|
13
|
+
rovoConfig?: RovoConfig;
|
|
14
|
+
};
|
|
15
|
+
declare const extractRovoChatAction: ({ actionOptions, appearance, id, product, response, rovoConfig, }: ExtractInvokeRovoChatActionParam) => RovoChatActionData | undefined;
|
|
7
16
|
export default extractRovoChatAction;
|
|
@@ -6,7 +6,10 @@ export type UseInvokeClientActionProps = {
|
|
|
6
6
|
*/
|
|
7
7
|
fireEvent?: FireEventFunction;
|
|
8
8
|
};
|
|
9
|
-
export type InvokeClientActionSubjectId = 'copyLink' | 'downloadDocument' | 'invokePreviewScreen' | 'shortcutGoToLink';
|
|
9
|
+
export type InvokeClientActionSubjectId = 'copyLink' | 'downloadDocument' | 'invokePreviewScreen' | 'rovoChatPrompt' | 'shortcutGoToLink';
|
|
10
|
+
type InvokeRovoChatClientActionProps = {
|
|
11
|
+
prompt?: string;
|
|
12
|
+
};
|
|
10
13
|
export type InvokeClientActionProps = {
|
|
11
14
|
/**
|
|
12
15
|
* Invoke action to execute.
|
|
@@ -43,5 +46,6 @@ export type InvokeClientActionProps = {
|
|
|
43
46
|
* Resource type for analytics purposes.
|
|
44
47
|
*/
|
|
45
48
|
resourceType?: string;
|
|
46
|
-
};
|
|
49
|
+
} & InvokeRovoChatClientActionProps;
|
|
47
50
|
export type InvokeClientActionHandler = (opts: InvokeClientActionProps) => Promise<void>;
|
|
51
|
+
export {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
5
5
|
*
|
|
6
|
-
* @codegen <<SignedSource::
|
|
6
|
+
* @codegen <<SignedSource::ba09a8b50ef409ef59594023566396c8>>
|
|
7
7
|
* @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen smart-card
|
|
8
8
|
*/
|
|
9
9
|
export type PackageMetaDataContextType = {
|
|
@@ -69,6 +69,14 @@ export type ButtonClickedIssueStatusUpdateAttributesType = {
|
|
|
69
69
|
resourceType: string | null;
|
|
70
70
|
};
|
|
71
71
|
export type ButtonClickedAiSummaryAttributesType = {};
|
|
72
|
+
export type ButtonClickedRovoChatPromptAttributesType = {
|
|
73
|
+
actionType: string | null;
|
|
74
|
+
id: string | null;
|
|
75
|
+
definitionId: string | null;
|
|
76
|
+
display: 'inline' | 'block' | 'embed' | 'embedPreview' | 'flexible' | 'hoverCardPreview' | 'url' | null;
|
|
77
|
+
resourceType: string | null;
|
|
78
|
+
prompt: string | null;
|
|
79
|
+
};
|
|
72
80
|
export type ButtonClickedCopySummaryAttributesType = {};
|
|
73
81
|
export type SummaryViewedAttributesType = {
|
|
74
82
|
fromCache: boolean | null;
|
|
@@ -274,6 +282,9 @@ export type AnalyticsEventAttributes = {
|
|
|
274
282
|
/**
|
|
275
283
|
* fired when an ai summary is clicked */
|
|
276
284
|
'ui.button.clicked.aiSummary': ButtonClickedAiSummaryAttributesType;
|
|
285
|
+
/**
|
|
286
|
+
* Fired when sending prompt to RovoChat via click */
|
|
287
|
+
'ui.button.clicked.rovoChatPrompt': ButtonClickedRovoChatPromptAttributesType;
|
|
277
288
|
/**
|
|
278
289
|
* fired when the copy ai summary button is clicked */
|
|
279
290
|
'ui.button.clicked.copySummary': ButtonClickedCopySummaryAttributesType;
|
|
@@ -3,5 +3,14 @@ import type { ProductType } from '@atlaskit/linking-common';
|
|
|
3
3
|
import type { RovoChatActionData } from '../../../state/flexible-ui-context/types';
|
|
4
4
|
import type { RovoConfig } from '../../../state/hooks/use-rovo-config';
|
|
5
5
|
import { type InternalCardActionOptions as CardActionOptions } from '../../../view/Card/types';
|
|
6
|
-
|
|
6
|
+
import type { FlexibleCardProps } from '../../../view/FlexibleCard/types';
|
|
7
|
+
type ExtractInvokeRovoChatActionParam = {
|
|
8
|
+
actionOptions?: CardActionOptions;
|
|
9
|
+
appearance?: FlexibleCardProps['appearance'];
|
|
10
|
+
id?: string;
|
|
11
|
+
product?: ProductType;
|
|
12
|
+
response: JsonLd.Response;
|
|
13
|
+
rovoConfig?: RovoConfig;
|
|
14
|
+
};
|
|
15
|
+
declare const extractRovoChatAction: ({ actionOptions, appearance, id, product, response, rovoConfig, }: ExtractInvokeRovoChatActionParam) => RovoChatActionData | undefined;
|
|
7
16
|
export default extractRovoChatAction;
|
|
@@ -6,7 +6,10 @@ export type UseInvokeClientActionProps = {
|
|
|
6
6
|
*/
|
|
7
7
|
fireEvent?: FireEventFunction;
|
|
8
8
|
};
|
|
9
|
-
export type InvokeClientActionSubjectId = 'copyLink' | 'downloadDocument' | 'invokePreviewScreen' | 'shortcutGoToLink';
|
|
9
|
+
export type InvokeClientActionSubjectId = 'copyLink' | 'downloadDocument' | 'invokePreviewScreen' | 'rovoChatPrompt' | 'shortcutGoToLink';
|
|
10
|
+
type InvokeRovoChatClientActionProps = {
|
|
11
|
+
prompt?: string;
|
|
12
|
+
};
|
|
10
13
|
export type InvokeClientActionProps = {
|
|
11
14
|
/**
|
|
12
15
|
* Invoke action to execute.
|
|
@@ -43,5 +46,6 @@ export type InvokeClientActionProps = {
|
|
|
43
46
|
* Resource type for analytics purposes.
|
|
44
47
|
*/
|
|
45
48
|
resourceType?: string;
|
|
46
|
-
};
|
|
49
|
+
} & InvokeRovoChatClientActionProps;
|
|
47
50
|
export type InvokeClientActionHandler = (opts: InvokeClientActionProps) => Promise<void>;
|
|
51
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/smart-card",
|
|
3
|
-
"version": "43.26.
|
|
3
|
+
"version": "43.26.5",
|
|
4
4
|
"description": "Smart card component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"@atlaskit/button": "^23.10.0",
|
|
39
39
|
"@atlaskit/checkbox": "^17.3.0",
|
|
40
40
|
"@atlaskit/css": "^0.19.0",
|
|
41
|
-
"@atlaskit/dropdown-menu": "^16.
|
|
41
|
+
"@atlaskit/dropdown-menu": "^16.7.0",
|
|
42
42
|
"@atlaskit/embedded-confluence": "^4.5.0",
|
|
43
43
|
"@atlaskit/feature-gate-js-client": "^5.5.0",
|
|
44
44
|
"@atlaskit/form": "^15.4.0",
|
|
45
45
|
"@atlaskit/frontend-utilities": "^3.2.0",
|
|
46
46
|
"@atlaskit/heading": "^5.3.0",
|
|
47
|
-
"@atlaskit/icon": "^32.
|
|
47
|
+
"@atlaskit/icon": "^32.1.0",
|
|
48
48
|
"@atlaskit/icon-file-type": "^7.0.0",
|
|
49
49
|
"@atlaskit/icon-object": "^7.4.0",
|
|
50
50
|
"@atlaskit/image": "^3.0.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@atlaskit/popup": "^4.13.0",
|
|
67
67
|
"@atlaskit/primitives": "^18.0.0",
|
|
68
68
|
"@atlaskit/react-ufo": "^5.4.0",
|
|
69
|
-
"@atlaskit/rovo-triggers": "^5.
|
|
69
|
+
"@atlaskit/rovo-triggers": "^5.25.0",
|
|
70
70
|
"@atlaskit/section-message": "^8.12.0",
|
|
71
71
|
"@atlaskit/select": "^21.8.0",
|
|
72
72
|
"@atlaskit/spinner": "^19.0.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@atlaskit/textfield": "^8.2.0",
|
|
75
75
|
"@atlaskit/theme": "^22.0.0",
|
|
76
76
|
"@atlaskit/tile": "^1.0.0",
|
|
77
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
77
|
+
"@atlaskit/tmp-editor-statsig": "^39.0.0",
|
|
78
78
|
"@atlaskit/tokens": "^11.1.0",
|
|
79
79
|
"@atlaskit/tooltip": "^20.14.0",
|
|
80
80
|
"@atlaskit/ufo": "^0.4.0",
|