@atlaskit/smart-card 45.3.2 → 45.4.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/extractors/flexible/actions/extract-rovo-chat-action.js +2 -4
  3. package/dist/cjs/state/hooks/use-block-card-rovo-action-experiment/index.js +9 -28
  4. package/dist/cjs/utils/analytics/analytics.js +1 -1
  5. package/dist/cjs/view/BlockCard/views/ResolvedView.js +11 -18
  6. package/dist/cjs/view/FlexibleCard/components/actions/action/action-button/index.js +4 -3
  7. package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js +4 -3
  8. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/index.js +4 -3
  9. package/dist/cjs/view/FlexibleCard/components/actions/copy-link-action/index.js +4 -3
  10. package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +6 -5
  11. package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +7 -9
  12. package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +7 -9
  13. package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +1 -4
  14. package/dist/cjs/view/FlexibleCard/components/elements/common/base-badge-element/index.js +4 -3
  15. package/dist/cjs/view/LinkUrl/index.js +1 -1
  16. package/dist/cjs/view/common/rovo-chat-utils/index.js +3 -5
  17. package/dist/es2019/extractors/flexible/actions/extract-rovo-chat-action.js +2 -4
  18. package/dist/es2019/state/hooks/use-block-card-rovo-action-experiment/index.js +6 -26
  19. package/dist/es2019/utils/analytics/analytics.js +1 -1
  20. package/dist/es2019/view/BlockCard/views/ResolvedView.js +33 -37
  21. package/dist/es2019/view/FlexibleCard/components/actions/action/action-button/index.js +5 -3
  22. package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js +5 -3
  23. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/index.js +5 -3
  24. package/dist/es2019/view/FlexibleCard/components/actions/copy-link-action/index.js +5 -3
  25. package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +7 -5
  26. package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +7 -9
  27. package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +7 -9
  28. package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +1 -4
  29. package/dist/es2019/view/FlexibleCard/components/elements/common/base-badge-element/index.js +5 -3
  30. package/dist/es2019/view/LinkUrl/index.js +1 -1
  31. package/dist/es2019/view/common/rovo-chat-utils/index.js +3 -5
  32. package/dist/esm/extractors/flexible/actions/extract-rovo-chat-action.js +2 -4
  33. package/dist/esm/state/hooks/use-block-card-rovo-action-experiment/index.js +6 -25
  34. package/dist/esm/utils/analytics/analytics.js +1 -1
  35. package/dist/esm/view/BlockCard/views/ResolvedView.js +12 -19
  36. package/dist/esm/view/FlexibleCard/components/actions/action/action-button/index.js +4 -3
  37. package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js +4 -3
  38. package/dist/esm/view/FlexibleCard/components/actions/automation-action/index.js +4 -3
  39. package/dist/esm/view/FlexibleCard/components/actions/copy-link-action/index.js +4 -3
  40. package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +6 -5
  41. package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +7 -9
  42. package/dist/esm/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +7 -9
  43. package/dist/esm/view/FlexibleCard/components/blocks/utils.js +1 -4
  44. package/dist/esm/view/FlexibleCard/components/elements/common/base-badge-element/index.js +4 -3
  45. package/dist/esm/view/LinkUrl/index.js +1 -1
  46. package/dist/esm/view/common/rovo-chat-utils/index.js +3 -5
  47. package/dist/types/state/hooks/use-block-card-rovo-action-experiment/index.d.ts +3 -15
  48. package/package.json +4 -7
@@ -1,31 +1,23 @@
1
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
2
  import { getIsRovoChatEnabled } from '../../../utils/rovo';
6
3
  import { getExtensionKey } from '../../helpers';
7
4
  import { useSmartCardState } from '../../store';
8
5
  import useRovoConfig from '../use-rovo-config';
9
6
  var ELIGIBLE_EXTENSION_KEYS = new Set(['slack-object-provider', 'google-object-provider', 'onedrive-object-provider', 'github-object-provider', 'ms-teams-object-provider', 'gitlab-object-provider', 'salesforce-object-provider']);
10
- var NOT_ENABLED_RESULT = {
11
- isEnabled: false
12
- };
13
7
 
14
8
  /**
15
- * Returns whether the platform_sl_3p_auth_rovo_block_card_confluence experiment
16
- * is enabled for the current user and link context.
9
+ * Returns whether the rovo actions are enabled for the current user and link context.
17
10
  *
18
11
  * All eligibility criteria are consolidated here:
19
12
  * 1. Rovo chat must be enabled for the tenant.
20
13
  * 2. The consumer must have opted in via actionOptions.rovoChatAction.optIn.
21
14
  * 3. The link must support the RovoActions feature.
22
15
  * 4. The extension key must be one of the supported options.
23
- * 5. The experiment value must be true (via tmp-editor-statsig).
24
16
  *
25
17
  * The extension key is derived from the card store via the resolved URL,
26
18
  * so callers don't need to thread it as a prop.
27
19
  */
