@atlaskit/smart-card 46.22.3 → 46.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 +18 -0
- package/analytics.spec.yaml +6 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-remix-action-and-rovo-chat-action-opted-out--default.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-remix-action-experiment-on---default.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-remix-action-and-rovo-chat-action-opted-out--default.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-remix-action-experiment-on---default.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-remix-action-and-rovo-chat-action-opted-out--default.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-remix-action-experiment-on---default.png +3 -0
- package/dist/cjs/constants.js +2 -0
- package/dist/cjs/extractors/flexible/actions/extract-remix-action.js +53 -0
- package/dist/cjs/extractors/flexible/actions/index.js +11 -2
- package/dist/cjs/extractors/flexible/index.js +7 -3
- package/dist/cjs/messages.js +4 -9
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/utils/is-remix-action-enabled.js +48 -0
- package/dist/cjs/utils/use-remix-action-exposure.js +16 -0
- package/dist/cjs/view/BlockCard/views/ResolvedView.js +18 -13
- package/dist/cjs/view/EmbedCard/components/rovo-actions-footer/index.js +58 -10
- package/dist/cjs/view/EmbedCard/index.js +2 -0
- package/dist/cjs/view/EmbedCard/views/ResolvedView.js +23 -7
- package/dist/cjs/view/FlexibleCard/components/actions/remix-action/index.js +81 -0
- package/dist/cjs/view/FlexibleCard/components/blocks/action-block/index.js +3 -2
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +2 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +5 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +10 -3
- package/dist/cjs/view/FlexibleCard/components/blocks/hover-card-footer-block/index.js +1 -1
- package/dist/cjs/view/FlexibleCard/index.js +9 -3
- package/dist/cjs/view/InlineCard/ResolvedView/InlineCardResolvedViewFunctional.js +9 -1
- package/dist/cjs/view/InlineCard/common/inline-card-action/index.js +70 -0
- package/dist/cjs/view/InlineCard/common/remix-action/index.compiled.css +5 -0
- package/dist/cjs/view/InlineCard/common/remix-action/index.js +77 -0
- package/dist/cjs/view/InlineCard/common/rovo-actions-cta/index.js +1 -24
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/common/rovo-chat-utils/index.js +0 -28
- package/dist/cjs/view/common/rovo-post-auth-prompts/index.js +1 -16
- package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-remix-action-and-rovo-chat-action-opted-out--default.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-remix-action-experiment-on---default.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-remix-action-and-rovo-chat-action-opted-out--default.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-remix-action-experiment-on---default.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-remix-action-and-rovo-chat-action-opted-out--default.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-remix-action-experiment-on---default.png +3 -0
- package/dist/es2019/constants.js +2 -0
- package/dist/es2019/extractors/flexible/actions/extract-remix-action.js +48 -0
- package/dist/es2019/extractors/flexible/actions/index.js +12 -0
- package/dist/es2019/extractors/flexible/index.js +4 -0
- package/dist/es2019/messages.js +4 -9
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/utils/is-remix-action-enabled.js +39 -0
- package/dist/es2019/utils/use-remix-action-exposure.js +11 -0
- package/dist/es2019/view/BlockCard/views/ResolvedView.js +19 -14
- package/dist/es2019/view/EmbedCard/components/rovo-actions-footer/index.js +43 -11
- package/dist/es2019/view/EmbedCard/index.js +2 -0
- package/dist/es2019/view/EmbedCard/views/ResolvedView.js +22 -7
- package/dist/es2019/view/FlexibleCard/components/actions/remix-action/index.js +54 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-block/index.js +3 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +2 -0
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +4 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +9 -4
- package/dist/es2019/view/FlexibleCard/components/blocks/hover-card-footer-block/index.js +1 -1
- package/dist/es2019/view/FlexibleCard/index.js +8 -1
- package/dist/es2019/view/InlineCard/ResolvedView/InlineCardResolvedViewFunctional.js +9 -1
- package/dist/es2019/view/InlineCard/common/inline-card-action/index.js +61 -0
- package/dist/es2019/view/InlineCard/common/remix-action/index.compiled.css +5 -0
- package/dist/es2019/view/InlineCard/common/remix-action/index.js +50 -0
- package/dist/es2019/view/InlineCard/common/rovo-actions-cta/index.js +1 -24
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/common/rovo-chat-utils/index.js +0 -26
- package/dist/es2019/view/common/rovo-post-auth-prompts/index.js +1 -15
- package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-remix-action-and-rovo-chat-action-opted-out--default.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-remix-action-experiment-on---default.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-remix-action-and-rovo-chat-action-opted-out--default.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-remix-action-experiment-on---default.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-remix-action-and-rovo-chat-action-opted-out--default.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-remix-action-experiment-on---default.png +3 -0
- package/dist/esm/constants.js +2 -0
- package/dist/esm/extractors/flexible/actions/extract-remix-action.js +47 -0
- package/dist/esm/extractors/flexible/actions/index.js +11 -2
- package/dist/esm/extractors/flexible/index.js +7 -3
- package/dist/esm/messages.js +4 -9
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/utils/is-remix-action-enabled.js +42 -0
- package/dist/esm/utils/use-remix-action-exposure.js +11 -0
- package/dist/esm/view/BlockCard/views/ResolvedView.js +19 -14
- package/dist/esm/view/EmbedCard/components/rovo-actions-footer/index.js +59 -11
- package/dist/esm/view/EmbedCard/index.js +2 -0
- package/dist/esm/view/EmbedCard/views/ResolvedView.js +23 -7
- package/dist/esm/view/FlexibleCard/components/actions/remix-action/index.js +72 -0
- package/dist/esm/view/FlexibleCard/components/blocks/action-block/index.js +3 -2
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +2 -1
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +5 -1
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +11 -4
- package/dist/esm/view/FlexibleCard/components/blocks/hover-card-footer-block/index.js +1 -1
- package/dist/esm/view/FlexibleCard/index.js +9 -3
- package/dist/esm/view/InlineCard/ResolvedView/InlineCardResolvedViewFunctional.js +9 -1
- package/dist/esm/view/InlineCard/common/inline-card-action/index.js +61 -0
- package/dist/esm/view/InlineCard/common/remix-action/index.compiled.css +5 -0
- package/dist/esm/view/InlineCard/common/remix-action/index.js +70 -0
- package/dist/esm/view/InlineCard/common/rovo-actions-cta/index.js +1 -24
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/common/rovo-chat-utils/index.js +0 -28
- package/dist/esm/view/common/rovo-post-auth-prompts/index.js +1 -16
- package/dist/types/common/analytics/generated/analytics.types.d.ts +11 -1
- package/dist/types/constants.d.ts +2 -0
- package/dist/types/extractors/flexible/actions/extract-remix-action.d.ts +15 -0
- package/dist/types/extractors/flexible/actions/index.d.ts +3 -1
- package/dist/types/extractors/flexible/index.d.ts +1 -1
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/state/flexible-ui-context/types.d.ts +5 -0
- package/dist/types/state/hooks/use-invoke-client-action/types.d.ts +1 -1
- package/dist/types/utils/is-remix-action-enabled.d.ts +15 -0
- package/dist/types/utils/use-remix-action-exposure.d.ts +2 -0
- package/dist/types/view/Card/types.d.ts +10 -1
- package/dist/types/view/EmbedCard/components/rovo-actions-footer/index.d.ts +5 -4
- package/dist/types/view/EmbedCard/views/ResolvedView.d.ts +2 -0
- package/dist/types/view/FlexibleCard/components/actions/remix-action/index.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/action-group/index.d.ts +1 -1
- package/dist/types/view/FlexibleCard/components/blocks/action-group/types.d.ts +4 -0
- package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +8 -2
- package/dist/types/view/FlexibleCard/types.d.ts +2 -1
- package/dist/types/view/InlineCard/common/inline-card-action/index.d.ts +11 -0
- package/dist/types/view/InlineCard/common/remix-action/index.d.ts +9 -0
- package/dist/types/view/common/rovo-chat-utils/index.d.ts +1 -2
- package/dist/types/view/common/rovo-post-auth-prompts/index.d.ts +1 -10
- package/package.json +2 -2
- package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +0 -3
- package/dist/cjs/utils/is-rovo-chat-action-visualize-enabled.js +0 -43
- package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +0 -3
- package/dist/es2019/utils/is-rovo-chat-action-visualize-enabled.js +0 -34
- package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/block-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/embed-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/inline-card-google-sheets-with-visualize-rovo-action-experiment-on---default.png +0 -3
- package/dist/esm/utils/is-rovo-chat-action-visualize-enabled.js +0 -37
- package/dist/types/utils/is-rovo-chat-action-visualize-enabled.d.ts +0 -18
- /package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/{block-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png → block-card-google-sheets-without-remix-action-experiment-off---default.png} +0 -0
- /package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/{embed-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png → embed-card-google-sheets-without-remix-action-experiment-off---default.png} +0 -0
- /package/dist/cjs/__tests__/vr-tests/__snapshots__/google-sheets-visualize/{inline-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png → inline-card-google-sheets-without-remix-action-experiment-off---default.png} +0 -0
- /package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/{block-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png → block-card-google-sheets-without-remix-action-experiment-off---default.png} +0 -0
- /package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/{embed-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png → embed-card-google-sheets-without-remix-action-experiment-off---default.png} +0 -0
- /package/dist/es2019/__tests__/vr-tests/__snapshots__/google-sheets-visualize/{inline-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png → inline-card-google-sheets-without-remix-action-experiment-off---default.png} +0 -0
- /package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/{block-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png → block-card-google-sheets-without-remix-action-experiment-off---default.png} +0 -0
- /package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/{embed-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png → embed-card-google-sheets-without-remix-action-experiment-off---default.png} +0 -0
- /package/dist/esm/__tests__/vr-tests/__snapshots__/google-sheets-visualize/{inline-card-google-sheets-without-visualize-rovo-action-experiment-off---default.png → inline-card-google-sheets-without-remix-action-experiment-off---default.png} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 46.23.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`e307d210d86b3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e307d210d86b3) -
|
|
8
|
+
In the Visualize experiment, the Visualize action on Google Sheets links only shows where the
|
|
9
|
+
`remix` link provider plugin reports Remix is available. Inline, block and embed cards show Remix
|
|
10
|
+
text and icon, and open the plugin-owned Remix modal instead of sending a Rovo Chat prompt.
|
|
11
|
+
|
|
12
|
+
Give Remix its own action configuration (`remixAction.optIn` and `CardAction.RemixAction`
|
|
13
|
+
exclusion), extraction, and click analytics, independent of Rovo Chat actions. Hover previews do
|
|
14
|
+
not show Remix or record an exposure, and Remix clicks reuse the card's analytics ID when
|
|
15
|
+
available.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 46.22.3
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/analytics.spec.yaml
CHANGED
|
@@ -246,6 +246,12 @@ events:
|
|
|
246
246
|
(currently See takeaways); inlineAction identifies Summarize or Explain, whether or not
|
|
247
247
|
a spotlight is visible. Absent for older clients, gate-off and other surfaces.
|
|
248
248
|
|
|
249
|
+
- button clicked (remix):
|
|
250
|
+
type: ui
|
|
251
|
+
description: Fired when Remix is opened via click
|
|
252
|
+
attributes:
|
|
253
|
+
<<: [*PackageMetaDataContext, *ResolvedContext, *ClientActionAttributes]
|
|
254
|
+
|
|
249
255
|
- button clicked (copySummary):
|
|
250
256
|
type: ui
|
|
251
257
|
description: fired when the copy ai summary button is clicked
|
package/dist/cjs/constants.js
CHANGED
|
@@ -162,6 +162,7 @@ var ActionName = exports.ActionName = /*#__PURE__*/function (ActionName) {
|
|
|
162
162
|
}({});
|
|
163
163
|
var InternalActionName = exports.InternalActionName = /*#__PURE__*/function (InternalActionName) {
|
|
164
164
|
InternalActionName["AISummaryAction"] = "AISummaryAction";
|
|
165
|
+
InternalActionName["RemixAction"] = "RemixAction";
|
|
165
166
|
InternalActionName["UnresolvedAction"] = "UnresolvedAction";
|
|
166
167
|
InternalActionName["ViewRelatedLinksAction"] = "ViewRelatedLinksAction";
|
|
167
168
|
return InternalActionName;
|
|
@@ -263,6 +264,7 @@ var CardAction = exports.CardAction = /*#__PURE__*/function (CardAction) {
|
|
|
263
264
|
CardAction["DownloadAction"] = "DownloadAction";
|
|
264
265
|
CardAction["FollowAction"] = "FollowAction";
|
|
265
266
|
CardAction["PreviewAction"] = "PreviewAction";
|
|
267
|
+
CardAction["RemixAction"] = "RemixAction";
|
|
266
268
|
CardAction["RovoChatAction"] = "RovoChatAction";
|
|
267
269
|
CardAction["ViewAction"] = "ViewAction";
|
|
268
270
|
return CardAction;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _extractSmartLinkUrl2 = require("@atlaskit/link-extractors/extract-smart-link-url");
|
|
8
|
+
var _constants = require("../../../constants");
|
|
9
|
+
var _getDefinitionId = require("../../../state/getDefinitionId");
|
|
10
|
+
var _getExtensionKey = require("../../../state/getExtensionKey");
|
|
11
|
+
var _getResourceType = require("../../../state/getResourceType");
|
|
12
|
+
var _canShowAction = require("../../../utils/actions/can-show-action");
|
|
13
|
+
var _isRemixActionEnabled = require("../../../utils/is-remix-action-enabled");
|
|
14
|
+
var extractRemixAction = function extractRemixAction(_ref) {
|
|
15
|
+
var _actionOptions$remixA, _extractSmartLinkUrl;
|
|
16
|
+
var actionOptions = _ref.actionOptions,
|
|
17
|
+
appearance = _ref.appearance,
|
|
18
|
+
id = _ref.id,
|
|
19
|
+
remix = _ref.remix,
|
|
20
|
+
response = _ref.response,
|
|
21
|
+
url = _ref.url;
|
|
22
|
+
if (!(0, _canShowAction.canShowAction)(_constants.CardAction.RemixAction, actionOptions)) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (!(actionOptions !== null && actionOptions !== void 0 && (_actionOptions$remixA = actionOptions.remixAction) !== null && _actionOptions$remixA !== void 0 && _actionOptions$remixA.optIn)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
var remixUrl = (_extractSmartLinkUrl = (0, _extractSmartLinkUrl2.extractSmartLinkUrl)(response)) !== null && _extractSmartLinkUrl !== void 0 ? _extractSmartLinkUrl : url;
|
|
29
|
+
if (!remixUrl) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
var extensionKey = (0, _getExtensionKey.getExtensionKey)(response);
|
|
33
|
+
if (!(0, _isRemixActionEnabled.isRemixActionEnabled)({
|
|
34
|
+
extensionKey: extensionKey,
|
|
35
|
+
remix: remix,
|
|
36
|
+
response: response
|
|
37
|
+
})) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
invokeAction: {
|
|
42
|
+
actionSubjectId: 'remix',
|
|
43
|
+
actionType: _constants.InternalActionName.RemixAction,
|
|
44
|
+
definitionId: (0, _getDefinitionId.getDefinitionId)(response),
|
|
45
|
+
display: appearance,
|
|
46
|
+
extensionKey: extensionKey,
|
|
47
|
+
id: id,
|
|
48
|
+
resourceType: (0, _getResourceType.getResourceType)(response)
|
|
49
|
+
},
|
|
50
|
+
url: remixUrl
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
var _default = exports.default = extractRemixAction;
|
|
@@ -14,6 +14,7 @@ var _extractCopyLinkAction = require("./extract-copy-link-action");
|
|
|
14
14
|
var _extractDownloadAction = require("./extract-download-action");
|
|
15
15
|
var _extractFollowAction = _interopRequireDefault(require("./extract-follow-action"));
|
|
16
16
|
var _extractPreviewAction = require("./extract-preview-action");
|
|
17
|
+
var _extractRemixAction = _interopRequireDefault(require("./extract-remix-action"));
|
|
17
18
|
var _extractRovoChatAction = _interopRequireDefault(require("./extract-rovo-chat-action"));
|
|
18
19
|
var _extractViewRelatedLinksAction = require("./extract-view-related-links-action");
|
|
19
20
|
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; }
|
|
@@ -26,6 +27,7 @@ var extractFlexibleCardActions = exports.extractFlexibleCardActions = function e
|
|
|
26
27
|
id = _ref.id,
|
|
27
28
|
origin = _ref.origin,
|
|
28
29
|
product = _ref.product,
|
|
30
|
+
remix = _ref.remix,
|
|
29
31
|
response = _ref.response,
|
|
30
32
|
rovoConfig = _ref.rovoConfig,
|
|
31
33
|
transformUrl = _ref.transformUrl,
|
|
@@ -33,7 +35,7 @@ var extractFlexibleCardActions = exports.extractFlexibleCardActions = function e
|
|
|
33
35
|
isPreviewPanelAvailable = _ref.isPreviewPanelAvailable,
|
|
34
36
|
isPreviewRestricted = _ref.isPreviewRestricted,
|
|
35
37
|
openPreviewPanel = _ref.openPreviewPanel;
|
|
36
|
-
var action = (
|
|
38
|
+
var action = _objectSpread(_objectSpread((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants.ActionName.CopyLinkAction, (0, _extractCopyLinkAction.extractCopyLinkClientAction)({
|
|
37
39
|
actionOptions: actionOptions,
|
|
38
40
|
appearance: appearance,
|
|
39
41
|
id: id,
|
|
@@ -63,7 +65,14 @@ var extractFlexibleCardActions = exports.extractFlexibleCardActions = function e
|
|
|
63
65
|
product: product,
|
|
64
66
|
response: response,
|
|
65
67
|
rovoConfig: rovoConfig
|
|
66
|
-
})), _constants.InternalActionName.
|
|
68
|
+
})), (0, _fg.fg)('platform_sl_3p_auth_visualize_killswitch') ? (0, _defineProperty2.default)({}, _constants.InternalActionName.RemixAction, (0, _extractRemixAction.default)({
|
|
69
|
+
actionOptions: actionOptions,
|
|
70
|
+
appearance: appearance,
|
|
71
|
+
id: id,
|
|
72
|
+
remix: remix,
|
|
73
|
+
response: response,
|
|
74
|
+
url: url
|
|
75
|
+
})) : undefined), {}, (0, _defineProperty2.default)({}, _constants.InternalActionName.ViewRelatedLinksAction, (0, _extractViewRelatedLinksAction.extractViewRelatedLinksAction)(response)));
|
|
67
76
|
return Object.values(action).some(function (value) {
|
|
68
77
|
return Boolean(value);
|
|
69
78
|
}) ? action : undefined;
|
|
@@ -53,7 +53,7 @@ var _extractViewCount = require("./extract-view-count");
|
|
|
53
53
|
var _extractVoteCount = require("./extract-vote-count");
|
|
54
54
|
var _extractSmartLinkIcon = require("./icon/extract-smart-link-icon");
|
|
55
55
|
var _latestCommit = require("./latest-commit");
|
|
56
|
-
var _excluded = ["appearance", "fireEvent", "id", "onClick", "onAuxClick", "onContextMenu", "origin", "product", "resolve", "rovoConfig", "actionOptions", "response", "status", "aiSummaryConfig", "isPreviewPanelAvailable", "isPreviewRestricted", "openPreviewPanel", "transformUrl"];
|
|
56
|
+
var _excluded = ["appearance", "fireEvent", "id", "onClick", "onAuxClick", "onContextMenu", "origin", "product", "resolve", "rovoConfig", "remix", "actionOptions", "response", "status", "aiSummaryConfig", "isPreviewPanelAvailable", "isPreviewRestricted", "openPreviewPanel", "transformUrl"];
|
|
57
57
|
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; }
|
|
58
58
|
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; }
|
|
59
59
|
var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
@@ -69,6 +69,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
69
69
|
product = _ref.product,
|
|
70
70
|
resolve = _ref.resolve,
|
|
71
71
|
rovoConfig = _ref.rovoConfig,
|
|
72
|
+
remix = _ref.remix,
|
|
72
73
|
actionOptions = _ref.actionOptions,
|
|
73
74
|
response = _ref.response,
|
|
74
75
|
status = _ref.status,
|
|
@@ -87,7 +88,7 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
87
88
|
var meta = (_response$meta = response.meta) !== null && _response$meta !== void 0 ? _response$meta : {};
|
|
88
89
|
var url = (0, _extractSmartLinkUrl.extractSmartLinkUrl)(response);
|
|
89
90
|
return {
|
|
90
|
-
actions: (0, _actions.extractFlexibleCardActions)(_objectSpread(_objectSpread({
|
|
91
|
+
actions: (0, _actions.extractFlexibleCardActions)(_objectSpread(_objectSpread(_objectSpread({
|
|
91
92
|
actionOptions: actionOptions,
|
|
92
93
|
aiSummaryConfig: aiSummaryConfig,
|
|
93
94
|
appearance: appearance,
|
|
@@ -95,7 +96,10 @@ var extractFlexibleUiContext = function extractFlexibleUiContext() {
|
|
|
95
96
|
id: id,
|
|
96
97
|
origin: origin,
|
|
97
98
|
product: product,
|
|
98
|
-
rovoConfig: rovoConfig
|
|
99
|
+
rovoConfig: rovoConfig
|
|
100
|
+
}, (0, _fg.fg)('platform_sl_3p_auth_visualize_killswitch') ? {
|
|
101
|
+
remix: remix
|
|
102
|
+
} : undefined), {}, {
|
|
99
103
|
response: response,
|
|
100
104
|
url: props.url,
|
|
101
105
|
// Use the original URL in edge cases, such as short links for AI summary and copy link actions.
|
package/dist/cjs/messages.js
CHANGED
|
@@ -1117,14 +1117,9 @@ var messages = exports.messages = (0, _reactIntl.defineMessages)({
|
|
|
1117
1117
|
defaultMessage: 'Your team sees richer <b>{provider}</b> previews.',
|
|
1118
1118
|
description: 'Social proof message shown on unauthorized 3P block cards when less than 30% of the tenant has connected the provider. {provider} is the 3P app name (e.g. OneDrive).'
|
|
1119
1119
|
},
|
|
1120
|
-
|
|
1121
|
-
id: 'fabric.linking.
|
|
1122
|
-
defaultMessage: '
|
|
1123
|
-
description: '
|
|
1124
|
-
},
|
|
1125
|
-
rovo_prompt_message_visualize: {
|
|
1126
|
-
id: 'fabric.linking.rovo_prompt_message_visualize.non-final',
|
|
1127
|
-
defaultMessage: '<p>Visualize this link <a>{url}</a></p>',
|
|
1128
|
-
description: 'The prompt message to send to Rovo Chat. {url} refers to Smart Link that the user triggers this action from. (Please make sure all html tags remain the same.)'
|
|
1120
|
+
rovo_prompt_button_remix: {
|
|
1121
|
+
id: 'fabric.linking.rovo_prompt_button_remix.non-final',
|
|
1122
|
+
defaultMessage: 'Remix',
|
|
1123
|
+
description: 'Button that opens the Remix chooser for this Smart Link.'
|
|
1129
1124
|
}
|
|
1130
1125
|
});
|
|
@@ -25,7 +25,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
25
25
|
var context = exports.context = {
|
|
26
26
|
componentName: 'smart-cards',
|
|
27
27
|
packageName: "@atlaskit/smart-card" || '',
|
|
28
|
-
packageVersion: "46.22.
|
|
28
|
+
packageVersion: "46.22.3" || ''
|
|
29
29
|
};
|
|
30
30
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
31
31
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isRemixActionEnabled = void 0;
|
|
7
|
+
var _unsafeExpValNoExposure = require("@atlaskit/platform-feature-experiments/unsafe-exp-val-no-exposure");
|
|
8
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
9
|
+
/**
|
|
10
|
+
* Check rollout without exposure: the action may never be rendered, e.g. in a hover preview.
|
|
11
|
+
* Remove this function on experiment cleanup; the business rules stay.
|
|
12
|
+
*/
|
|
13
|
+
var isRemixExperimentEnabled = function isRemixExperimentEnabled() {
|
|
14
|
+
return (0, _fg.fg)('platform_sl_3p_auth_visualize_killswitch') && (0, _unsafeExpValNoExposure.UNSAFE_expValNoExposure)('platform_sl_3p_auth_visualize_exp', 'isEnabled', false);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* `@type` is a string or string array per JSON-LD, but it comes from the network, so guard
|
|
19
|
+
* against any other shape rather than calling `.includes` on it directly.
|
|
20
|
+
*/
|
|
21
|
+
var isGoogleSheetsType = function isGoogleSheetsType(response) {
|
|
22
|
+
var _response$data;
|
|
23
|
+
var type = response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data['@type'];
|
|
24
|
+
var types = Array.isArray(type) ? type : [type];
|
|
25
|
+
return types.includes('schema:SpreadsheetDigitalDocument');
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Capability callbacks are implemented outside smart-card. Treat a failure as
|
|
29
|
+
// unavailable instead of failing card extraction/rendering.
|
|
30
|
+
var isRemixAvailable = function isRemixAvailable(remix) {
|
|
31
|
+
try {
|
|
32
|
+
return Boolean(remix === null || remix === void 0 ? void 0 : remix.isAvailable());
|
|
33
|
+
} catch (_unused) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Whether the Remix action is offered for a resolved link.
|
|
40
|
+
*
|
|
41
|
+
* This check does not record exposure. The rendered Remix control owns exposure.
|
|
42
|
+
*/
|
|
43
|
+
var isRemixActionEnabled = exports.isRemixActionEnabled = function isRemixActionEnabled(_ref) {
|
|
44
|
+
var extensionKey = _ref.extensionKey,
|
|
45
|
+
remix = _ref.remix,
|
|
46
|
+
response = _ref.response;
|
|
47
|
+
return extensionKey === 'google-object-provider' && isGoogleSheetsType(response) && isRemixAvailable(remix) && isRemixExperimentEnabled();
|
|
48
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useRemixActionExposure = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _expVal = require("@atlaskit/platform-feature-experiments/exp-val");
|
|
9
|
+
/** Record exposure only once the eligible Remix control has been committed. */
|
|
10
|
+
var useRemixActionExposure = exports.useRemixActionExposure = function useRemixActionExposure(isRendered) {
|
|
11
|
+
(0, _react.useEffect)(function () {
|
|
12
|
+
if (isRendered) {
|
|
13
|
+
(0, _expVal.expVal)('platform_sl_3p_auth_visualize_exp', 'isEnabled', false);
|
|
14
|
+
}
|
|
15
|
+
}, [isRendered]);
|
|
16
|
+
};
|
|
@@ -14,12 +14,12 @@ var _runtime = require("@compiled/react/runtime");
|
|
|
14
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
15
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
16
16
|
var _userAgent = require("@atlaskit/linking-common/user-agent");
|
|
17
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
17
18
|
var _constants = require("../../../constants");
|
|
18
19
|
var _extractRovoChatAction = _interopRequireDefault(require("../../../extractors/flexible/actions/extract-rovo-chat-action"));
|
|
19
20
|
var _getExtensionKey = require("../../../state/getExtensionKey");
|
|
20
21
|
var _useBlockCardRovoActionExperiment = _interopRequireDefault(require("../../../state/hooks/use-block-card-rovo-action-experiment"));
|
|
21
22
|
var _useRovoConfig = _interopRequireDefault(require("../../../state/hooks/use-rovo-config"));
|
|
22
|
-
var _isRovoChatActionVisualizeEnabled = require("../../../utils/is-rovo-chat-action-visualize-enabled");
|
|
23
23
|
var _rovoChatUtils = require("../../common/rovo-chat-utils");
|
|
24
24
|
var _FlexibleCard = _interopRequireDefault(require("../../FlexibleCard"));
|
|
25
25
|
var _footerBlock = _interopRequireDefault(require("../../FlexibleCard/components/blocks/footer-block"));
|
|
@@ -42,6 +42,7 @@ var footerBlockSafariStyles = null;
|
|
|
42
42
|
*/
|
|
43
43
|
var ResolvedView = function ResolvedView(_ref) {
|
|
44
44
|
var cardState = _ref.cardState,
|
|
45
|
+
id = _ref.id,
|
|
45
46
|
onClick = _ref.onClick,
|
|
46
47
|
onAuxClick = _ref.onAuxClick,
|
|
47
48
|
onContextMenu = _ref.onContextMenu,
|
|
@@ -86,26 +87,20 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
86
87
|
return [_rovoChatUtils.RovoChatPromptKey.IDENTIFY_KEY_POINTS].concat(defaultPrompts);
|
|
87
88
|
}
|
|
88
89
|
if (extensionKey === 'google-object-provider' && linkType !== null && linkType !== void 0 && linkType.includes('schema:SpreadsheetDigitalDocument')) {
|
|
89
|
-
if ((0, _isRovoChatActionVisualizeEnabled.isRovoChatActionVisualizeEnabled)({
|
|
90
|
-
extensionKey: extensionKey,
|
|
91
|
-
product: rovoConfig === null || rovoConfig === void 0 ? void 0 : rovoConfig.product,
|
|
92
|
-
response: cardState === null || cardState === void 0 ? void 0 : cardState.details
|
|
93
|
-
})) {
|
|
94
|
-
return [_rovoChatUtils.RovoChatPromptKey.IDENTIFY_KEY_TRENDS, _rovoChatUtils.RovoChatPromptKey.VISUALIZE].concat(defaultPrompts);
|
|
95
|
-
}
|
|
96
90
|
return [_rovoChatUtils.RovoChatPromptKey.IDENTIFY_KEY_TRENDS].concat(defaultPrompts);
|
|
97
91
|
}
|
|
98
92
|
return [_rovoChatUtils.RovoChatPromptKey.SUMMARIZE_LINK].concat(defaultPrompts);
|
|
99
93
|
}
|
|
100
94
|
return [];
|
|
101
|
-
}, [cardState === null || cardState === void 0 ? void 0 : cardState.details, extensionKey, is3PRovoBlockRovoActionEnabled
|
|
95
|
+
}, [cardState === null || cardState === void 0 ? void 0 : cardState.details, extensionKey, is3PRovoBlockRovoActionEnabled]);
|
|
102
96
|
var footerActions = (0, _react.useMemo)(function () {
|
|
103
97
|
var showRovoResolvedView = (cardState === null || cardState === void 0 ? void 0 : cardState.status) === 'resolved' && cardState.details && (0, _extractRovoChatAction.default)({
|
|
104
98
|
response: cardState.details,
|
|
105
99
|
rovoConfig: rovoConfig,
|
|
106
100
|
actionOptions: actionOptions
|
|
107
101
|
}) !== undefined;
|
|
108
|
-
|
|
102
|
+
var usesIconFooter = showRovoResolvedView && is3PRovoBlockRovoActionEnabled;
|
|
103
|
+
var actions = usesIconFooter ? [{
|
|
109
104
|
name: _constants.ActionName.RovoChatAction,
|
|
110
105
|
prompts: prompts,
|
|
111
106
|
iconSize: 'small',
|
|
@@ -126,13 +121,23 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
126
121
|
name: _constants.ActionName.DownloadAction,
|
|
127
122
|
hideIcon: true
|
|
128
123
|
}];
|
|
124
|
+
return (0, _fg.fg)('platform_sl_3p_auth_visualize_killswitch') ? [usesIconFooter ? {
|
|
125
|
+
name: _constants.InternalActionName.RemixAction,
|
|
126
|
+
iconSize: 'small'
|
|
127
|
+
} : {
|
|
128
|
+
name: _constants.InternalActionName.RemixAction,
|
|
129
|
+
hideIcon: true
|
|
130
|
+
}].concat(actions) : actions;
|
|
129
131
|
}, [prompts, is3PRovoBlockRovoActionEnabled, cardState, rovoConfig, actionOptions]);
|
|
130
132
|
var uiOptions = _utils.FlexibleCardUiOptions;
|
|
131
133
|
uiOptions.enableSnippetRenderer = true;
|
|
132
134
|
uiOptions.hideLoadingSkeleton = hideIconLoadingSkeleton;
|
|
133
|
-
return /*#__PURE__*/React.createElement(_FlexibleCard.default, {
|
|
135
|
+
return /*#__PURE__*/React.createElement(_FlexibleCard.default, (0, _extends2.default)({
|
|
134
136
|
appearance: "block",
|
|
135
|
-
cardState: cardState
|
|
137
|
+
cardState: cardState
|
|
138
|
+
}, (0, _fg.fg)('platform_sl_3p_auth_visualize_killswitch') ? {
|
|
139
|
+
id: id
|
|
140
|
+
} : undefined, {
|
|
136
141
|
onClick: onClick,
|
|
137
142
|
onAuxClick: onAuxClick,
|
|
138
143
|
onContextMenu: onContextMenu,
|
|
@@ -143,7 +148,7 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
143
148
|
testId: testId,
|
|
144
149
|
ui: uiOptions,
|
|
145
150
|
url: url
|
|
146
|
-
}, /*#__PURE__*/React.createElement(_titleBlock.default, (0, _extends2.default)({}, _utils.titleBlockOptions, {
|
|
151
|
+
}), /*#__PURE__*/React.createElement(_titleBlock.default, (0, _extends2.default)({}, _utils.titleBlockOptions, {
|
|
147
152
|
metadata: titleMetadata,
|
|
148
153
|
subtitle: [{
|
|
149
154
|
name: _constants.ElementName.Location
|
|
@@ -16,10 +16,14 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
16
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
17
|
var _reactIntl = require("react-intl");
|
|
18
18
|
var _button = _interopRequireDefault(require("@atlaskit/button/default/button"));
|
|
19
|
+
var _aiGenerativeRemix = _interopRequireDefault(require("@atlaskit/icon-lab/core/ai-generative-remix"));
|
|
20
|
+
var _usePlugins2 = require("@atlaskit/link-provider/use-plugins");
|
|
19
21
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
20
22
|
var _widthObserver = require("@atlaskit/width-detector/width-observer");
|
|
23
|
+
var _messages = require("../../../../messages");
|
|
21
24
|
var _useInvokeClientAction = _interopRequireDefault(require("../../../../state/hooks/use-invoke-client-action"));
|
|
22
25
|
var _useRovoChat2 = _interopRequireDefault(require("../../../../state/hooks/use-rovo-chat"));
|
|
26
|
+
var _useRemixActionExposure = require("../../../../utils/use-remix-action-exposure");
|
|
23
27
|
var _rovoChatUtils = require("../../../common/rovo-chat-utils");
|
|
24
28
|
var _aiEditIcon = _interopRequireDefault(require("../../../FlexibleCard/assets/ai-edit-icon"));
|
|
25
29
|
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); }
|
|
@@ -58,10 +62,13 @@ var RovoPromptButton = function RovoPromptButton(_ref) {
|
|
|
58
62
|
};
|
|
59
63
|
var EmbedRovoActionsFooter = function EmbedRovoActionsFooter(_ref2) {
|
|
60
64
|
var actionData = _ref2.actionData,
|
|
65
|
+
remixActionData = _ref2.remixActionData,
|
|
61
66
|
prompts = _ref2.prompts,
|
|
62
67
|
_ref2$testId = _ref2.testId,
|
|
63
68
|
testId = _ref2$testId === void 0 ? 'embed-rovo-actions-footer' : _ref2$testId;
|
|
64
69
|
var intl = (0, _reactIntl.useIntl)();
|
|
70
|
+
var _usePlugins = (0, _usePlugins2.usePlugins)(),
|
|
71
|
+
remix = _usePlugins.remix;
|
|
65
72
|
var invoke = (0, _useInvokeClientAction.default)({});
|
|
66
73
|
var _useRovoChat = (0, _useRovoChat2.default)(),
|
|
67
74
|
isRovoChatEnabled = _useRovoChat.isRovoChatEnabled,
|
|
@@ -72,9 +79,14 @@ var EmbedRovoActionsFooter = function EmbedRovoActionsFooter(_ref2) {
|
|
|
72
79
|
setContainerWidth = _useState2[1];
|
|
73
80
|
var shouldHideSecondaryActions = containerWidth !== undefined && containerWidth < HIDE_SECONDARY_ACTIONS_WIDTH;
|
|
74
81
|
var shouldHidePrimaryActionContent = containerWidth !== undefined && containerWidth < PRIMARY_ACTION_ICON_ONLY_WIDTH;
|
|
82
|
+
var isRemixVisible = Boolean(remixActionData && remix);
|
|
83
|
+
(0, _useRemixActionExposure.useRemixActionExposure)(isRemixVisible);
|
|
75
84
|
var onClick = (0, _react.useCallback)(function (event, promptData, promptKey) {
|
|
76
85
|
event.preventDefault();
|
|
77
86
|
event.stopPropagation();
|
|
87
|
+
if (!actionData) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
78
90
|
invoke(_objectSpread(_objectSpread({}, actionData.invokeAction), {}, {
|
|
79
91
|
actionFn: function () {
|
|
80
92
|
var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
@@ -95,7 +107,7 @@ var EmbedRovoActionsFooter = function EmbedRovoActionsFooter(_ref2) {
|
|
|
95
107
|
}(),
|
|
96
108
|
prompt: promptKey
|
|
97
109
|
}));
|
|
98
|
-
}, [actionData
|
|
110
|
+
}, [actionData, invoke, sendPromptMessage]);
|
|
99
111
|
var promptActions = (0, _react.useMemo)(function () {
|
|
100
112
|
return prompts.reduce(function (actions, promptKey) {
|
|
101
113
|
if (shouldHideSecondaryActions && actions.length > 0) {
|
|
@@ -104,21 +116,20 @@ var EmbedRovoActionsFooter = function EmbedRovoActionsFooter(_ref2) {
|
|
|
104
116
|
var promptAction = (0, _rovoChatUtils.getPromptAction)({
|
|
105
117
|
promptKey: promptKey,
|
|
106
118
|
intl: intl,
|
|
107
|
-
url: actionData.url,
|
|
108
|
-
product: actionData.product,
|
|
119
|
+
url: actionData === null || actionData === void 0 ? void 0 : actionData.url,
|
|
120
|
+
product: actionData === null || actionData === void 0 ? void 0 : actionData.product,
|
|
109
121
|
iconSize: 'small'
|
|
110
122
|
});
|
|
111
123
|
if (!promptAction) {
|
|
112
124
|
return actions;
|
|
113
125
|
}
|
|
114
126
|
var isPrimaryAction = actions.length === 0;
|
|
115
|
-
// The primary action normally uses the branded AI icon.
|
|
116
|
-
// chart icon so the action stays recognisable, including in the icon-only view.
|
|
127
|
+
// The primary chat action normally uses the branded AI icon.
|
|
117
128
|
// With platform_sl_rovo_summarize_icon_consistency on, every action keeps its own
|
|
118
129
|
// prompt icon so Summarize matches the inline and block cards.
|
|
119
|
-
var shouldUseBrandedIcon = (0, _fg.fg)('platform_sl_rovo_summarize_icon_consistency') ? false : isPrimaryAction
|
|
130
|
+
var shouldUseBrandedIcon = (0, _fg.fg)('platform_sl_rovo_summarize_icon_consistency') ? false : isPrimaryAction;
|
|
120
131
|
actions.push( /*#__PURE__*/_react.default.createElement(RovoPromptButton, {
|
|
121
|
-
hideContent: isPrimaryAction && shouldHidePrimaryActionContent,
|
|
132
|
+
hideContent: isPrimaryAction && !remixActionData && shouldHidePrimaryActionContent,
|
|
122
133
|
icon: shouldUseBrandedIcon ? /*#__PURE__*/_react.default.createElement(_aiEditIcon.default, null) : promptAction.icon,
|
|
123
134
|
key: promptKey,
|
|
124
135
|
onClick: onClick,
|
|
@@ -128,8 +139,8 @@ var EmbedRovoActionsFooter = function EmbedRovoActionsFooter(_ref2) {
|
|
|
128
139
|
}));
|
|
129
140
|
return actions;
|
|
130
141
|
}, []);
|
|
131
|
-
}, [actionData.product, actionData.url, intl, onClick, prompts, shouldHidePrimaryActionContent, shouldHideSecondaryActions, testId]);
|
|
132
|
-
if (!isRovoChatEnabled || promptActions.length === 0) {
|
|
142
|
+
}, [actionData === null || actionData === void 0 ? void 0 : actionData.product, actionData === null || actionData === void 0 ? void 0 : actionData.url, intl, onClick, prompts, remixActionData, shouldHidePrimaryActionContent, shouldHideSecondaryActions, testId]);
|
|
143
|
+
if (!isRemixVisible && (!isRovoChatEnabled || !actionData || promptActions.length === 0)) {
|
|
133
144
|
return null;
|
|
134
145
|
}
|
|
135
146
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -139,6 +150,43 @@ var EmbedRovoActionsFooter = function EmbedRovoActionsFooter(_ref2) {
|
|
|
139
150
|
offscreen: true
|
|
140
151
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
141
152
|
className: (0, _runtime.ax)([styles.actionGroup])
|
|
142
|
-
},
|
|
153
|
+
}, remixActionData && remix ? /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
154
|
+
appearance: "subtle",
|
|
155
|
+
spacing: "compact",
|
|
156
|
+
"aria-label": intl.formatMessage(_messages.messages.rovo_prompt_button_remix),
|
|
157
|
+
iconBefore: function iconBefore() {
|
|
158
|
+
return /*#__PURE__*/_react.default.createElement(_aiGenerativeRemix.default, {
|
|
159
|
+
label: "",
|
|
160
|
+
size: "small"
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
onClick: function onClick(event) {
|
|
164
|
+
event.preventDefault();
|
|
165
|
+
event.stopPropagation();
|
|
166
|
+
var anchorElement = event.currentTarget;
|
|
167
|
+
void invoke(_objectSpread(_objectSpread({}, remixActionData.invokeAction), {}, {
|
|
168
|
+
actionFn: function () {
|
|
169
|
+
var _actionFn2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
170
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
171
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
172
|
+
case 0:
|
|
173
|
+
return _context2.abrupt("return", remix.open({
|
|
174
|
+
anchorElement: anchorElement,
|
|
175
|
+
url: remixActionData.url
|
|
176
|
+
}));
|
|
177
|
+
case 1:
|
|
178
|
+
case "end":
|
|
179
|
+
return _context2.stop();
|
|
180
|
+
}
|
|
181
|
+
}, _callee2);
|
|
182
|
+
}));
|
|
183
|
+
function actionFn() {
|
|
184
|
+
return _actionFn2.apply(this, arguments);
|
|
185
|
+
}
|
|
186
|
+
return actionFn;
|
|
187
|
+
}()
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
}, shouldHidePrimaryActionContent ? undefined : intl.formatMessage(_messages.messages.rovo_prompt_button_remix)) : null, isRovoChatEnabled && actionData && !(remixActionData && shouldHideSecondaryActions) ? promptActions : null));
|
|
143
191
|
};
|
|
144
192
|
var _default = exports.default = EmbedRovoActionsFooter;
|
|
@@ -33,6 +33,7 @@ var UFOLoadHoldWrapper = function UFOLoadHoldWrapper(_ref) {
|
|
|
33
33
|
var EmbedCard = exports.EmbedCard = /*#__PURE__*/_react.default.forwardRef(function (_ref2, iframeRef) {
|
|
34
34
|
var _details$meta2, _forbiddenViewProps$c, _forbiddenViewProps$c2, _notFoundViewProps$co, _notFoundViewProps$co2;
|
|
35
35
|
var url = _ref2.url,
|
|
36
|
+
id = _ref2.id,
|
|
36
37
|
cardState = _ref2.cardState,
|
|
37
38
|
handleAuthorize = _ref2.handleAuthorize,
|
|
38
39
|
handleErrorRetry = _ref2.handleErrorRetry,
|
|
@@ -105,6 +106,7 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/_react.default.forwardRef(funct
|
|
|
105
106
|
}
|
|
106
107
|
if (resolvedViewProps.preview) {
|
|
107
108
|
return /*#__PURE__*/_react.default.createElement(_ResolvedView3.EmbedCardResolvedView, (0, _extends2.default)({}, resolvedViewProps, {
|
|
109
|
+
id: id,
|
|
108
110
|
actionOptions: actionOptions,
|
|
109
111
|
details: details,
|
|
110
112
|
isSelected: isSelected,
|
|
@@ -12,9 +12,12 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
|
12
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _link = _interopRequireDefault(require("@atlaskit/icon/core/link"));
|
|
15
|
+
var _usePlugins2 = require("@atlaskit/link-provider/use-plugins");
|
|
15
16
|
var _useSmartLinkContext2 = require("@atlaskit/link-provider/use-smart-link-context");
|
|
17
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
16
18
|
var _useThemeObserver = require("@atlaskit/tokens/use-theme-observer");
|
|
17
19
|
var _constants = require("../../../constants");
|
|
20
|
+
var _extractRemixAction = _interopRequireDefault(require("../../../extractors/flexible/actions/extract-remix-action"));
|
|
18
21
|
var _extractRovoChatAction = _interopRequireDefault(require("../../../extractors/flexible/actions/extract-rovo-chat-action"));
|
|
19
22
|
var _getExtensionKey = require("../../../state/getExtensionKey");
|
|
20
23
|
var _useEmbedRovoActionsFooterExperiment = _interopRequireDefault(require("../../../state/hooks/use-embed-rovo-actions-footer-experiment"));
|
|
@@ -43,11 +46,14 @@ var EmbedFrameWithRovoFooter = function EmbedFrameWithRovoFooter(_ref) {
|
|
|
43
46
|
var actionOptions = _ref.actionOptions,
|
|
44
47
|
details = _ref.details,
|
|
45
48
|
frame = _ref.frame,
|
|
49
|
+
id = _ref.id,
|
|
46
50
|
link = _ref.link,
|
|
47
51
|
testId = _ref.testId;
|
|
48
52
|
var _useRovoConfig = (0, _useRovoConfig2.default)(),
|
|
49
53
|
rovoOptions = _useRovoConfig.rovoOptions,
|
|
50
54
|
product = _useRovoConfig.product;
|
|
55
|
+
var _usePlugins = (0, _usePlugins2.usePlugins)(),
|
|
56
|
+
remix = _usePlugins.remix;
|
|
51
57
|
var _useEmbedRovoActionsF = (0, _useEmbedRovoActionsFooterExperiment.default)(link, actionOptions, rovoOptions, product),
|
|
52
58
|
isEmbedRovoActionsFooterEnabled = _useEmbedRovoActionsF.isEnabled;
|
|
53
59
|
var rovoActionData = _react.default.useMemo(function () {
|
|
@@ -62,24 +68,32 @@ var EmbedFrameWithRovoFooter = function EmbedFrameWithRovoFooter(_ref) {
|
|
|
62
68
|
appearance: _constants.CardDisplay.Embed
|
|
63
69
|
}) : undefined;
|
|
64
70
|
}, [actionOptions, details, isEmbedRovoActionsFooterEnabled, product, rovoOptions]);
|
|
71
|
+
var remixActionData = _react.default.useMemo(function () {
|
|
72
|
+
return details && (0, _fg.fg)('platform_sl_3p_auth_visualize_killswitch') ? (0, _extractRemixAction.default)({
|
|
73
|
+
response: details,
|
|
74
|
+
url: link,
|
|
75
|
+
remix: remix,
|
|
76
|
+
actionOptions: actionOptions,
|
|
77
|
+
appearance: 'embed',
|
|
78
|
+
id: id
|
|
79
|
+
}) : undefined;
|
|
80
|
+
}, [details, link, remix, actionOptions, id]);
|
|
65
81
|
var prompts = _react.default.useMemo(function () {
|
|
66
82
|
if (!isEmbedRovoActionsFooterEnabled) {
|
|
67
83
|
return [];
|
|
68
84
|
}
|
|
69
85
|
return (0, _rovoPostAuthPrompts.getRovoPostAuthPromptKeys)({
|
|
70
|
-
extensionKey: (0, _getExtensionKey.getExtensionKey)(details)
|
|
71
|
-
isRovoChatActionShown: !!rovoActionData,
|
|
72
|
-
product: product,
|
|
73
|
-
response: details
|
|
86
|
+
extensionKey: (0, _getExtensionKey.getExtensionKey)(details)
|
|
74
87
|
});
|
|
75
|
-
}, [details, isEmbedRovoActionsFooterEnabled
|
|
88
|
+
}, [details, isEmbedRovoActionsFooterEnabled]);
|
|
76
89
|
var footer = _react.default.useMemo(function () {
|
|
77
|
-
return rovoActionData && prompts.length > 0 ? /*#__PURE__*/_react.default.createElement(LazyEmbedRovoActionsFooter, {
|
|
90
|
+
return rovoActionData && prompts.length > 0 || remixActionData ? /*#__PURE__*/_react.default.createElement(LazyEmbedRovoActionsFooter, {
|
|
78
91
|
actionData: rovoActionData,
|
|
92
|
+
remixActionData: remixActionData,
|
|
79
93
|
prompts: prompts,
|
|
80
94
|
testId: "".concat(testId, "-rovo-actions-footer")
|
|
81
95
|
}) : undefined;
|
|
82
|
-
}, [prompts, rovoActionData, testId]);
|
|
96
|
+
}, [prompts, rovoActionData, remixActionData, testId]);
|
|
83
97
|
return footer ? /*#__PURE__*/_react.default.createElement("div", {
|
|
84
98
|
className: (0, _runtime.ax)([styles.contentWithFooter])
|
|
85
99
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -93,6 +107,7 @@ var EmbedCardResolvedView = exports.EmbedCardResolvedView = /*#__PURE__*/_react.
|
|
|
93
107
|
link = _ref2.link,
|
|
94
108
|
context = _ref2.context,
|
|
95
109
|
details = _ref2.details,
|
|
110
|
+
id = _ref2.id,
|
|
96
111
|
onClick = _ref2.onClick,
|
|
97
112
|
onAuxClick = _ref2.onAuxClick,
|
|
98
113
|
onContextMenu = _ref2.onContextMenu,
|
|
@@ -173,6 +188,7 @@ var EmbedCardResolvedView = exports.EmbedCardResolvedView = /*#__PURE__*/_react.
|
|
|
173
188
|
actionOptions: actionOptions,
|
|
174
189
|
details: details,
|
|
175
190
|
frame: frame,
|
|
191
|
+
id: id,
|
|
176
192
|
link: link,
|
|
177
193
|
testId: testId
|
|
178
194
|
});
|