@atlaskit/smart-card 45.5.0 → 45.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/cjs/extractors/flexible/actions/extract-rovo-chat-action.js +3 -1
- package/dist/cjs/state/hooks/use-embed-rovo-actions-footer-experiment/index.js +65 -0
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/CardWithUrl/component.js +1 -0
- package/dist/cjs/view/CardWithUrl/experiment-meta-event-attributes/index.js +17 -3
- package/dist/cjs/view/EmbedCard/components/rovo-actions-footer/index.compiled.css +3 -0
- package/dist/cjs/view/EmbedCard/components/rovo-actions-footer/index.js +138 -0
- package/dist/cjs/view/EmbedCard/index.js +2 -0
- package/dist/cjs/view/EmbedCard/views/ResolvedView.compiled.css +6 -0
- package/dist/cjs/view/EmbedCard/views/ResolvedView.js +129 -36
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/cjs/view/common/rovo-post-auth-prompts/index.js +15 -0
- package/dist/es2019/extractors/flexible/actions/extract-rovo-chat-action.js +3 -1
- package/dist/es2019/state/hooks/use-embed-rovo-actions-footer-experiment/index.js +58 -0
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/CardWithUrl/component.js +1 -0
- package/dist/es2019/view/CardWithUrl/experiment-meta-event-attributes/index.js +18 -2
- package/dist/es2019/view/EmbedCard/components/rovo-actions-footer/index.compiled.css +3 -0
- package/dist/es2019/view/EmbedCard/components/rovo-actions-footer/index.js +100 -0
- package/dist/es2019/view/EmbedCard/index.js +2 -0
- package/dist/es2019/view/EmbedCard/views/ResolvedView.compiled.css +6 -0
- package/dist/es2019/view/EmbedCard/views/ResolvedView.js +94 -13
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/es2019/view/common/rovo-post-auth-prompts/index.js +10 -0
- package/dist/esm/extractors/flexible/actions/extract-rovo-chat-action.js +3 -1
- package/dist/esm/state/hooks/use-embed-rovo-actions-footer-experiment/index.js +58 -0
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/CardWithUrl/component.js +1 -0
- package/dist/esm/view/CardWithUrl/experiment-meta-event-attributes/index.js +17 -3
- package/dist/esm/view/EmbedCard/components/rovo-actions-footer/index.compiled.css +3 -0
- package/dist/esm/view/EmbedCard/components/rovo-actions-footer/index.js +129 -0
- package/dist/esm/view/EmbedCard/index.js +2 -0
- package/dist/esm/view/EmbedCard/views/ResolvedView.compiled.css +6 -0
- package/dist/esm/view/EmbedCard/views/ResolvedView.js +125 -36
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/esm/view/common/rovo-post-auth-prompts/index.js +9 -0
- package/dist/types/extractors/flexible/actions/extract-rovo-chat-action.d.ts +2 -1
- package/dist/types/state/hooks/use-embed-rovo-actions-footer-experiment/index.d.ts +23 -0
- package/dist/types/view/CardWithUrl/experiment-meta-event-attributes/index.d.ts +5 -2
- package/dist/types/view/EmbedCard/components/rovo-actions-footer/index.d.ts +14 -0
- package/dist/types/view/EmbedCard/views/ResolvedView.d.ts +8 -0
- package/dist/types/view/common/rovo-post-auth-prompts/index.d.ts +5 -0
- package/package.json +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/smart-card
|
|
2
2
|
|
|
3
|
+
## 45.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`0c3036cbf6b5c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0c3036cbf6b5c) -
|
|
8
|
+
Add gated Rovo actions footer experiment for eligible resolved 3P Smart Link embeds in Confluence.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 45.5.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
|
@@ -18,6 +18,7 @@ var extractRovoChatAction = function extractRovoChatAction(_ref) {
|
|
|
18
18
|
var actionOptions = _ref.actionOptions,
|
|
19
19
|
appearance = _ref.appearance,
|
|
20
20
|
id = _ref.id,
|
|
21
|
+
isEmbedRovoActionsFooterExperimentEnabled = _ref.isEmbedRovoActionsFooterExperimentEnabled,
|
|
21
22
|
product = _ref.product,
|
|
22
23
|
response = _ref.response,
|
|
23
24
|
rovoConfig = _ref.rovoConfig;
|
|
@@ -33,7 +34,8 @@ var extractRovoChatAction = function extractRovoChatAction(_ref) {
|
|
|
33
34
|
var isInlineExperimentEnabled = (0, _platformFeatureFlags.fg)('platform_sl_3p_auth_inline_tailored_cta_killswitch') && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_sl_3p_auth_inline_tailored_cta', 'isEnabled', true);
|
|
34
35
|
var is3PAuthRovoActionEnabled = isGoogleProvider && (0, _platformFeatureFlags.fg)('platform_sl_3p_auth_rovo_action_kill_switch');
|
|
35
36
|
var is3PBlockPostAuthActionsEnabled = extensionKey !== undefined && ELIGIBLE_EXTENSION_KEYS.has(extensionKey) && (rovoConfig === null || rovoConfig === void 0 ? void 0 : rovoConfig.product) === 'CONFLUENCE';
|
|
36
|
-
var
|
|
37
|
+
var is3PEmbedPostAuthActionsEnabled = isEmbedRovoActionsFooterExperimentEnabled === true;
|
|
38
|
+
var isSupportedFeature = is3PAuthRovoActionEnabled || is3PBlockPostAuthActionsEnabled || isInlineExperimentEnabled || is3PEmbedPostAuthActionsEnabled;
|
|
37
39
|
var isOptIn = (actionOptions === null || actionOptions === void 0 || (_actionOptions$rovoCh = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh === void 0 ? void 0 : _actionOptions$rovoCh.optIn) === true;
|
|
38
40
|
var url = (0, _linkExtractors.extractSmartLinkUrl)(response);
|
|
39
41
|
return isSupportedFeature && isOptIn ? {
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.isEmbedRovoActionsFooterExperimentEnabled = exports.getEmbedRovoActionsFooterExperimentMeta = exports.default = exports.EMBED_ROVO_ACTIONS_FOOTER_EXPERIMENT_KEY = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
12
|
+
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
13
|
+
var _rovo = require("../../../utils/rovo");
|
|
14
|
+
var _helpers = require("../../helpers");
|
|
15
|
+
var _store = require("../../store");
|
|
16
|
+
var EMBED_ROVO_ACTIONS_FOOTER_ELIGIBLE_EXTENSION_KEYS = new Set(['google-object-provider', 'onedrive-object-provider', 'github-object-provider', 'gitlab-object-provider']);
|
|
17
|
+
var isEligibleEmbedRovoActionsFooterExtensionKey = function isEligibleEmbedRovoActionsFooterExtensionKey(extensionKey) {
|
|
18
|
+
return extensionKey !== undefined && EMBED_ROVO_ACTIONS_FOOTER_ELIGIBLE_EXTENSION_KEYS.has(extensionKey);
|
|
19
|
+
};
|
|
20
|
+
var EMBED_ROVO_ACTIONS_FOOTER_EXPERIMENT_KEY = exports.EMBED_ROVO_ACTIONS_FOOTER_EXPERIMENT_KEY = 'platform_sl_3p_auth_rovo_embed_footer_exp';
|
|
21
|
+
var NOT_ENABLED_RESULT = {
|
|
22
|
+
isEnabled: false
|
|
23
|
+
};
|
|
24
|
+
var isEmbedRovoActionsFooterExperimentEnabled = exports.isEmbedRovoActionsFooterExperimentEnabled = function isEmbedRovoActionsFooterExperimentEnabled(product) {
|
|
25
|
+
return product === 'CONFLUENCE' && (0, _platformFeatureFlags.fg)('platform_sl_3p_auth_rovo_embed_footer_kill_switch') && (0, _expValEquals.expValEquals)(EMBED_ROVO_ACTIONS_FOOTER_EXPERIMENT_KEY, 'isEnabled', true);
|
|
26
|
+
};
|
|
27
|
+
var isEmbedRovoActionsFooterKillSwitchEnabled = function isEmbedRovoActionsFooterKillSwitchEnabled(product) {
|
|
28
|
+
return product === 'CONFLUENCE' && (0, _platformFeatureFlags.fg)('platform_sl_3p_auth_rovo_embed_footer_kill_switch');
|
|
29
|
+
};
|
|
30
|
+
var isEmbedRovoActionsFooterExperimentEnabledNoExposure = function isEmbedRovoActionsFooterExperimentEnabledNoExposure(product) {
|
|
31
|
+
return isEmbedRovoActionsFooterKillSwitchEnabled(product) && (0, _expValEqualsNoExposure.expValEqualsNoExposure)(EMBED_ROVO_ACTIONS_FOOTER_EXPERIMENT_KEY, 'isEnabled', true);
|
|
32
|
+
};
|
|
33
|
+
var getEmbedRovoActionsFooterExperimentMeta = exports.getEmbedRovoActionsFooterExperimentMeta = function getEmbedRovoActionsFooterExperimentMeta(_ref) {
|
|
34
|
+
var extensionKey = _ref.extensionKey,
|
|
35
|
+
isRovoChatActionOptedIn = _ref.isRovoChatActionOptedIn,
|
|
36
|
+
isRovoChatEnabled = _ref.isRovoChatEnabled,
|
|
37
|
+
product = _ref.product;
|
|
38
|
+
var isEligible = isEmbedRovoActionsFooterKillSwitchEnabled(product) && isRovoChatEnabled && isRovoChatActionOptedIn && isEligibleEmbedRovoActionsFooterExtensionKey(extensionKey);
|
|
39
|
+
if (!isEligible) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
return (0, _defineProperty2.default)({}, EMBED_ROVO_ACTIONS_FOOTER_EXPERIMENT_KEY, {
|
|
43
|
+
isEligible: true,
|
|
44
|
+
isTreatment: isEmbedRovoActionsFooterExperimentEnabledNoExposure(product)
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
var useEmbedRovoActionsFooterExperiment = function useEmbedRovoActionsFooterExperiment(url, actionOptions, rovoOptions, product) {
|
|
48
|
+
var _actionOptions$rovoCh, _actionOptions$rovoCh2;
|
|
49
|
+
var isRovoChatEnabled = (0, _rovo.getIsRovoChatEnabled)(rovoOptions);
|
|
50
|
+
var cardState = (0, _store.useSmartCardState)(url !== null && url !== void 0 ? url : '');
|
|
51
|
+
var extensionKey = (0, _helpers.getExtensionKey)(cardState.details);
|
|
52
|
+
var isRovoChatActionOptedIn = (_actionOptions$rovoCh = actionOptions === null || actionOptions === void 0 || (_actionOptions$rovoCh2 = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh2 === void 0 ? void 0 : _actionOptions$rovoCh2.optIn) !== null && _actionOptions$rovoCh !== void 0 ? _actionOptions$rovoCh : false;
|
|
53
|
+
return (0, _react.useMemo)(function () {
|
|
54
|
+
if (!isRovoChatEnabled || !url || !isRovoChatActionOptedIn || !extensionKey) {
|
|
55
|
+
return NOT_ENABLED_RESULT;
|
|
56
|
+
}
|
|
57
|
+
if (!isEligibleEmbedRovoActionsFooterExtensionKey(extensionKey)) {
|
|
58
|
+
return NOT_ENABLED_RESULT;
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
isEnabled: isEmbedRovoActionsFooterExperimentEnabled(product)
|
|
62
|
+
};
|
|
63
|
+
}, [isRovoChatEnabled, extensionKey, url, isRovoChatActionOptedIn, product]);
|
|
64
|
+
};
|
|
65
|
+
var _default = exports.default = useEmbedRovoActionsFooterExperiment;
|
|
@@ -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: "45.
|
|
14
|
+
packageVersion: "45.5.0" || ''
|
|
15
15
|
};
|
|
16
16
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
17
17
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -315,6 +315,7 @@ function Component(_ref) {
|
|
|
315
315
|
return actions.invoke(opts, appearance);
|
|
316
316
|
}, [actions, appearance]);
|
|
317
317
|
var experimentMetaEventAttributes = (0, _experimentMetaEventAttributes.default)({
|
|
318
|
+
actionOptions: actionOptions,
|
|
318
319
|
appearance: appearance,
|
|
319
320
|
state: state
|
|
320
321
|
});
|
|
@@ -9,18 +9,32 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
10
|
var _state = require("../../../state");
|
|
11
11
|
var _helpers = require("../../../state/helpers");
|
|
12
|
+
var _useEmbedRovoActionsFooterExperiment = require("../../../state/hooks/use-embed-rovo-actions-footer-experiment");
|
|
13
|
+
var _useRovoConfig2 = _interopRequireDefault(require("../../../state/hooks/use-rovo-config"));
|
|
12
14
|
var _useSocialProofExperiment = require("../../../state/hooks/use-social-proof-experiment");
|
|
15
|
+
var _rovo = require("../../../utils/rovo");
|
|
13
16
|
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; }
|
|
14
17
|
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; }
|
|
15
18
|
var useExperimentMetaEventAttributes = function useExperimentMetaEventAttributes(_ref) {
|
|
16
|
-
var
|
|
19
|
+
var _actionOptions$rovoCh, _actionOptions$rovoCh2;
|
|
20
|
+
var actionOptions = _ref.actionOptions,
|
|
21
|
+
appearance = _ref.appearance,
|
|
17
22
|
state = _ref.state;
|
|
18
23
|
var _useSmartLinkContext = (0, _state.useSmartLinkContext)(),
|
|
19
24
|
baseUriWithNoTrailingSlash = _useSmartLinkContext.connections.client.baseUrlOverride;
|
|
25
|
+
var _useRovoConfig = (0, _useRovoConfig2.default)(),
|
|
26
|
+
rovoOptions = _useRovoConfig.rovoOptions,
|
|
27
|
+
product = _useRovoConfig.product;
|
|
20
28
|
var details = state.details,
|
|
21
29
|
status = state.status;
|
|
22
30
|
var extensionKey = (0, _helpers.getExtensionKey)(details);
|
|
23
|
-
|
|
31
|
+
var embedRovoActionsFooterExperimentMeta = appearance === 'embed' && status === 'resolved' ? (0, _useEmbedRovoActionsFooterExperiment.getEmbedRovoActionsFooterExperimentMeta)({
|
|
32
|
+
extensionKey: extensionKey,
|
|
33
|
+
isRovoChatActionOptedIn: (_actionOptions$rovoCh = actionOptions === null || actionOptions === void 0 || (_actionOptions$rovoCh2 = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh2 === void 0 ? void 0 : _actionOptions$rovoCh2.optIn) !== null && _actionOptions$rovoCh !== void 0 ? _actionOptions$rovoCh : false,
|
|
34
|
+
isRovoChatEnabled: (0, _rovo.getIsRovoChatEnabled)(rovoOptions),
|
|
35
|
+
product: product
|
|
36
|
+
}) : undefined;
|
|
37
|
+
if (!embedRovoActionsFooterExperimentMeta && !(0, _platformFeatureFlags.fg)('social-proof-3p-unauth-block-fg') && !(0, _platformFeatureFlags.fg)('platform_sl_3p_preauth_soc_proof_inline_killswitch')) {
|
|
24
38
|
return undefined;
|
|
25
39
|
}
|
|
26
40
|
var blockSocialProofExperimentMeta = appearance === 'block' && status === 'unauthorized' && (0, _platformFeatureFlags.fg)('social-proof-3p-unauth-block-fg') ? (0, _useSocialProofExperiment.getSocialProofExperimentMeta)({
|
|
@@ -31,7 +45,7 @@ var useExperimentMetaEventAttributes = function useExperimentMetaEventAttributes
|
|
|
31
45
|
extensionKey: extensionKey,
|
|
32
46
|
baseUriWithNoTrailingSlash: baseUriWithNoTrailingSlash
|
|
33
47
|
}) : undefined;
|
|
34
|
-
var experimentMeta = _objectSpread(_objectSpread({}, blockSocialProofExperimentMeta), inlineSocialProofExperimentMeta);
|
|
48
|
+
var experimentMeta = _objectSpread(_objectSpread(_objectSpread({}, blockSocialProofExperimentMeta), inlineSocialProofExperimentMeta), embedRovoActionsFooterExperimentMeta);
|
|
35
49
|
if (Object.keys(experimentMeta).length > 0) {
|
|
36
50
|
return experimentMeta;
|
|
37
51
|
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.default = void 0;
|
|
10
|
+
require("./index.compiled.css");
|
|
11
|
+
var _runtime = require("@compiled/react/runtime");
|
|
12
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
var _reactIntl = require("react-intl");
|
|
18
|
+
var _new = _interopRequireDefault(require("@atlaskit/button/new"));
|
|
19
|
+
var _widthDetector = require("@atlaskit/width-detector");
|
|
20
|
+
var _useInvokeClientAction = _interopRequireDefault(require("../../../../state/hooks/use-invoke-client-action"));
|
|
21
|
+
var _useRovoChat2 = _interopRequireDefault(require("../../../../state/hooks/use-rovo-chat"));
|
|
22
|
+
var _rovoChatUtils = require("../../../common/rovo-chat-utils");
|
|
23
|
+
var _aiEditIcon = _interopRequireDefault(require("../../../FlexibleCard/assets/ai-edit-icon"));
|
|
24
|
+
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); }
|
|
25
|
+
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
|
+
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; }
|
|
27
|
+
var HIDE_SECONDARY_ACTIONS_WIDTH = 320;
|
|
28
|
+
var PRIMARY_ACTION_ICON_ONLY_WIDTH = 220;
|
|
29
|
+
var styles = {
|
|
30
|
+
actionGroup: "_zulpidpf _1e0c1txw _2lx2vrvc"
|
|
31
|
+
};
|
|
32
|
+
var RovoPromptButton = function RovoPromptButton(_ref) {
|
|
33
|
+
var _ref$hideContent = _ref.hideContent,
|
|
34
|
+
hideContent = _ref$hideContent === void 0 ? false : _ref$hideContent,
|
|
35
|
+
icon = _ref.icon,
|
|
36
|
+
onClick = _ref.onClick,
|
|
37
|
+
promptAction = _ref.promptAction,
|
|
38
|
+
promptKey = _ref.promptKey,
|
|
39
|
+
testId = _ref.testId;
|
|
40
|
+
var iconBefore = (0, _react.useCallback)(function () {
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
42
|
+
"aria-hidden": "true"
|
|
43
|
+
}, icon);
|
|
44
|
+
}, [icon]);
|
|
45
|
+
var label = promptAction.data.name;
|
|
46
|
+
var handleClick = (0, _react.useCallback)(function (event) {
|
|
47
|
+
return onClick(event, promptAction.data, promptKey);
|
|
48
|
+
}, [onClick, promptAction.data, promptKey]);
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement(_new.default, {
|
|
50
|
+
appearance: "subtle",
|
|
51
|
+
"aria-label": hideContent ? label : undefined,
|
|
52
|
+
iconBefore: iconBefore,
|
|
53
|
+
onClick: handleClick,
|
|
54
|
+
spacing: "compact",
|
|
55
|
+
testId: "".concat(testId, "-").concat(promptKey)
|
|
56
|
+
}, hideContent ? null : label);
|
|
57
|
+
};
|
|
58
|
+
var EmbedRovoActionsFooter = function EmbedRovoActionsFooter(_ref2) {
|
|
59
|
+
var actionData = _ref2.actionData,
|
|
60
|
+
prompts = _ref2.prompts,
|
|
61
|
+
_ref2$testId = _ref2.testId,
|
|
62
|
+
testId = _ref2$testId === void 0 ? 'embed-rovo-actions-footer' : _ref2$testId;
|
|
63
|
+
var intl = (0, _reactIntl.useIntl)();
|
|
64
|
+
var invoke = (0, _useInvokeClientAction.default)({});
|
|
65
|
+
var _useRovoChat = (0, _useRovoChat2.default)(),
|
|
66
|
+
isRovoChatEnabled = _useRovoChat.isRovoChatEnabled,
|
|
67
|
+
sendPromptMessage = _useRovoChat.sendPromptMessage;
|
|
68
|
+
var _useState = (0, _react.useState)(undefined),
|
|
69
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
70
|
+
containerWidth = _useState2[0],
|
|
71
|
+
setContainerWidth = _useState2[1];
|
|
72
|
+
var shouldHideSecondaryActions = containerWidth !== undefined && containerWidth < HIDE_SECONDARY_ACTIONS_WIDTH;
|
|
73
|
+
var shouldHidePrimaryActionContent = containerWidth !== undefined && containerWidth < PRIMARY_ACTION_ICON_ONLY_WIDTH;
|
|
74
|
+
var onClick = (0, _react.useCallback)(function (event, promptData, promptKey) {
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
event.stopPropagation();
|
|
77
|
+
invoke(_objectSpread(_objectSpread({}, actionData.invokeAction), {}, {
|
|
78
|
+
actionFn: function () {
|
|
79
|
+
var _actionFn = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
80
|
+
return _regenerator.default.wrap(function (_context) {
|
|
81
|
+
while (1) switch (_context.prev = _context.next) {
|
|
82
|
+
case 0:
|
|
83
|
+
return _context.abrupt("return", sendPromptMessage(promptData));
|
|
84
|
+
case 1:
|
|
85
|
+
case "end":
|
|
86
|
+
return _context.stop();
|
|
87
|
+
}
|
|
88
|
+
}, _callee);
|
|
89
|
+
}));
|
|
90
|
+
function actionFn() {
|
|
91
|
+
return _actionFn.apply(this, arguments);
|
|
92
|
+
}
|
|
93
|
+
return actionFn;
|
|
94
|
+
}(),
|
|
95
|
+
prompt: promptKey
|
|
96
|
+
}));
|
|
97
|
+
}, [actionData.invokeAction, invoke, sendPromptMessage]);
|
|
98
|
+
var promptActions = (0, _react.useMemo)(function () {
|
|
99
|
+
return prompts.reduce(function (actions, promptKey) {
|
|
100
|
+
if (shouldHideSecondaryActions && actions.length > 0) {
|
|
101
|
+
return actions;
|
|
102
|
+
}
|
|
103
|
+
var promptAction = (0, _rovoChatUtils.getPromptAction)({
|
|
104
|
+
promptKey: promptKey,
|
|
105
|
+
intl: intl,
|
|
106
|
+
url: actionData.url,
|
|
107
|
+
product: actionData.product,
|
|
108
|
+
iconSize: 'small'
|
|
109
|
+
});
|
|
110
|
+
if (!promptAction) {
|
|
111
|
+
return actions;
|
|
112
|
+
}
|
|
113
|
+
var isPrimaryAction = actions.length === 0;
|
|
114
|
+
actions.push( /*#__PURE__*/_react.default.createElement(RovoPromptButton, {
|
|
115
|
+
hideContent: isPrimaryAction && shouldHidePrimaryActionContent,
|
|
116
|
+
icon: isPrimaryAction ? /*#__PURE__*/_react.default.createElement(_aiEditIcon.default, null) : promptAction.icon,
|
|
117
|
+
key: promptKey,
|
|
118
|
+
onClick: onClick,
|
|
119
|
+
promptAction: promptAction,
|
|
120
|
+
promptKey: promptKey,
|
|
121
|
+
testId: testId
|
|
122
|
+
}));
|
|
123
|
+
return actions;
|
|
124
|
+
}, []);
|
|
125
|
+
}, [actionData.product, actionData.url, intl, onClick, prompts, shouldHidePrimaryActionContent, shouldHideSecondaryActions, testId]);
|
|
126
|
+
if (!isRovoChatEnabled || promptActions.length === 0) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
130
|
+
"data-testid": testId
|
|
131
|
+
}, /*#__PURE__*/_react.default.createElement(_widthDetector.WidthObserver, {
|
|
132
|
+
setWidth: setContainerWidth,
|
|
133
|
+
offscreen: true
|
|
134
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
135
|
+
className: (0, _runtime.ax)([styles.actionGroup])
|
|
136
|
+
}, promptActions));
|
|
137
|
+
};
|
|
138
|
+
var _default = exports.default = EmbedRovoActionsFooter;
|
|
@@ -104,6 +104,8 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/_react.default.forwardRef(funct
|
|
|
104
104
|
}
|
|
105
105
|
if (resolvedViewProps.preview) {
|
|
106
106
|
return /*#__PURE__*/_react.default.createElement(_ResolvedView3.EmbedCardResolvedView, (0, _extends2.default)({}, resolvedViewProps, {
|
|
107
|
+
actionOptions: actionOptions,
|
|
108
|
+
details: details,
|
|
107
109
|
isSelected: isSelected,
|
|
108
110
|
frameStyle: frameStyle,
|
|
109
111
|
inheritDimensions: inheritDimensions,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* ResolvedView.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -5,40 +6,124 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.EmbedCardResolvedView = void 0;
|
|
9
|
+
require("./ResolvedView.compiled.css");
|
|
10
|
+
var _runtime = require("@compiled/react/runtime");
|
|
11
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
8
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
13
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
var _reactLoadable = _interopRequireDefault(require("react-loadable"));
|
|
11
16
|
var _link = _interopRequireDefault(require("@atlaskit/icon/core/link"));
|
|
12
17
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
|
+
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
13
19
|
var _tokens = require("@atlaskit/tokens");
|
|
20
|
+
var _constants = require("../../../constants");
|
|
21
|
+
var _extractRovoChatAction = _interopRequireDefault(require("../../../extractors/flexible/actions/extract-rovo-chat-action"));
|
|
22
|
+
var _helpers = require("../../../state/helpers");
|
|
23
|
+
var _useEmbedRovoActionsFooterExperiment = _interopRequireDefault(require("../../../state/hooks/use-embed-rovo-actions-footer-experiment"));
|
|
24
|
+
var _useRovoConfig2 = _interopRequireDefault(require("../../../state/hooks/use-rovo-config"));
|
|
14
25
|
var _utils = require("../../../utils");
|
|
26
|
+
var _rovoPostAuthPrompts = require("../../common/rovo-post-auth-prompts");
|
|
15
27
|
var _ExpandedFrame = require("../components/ExpandedFrame");
|
|
16
28
|
var _Frame = require("../components/Frame");
|
|
17
29
|
var _ImageIcon = require("../components/ImageIcon");
|
|
18
30
|
var _useEmbedResolvePostMessageListener = require("../useEmbedResolvePostMessageListener");
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
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" != (0, _typeof2.default)(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); }
|
|
32
|
+
var EmbedRovoActionsFooter = (0, _reactLoadable.default)({
|
|
33
|
+
loader: function loader() {
|
|
34
|
+
return Promise.resolve().then(function () {
|
|
35
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "smart-card-embed-rovo-actions-footer" */'../components/rovo-actions-footer'));
|
|
36
|
+
}).then(function (module) {
|
|
37
|
+
return module.default;
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
loading: function loading() {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
EmbedRovoActionsFooter.displayName = 'lazy(EmbedRovoActionsFooter)';
|
|
45
|
+
var styles = {
|
|
46
|
+
contentWithFooter: "_1e0c1txw _2lx21bp4 _4t3i1osq _1tkeidpf",
|
|
47
|
+
frameWithFooter: "_16jlkb7n _1tkeidpf",
|
|
48
|
+
footer: "_1e0c1txw _1bah1y6m"
|
|
49
|
+
};
|
|
50
|
+
var EmbedFrameWithRovoFooter = function EmbedFrameWithRovoFooter(_ref) {
|
|
51
|
+
var actionOptions = _ref.actionOptions,
|
|
52
|
+
details = _ref.details,
|
|
53
|
+
frame = _ref.frame,
|
|
54
|
+
link = _ref.link,
|
|
55
|
+
testId = _ref.testId;
|
|
56
|
+
var _useRovoConfig = (0, _useRovoConfig2.default)(),
|
|
57
|
+
rovoOptions = _useRovoConfig.rovoOptions,
|
|
58
|
+
product = _useRovoConfig.product;
|
|
59
|
+
var _useEmbedRovoActionsF = (0, _useEmbedRovoActionsFooterExperiment.default)(link, actionOptions, rovoOptions, product),
|
|
60
|
+
isEmbedRovoActionsFooterEnabled = _useEmbedRovoActionsF.isEnabled;
|
|
61
|
+
var rovoActionData = _react.default.useMemo(function () {
|
|
62
|
+
return isEmbedRovoActionsFooterEnabled && details ? (0, _extractRovoChatAction.default)({
|
|
63
|
+
response: details,
|
|
64
|
+
rovoConfig: {
|
|
65
|
+
rovoOptions: rovoOptions,
|
|
66
|
+
product: product
|
|
67
|
+
},
|
|
68
|
+
product: product,
|
|
69
|
+
actionOptions: actionOptions,
|
|
70
|
+
appearance: _constants.CardDisplay.Embed,
|
|
71
|
+
isEmbedRovoActionsFooterExperimentEnabled: isEmbedRovoActionsFooterEnabled
|
|
72
|
+
}) : undefined;
|
|
73
|
+
}, [actionOptions, details, isEmbedRovoActionsFooterEnabled, product, rovoOptions]);
|
|
74
|
+
var prompts = _react.default.useMemo(function () {
|
|
75
|
+
if (!isEmbedRovoActionsFooterEnabled) {
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
return (0, _rovoPostAuthPrompts.getRovoPostAuthPromptKeys)({
|
|
79
|
+
extensionKey: (0, _helpers.getExtensionKey)(details)
|
|
80
|
+
});
|
|
81
|
+
}, [details, isEmbedRovoActionsFooterEnabled]);
|
|
82
|
+
var footer = _react.default.useMemo(function () {
|
|
83
|
+
return rovoActionData && prompts.length > 0 ? /*#__PURE__*/_react.default.createElement(EmbedRovoActionsFooter, {
|
|
84
|
+
actionData: rovoActionData,
|
|
85
|
+
prompts: prompts,
|
|
86
|
+
testId: "".concat(testId, "-rovo-actions-footer")
|
|
87
|
+
}) : undefined;
|
|
88
|
+
}, [prompts, rovoActionData, testId]);
|
|
89
|
+
return footer ? /*#__PURE__*/_react.default.createElement("div", {
|
|
90
|
+
className: (0, _runtime.ax)([styles.contentWithFooter])
|
|
91
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
92
|
+
className: (0, _runtime.ax)([styles.frameWithFooter])
|
|
93
|
+
}, frame), /*#__PURE__*/_react.default.createElement("div", {
|
|
94
|
+
className: (0, _runtime.ax)([styles.footer])
|
|
95
|
+
}, footer)) : frame;
|
|
96
|
+
};
|
|
97
|
+
var EmbedFrameWithoutRovoFooter = function EmbedFrameWithoutRovoFooter(_ref2) {
|
|
98
|
+
var frame = _ref2.frame;
|
|
99
|
+
return frame;
|
|
100
|
+
};
|
|
101
|
+
var EmbedFrameWithOptionalRovoFooter = (0, _platformFeatureFlagsReact.componentWithFG)('platform_sl_3p_auth_rovo_embed_footer_kill_switch', EmbedFrameWithRovoFooter, EmbedFrameWithoutRovoFooter);
|
|
102
|
+
var EmbedCardResolvedView = exports.EmbedCardResolvedView = /*#__PURE__*/_react.default.forwardRef(function (_ref3, embedIframeRef) {
|
|
103
|
+
var actionOptions = _ref3.actionOptions,
|
|
104
|
+
link = _ref3.link,
|
|
105
|
+
context = _ref3.context,
|
|
106
|
+
details = _ref3.details,
|
|
107
|
+
onClick = _ref3.onClick,
|
|
108
|
+
onAuxClick = _ref3.onAuxClick,
|
|
109
|
+
onContextMenu = _ref3.onContextMenu,
|
|
110
|
+
isSelected = _ref3.isSelected,
|
|
111
|
+
frameStyle = _ref3.frameStyle,
|
|
112
|
+
preview = _ref3.preview,
|
|
113
|
+
title = _ref3.title,
|
|
114
|
+
isTrusted = _ref3.isTrusted,
|
|
115
|
+
_ref3$testId = _ref3.testId,
|
|
116
|
+
testId = _ref3$testId === void 0 ? 'embed-card-resolved-view' : _ref3$testId,
|
|
117
|
+
inheritDimensions = _ref3.inheritDimensions,
|
|
118
|
+
onIframeDwell = _ref3.onIframeDwell,
|
|
119
|
+
onIframeFocus = _ref3.onIframeFocus,
|
|
120
|
+
onIframeMouseEnter = _ref3.onIframeMouseEnter,
|
|
121
|
+
onIframeMouseLeave = _ref3.onIframeMouseLeave,
|
|
122
|
+
isSupportTheming = _ref3.isSupportTheming,
|
|
123
|
+
type = _ref3.type,
|
|
124
|
+
CompetitorPrompt = _ref3.CompetitorPrompt,
|
|
125
|
+
hideIconLoadingSkeleton = _ref3.hideIconLoadingSkeleton,
|
|
126
|
+
extensionKey = _ref3.extensionKey;
|
|
42
127
|
var iconFromContext = context === null || context === void 0 ? void 0 : context.icon;
|
|
43
128
|
var iconLabel = context === null || context === void 0 ? void 0 : context.iconLabel;
|
|
44
129
|
var src = typeof iconFromContext === 'string' ? iconFromContext : undefined;
|
|
@@ -77,6 +162,26 @@ var EmbedCardResolvedView = exports.EmbedCardResolvedView = /*#__PURE__*/_react.
|
|
|
77
162
|
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
|
78
163
|
isMouseOver = _React$useState2[0],
|
|
79
164
|
setMouseOver = _React$useState2[1];
|
|
165
|
+
var frame = /*#__PURE__*/_react.default.createElement(_Frame.Frame, {
|
|
166
|
+
url: previewUrl,
|
|
167
|
+
isTrusted: isTrusted,
|
|
168
|
+
testId: testId,
|
|
169
|
+
ref: embedIframeRef,
|
|
170
|
+
onIframeDwell: onIframeDwell,
|
|
171
|
+
onIframeFocus: onIframeFocus,
|
|
172
|
+
onIframeMouseEnter: onIframeMouseEnter,
|
|
173
|
+
onIframeMouseLeave: onIframeMouseLeave,
|
|
174
|
+
isMouseOver: isMouseOver,
|
|
175
|
+
title: text,
|
|
176
|
+
extensionKey: extensionKey
|
|
177
|
+
});
|
|
178
|
+
var frameWithFooter = /*#__PURE__*/_react.default.createElement(EmbedFrameWithOptionalRovoFooter, {
|
|
179
|
+
actionOptions: actionOptions,
|
|
180
|
+
details: details,
|
|
181
|
+
frame: frame,
|
|
182
|
+
link: link,
|
|
183
|
+
testId: testId
|
|
184
|
+
});
|
|
80
185
|
return /*#__PURE__*/_react.default.createElement(_ExpandedFrame.ExpandedFrame, {
|
|
81
186
|
isSelected: isSelected,
|
|
82
187
|
frameStyle: frameStyle,
|
|
@@ -98,17 +203,5 @@ var EmbedCardResolvedView = exports.EmbedCardResolvedView = /*#__PURE__*/_react.
|
|
|
98
203
|
setMouseOver(false);
|
|
99
204
|
onIframeMouseLeave === null || onIframeMouseLeave === void 0 || onIframeMouseLeave();
|
|
100
205
|
}
|
|
101
|
-
},
|
|
102
|
-
url: previewUrl,
|
|
103
|
-
isTrusted: isTrusted,
|
|
104
|
-
testId: testId,
|
|
105
|
-
ref: embedIframeRef,
|
|
106
|
-
onIframeDwell: onIframeDwell,
|
|
107
|
-
onIframeFocus: onIframeFocus,
|
|
108
|
-
onIframeMouseEnter: onIframeMouseEnter,
|
|
109
|
-
onIframeMouseLeave: onIframeMouseLeave,
|
|
110
|
-
isMouseOver: isMouseOver,
|
|
111
|
-
title: text,
|
|
112
|
-
extensionKey: extensionKey
|
|
113
|
-
}));
|
|
206
|
+
}, frameWithFooter);
|
|
114
207
|
});
|
|
@@ -19,7 +19,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLink
|
|
|
19
19
|
_excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
|
|
20
20
|
var PACKAGE_DATA = {
|
|
21
21
|
packageName: "@atlaskit/smart-card",
|
|
22
|
-
packageVersion: "45.
|
|
22
|
+
packageVersion: "45.5.0",
|
|
23
23
|
componentName: 'linkUrl'
|
|
24
24
|
};
|
|
25
25
|
var LinkUrl = function LinkUrl(_ref) {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getRovoPostAuthPromptKeys = void 0;
|
|
7
|
+
var _rovoChatUtils = require("../rovo-chat-utils");
|
|
8
|
+
var getRovoPostAuthPromptKeys = exports.getRovoPostAuthPromptKeys = function getRovoPostAuthPromptKeys(_ref) {
|
|
9
|
+
var extensionKey = _ref.extensionKey;
|
|
10
|
+
var defaultPrompts = [_rovoChatUtils.RovoChatPromptKey.KEY_HIGHLIGHTS];
|
|
11
|
+
if (extensionKey === 'github-object-provider' || extensionKey === 'gitlab-object-provider') {
|
|
12
|
+
return [_rovoChatUtils.RovoChatPromptKey.EXPLAIN_CODE].concat(defaultPrompts);
|
|
13
|
+
}
|
|
14
|
+
return [_rovoChatUtils.RovoChatPromptKey.SUMMARIZE_DOCUMENT].concat(defaultPrompts);
|
|
15
|
+
};
|
|
@@ -11,6 +11,7 @@ const extractRovoChatAction = ({
|
|
|
11
11
|
actionOptions,
|
|
12
12
|
appearance,
|
|
13
13
|
id,
|
|
14
|
+
isEmbedRovoActionsFooterExperimentEnabled,
|
|
14
15
|
product,
|
|
15
16
|
response,
|
|
16
17
|
rovoConfig
|
|
@@ -28,7 +29,8 @@ const extractRovoChatAction = ({
|
|
|
28
29
|
const isInlineExperimentEnabled = fg('platform_sl_3p_auth_inline_tailored_cta_killswitch') && expValEqualsNoExposure('platform_sl_3p_auth_inline_tailored_cta', 'isEnabled', true);
|
|
29
30
|
const is3PAuthRovoActionEnabled = isGoogleProvider && fg('platform_sl_3p_auth_rovo_action_kill_switch');
|
|
30
31
|
const is3PBlockPostAuthActionsEnabled = extensionKey !== undefined && ELIGIBLE_EXTENSION_KEYS.has(extensionKey) && (rovoConfig === null || rovoConfig === void 0 ? void 0 : rovoConfig.product) === 'CONFLUENCE';
|
|
31
|
-
const
|
|
32
|
+
const is3PEmbedPostAuthActionsEnabled = isEmbedRovoActionsFooterExperimentEnabled === true;
|
|
33
|
+
const isSupportedFeature = is3PAuthRovoActionEnabled || is3PBlockPostAuthActionsEnabled || isInlineExperimentEnabled || is3PEmbedPostAuthActionsEnabled;
|
|
32
34
|
const isOptIn = (actionOptions === null || actionOptions === void 0 ? void 0 : (_actionOptions$rovoCh = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh === void 0 ? void 0 : _actionOptions$rovoCh.optIn) === true;
|
|
33
35
|
const url = extractSmartLinkUrl(response);
|
|
34
36
|
return isSupportedFeature && isOptIn ? {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
5
|
+
import { getIsRovoChatEnabled } from '../../../utils/rovo';
|
|
6
|
+
import { getExtensionKey } from '../../helpers';
|
|
7
|
+
import { useSmartCardState } from '../../store';
|
|
8
|
+
const EMBED_ROVO_ACTIONS_FOOTER_ELIGIBLE_EXTENSION_KEYS = new Set(['google-object-provider', 'onedrive-object-provider', 'github-object-provider', 'gitlab-object-provider']);
|
|
9
|
+
const isEligibleEmbedRovoActionsFooterExtensionKey = extensionKey => extensionKey !== undefined && EMBED_ROVO_ACTIONS_FOOTER_ELIGIBLE_EXTENSION_KEYS.has(extensionKey);
|
|
10
|
+
export const EMBED_ROVO_ACTIONS_FOOTER_EXPERIMENT_KEY = 'platform_sl_3p_auth_rovo_embed_footer_exp';
|
|
11
|
+
const NOT_ENABLED_RESULT = {
|
|
12
|
+
isEnabled: false
|
|
13
|
+
};
|
|
14
|
+
export const isEmbedRovoActionsFooterExperimentEnabled = product => {
|
|
15
|
+
return product === 'CONFLUENCE' && fg('platform_sl_3p_auth_rovo_embed_footer_kill_switch') && expValEquals(EMBED_ROVO_ACTIONS_FOOTER_EXPERIMENT_KEY, 'isEnabled', true);
|
|
16
|
+
};
|
|
17
|
+
const isEmbedRovoActionsFooterKillSwitchEnabled = product => {
|
|
18
|
+
return product === 'CONFLUENCE' && fg('platform_sl_3p_auth_rovo_embed_footer_kill_switch');
|
|
19
|
+
};
|
|
20
|
+
const isEmbedRovoActionsFooterExperimentEnabledNoExposure = product => {
|
|
21
|
+
return isEmbedRovoActionsFooterKillSwitchEnabled(product) && expValEqualsNoExposure(EMBED_ROVO_ACTIONS_FOOTER_EXPERIMENT_KEY, 'isEnabled', true);
|
|
22
|
+
};
|
|
23
|
+
export const getEmbedRovoActionsFooterExperimentMeta = ({
|
|
24
|
+
extensionKey,
|
|
25
|
+
isRovoChatActionOptedIn,
|
|
26
|
+
isRovoChatEnabled,
|
|
27
|
+
product
|
|
28
|
+
}) => {
|
|
29
|
+
const isEligible = isEmbedRovoActionsFooterKillSwitchEnabled(product) && isRovoChatEnabled && isRovoChatActionOptedIn && isEligibleEmbedRovoActionsFooterExtensionKey(extensionKey);
|
|
30
|
+
if (!isEligible) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
[EMBED_ROVO_ACTIONS_FOOTER_EXPERIMENT_KEY]: {
|
|
35
|
+
isEligible: true,
|
|
36
|
+
isTreatment: isEmbedRovoActionsFooterExperimentEnabledNoExposure(product)
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
const useEmbedRovoActionsFooterExperiment = (url, actionOptions, rovoOptions, product) => {
|
|
41
|
+
var _actionOptions$rovoCh, _actionOptions$rovoCh2;
|
|
42
|
+
const isRovoChatEnabled = getIsRovoChatEnabled(rovoOptions);
|
|
43
|
+
const cardState = useSmartCardState(url !== null && url !== void 0 ? url : '');
|
|
44
|
+
const extensionKey = getExtensionKey(cardState.details);
|
|
45
|
+
const isRovoChatActionOptedIn = (_actionOptions$rovoCh = actionOptions === null || actionOptions === void 0 ? void 0 : (_actionOptions$rovoCh2 = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh2 === void 0 ? void 0 : _actionOptions$rovoCh2.optIn) !== null && _actionOptions$rovoCh !== void 0 ? _actionOptions$rovoCh : false;
|
|
46
|
+
return useMemo(() => {
|
|
47
|
+
if (!isRovoChatEnabled || !url || !isRovoChatActionOptedIn || !extensionKey) {
|
|
48
|
+
return NOT_ENABLED_RESULT;
|
|
49
|
+
}
|
|
50
|
+
if (!isEligibleEmbedRovoActionsFooterExtensionKey(extensionKey)) {
|
|
51
|
+
return NOT_ENABLED_RESULT;
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
isEnabled: isEmbedRovoActionsFooterExperimentEnabled(product)
|
|
55
|
+
};
|
|
56
|
+
}, [isRovoChatEnabled, extensionKey, url, isRovoChatActionOptedIn, product]);
|
|
57
|
+
};
|
|
58
|
+
export default useEmbedRovoActionsFooterExperiment;
|
|
@@ -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: "45.
|
|
5
|
+
packageVersion: "45.5.0" || ''
|
|
6
6
|
};
|
|
7
7
|
export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
8
8
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|