@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
  const ELIGIBLE_EXTENSION_KEYS = new Set(['slack-object-provider', 'google-object-provider', 'onedrive-object-provider', 'github-object-provider', 'ms-teams-object-provider', 'gitlab-object-provider', 'salesforce-object-provider']);
10
- const 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
- const useBlockCardRovoActionExperiment = (url, actionOptions) => {
20
+ const useBlockCardRovoAction = (url, actionOptions) => {
29
21
  var _actionOptions$rovoCh, _actionOptions$rovoCh2;
30
22
  const {
31
23
  rovoOptions: rovoConfig,
@@ -37,24 +29,12 @@ const useBlockCardRovoActionExperiment = (url, actionOptions) => {
37
29
  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;
38
30
  return useMemo(() => {
39
31
  if (!isRovoChatEnabled || !url || !isRovoChatActionOptedIn) {
40
- return NOT_ENABLED_RESULT;
32
+ return false;
41
33
  }
42
34
  if (extensionKey && !ELIGIBLE_EXTENSION_KEYS.has(extensionKey)) {
43
- return NOT_ENABLED_RESULT;
35
+ return false;
44
36
  }
45
- const 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);
46
- return {
47
- isEnabled: isConfluenceEnabled
48
- };
37
+ return !!product && product === 'CONFLUENCE';
49
38
  }, [isRovoChatEnabled, extensionKey, url, isRovoChatActionOptedIn, product]);
50
39
  };
51
- export const isBlockCardRovoActionExperimentEnabled = product => {
52
- 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);
53
- };
54
- export const useBlockCardRovoActionExperimentNoExposure = () => {
55
- const {
56
- product
57
- } = useRovoConfig();
58
- return isBlockCardRovoActionExperimentEnabled(product);
59
- };
60
- export default useBlockCardRovoActionExperiment;
40
+ export default useBlockCardRovoAction;
@@ -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.3.1" || ''
5
+ packageVersion: "45.3.2" || ''
6
6
  };
7
7
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
8
8
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -9,7 +9,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import { ActionName, CardDisplay, ElementName, SmartLinkPosition } from '../../../constants';
10
10
  import extractRovoChatAction from '../../../extractors/flexible/actions/extract-rovo-chat-action';
11
11
  import { getExtensionKey } from '../../../state/helpers';
12
- import useBlockCardRovoActionExperiment from '../../../state/hooks/use-block-card-rovo-action-experiment';
12
+ import useBlockCardRovoAction from '../../../state/hooks/use-block-card-rovo-action-experiment';
13
13
  import useRovoConfig from '../../../state/hooks/use-rovo-config';
14
14
  import { RovoChatPromptKey } from '../../common/rovo-chat-utils';
15
15
  import FlexibleCard from '../../FlexibleCard';