28
- var useBlockCardRovoActionExperiment = function useBlockCardRovoActionExperiment(url, actionOptions) {
20
+ var useBlockCardRovoAction = function useBlockCardRovoAction(url, actionOptions) {
29
21
  var _actionOptions$rovoCh, _actionOptions$rovoCh2;
30
22
  var _useRovoConfig = useRovoConfig(),
31
23
  rovoConfig = _useRovoConfig.rovoOptions,
@@ -36,23 +28,12 @@ var useBlockCardRovoActionExperiment = function useBlockCardRovoActionExperiment
36
28
  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;
37
29
  return useMemo(function () {
38
30
  if (!isRovoChatEnabled || !url || !isRovoChatActionOptedIn) {
39
- return NOT_ENABLED_RESULT;
31
+ return false;
40
32
  }
41
33
  if (extensionKey && !ELIGIBLE_EXTENSION_KEYS.has(extensionKey)) {
42
- return NOT_ENABLED_RESULT;
34
+ return false;
43
35
  }
44
- var isConfluenceEnabled = !!product && product === 'CONFLUENCE' && fg('platform_sl_3p_auth_rovo_block_card_kill_switch') && expValEquals('platform_sl_3p_auth_rovo_block_card_confluence', 'isEnabled', true);
45
- return {
46
- isEnabled: isConfluenceEnabled
47
- };
36
+ return !!product && product === 'CONFLUENCE';
48
37
  }, [isRovoChatEnabled, extensionKey, url, isRovoChatActionOptedIn, product]);
49
38
  };
50
- export var isBlockCardRovoActionExperimentEnabled = function isBlockCardRovoActionExperimentEnabled(product) {
51
- return !!product && product === 'CONFLUENCE' && fg('platform_sl_3p_auth_rovo_block_card_kill_switch') && expValEqualsNoExposure('platform_sl_3p_auth_rovo_block_card_confluence', 'isEnabled', true);
52
- };
53
- export var useBlockCardRovoActionExperimentNoExposure = function useBlockCardRovoActionExperimentNoExposure() {
54
- var _useRovoConfig2 = useRovoConfig(),
55
- product = _useRovoConfig2.product;
56
- return isBlockCardRovoActionExperimentEnabled(product);
57
- };
58
- export default useBlockCardRovoActionExperiment;
39
+ export default useBlockCardRovoAction;
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
4
4
  export var context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card" || '',
7
- packageVersion: "45.3.1" || ''
7
+ packageVersion: "45.3.2" || ''
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -10,7 +10,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
10
10
  import { ActionName, CardDisplay, ElementName, SmartLinkPosition } from '../../../constants';
11
11
  import extractRovoChatAction from '../../../extractors/flexible/actions/extract-rovo-chat-action';
12
12
  import { getExtensionKey } from '../../../state/helpers';
13
- import useBlockCardRovoActionExperiment from '../../../state/hooks/use-block-card-rovo-action-experiment';
13
+ import useBlockCardRovoAction from '../../../state/hooks/use-block-card-rovo-action-experiment';
14
14
  import useRovoConfig from '../../../state/hooks/use-rovo-config';
15
15
  import { RovoChatPromptKey } from '../../common/rovo-chat-utils';
16
16
  import FlexibleCard from '../../FlexibleCard';
@@ -46,20 +46,8 @@ var ResolvedView = function ResolvedView(_ref) {
46
46
  isPreviewBlockErrored = _useState2[0],
47
47
  setIsPreviewBlockErrored = _useState2[1];
48
48
  var extensionKey = getExtensionKey(cardState.details);
49
- var _useBlockCardRovoActi = useBlockCardRovoActionExperiment(url, actionOptions),
50
- is3PRovoBlockExperimentEnabled = _useBlockCardRovoActi.isEnabled;
51
- var rovoConfig = is3PRovoBlockExperimentEnabled ?
52
- // eslint-disable-next-line react-hooks/rules-of-hooks
53
- useRovoConfig() : undefined;
54
- var showRovoResolvedView = is3PRovoBlockExperimentEnabled ?
55
- // eslint-disable-next-line react-hooks/rules-of-hooks
56
- useMemo(function () {
57
- return (cardState === null || cardState === void 0 ? void 0 : cardState.status) === 'resolved' && cardState.details && extractRovoChatAction({
58
- response: cardState.details,
59
- rovoConfig: rovoConfig,
60
- actionOptions: actionOptions
61
- }) !== undefined;
62
- }, [actionOptions, cardState === null || cardState === void 0 ? void 0 : cardState.details, cardState === null || cardState === void 0 ? void 0 : cardState.status, rovoConfig]) : undefined;
49
+ var is3PRovoBlockRovoActionEnabled = useBlockCardRovoAction(url, actionOptions);
50
+ var rovoConfig = useRovoConfig();
63
51
 
64
52
  // eslint-disable-next-line react-hooks/rules-of-hooks
65
53
  var _useMemo = useMemo(function () {
@@ -75,7 +63,7 @@ var ResolvedView = function ResolvedView(_ref) {
75
63
  topMetadata = _getSimulatedBetterMe.topMetadata,
76
64
  bottomMetadata = _getSimulatedBetterMe.bottomMetadata;
77
65
  var prompts = useMemo(function () {
78
- if (is3PRovoBlockExperimentEnabled) {
66
+ if (is3PRovoBlockRovoActionEnabled) {
79
67
  var _cardState$details;
80
68
  var defaultPrompts = [RovoChatPromptKey.KEY_HIGHLIGHTS];
81
69
  var linkType = (_cardState$details = cardState.details) === null || _cardState$details === void 0 || (_cardState$details = _cardState$details.data) === null || _cardState$details === void 0 ? void 0 : _cardState$details['@type'];
@@ -91,9 +79,14 @@ var ResolvedView = function ResolvedView(_ref) {
91
79
  return [RovoChatPromptKey.SUMMARIZE_LINK].concat(defaultPrompts);
92
80
  }
93
81
  return [];
94
- }, [cardState === null || cardState === void 0 || (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data, extensionKey, is3PRovoBlockExperimentEnabled]);
82
+ }, [cardState === null || cardState === void 0 || (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data, extensionKey, is3PRovoBlockRovoActionEnabled]);
95
83
  var footerActions = useMemo(function () {
96
- return showRovoResolvedView && is3PRovoBlockExperimentEnabled ? [{
84
+ var showRovoResolvedView = (cardState === null || cardState === void 0 ? void 0 : cardState.status) === 'resolved' && cardState.details && extractRovoChatAction({
85
+ response: cardState.details,
86
+ rovoConfig: rovoConfig,
87
+ actionOptions: actionOptions
88
+ }) !== undefined;
89
+ return showRovoResolvedView && is3PRovoBlockRovoActionEnabled ? [{
97
90
  name: ActionName.RovoChatAction,
98
91
  prompts: prompts,
99
92
  iconSize: 'small',
@@ -114,7 +107,7 @@ var ResolvedView = function ResolvedView(_ref) {
114
107
  name: ActionName.DownloadAction,
115
108
  hideIcon: true
116
109
  }];
117
- }, [showRovoResolvedView, prompts, is3PRovoBlockExperimentEnabled]);
110
+ }, [prompts, is3PRovoBlockRovoActionEnabled, cardState, rovoConfig, actionOptions]);
118
111
  var uiOptions = FlexibleCardUiOptions;
119
112
  uiOptions.enableSnippetRenderer = true;
120
113
  uiOptions.hideLoadingSkeleton = hideIconLoadingSkeleton;
@@ -9,7 +9,7 @@ import { Box } from '@atlaskit/primitives/compiled';
9
9
  import Tooltip from '@atlaskit/tooltip';
10
10
  import { ActionName, SmartLinkSize } from '../../../../../../constants';
11
11
  import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../../state/flexible-ui-context';
12
- import { useBlockCardRovoActionExperimentNoExposure } from '../../../../../../state/hooks/use-block-card-rovo-action-experiment';
12
+ import useRovoConfig from '../../../../../../state/hooks/use-rovo-config';
13
13
  import { withOverrideCss } from '../../../common/with-override-css';
14
14
  import { sizeToButtonSpacing } from '../../../utils';
15
15
  var IconOnlyLarge = null;
@@ -57,8 +57,9 @@ var ActionButtonRefresh = /*#__PURE__*/forwardRef(function (_ref, ref) {
57
57
  ariaLabel = _ref.ariaLabel;
58
58
  var iconOnly = !content;
59
59
  var context = useFlexibleUiContext();
60
- var isRovoBlockCardExperimentEnabled = useBlockCardRovoActionExperimentNoExposure();
61
- var isRovoSupported = !!(context !== null && context !== void 0 && (_context$actions = context.actions) !== null && _context$actions !== void 0 && _context$actions[ActionName.RovoChatAction]) && isRovoBlockCardExperimentEnabled;
60
+ var _useRovoConfig = useRovoConfig(),
61
+ product = _useRovoConfig.product;
62
+ var isRovoSupported = !!(context !== null && context !== void 0 && (_context$actions = context.actions) !== null && _context$actions !== void 0 && _context$actions[ActionName.RovoChatAction]) && !!product && product === 'CONFLUENCE';
62
63
  var onButtonClick = useCallback(function (handler) {
63
64
  return function (e) {
64
65
  e.preventDefault();
@@ -7,7 +7,7 @@ import RovoIcon from '@atlaskit/icon-lab/core/rovo';
7
7
  import { fg } from '@atlaskit/platform-feature-flags';
8
8
  import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
9
9
  import { messages } from '../../../../../messages';
10
- import { useBlockCardRovoActionExperimentNoExposure } from '../../../../../state/hooks/use-block-card-rovo-action-experiment';
10
+ import useRovoConfig from '../../../../../state/hooks/use-rovo-config';
11
11
  import Action from '../action';
12
12
  import { getErrorMessage } from './utils';
13
13
  export function AISummariseAction(_ref) {
@@ -19,7 +19,8 @@ export function AISummariseAction(_ref) {
19
19
  props = _objectWithoutProperties(_ref, _excluded);
20
20
  var _useAnalyticsEvents = useAnalyticsEvents(),
21
21
  fireEvent = _useAnalyticsEvents.fireEvent;
22
- var isRovoBlockCardExperimentEnabled = useBlockCardRovoActionExperimentNoExposure();
22
+ var _useRovoConfig = useRovoConfig(),
23
+ product = _useRovoConfig.product;
23
24
  var onCompleted = useCallback(function (state) {
24
25
  if ((state === null || state === void 0 ? void 0 : state.status) === 'error') {
25
26
  onErrorCallback === null || onErrorCallback === void 0 || onErrorCallback(getErrorMessage(state.error));
@@ -42,7 +43,7 @@ export function AISummariseAction(_ref) {
42
43
  spacing: "spacious",
43
44
  color: "currentColor",
44
45
  label: "Summarise with AI"
45
- }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || isRovoBlockCardExperimentEnabled ? {
46
+ }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || !!product && product === 'CONFLUENCE' ? {
46
47
  size: props.iconSize
47
48
  } : {})),
48
49
  onClick: handleActionClick,
@@ -8,7 +8,7 @@ import { useAnalyticsEvents } from '../../../../../common/analytics/generated/us
8
8
  import { ActionName } from '../../../../../constants';
9
9
  import { messages } from '../../../../../messages';
10
10
  import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
11
- import { useBlockCardRovoActionExperimentNoExposure } from '../../../../../state/hooks/use-block-card-rovo-action-experiment';
11
+ import useRovoConfig from '../../../../../state/hooks/use-rovo-config';
12
12
  import { useSmartLinkModal } from '../../../../../state/modal';
13
13
  import Action from '../action';
14
14
  import { getModalContent } from './utils';
@@ -25,7 +25,8 @@ var AutomationAction = function AutomationAction(props) {
25
25
  var _useAnalyticsEvents = useAnalyticsEvents(),
26
26
  fireEvent = _useAnalyticsEvents.fireEvent;
27
27
  var automationActionData = context === null || context === void 0 || (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.AutomationAction];
28
- var isRovoBlockCardExperimentEnabled = useBlockCardRovoActionExperimentNoExposure();
28
+ var _useRovoConfig = useRovoConfig(),
29
+ rovoProduct = _useRovoConfig.product;
29
30
  var automationActionOnClick = useCallback(function (automationActionData) {
30
31
  var product = automationActionData.product,
31
32
  resourceType = automationActionData.resourceType,
@@ -77,7 +78,7 @@ var AutomationAction = function AutomationAction(props) {
77
78
  spacing: "spacious",
78
79
  color: "currentColor",
79
80
  label: automationActionIconLabel
80
- }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || isRovoBlockCardExperimentEnabled ? {
81
+ }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || !!rovoProduct && rovoProduct === 'CONFLUENCE' ? {
81
82
  size: props.iconSize
82
83
  } : {})),
83
84
  testId: "smart-action-automation-action",
@@ -14,8 +14,8 @@ import { fg } from '@atlaskit/platform-feature-flags';
14
14
  import { ActionName } from '../../../../../constants';
15
15
  import { messages } from '../../../../../messages';
16
16
  import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
17
- import { useBlockCardRovoActionExperimentNoExposure } from '../../../../../state/hooks/use-block-card-rovo-action-experiment';
18
17
  import useInvokeClientAction from '../../../../../state/hooks/use-invoke-client-action';
18
+ import useRovoConfig from '../../../../../state/hooks/use-rovo-config';
19
19
  import Action from '../action';
20
20
  var CopyLinkAction = function CopyLinkAction(_ref) {
21
21
  var _context$actions;
@@ -29,7 +29,8 @@ var CopyLinkAction = function CopyLinkAction(_ref) {
29
29
  _useState2 = _slicedToArray(_useState, 2),
30
30
  tooltipMessage = _useState2[0],
31
31
  setTooltipMessage = _useState2[1];
32
- var isRovoBlockCardExperimentEnabled = useBlockCardRovoActionExperimentNoExposure();
32
+ var _useRovoConfig = useRovoConfig(),
33
+ product = _useRovoConfig.product;
33
34
  var onClick = useCallback(function () {
34
35
  if (data !== null && data !== void 0 && data.invokeAction) {
35
36
  invoke(_objectSpread(_objectSpread({}, data.invokeAction), {}, {
@@ -65,7 +66,7 @@ var CopyLinkAction = function CopyLinkAction(_ref) {
65
66
  color: "currentColor",
66
67
  label: "",
67
68
  spacing: "spacious"
68
- }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || isRovoBlockCardExperimentEnabled ? {
69
+ }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || !!product && product === 'CONFLUENCE' ? {
69
70
  size: props.iconSize
70
71
  } : {})),
71
72
  onClick: onClick,
@@ -10,8 +10,8 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
10
  import { ActionName } from '../../../../../constants';
11
11
  import { messages } from '../../../../../messages';
12
12
  import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
13
- import { useBlockCardRovoActionExperimentNoExposure } from '../../../../../state/hooks/use-block-card-rovo-action-experiment';
14
13
  import useInvokeClientAction from '../../../../../state/hooks/use-invoke-client-action';
14
+ import useRovoConfig from '../../../../../state/hooks/use-rovo-config';
15
15
  import Action from '../action';
16
16
  var PreviewAction = function PreviewAction(_ref) {
17
17
  var _context$actions;
@@ -22,7 +22,8 @@ var PreviewAction = function PreviewAction(_ref) {
22
22
  var invoke = useInvokeClientAction({});
23
23
  var data = context === null || context === void 0 || (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.PreviewAction];
24
24
  var hasPreviewPanel = data === null || data === void 0 ? void 0 : data.hasPreviewPanel;
25
- var isRovoBlockCardExperimentEnabled = useBlockCardRovoActionExperimentNoExposure();
25
+ var _useRovoConfig = useRovoConfig(),
26
+ product = _useRovoConfig.product;
26
27
  var onClick = useCallback(function () {
27
28
  if (data !== null && data !== void 0 && data.invokeAction) {
28
29
  invoke(data.invokeAction);
@@ -38,7 +39,7 @@ var PreviewAction = function PreviewAction(_ref) {
38
39
  color: "currentColor",
39
40
  spacing: "spacious",
40
41
  label: ""
41
- }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || isRovoBlockCardExperimentEnabled ? {
42
+ }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || !!product && product === 'CONFLUENCE' ? {
42
43
  size: props.iconSize
43
44
  } : {}));
44
45
  }
@@ -46,10 +47,10 @@ var PreviewAction = function PreviewAction(_ref) {
46
47
  color: "currentColor",
47
48
  spacing: "spacious",
48
49
  label: ""
49
- }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || isRovoBlockCardExperimentEnabled ? {
50
+ }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || !!product && product === 'CONFLUENCE' ? {
50
51
  size: props.iconSize
51
52
  } : {}));
52
- }, [hasPreviewPanel, props.iconSize, isRovoBlockCardExperimentEnabled]);
53
+ }, [hasPreviewPanel, props.iconSize, product]);
53
54
  var actionLabel = useMemo(function () {
54
55
  // Only use panel message if experiment is enabled and hasPreviewPanel is true
55
56
  if (expValEquals('platform_hover_card_preview_panel', 'cohort', 'test') && hasPreviewPanel) {
@@ -20,7 +20,6 @@ import Tooltip from '@atlaskit/tooltip';
20
20
  import { ActionName, CardDisplay, SmartLinkSize } from '../../../../../constants';
21
21
  import { messages } from '../../../../../messages';
22
22
  import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
23
- import { isBlockCardRovoActionExperimentEnabled } from '../../../../../state/hooks/use-block-card-rovo-action-experiment';
24
23
  import useRovoConfig from '../../../../../state/hooks/use-rovo-config';
25
24
  import { RovoChatPromptKey } from '../../../../common/rovo-chat-utils';
26
25
  import { sizeToButtonSpacing } from '../../utils';
@@ -81,7 +80,6 @@ var ActionGroup = function ActionGroup(_ref) {
81
80
  }, [context, items, product]);
82
81
  var isMoreThenTwoItems = renderableActionItems.length > visibleButtonsNum;
83
82
  var rovoChatAction = context === null || context === void 0 || (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.RovoChatAction];
84
- var is3PBlockExperimentEnabled = isBlockCardRovoActionExperimentEnabled(rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.product);
85
83
  var onOpenChange = useCallback(function (attrs) {
86
84
  setIsOpen(attrs.isOpen);
87
85
  if (onDropdownOpenChange) {
@@ -96,7 +94,7 @@ var ActionGroup = function ActionGroup(_ref) {
96
94
  }
97
95
  }, [isOpen, onOpenChange]);
98
96
  var actionButtons = useMemo(function () {
99
- if (!!rovoChatAction && is3PBlockExperimentEnabled) {
97
+ if (!!rovoChatAction && rovoChatAction.product === 'CONFLUENCE') {
100
98
  var rovoActions = [].concat(_toConsumableArray(containerWidth >= REDUCED_ACTIONS_SIZE ? renderableActionItems.slice(0, visibleButtonsNum - 1) : []), _toConsumableArray(containerWidth >= OVERFLOW_ONLY_ACTIONS_SIZE ? [{
101
99
  name: ActionName.RovoChatAction,
102
100
  prompts: [RovoChatPromptKey.ASK_ROVO_ANYTHING],
@@ -116,10 +114,10 @@ var ActionGroup = function ActionGroup(_ref) {
116
114
  }
117
115
  var actionItems = isMoreThenTwoItems ? renderableActionItems.slice(0, visibleButtonsNum - 1) : renderableActionItems;
118
116
  return renderActionItems(actionItems, size, appearance, false, onActionItemClick);
119
- }, [appearance, isMoreThenTwoItems, onActionItemClick, renderableActionItems, size, visibleButtonsNum, rovoChatAction, is3PBlockExperimentEnabled, containerWidth]);
117
+ }, [appearance, isMoreThenTwoItems, onActionItemClick, renderableActionItems, size, visibleButtonsNum, rovoChatAction, containerWidth]);
120
118
  var moreActionDropdown = useMemo(function () {
121
119
  var actionItems;
122
- if (!!rovoChatAction && is3PBlockExperimentEnabled && containerWidth < OVERFLOW_ONLY_ACTIONS_SIZE) {
120
+ if (!!rovoChatAction && rovoChatAction.product === 'CONFLUENCE' && containerWidth < OVERFLOW_ONLY_ACTIONS_SIZE) {
123
121
  actionItems = [].concat(_toConsumableArray(renderableActionItems), [{
124
122
  name: ActionName.RovoChatAction,
125
123
  prompts: [RovoChatPromptKey.ASK_ROVO_ANYTHING],
@@ -132,7 +130,7 @@ var ActionGroup = function ActionGroup(_ref) {
132
130
  name: ActionName.PreviewAction,
133
131
  iconSize: 'small'
134
132
  }]);
135
- } else if (!!rovoChatAction && is3PBlockExperimentEnabled && containerWidth < REDUCED_ACTIONS_SIZE) {
133
+ } else if (!!rovoChatAction && rovoChatAction.product === 'CONFLUENCE' && containerWidth < REDUCED_ACTIONS_SIZE) {
136
134
  actionItems = renderableActionItems;
137
135
  } else {
138
136
  actionItems = isMoreThenTwoItems ? renderableActionItems.slice(visibleButtonsNum - 1) : [];
@@ -156,11 +154,11 @@ var ActionGroup = function ActionGroup(_ref) {
156
154
  testId: "action-group-more-button-tooltip",
157
155
  tag: "span"
158
156
  }, /*#__PURE__*/React.createElement(Button, _extends({}, props, {
159
- spacing: !!rovoChatAction && is3PBlockExperimentEnabled ? size === SmartLinkSize.XLarge ? 'default' : 'compact' : spacing,
157
+ spacing: !!rovoChatAction && rovoChatAction.product === 'CONFLUENCE' ? size === SmartLinkSize.XLarge ? 'default' : 'compact' : spacing,
160
158
  testId: "action-group-more-button",
161
159
  iconBefore: moreIcon,
162
160
  ref: triggerRef
163
- }, is3PBlockExperimentEnabled ? {
161
+ }, !!rovoChatAction && rovoChatAction.product === 'CONFLUENCE' ? {
164
162
  appearance: appearance
165
163
  } : {})));
166
164
  },
@@ -169,7 +167,7 @@ var ActionGroup = function ActionGroup(_ref) {
169
167
  }, renderActionItems(actionItems, size, appearance, true, onActionItemClick));
170
168
  }
171
169
  return null;
172
- }, [appearance, isMoreThenTwoItems, isOpen, onActionItemClick, onOpenChange, renderableActionItems, size, ui === null || ui === void 0 ? void 0 : ui.zIndex, visibleButtonsNum, rovoChatAction, is3PBlockExperimentEnabled, containerWidth]);
170
+ }, [appearance, isMoreThenTwoItems, isOpen, onActionItemClick, onOpenChange, renderableActionItems, size, ui === null || ui === void 0 ? void 0 : ui.zIndex, visibleButtonsNum, rovoChatAction, containerWidth]);
173
171
  return renderableActionItems.length > 0 ? /*#__PURE__*/React.createElement("div", {
174
172
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
175
173
  className: ax(["_1e0c116y _dzc21h6o _1ilq1i6y", "actions-button-group"]),
@@ -9,7 +9,6 @@ import { browser } from '@atlaskit/linking-common/user-agent';
9
9
  import { WidthObserver } from '@atlaskit/width-detector';
10
10
  import { ActionName, SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
11
11
  import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context';
12
- import { isBlockCardRovoActionExperimentEnabled } from '../../../../../../state/hooks/use-block-card-rovo-action-experiment';
13
12
  import { Provider } from '../../../elements';
14
13
  import ActionGroup from '../../action-group';
15
14
  import Block from '../../block';
@@ -30,8 +29,7 @@ var FooterBlockResolvedView = function FooterBlockResolvedView(props) {
30
29
  isPreviewBlockErrored = props.isPreviewBlockErrored;
31
30
  var context = useFlexibleUiContext();
32
31
  var rovoChatAction = context === null || context === void 0 || (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.RovoChatAction];
33
- var is3PBlockExperimentEnabled = isBlockCardRovoActionExperimentEnabled(rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.product);
34
- var hasPreview = !!rovoChatAction && is3PBlockExperimentEnabled && !!(context !== null && context !== void 0 && context.preview) && !isPreviewBlockErrored;
32
+ var hasPreview = !!rovoChatAction && !!(rovoChatAction !== null && rovoChatAction !== void 0 && rovoChatAction.product) && (rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.product) === 'CONFLUENCE' && !!(context !== null && context !== void 0 && context.preview) && !isPreviewBlockErrored;
35
33
  var hasActions = useMemo(function () {
36
34
  var _filterActionItems;
37
35
  return ((_filterActionItems = filterActionItems(actions, context)) === null || _filterActionItems === void 0 ? void 0 : _filterActionItems.length) > 0;
@@ -62,22 +60,22 @@ var FooterBlockResolvedView = function FooterBlockResolvedView(props) {
62
60
  appearance: "subtle",
63
61
  testId: "".concat(testId, "-provider"),
64
62
  hideLabel: hasPreview,
65
- className: ax([!!rovoChatAction && is3PBlockExperimentEnabled && "_1wpz1h6o"])
63
+ className: ax([!!rovoChatAction && (rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.product) === 'CONFLUENCE' && "_1wpz1h6o"])
66
64
  }), actions && hasActions ? /*#__PURE__*/React.createElement(ElementGroup, {
67
65
  testId: "smart-element-group-actions",
68
66
  align: SmartLinkAlignment.Right,
69
67
  direction: SmartLinkDirection.Horizontal,
70
68
  width: SmartLinkWidth.Flexible,
71
- className: ax([size === SmartLinkSize.XLarge && "_c71lxy5q", safari && "_4t3i1osq", !!rovoChatAction && is3PBlockExperimentEnabled && "_kqswh2mm"])
72
- }, !!rovoChatAction && is3PBlockExperimentEnabled && /*#__PURE__*/React.createElement(WidthObserver, {
69
+ className: ax([size === SmartLinkSize.XLarge && "_c71lxy5q", safari && "_4t3i1osq", !!rovoChatAction && (rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.product) === 'CONFLUENCE' && "_kqswh2mm"])
70
+ }, !!rovoChatAction && (rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.product) === 'CONFLUENCE' && /*#__PURE__*/React.createElement(WidthObserver, {
73
71
  setWidth: setContainerWidth,
74
72
  offscreen: true
75
73
  }), /*#__PURE__*/React.createElement(ActionGroup, {
76
74
  onDropdownOpenChange: onDropdownOpenChange,
77
75
  items: actions,
78
- appearance: !!rovoChatAction && is3PBlockExperimentEnabled ? 'subtle' : 'default',
79
- size: !!rovoChatAction && is3PBlockExperimentEnabled ? SmartLinkSize.Small : size,
80
- containerWidth: !!rovoChatAction && is3PBlockExperimentEnabled ? containerWidth : undefined
76
+ appearance: !!rovoChatAction && (rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.product) === 'CONFLUENCE' ? 'subtle' : 'default',
77
+ size: !!rovoChatAction && (rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.product) === 'CONFLUENCE' ? SmartLinkSize.Small : size,
78
+ containerWidth: !!rovoChatAction && (rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.product) === 'CONFLUENCE' ? containerWidth : undefined
81
79
  })) : null);
82
80
  };
83
81
  export default FooterBlockResolvedView;
@@ -6,7 +6,6 @@ var _excluded = ["name"];
6
6
  var _ElementDisplaySchema;
7
7
  import React from 'react';
8
8
  import { ActionName, ElementName, SmartLinkSize } from '../../../../constants';
9
- import { isBlockCardRovoActionExperimentEnabled } from '../../../../state/hooks/use-block-card-rovo-action-experiment';
10
9
  import { isFlexibleUiElement } from '../../../../utils/flexible';
11
10
  import * as Elements from '../elements';
12
11
  import ActionGroup from './action-group';
@@ -51,7 +50,6 @@ export var filterActionItems = function filterActionItems() {
51
50
  var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
52
51
  var context = arguments.length > 1 ? arguments[1] : undefined;
53
52
  var product = arguments.length > 2 ? arguments[2] : undefined;
54
- var isBlockCard3PExperimentEnabled = isBlockCardRovoActionExperimentEnabled(product);
55
53
  return items.filter(function (item) {
56
54
  switch (item.name) {
57
55
  case ActionName.DeleteAction:
@@ -60,11 +58,10 @@ export var filterActionItems = function filterActionItems() {
60
58
  // Named and custom actions that user defines.
61
59
  return Boolean(ActionName[item.name]);
62
60
  case ActionName.RovoChatAction:
63
- if (isBlockCard3PExperimentEnabled) {
61
+ if (!!product && product === 'CONFLUENCE') {
64
62
  return Boolean(ActionName[item.name]);
65
63
  }
66
64
  // same as default case below
67
- // remove on cleanup of platform_sl_3p_auth_rovo_block_card_kill_switch
68
65
  if ((context === null || context === void 0 ? void 0 : context.actions) === undefined) {
69
66
  return false;
70
67
  }
@@ -10,7 +10,7 @@ import { Box } from '@atlaskit/primitives/compiled';
10
10
  import { IconType } from '../../../../../../constants';
11
11
  import { messages } from '../../../../../../messages';
12
12
  import { useFlexibleUiOptionContext } from '../../../../../../state/flexible-ui-context';
13
- import { useBlockCardRovoActionExperimentNoExposure } from '../../../../../../state/hooks/use-block-card-rovo-action-experiment';
13
+ import useRovoConfig from '../../../../../../state/hooks/use-rovo-config';
14
14
  import ImageIcon from '../../../../../common/image-icon';
15
15
  import AtlaskitIcon from '../../../common/atlaskit-icon';
16
16
  import { withOverrideCss } from '../../../common/with-override-css';
@@ -81,13 +81,14 @@ var BaseBadgeRefreshNew = /*#__PURE__*/forwardRef(function (_ref, ref) {
81
81
  _ref$hideLabel = _ref.hideLabel,
82
82
  hideLabel = _ref$hideLabel === void 0 ? false : _ref$hideLabel;
83
83
  var ui = useFlexibleUiOptionContext();
84
- var isRovoBlockCardExperimentEnabled = useBlockCardRovoActionExperimentNoExposure();
84
+ var _useRovoConfig = useRovoConfig(),
85
+ product = _useRovoConfig.product;
85
86
  var formattedMessageOrLabel = getFormattedMessageFromIcon(icon) || label;
86
87
  var badgeIcon = renderAtlaskitIcon(icon, testId) || renderImageIcon(url, testId, ui === null || ui === void 0 ? void 0 : ui.hideLoadingSkeleton);
87
88
  if (!formattedMessageOrLabel || !badgeIcon) {
88
89
  return null;
89
90
  }
90
- var shouldHideLabel = hideLabel && isRovoBlockCardExperimentEnabled;
91
+ var shouldHideLabel = hideLabel && !!product && product === 'CONFLUENCE';
91
92
  return /*#__PURE__*/React.createElement("span", {
92
93
  "data-smart-element": name,
93
94
  "data-smart-element-badge": true,
@@ -12,7 +12,7 @@ import LinkWarningModal from './LinkWarningModal';
12
12
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
13
13
  var PACKAGE_DATA = {
14
14
  packageName: "@atlaskit/smart-card",
15
- packageVersion: "45.3.1",
15
+ packageVersion: "45.3.2",
16
16
  componentName: 'linkUrl'
17
17
  };
18
18
  var LinkUrl = function LinkUrl(_ref) {
@@ -6,7 +6,6 @@ import RovoChatIcon from '@atlaskit/icon/core/rovo-chat';
6
6
  import { RovoIcon } from '@atlaskit/logo';
7
7
  import { CardDisplay } from '../../../constants';
8
8
  import { messages } from '../../../messages';
9
- import { isBlockCardRovoActionExperimentEnabled } from '../../../state/hooks/use-block-card-rovo-action-experiment';
10
9
  import AiChapterIcon from '../../FlexibleCard/assets/ai-chapter-icon';
11
10
  import AIEditIcon from '../../FlexibleCard/assets/ai-edit-icon';
12
11
  import AISearchIcon from '../../FlexibleCard/assets/ai-search-icon';
@@ -65,7 +64,6 @@ export var getPromptAction = function getPromptAction(_ref) {
65
64
  },
66
65
  contextLong = _ref2.contextLong,
67
66
  contextShort = _ref2.contextShort;
68
- var isBlockCard3PExperimentEnabled = isBlockCardRovoActionExperimentEnabled(product);
69
67
  switch (promptKey) {
70
68
  case RovoChatPromptKey.RECOMMEND_OTHER_SOURCES:
71
69
  var label_recommend = intl.formatMessage(messages.rovo_prompt_button_recommend_other_sources);
@@ -131,10 +129,10 @@ export var getPromptAction = function getPromptAction(_ref) {
131
129
  ignoreTag: true
132
130
  });
133
131
  return {
134
- icon: cardAppearance === CardDisplay.Block && isBlockCard3PExperimentEnabled ? /*#__PURE__*/React.createElement(AiChatIcon, {
132
+ icon: /*#__PURE__*/React.createElement(AiChatIcon, {
135
133
  label: label_summarize,
136
134
  size: iconSize
137
- }) : /*#__PURE__*/React.createElement(AIEditIcon, null),
135
+ }),
138
136
  content: label_summarize,
139
137
  tooltipMessage: label_summarize,
140
138
  data: {
@@ -195,7 +193,7 @@ export var getPromptAction = function getPromptAction(_ref) {
195
193
  url: url
196
194
  });
197
195
  return {
198
- icon: cardAppearance === CardDisplay.Block && isBlockCard3PExperimentEnabled ? /*#__PURE__*/React.createElement(RovoIcon, {
196
+ icon: cardAppearance === CardDisplay.Block && !!product && product === 'CONFLUENCE' ? /*#__PURE__*/React.createElement(RovoIcon, {
199
197
  label: label_ask_rovo_anything,
200
198
  size: 'xxsmall',
201
199
  shouldUseHexLogo: true
@@ -1,27 +1,15 @@
1
- import type { ProductType } from '@atlaskit/linking-common';
2
1
  import type { CardActionOptions } from '../../../view/Card/types';
3
- export interface BlockCardRovoActionExperiment {
4
- /**
5
- * True when the user is in the treatment cohort and should see the
6
- * inline action nudge UI. All treatment surfaces should gate on this.
7
- */
8
- isEnabled: boolean;
9
- }
10
2
  /**
11
- * Returns whether the platform_sl_3p_auth_rovo_block_card_confluence experiment
12
- * is enabled for the current user and link context.
3
+ * Returns whether the rovo actions are enabled for the current user and link context.
13
4
  *
14
5
  * All eligibility criteria are consolidated here:
15
6
  * 1. Rovo chat must be enabled for the tenant.
16
7
  * 2. The consumer must have opted in via actionOptions.rovoChatAction.optIn.
17
8
  * 3. The link must support the RovoActions feature.
18
9
  * 4. The extension key must be one of the supported options.
19
- * 5. The experiment value must be true (via tmp-editor-statsig).
20
10
  *
21
11
  * The extension key is derived from the card store via the resolved URL,
22
12
  * so callers don't need to thread it as a prop.
23
13
  */
24
- declare const useBlockCardRovoActionExperiment: (url?: string, actionOptions?: CardActionOptions) => BlockCardRovoActionExperiment;
25
- export declare const isBlockCardRovoActionExperimentEnabled: (product?: ProductType) => boolean;
26
- export declare const useBlockCardRovoActionExperimentNoExposure: () => boolean;
27
- export default useBlockCardRovoActionExperiment;
14
+ declare const useBlockCardRovoAction: (url?: string, actionOptions?: CardActionOptions) => boolean;
15
+ export default useBlockCardRovoAction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "45.3.2",
3
+ "version": "45.4.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -77,7 +77,7 @@
77
77
  "@atlaskit/platform-feature-flags-react": "^1.0.0",
78
78
  "@atlaskit/popup": "^5.0.0",
79
79
  "@atlaskit/primitives": "^20.0.0",
80
- "@atlaskit/react-ufo": "^7.1.0",
80
+ "@atlaskit/react-ufo": "^7.2.0",
81
81
  "@atlaskit/rovo-triggers": "^9.2.0",
82
82
  "@atlaskit/section-message": "^9.1.0",
83
83
  "@atlaskit/select": "^22.1.0",
@@ -87,7 +87,7 @@
87
87
  "@atlaskit/textfield": "^9.0.0",
88
88
  "@atlaskit/theme": "^26.0.0",
89
89
  "@atlaskit/tile": "^2.0.0",
90
- "@atlaskit/tmp-editor-statsig": "^111.0.0",
90
+ "@atlaskit/tmp-editor-statsig": "^112.0.0",
91
91
  "@atlaskit/tokens": "^15.0.0",
92
92
  "@atlaskit/tooltip": "^23.0.0",
93
93
  "@atlaskit/ufo": "^1.0.0",
@@ -120,7 +120,7 @@
120
120
  "@atlaskit/css-reset": "^8.0.0",
121
121
  "@atlaskit/media-test-helpers": "^42.0.0",
122
122
  "@atlaskit/ssr": "workspace:^",
123
- "@atlassian/a11y-jest-testing": "^0.12.0",
123
+ "@atlassian/a11y-jest-testing": "^0.13.0",
124
124
  "@atlassian/analytics-tooling": "workspace:^",
125
125
  "@atlassian/feature-flags-test-utils": "^1.1.0",
126
126
  "@atlassian/gemini": "^1.47.0",
@@ -240,9 +240,6 @@
240
240
  "smart-card-inline-resolved-view-refactor": {
241
241
  "type": "boolean"
242
242
  },
243
- "platform_sl_3p_auth_rovo_block_card_kill_switch": {
244
- "type": "boolean"
245
- },
246
243
  "dfo-fix-preview-dynamic-style": {
247
244
  "type": "boolean"
248
245
  },