@@ -42,19 +42,8 @@ const ResolvedView = ({
42
42
  var _cardState$details2;
43
43
  const [isPreviewBlockErrored, setIsPreviewBlockErrored] = useState(false);
44
44
  const extensionKey = getExtensionKey(cardState.details);
45
- const {
46
- isEnabled: is3PRovoBlockExperimentEnabled
47
- } = useBlockCardRovoActionExperiment(url, actionOptions);
48
- const rovoConfig = is3PRovoBlockExperimentEnabled ?
49
- // eslint-disable-next-line react-hooks/rules-of-hooks
50
- useRovoConfig() : undefined;
51
- const showRovoResolvedView = is3PRovoBlockExperimentEnabled ?
52
- // eslint-disable-next-line react-hooks/rules-of-hooks
53
- useMemo(() => (cardState === null || cardState === void 0 ? void 0 : cardState.status) === 'resolved' && cardState.details && extractRovoChatAction({
54
- response: cardState.details,
55
- rovoConfig,
56
- actionOptions: actionOptions
57
- }) !== undefined, [actionOptions, cardState === null || cardState === void 0 ? void 0 : cardState.details, cardState === null || cardState === void 0 ? void 0 : cardState.status, rovoConfig]) : undefined;
45
+ const is3PRovoBlockRovoActionEnabled = useBlockCardRovoAction(url, actionOptions);
46
+ const rovoConfig = useRovoConfig();
58
47
 
59
48
  // eslint-disable-next-line react-hooks/rules-of-hooks
60
49
  const {
@@ -69,7 +58,7 @@ const ResolvedView = ({
69
58
  bottomMetadata
70
59
  } = getSimulatedBetterMetadata(cardState.details);
71
60
  const prompts = useMemo(() => {
72
- if (is3PRovoBlockExperimentEnabled) {
61
+ if (is3PRovoBlockRovoActionEnabled) {
73
62
  var _cardState$details, _cardState$details$da;
74
63
  const defaultPrompts = [RovoChatPromptKey.KEY_HIGHLIGHTS];
75
64
  const linkType = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : (_cardState$details$da = _cardState$details.data) === null || _cardState$details$da === void 0 ? void 0 : _cardState$details$da['@type'];
@@ -85,28 +74,35 @@ const ResolvedView = ({
85
74
  return [RovoChatPromptKey.SUMMARIZE_LINK, ...defaultPrompts];
86
75
  }
87
76
  return [];
88
- }, [cardState === null || cardState === void 0 ? void 0 : (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data, extensionKey, is3PRovoBlockExperimentEnabled]);
89
- const footerActions = useMemo(() => showRovoResolvedView && is3PRovoBlockExperimentEnabled ? [{
90
- name: ActionName.RovoChatAction,
91
- prompts: prompts,
92
- iconSize: 'small',
93
- cardAppearance: CardDisplay.Block
94
- }, {
95
- name: ActionName.FollowAction,
96
- iconSize: 'small'
97
- }, {
98
- name: ActionName.DownloadAction,
99
- iconSize: 'small'
100
- }] : [{
101
- name: ActionName.FollowAction,
102
- hideIcon: true
103
- }, {
104
- name: ActionName.PreviewAction,
105
- hideIcon: true
106
- }, {
107
- name: ActionName.DownloadAction,
108
- hideIcon: true
109
- }], [showRovoResolvedView, prompts, is3PRovoBlockExperimentEnabled]);
77
+ }, [cardState === null || cardState === void 0 ? void 0 : (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data, extensionKey, is3PRovoBlockRovoActionEnabled]);
78
+ const footerActions = useMemo(() => {
79
+ const showRovoResolvedView = (cardState === null || cardState === void 0 ? void 0 : cardState.status) === 'resolved' && cardState.details && extractRovoChatAction({
80
+ response: cardState.details,
81
+ rovoConfig,
82
+ actionOptions: actionOptions
83
+ }) !== undefined;
84
+ return showRovoResolvedView && is3PRovoBlockRovoActionEnabled ? [{
85
+ name: ActionName.RovoChatAction,
86
+ prompts: prompts,
87
+ iconSize: 'small',
88
+ cardAppearance: CardDisplay.Block
89
+ }, {
90
+ name: ActionName.FollowAction,
91
+ iconSize: 'small'
92
+ }, {
93
+ name: ActionName.DownloadAction,
94
+ iconSize: 'small'
95
+ }] : [{
96
+ name: ActionName.FollowAction,
97
+ hideIcon: true
98
+ }, {
99
+ name: ActionName.PreviewAction,
100
+ hideIcon: true
101
+ }, {
102
+ name: ActionName.DownloadAction,
103
+ hideIcon: true
104
+ }];
105
+ }, [prompts, is3PRovoBlockRovoActionEnabled, cardState, rovoConfig, actionOptions]);
110
106
  const uiOptions = FlexibleCardUiOptions;
111
107
  uiOptions.enableSnippetRenderer = true;
112
108
  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
  const IconOnlyLarge = null;
@@ -57,8 +57,10 @@ const ActionButtonRefresh = /*#__PURE__*/forwardRef(({
57
57
  var _context$actions;
58
58
  const iconOnly = !content;
59
59
  const context = useFlexibleUiContext();
60
- const isRovoBlockCardExperimentEnabled = useBlockCardRovoActionExperimentNoExposure();
61
- const isRovoSupported = !!(context !== null && context !== void 0 && (_context$actions = context.actions) !== null && _context$actions !== void 0 && _context$actions[ActionName.RovoChatAction]) && isRovoBlockCardExperimentEnabled;
60
+ const {
61
+ product
62
+ } = useRovoConfig();
63
+ const isRovoSupported = !!(context !== null && context !== void 0 && (_context$actions = context.actions) !== null && _context$actions !== void 0 && _context$actions[ActionName.RovoChatAction]) && !!product && product === 'CONFLUENCE';
62
64
  const onButtonClick = useCallback(handler => e => {
63
65
  e.preventDefault();
64
66
  handler();
@@ -5,7 +5,7 @@ import RovoIcon from '@atlaskit/icon-lab/core/rovo';
5
5
  import { fg } from '@atlaskit/platform-feature-flags';
6
6
  import { useAnalyticsEvents } from '../../../../../common/analytics/generated/use-analytics-events';
7
7
  import { messages } from '../../../../../messages';
8
- import { useBlockCardRovoActionExperimentNoExposure } from '../../../../../state/hooks/use-block-card-rovo-action-experiment';
8
+ import useRovoConfig from '../../../../../state/hooks/use-rovo-config';
9
9
  import Action from '../action';
10
10
  import { getErrorMessage } from './utils';
11
11
  export function AISummariseAction({
@@ -19,7 +19,9 @@ export function AISummariseAction({
19
19
  const {
20
20
  fireEvent
21
21
  } = useAnalyticsEvents();
22
- const isRovoBlockCardExperimentEnabled = useBlockCardRovoActionExperimentNoExposure();
22
+ const {
23
+ product
24
+ } = useRovoConfig();
23
25
  const onCompleted = useCallback(state => {
24
26
  if ((state === null || state === void 0 ? void 0 : state.status) === 'error') {
25
27
  onErrorCallback === null || onErrorCallback === void 0 ? void 0 : onErrorCallback(getErrorMessage(state.error));
@@ -42,7 +44,7 @@ export function AISummariseAction({
42
44
  spacing: "spacious",
43
45
  color: "currentColor",
44
46
  label: "Summarise with AI"
45
- }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || isRovoBlockCardExperimentEnabled ? {
47
+ }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || !!product && product === 'CONFLUENCE' ? {
46
48
  size: props.iconSize
47
49
  } : {})),
48
50
  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';
@@ -27,7 +27,9 @@ const AutomationAction = props => {
27
27
  fireEvent
28
28
  } = useAnalyticsEvents();
29
29
  const automationActionData = context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.AutomationAction];
30
- const isRovoBlockCardExperimentEnabled = useBlockCardRovoActionExperimentNoExposure();
30
+ const {
31
+ product: rovoProduct
32
+ } = useRovoConfig();
31
33
  const automationActionOnClick = useCallback(automationActionData => {
32
34
  const {
33
35
  product,
@@ -78,7 +80,7 @@ const AutomationAction = props => {
78
80
  spacing: "spacious",
79
81
  color: "currentColor",
80
82
  label: automationActionIconLabel
81
- }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || isRovoBlockCardExperimentEnabled ? {
83
+ }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || !!rovoProduct && rovoProduct === 'CONFLUENCE' ? {
82
84
  size: props.iconSize
83
85
  } : {})),
84
86
  testId: "smart-action-automation-action",
@@ -6,8 +6,8 @@ import { fg } from '@atlaskit/platform-feature-flags';
6
6
  import { ActionName } from '../../../../../constants';
7
7
  import { messages } from '../../../../../messages';
8
8
  import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
9
- import { useBlockCardRovoActionExperimentNoExposure } from '../../../../../state/hooks/use-block-card-rovo-action-experiment';
10
9
  import useInvokeClientAction from '../../../../../state/hooks/use-invoke-client-action';
10
+ import useRovoConfig from '../../../../../state/hooks/use-rovo-config';
11
11
  import Action from '../action';
12
12
  const CopyLinkAction = ({
13
13
  onClick: onClickCallback,
@@ -19,7 +19,9 @@ const CopyLinkAction = ({
19
19
  const invoke = useInvokeClientAction({});
20
20
  const data = context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.CopyLinkAction];
21
21
  const [tooltipMessage, setTooltipMessage] = useState(messages.copy_url_to_clipboard);
22
- const isRovoBlockCardExperimentEnabled = useBlockCardRovoActionExperimentNoExposure();
22
+ const {
23
+ product
24
+ } = useRovoConfig();
23
25
  const onClick = useCallback(() => {
24
26
  if (data !== null && data !== void 0 && data.invokeAction) {
25
27
  invoke({
@@ -40,7 +42,7 @@ const CopyLinkAction = ({
40
42
  color: "currentColor",
41
43
  label: "",
42
44
  spacing: "spacious"
43
- }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || isRovoBlockCardExperimentEnabled ? {
45
+ }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || !!product && product === 'CONFLUENCE' ? {
44
46
  size: props.iconSize
45
47
  } : {})),
46
48
  onClick: onClick,
@@ -8,8 +8,8 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
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';
12
11
  import useInvokeClientAction from '../../../../../state/hooks/use-invoke-client-action';
12
+ import useRovoConfig from '../../../../../state/hooks/use-rovo-config';
13
13
  import Action from '../action';
14
14
  const PreviewAction = ({
15
15
  onClick: onClickCallback,
@@ -21,7 +21,9 @@ const PreviewAction = ({
21
21
  const invoke = useInvokeClientAction({});
22
22
  const data = context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.PreviewAction];
23
23
  const hasPreviewPanel = data === null || data === void 0 ? void 0 : data.hasPreviewPanel;
24
- const isRovoBlockCardExperimentEnabled = useBlockCardRovoActionExperimentNoExposure();
24
+ const {
25
+ product
26
+ } = useRovoConfig();
25
27
  const onClick = useCallback(() => {
26
28
  if (data !== null && data !== void 0 && data.invokeAction) {
27
29
  invoke(data.invokeAction);
@@ -37,7 +39,7 @@ const PreviewAction = ({
37
39
  color: "currentColor",
38
40
  spacing: "spacious",
39
41
  label: ""
40
- }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || isRovoBlockCardExperimentEnabled ? {
42
+ }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || !!product && product === 'CONFLUENCE' ? {
41
43
  size: props.iconSize
42
44
  } : {}));
43
45
  }
@@ -45,10 +47,10 @@ const PreviewAction = ({
45
47
  color: "currentColor",
46
48
  spacing: "spacious",
47
49
  label: ""
48
- }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || isRovoBlockCardExperimentEnabled ? {
50
+ }, fg('platform_sl_3p_auth_rovo_action_kill_switch') || !!product && product === 'CONFLUENCE' ? {
49
51
  size: props.iconSize
50
52
  } : {}));
51
- }, [hasPreviewPanel, props.iconSize, isRovoBlockCardExperimentEnabled]);
53
+ }, [hasPreviewPanel, props.iconSize, product]);
52
54
  const actionLabel = useMemo(() => {
53
55
  // Only use panel message if experiment is enabled and hasPreviewPanel is true
54
56
  if (expValEquals('platform_hover_card_preview_panel', 'cohort', 'test') && hasPreviewPanel) {
@@ -16,7 +16,6 @@ import Tooltip from '@atlaskit/tooltip';
16
16
  import { ActionName, CardDisplay, SmartLinkSize } from '../../../../../constants';
17
17
  import { messages } from '../../../../../messages';
18
18
  import { useFlexibleUiContext, useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
19
- import { isBlockCardRovoActionExperimentEnabled } from '../../../../../state/hooks/use-block-card-rovo-action-experiment';
20
19
  import useRovoConfig from '../../../../../state/hooks/use-rovo-config';
21
20
  import { RovoChatPromptKey } from '../../../../common/rovo-chat-utils';
22
21
  import { sizeToButtonSpacing } from '../../utils';
@@ -61,7 +60,6 @@ const ActionGroup = ({
61
60
  const renderableActionItems = useMemo(() => filterActionItems(items, context, product), [context, items, product]);
62
61
  const isMoreThenTwoItems = renderableActionItems.length > visibleButtonsNum;
63
62
  const rovoChatAction = context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.RovoChatAction];
64
- const is3PBlockExperimentEnabled = isBlockCardRovoActionExperimentEnabled(rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.product);
65
63
  const onOpenChange = useCallback(attrs => {
66
64
  setIsOpen(attrs.isOpen);
67
65
  if (onDropdownOpenChange) {
@@ -76,7 +74,7 @@ const ActionGroup = ({
76
74
  }
77
75
  }, [isOpen, onOpenChange]);
78
76
  const actionButtons = useMemo(() => {
79
- if (!!rovoChatAction && is3PBlockExperimentEnabled) {
77
+ if (!!rovoChatAction && rovoChatAction.product === 'CONFLUENCE') {
80
78
  const rovoActions = [...(containerWidth >= REDUCED_ACTIONS_SIZE ? renderableActionItems.slice(0, visibleButtonsNum - 1) : []), ...(containerWidth >= OVERFLOW_ONLY_ACTIONS_SIZE ? [{
81
79
  name: ActionName.RovoChatAction,
82
80
  prompts: [RovoChatPromptKey.ASK_ROVO_ANYTHING],
@@ -96,10 +94,10 @@ const ActionGroup = ({
96
94
  }
97
95
  const actionItems = isMoreThenTwoItems ? renderableActionItems.slice(0, visibleButtonsNum - 1) : renderableActionItems;
98
96
  return renderActionItems(actionItems, size, appearance, false, onActionItemClick);
99
- }, [appearance, isMoreThenTwoItems, onActionItemClick, renderableActionItems, size, visibleButtonsNum, rovoChatAction, is3PBlockExperimentEnabled, containerWidth]);
97
+ }, [appearance, isMoreThenTwoItems, onActionItemClick, renderableActionItems, size, visibleButtonsNum, rovoChatAction, containerWidth]);
100
98
  const moreActionDropdown = useMemo(() => {
101
99
  let actionItems;
102
- if (!!rovoChatAction && is3PBlockExperimentEnabled && containerWidth < OVERFLOW_ONLY_ACTIONS_SIZE) {
100
+ if (!!rovoChatAction && rovoChatAction.product === 'CONFLUENCE' && containerWidth < OVERFLOW_ONLY_ACTIONS_SIZE) {
103
101
  actionItems = [...renderableActionItems, {
104
102
  name: ActionName.RovoChatAction,
105
103
  prompts: [RovoChatPromptKey.ASK_ROVO_ANYTHING],
@@ -112,7 +110,7 @@ const ActionGroup = ({
112
110
  name: ActionName.PreviewAction,
113
111
  iconSize: 'small'
114
112
  }];
115
- } else if (!!rovoChatAction && is3PBlockExperimentEnabled && containerWidth < REDUCED_ACTIONS_SIZE) {
113
+ } else if (!!rovoChatAction && rovoChatAction.product === 'CONFLUENCE' && containerWidth < REDUCED_ACTIONS_SIZE) {
116
114
  actionItems = renderableActionItems;
117
115
  } else {
118
116
  actionItems = isMoreThenTwoItems ? renderableActionItems.slice(visibleButtonsNum - 1) : [];
@@ -136,11 +134,11 @@ const ActionGroup = ({
136
134
  testId: "action-group-more-button-tooltip",
137
135
  tag: "span"
138
136
  }, /*#__PURE__*/React.createElement(Button, _extends({}, props, {
139
- spacing: !!rovoChatAction && is3PBlockExperimentEnabled ? size === SmartLinkSize.XLarge ? 'default' : 'compact' : spacing,
137
+ spacing: !!rovoChatAction && rovoChatAction.product === 'CONFLUENCE' ? size === SmartLinkSize.XLarge ? 'default' : 'compact' : spacing,
140
138
  testId: "action-group-more-button",
141
139
  iconBefore: moreIcon,
142
140
  ref: triggerRef
143
- }, is3PBlockExperimentEnabled ? {
141
+ }, !!rovoChatAction && rovoChatAction.product === 'CONFLUENCE' ? {
144
142
  appearance
145
143
  } : {}))),
146
144
  testId: "action-group-dropdown",
@@ -148,7 +146,7 @@ const ActionGroup = ({
148
146
  }, renderActionItems(actionItems, size, appearance, true, onActionItemClick));
149
147
  }
150
148
  return null;
151
- }, [appearance, isMoreThenTwoItems, isOpen, onActionItemClick, onOpenChange, renderableActionItems, size, ui === null || ui === void 0 ? void 0 : ui.zIndex, visibleButtonsNum, rovoChatAction, is3PBlockExperimentEnabled, containerWidth]);
149
+ }, [appearance, isMoreThenTwoItems, isOpen, onActionItemClick, onOpenChange, renderableActionItems, size, ui === null || ui === void 0 ? void 0 : ui.zIndex, visibleButtonsNum, rovoChatAction, containerWidth]);
152
150
  return renderableActionItems.length > 0 ? /*#__PURE__*/React.createElement("div", {
153
151
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
154
152
  className: ax(["_1e0c116y _dzc21h6o _1ilq1i6y", "actions-button-group"]),
@@ -8,7 +8,6 @@ import { browser } from '@atlaskit/linking-common/user-agent';
8
8
  import { WidthObserver } from '@atlaskit/width-detector';
9
9
  import { ActionName, SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
10
10
  import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context';
11
- import { isBlockCardRovoActionExperimentEnabled } from '../../../../../../state/hooks/use-block-card-rovo-action-experiment';
12
11
  import { Provider } from '../../../elements';
13
12
  import ActionGroup from '../../action-group';
14
13
  import Block from '../../block';
@@ -30,8 +29,7 @@ const FooterBlockResolvedView = props => {
30
29
  } = props;
31
30
  const context = useFlexibleUiContext();
32
31
  const rovoChatAction = context === null || context === void 0 ? void 0 : (_context$actions = context.actions) === null || _context$actions === void 0 ? void 0 : _context$actions[ActionName.RovoChatAction];
33
- const is3PBlockExperimentEnabled = isBlockCardRovoActionExperimentEnabled(rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.product);
34
- const hasPreview = !!rovoChatAction && is3PBlockExperimentEnabled && !!(context !== null && context !== void 0 && context.preview) && !isPreviewBlockErrored;
32
+ const 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
  const hasActions = useMemo(() => {
36
34
  var _filterActionItems;
37
35
  return ((_filterActionItems = filterActionItems(actions, context)) === null || _filterActionItems === void 0 ? void 0 : _filterActionItems.length) > 0;
@@ -57,22 +55,22 @@ const FooterBlockResolvedView = props => {
57
55
  appearance: "subtle",
58
56
  testId: `${testId}-provider`,
59
57
  hideLabel: hasPreview,
60
- className: ax([!!rovoChatAction && is3PBlockExperimentEnabled && "_1wpz1h6o"])
58
+ className: ax([!!rovoChatAction && (rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.product) === 'CONFLUENCE' && "_1wpz1h6o"])
61
59
  }), actions && hasActions ? /*#__PURE__*/React.createElement(ElementGroup, {
62
60
  testId: "smart-element-group-actions",
63
61
  align: SmartLinkAlignment.Right,
64
62
  direction: SmartLinkDirection.Horizontal,
65
63
  width: SmartLinkWidth.Flexible,
66
- className: ax([size === SmartLinkSize.XLarge && "_c71lxy5q", safari && "_4t3i1osq", !!rovoChatAction && is3PBlockExperimentEnabled && "_kqswh2mm"])
67
- }, !!rovoChatAction && is3PBlockExperimentEnabled && /*#__PURE__*/React.createElement(WidthObserver, {
64
+ className: ax([size === SmartLinkSize.XLarge && "_c71lxy5q", safari && "_4t3i1osq", !!rovoChatAction && (rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.product) === 'CONFLUENCE' && "_kqswh2mm"])
65
+ }, !!rovoChatAction && (rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.product) === 'CONFLUENCE' && /*#__PURE__*/React.createElement(WidthObserver, {
68
66
  setWidth: setContainerWidth,
69
67
  offscreen: true
70
68
  }), /*#__PURE__*/React.createElement(ActionGroup, {
71
69
  onDropdownOpenChange: onDropdownOpenChange,
72
70
  items: actions,
73
- appearance: !!rovoChatAction && is3PBlockExperimentEnabled ? 'subtle' : 'default',
74
- size: !!rovoChatAction && is3PBlockExperimentEnabled ? SmartLinkSize.Small : size,
75
- containerWidth: !!rovoChatAction && is3PBlockExperimentEnabled ? containerWidth : undefined
71
+ appearance: !!rovoChatAction && (rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.product) === 'CONFLUENCE' ? 'subtle' : 'default',
72
+ size: !!rovoChatAction && (rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.product) === 'CONFLUENCE' ? SmartLinkSize.Small : size,
73
+ containerWidth: !!rovoChatAction && (rovoChatAction === null || rovoChatAction === void 0 ? void 0 : rovoChatAction.product) === 'CONFLUENCE' ? containerWidth : undefined
76
74
  })) : null);
77
75
  };
78
76
  export default FooterBlockResolvedView;
@@ -1,7 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import { ActionName, ElementName, SmartLinkSize } from '../../../../constants';
4
- import { isBlockCardRovoActionExperimentEnabled } from '../../../../state/hooks/use-block-card-rovo-action-experiment';
5
4
  import { isFlexibleUiElement } from '../../../../utils/flexible';
6
5
  import * as Elements from '../elements';
7
6
  import ActionGroup from './action-group';
@@ -78,7 +77,6 @@ export const isJSXElementNull = children => {
78
77
  };
79
78
  const isElementOrElementGroup = node => /*#__PURE__*/React.isValidElement(node) && (isFlexibleUiElement(node) || node.type === ElementGroup);
80
79
  export const filterActionItems = (items = [], context, product) => {
81
- const isBlockCard3PExperimentEnabled = isBlockCardRovoActionExperimentEnabled(product);
82
80
  return items.filter(item => {
83
81
  switch (item.name) {
84
82
  case ActionName.DeleteAction:
@@ -87,11 +85,10 @@ export const filterActionItems = (items = [], context, product) => {
87
85
  // Named and custom actions that user defines.
88
86
  return Boolean(ActionName[item.name]);
89
87
  case ActionName.RovoChatAction:
90
- if (isBlockCard3PExperimentEnabled) {
88
+ if (!!product && product === 'CONFLUENCE') {
91
89
  return Boolean(ActionName[item.name]);
92
90
  }
93
91
  // same as default case below
94
- // remove on cleanup of platform_sl_3p_auth_rovo_block_card_kill_switch
95
92
  if ((context === null || context === void 0 ? void 0 : context.actions) === undefined) {
96
93
  return false;
97
94
  }
@@ -7,7 +7,7 @@ import { Box } from '@atlaskit/primitives/compiled';
7
7
  import { IconType } from '../../../../../../constants';
8
8
  import { messages } from '../../../../../../messages';
9
9
  import { useFlexibleUiOptionContext } from '../../../../../../state/flexible-ui-context';
10
- import { useBlockCardRovoActionExperimentNoExposure } from '../../../../../../state/hooks/use-block-card-rovo-action-experiment';
10
+ import useRovoConfig from '../../../../../../state/hooks/use-rovo-config';
11
11
  import ImageIcon from '../../../../../common/image-icon';
12
12
  import AtlaskitIcon from '../../../common/atlaskit-icon';
13
13
  import { withOverrideCss } from '../../../common/with-override-css';
@@ -87,13 +87,15 @@ const BaseBadgeRefreshNew = /*#__PURE__*/forwardRef(({
87
87
  hideLabel = false
88
88
  }, ref) => {
89
89
  const ui = useFlexibleUiOptionContext();
90
- const isRovoBlockCardExperimentEnabled = useBlockCardRovoActionExperimentNoExposure();
90
+ const {
91
+ product
92
+ } = useRovoConfig();
91
93
  const formattedMessageOrLabel = getFormattedMessageFromIcon(icon) || label;
92
94
  const badgeIcon = renderAtlaskitIcon(icon, testId) || renderImageIcon(url, testId, ui === null || ui === void 0 ? void 0 : ui.hideLoadingSkeleton);
93
95
  if (!formattedMessageOrLabel || !badgeIcon) {
94
96
  return null;
95
97
  }
96
- const shouldHideLabel = hideLabel && isRovoBlockCardExperimentEnabled;
98
+ const shouldHideLabel = hideLabel && !!product && product === 'CONFLUENCE';
97
99
  return /*#__PURE__*/React.createElement("span", {
98
100
  "data-smart-element": name,
99
101
  "data-smart-element-badge": true,
@@ -9,7 +9,7 @@ import LinkWarningModal from './LinkWarningModal';
9
9
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
10
10
  const PACKAGE_DATA = {
11
11
  packageName: "@atlaskit/smart-card",
12
- packageVersion: "45.3.1",
12
+ packageVersion: "45.3.2",
13
13
  componentName: 'linkUrl'
14
14
  };
15
15
  const LinkUrl = ({
@@ -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';
@@ -66,7 +65,6 @@ export const getPromptAction = ({
66
65
  contextLong: intl.formatMessage(messages.rovo_prompt_context_generic),
67
66
  contextShort: intl.formatMessage(messages.rovo_prompt_context_generic)
68
67
  };
69
- const isBlockCard3PExperimentEnabled = isBlockCardRovoActionExperimentEnabled(product);
70
68
  switch (promptKey) {
71
69
  case RovoChatPromptKey.RECOMMEND_OTHER_SOURCES:
72
70
  const label_recommend = intl.formatMessage(messages.rovo_prompt_button_recommend_other_sources);
@@ -132,10 +130,10 @@ export const getPromptAction = ({
132
130
  ignoreTag: true
133
131
  });
134
132
  return {
135
- icon: cardAppearance === CardDisplay.Block && isBlockCard3PExperimentEnabled ? /*#__PURE__*/React.createElement(AiChatIcon, {
133
+ icon: /*#__PURE__*/React.createElement(AiChatIcon, {
136
134
  label: label_summarize,
137
135
  size: iconSize
138
- }) : /*#__PURE__*/React.createElement(AIEditIcon, null),
136
+ }),
139
137
  content: label_summarize,
140
138
  tooltipMessage: label_summarize,
141
139
  data: {
@@ -196,7 +194,7 @@ export const getPromptAction = ({
196
194
  url
197
195
  });
198
196
  return {
199
- icon: cardAppearance === CardDisplay.Block && isBlockCard3PExperimentEnabled ? /*#__PURE__*/React.createElement(RovoIcon, {
197
+ icon: cardAppearance === CardDisplay.Block && !!product && product === 'CONFLUENCE' ? /*#__PURE__*/React.createElement(RovoIcon, {
200
198
  label: label_ask_rovo_anything,
201
199
  size: 'xxsmall',
202
200
  shouldUseHexLogo: true
@@ -3,13 +3,12 @@ import { fg } from '@atlaskit/platform-feature-flags';
3
3
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
4
4
  import { ActionName, CardAction } from '../../../constants';
5
5
  import { getDefinitionId, getExtensionKey, getResourceType } from '../../../state/helpers';
6
- import { isBlockCardRovoActionExperimentEnabled } from '../../../state/hooks/use-block-card-rovo-action-experiment';
7
6
  import { canShowAction } from '../../../utils/actions/can-show-action';
8
7
  import { getIsRovoChatEnabled } from '../../../utils/rovo';
9
8
  // For block card experiment (NAVX-4814)
10
9
  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']);
11
10
  var extractRovoChatAction = function extractRovoChatAction(_ref) {
12
- var _rovoConfig$product, _actionOptions$rovoCh;
11
+ var _actionOptions$rovoCh;
13
12
  var actionOptions = _ref.actionOptions,
14
13
  appearance = _ref.appearance,
15
14
  id = _ref.id,
@@ -25,10 +24,9 @@ var extractRovoChatAction = function extractRovoChatAction(_ref) {
25
24
  }
26
25
  var extensionKey = getExtensionKey(response);
27
26
  var isGoogleProvider = extensionKey === 'google-object-provider';
28
- var is3PBlockExperimentEnabled = isBlockCardRovoActionExperimentEnabled((_rovoConfig$product = rovoConfig === null || rovoConfig === void 0 ? void 0 : rovoConfig.product) !== null && _rovoConfig$product !== void 0 ? _rovoConfig$product : product);
29
27
  var isInlineExperimentEnabled = fg('platform_sl_3p_auth_inline_tailored_cta_killswitch') && expValEqualsNoExposure('platform_sl_3p_auth_inline_tailored_cta', 'isEnabled', true);
30
28
  var is3PAuthRovoActionEnabled = isGoogleProvider && fg('platform_sl_3p_auth_rovo_action_kill_switch');
31
- var is3PBlockPostAuthActionsEnabled = extensionKey !== undefined && ELIGIBLE_EXTENSION_KEYS.has(extensionKey) && is3PBlockExperimentEnabled;
29
+ var is3PBlockPostAuthActionsEnabled = extensionKey !== undefined && ELIGIBLE_EXTENSION_KEYS.has(extensionKey) && (rovoConfig === null || rovoConfig === void 0 ? void 0 : rovoConfig.product) === 'CONFLUENCE';
32
30
  var isSupportedFeature = is3PAuthRovoActionEnabled || is3PBlockPostAuthActionsEnabled || isInlineExperimentEnabled;
33
31
  var isOptIn = (actionOptions === null || actionOptions === void 0 || (_actionOptions$rovoCh = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh === void 0 ? void 0 : _actionOptions$rovoCh.optIn) === true;
34
32
  var url = extractSmartLinkUrl(response);