@atlaskit/smart-card 26.46.1 → 26.46.3

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 (68) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/constants.js +2 -2
  3. package/dist/cjs/messages.js +15 -0
  4. package/dist/cjs/utils/analytics/analytics.js +1 -1
  5. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.js +28 -0
  6. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +35 -0
  7. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-learn-more-anchor.js +22 -0
  8. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +116 -0
  9. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.js +35 -0
  10. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +35 -0
  11. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.js +5 -0
  12. package/dist/cjs/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +38 -25
  13. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +11 -2
  14. package/dist/cjs/view/LinkUrl/index.js +1 -1
  15. package/dist/cjs/view/common/ai-icon-loading/index.js +60 -0
  16. package/dist/es2019/constants.js +1 -1
  17. package/dist/es2019/messages.js +15 -0
  18. package/dist/es2019/utils/analytics/analytics.js +1 -1
  19. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.js +22 -0
  20. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +29 -0
  21. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-learn-more-anchor.js +12 -0
  22. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +105 -0
  23. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.js +29 -0
  24. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +26 -0
  25. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.js +1 -0
  26. package/dist/es2019/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +37 -28
  27. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +14 -4
  28. package/dist/es2019/view/LinkUrl/index.js +1 -1
  29. package/dist/es2019/view/common/ai-icon-loading/index.js +64 -0
  30. package/dist/esm/constants.js +1 -1
  31. package/dist/esm/messages.js +15 -0
  32. package/dist/esm/utils/analytics/analytics.js +1 -1
  33. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.js +21 -0
  34. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.js +25 -0
  35. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-learn-more-anchor.js +15 -0
  36. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.js +108 -0
  37. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.js +28 -0
  38. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.js +27 -0
  39. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.js +1 -0
  40. package/dist/esm/view/FlexibleCard/components/blocks/ai-summary-block/resolved/index.js +41 -28
  41. package/dist/esm/view/HoverCard/components/views/resolved/index.js +13 -4
  42. package/dist/esm/view/LinkUrl/index.js +1 -1
  43. package/dist/esm/view/common/ai-icon-loading/index.js +54 -0
  44. package/dist/types/__fixtures__/atlas-project-with-ai-summary.d.ts +2 -0
  45. package/dist/types/constants.d.ts +1 -0
  46. package/dist/types/messages.d.ts +1 -1
  47. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.d.ts +4 -0
  48. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.d.ts +4 -0
  49. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-learn-more-anchor.d.ts +3 -0
  50. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.d.ts +5 -0
  51. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.d.ts +4 -0
  52. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.d.ts +4 -0
  53. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +18 -0
  54. package/dist/types/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +2 -1
  55. package/dist/types/view/common/ai-icon-loading/index.d.ts +7 -0
  56. package/dist/types-ts4.5/__fixtures__/atlas-project-with-ai-summary.d.ts +2 -0
  57. package/dist/types-ts4.5/constants.d.ts +1 -0
  58. package/dist/types-ts4.5/messages.d.ts +1 -1
  59. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-container.d.ts +4 -0
  60. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-indicator-tooltip.d.ts +4 -0
  61. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-learn-more-anchor.d.ts +3 -0
  62. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-done.d.ts +5 -0
  63. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/ai-state-loading.d.ts +4 -0
  64. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/index.d.ts +4 -0
  65. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/ai-state-indicator/types.d.ts +18 -0
  66. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/ai-summary-block/types.d.ts +2 -1
  67. package/dist/types-ts4.5/view/common/ai-icon-loading/index.d.ts +7 -0
  68. package/package.json +9 -6
@@ -0,0 +1,29 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import styled from '@emotion/styled';
4
+ import Tooltip, { TooltipPrimitive } from '@atlaskit/tooltip';
5
+ import { Box, xcss } from '@atlaskit/primitives';
6
+ const AIIndicatorTooltipPrimitive = styled(TooltipPrimitive)`
7
+ border-radius: ${"var(--ds-border-radius, 3px)"};
8
+ background-color: ${"var(--ds-surface-raised, white)"};
9
+ box-shadow: ${"var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))"};
10
+ box-sizing: content-box;
11
+ padding: ${"var(--ds-space-200, 16px)"};
12
+ max-width: 350px;
13
+ `;
14
+ const triggerStyles = xcss({
15
+ display: 'inline-flex'
16
+ });
17
+ const AIIndicatorTooltip = ({
18
+ content,
19
+ trigger
20
+ }) => {
21
+ return /*#__PURE__*/React.createElement(Tooltip, {
22
+ component: AIIndicatorTooltipPrimitive,
23
+ content: content,
24
+ tag: "span"
25
+ }, tooltipProps => /*#__PURE__*/React.createElement(Box, _extends({
26
+ xcss: triggerStyles
27
+ }, tooltipProps), trigger));
28
+ };
29
+ export default AIIndicatorTooltip;
@@ -0,0 +1,12 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import { CONTENT_URL_AI } from '../../../../../../constants';
4
+ const AILearnMoreAnchor = ({
5
+ children,
6
+ ...props
7
+ }) => /*#__PURE__*/React.createElement("a", _extends({
8
+ href: CONTENT_URL_AI,
9
+ target: "_blank",
10
+ rel: "noopener noreferrer"
11
+ }, props), children);
12
+ export default AILearnMoreAnchor;
@@ -0,0 +1,105 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /** @jsx jsx */
3
+ import React from 'react';
4
+ import { FormattedMessage } from 'react-intl-next';
5
+ import { css, jsx } from '@emotion/react';
6
+ import EditorPanelIcon from '@atlaskit/icon/glyph/editor/panel';
7
+ import { Box, Inline, Stack, xcss } from '@atlaskit/primitives';
8
+ import { messages } from '../../../../../../messages';
9
+ import AIIcon from '../../../../../common/ai-icon';
10
+ import AIIndicatorTooltip from './ai-indicator-tooltip';
11
+ import AIIndicatorContainer from './ai-indicator-container';
12
+ import AILearnMoreAnchor from './ai-learn-more-anchor';
13
+ const tooltipMsgStyles = xcss({
14
+ color: 'color.text',
15
+ fontSize: '14px',
16
+ fontWeight: '400',
17
+ lineHeight: '20px'
18
+ });
19
+ const iconTooltipLinkStyles = css({
20
+ color: "var(--ds-text-subtlest, #626F86)",
21
+ '&:link, :visited': {
22
+ color: "var(--ds-text-subtlest, #626F86)"
23
+ },
24
+ '&:hover': {
25
+ color: "var(--ds-text-subtle, #44546F)"
26
+ },
27
+ '&:active': {
28
+ color: "var(--ds-text, #172B4D)"
29
+ },
30
+ textDecoration: 'underline'
31
+ });
32
+ const iconTooltipTitleStyles = xcss({
33
+ color: 'color.text',
34
+ fontSize: '12px',
35
+ fontWeight: '400',
36
+ lineHeight: '16px'
37
+ });
38
+ const iconTooltipDescStyles = xcss({
39
+ color: 'color.text.subtlest',
40
+ fontSize: '11px',
41
+ fontWeight: '400',
42
+ lineHeight: '14px'
43
+ });
44
+ const AIStateDone = ({
45
+ appearance,
46
+ testId
47
+ }) => {
48
+ const icon = jsx(AIIcon, {
49
+ label: "AI",
50
+ size: "small",
51
+ testId: `${testId}-done-icon`
52
+ });
53
+ switch (appearance) {
54
+ case 'icon-only':
55
+ return jsx(AIIndicatorTooltip, {
56
+ content: jsx(Inline, {
57
+ alignBlock: "center",
58
+ space: "space.100"
59
+ }, jsx(AIIcon, {
60
+ label: "AI",
61
+ size: "medium",
62
+ testId: `${testId}-done-tooltip-icon`
63
+ }), jsx(Stack, null, jsx(Box, {
64
+ xcss: iconTooltipTitleStyles,
65
+ testId: `${testId}-done-tooltip-title`
66
+ }, jsx(FormattedMessage, messages.ai_summarized)), jsx(Box, {
67
+ xcss: iconTooltipDescStyles
68
+ }, jsx(FormattedMessage, _extends({}, messages.ai_summarized_info, {
69
+ values: {
70
+ a: chunks => jsx(AILearnMoreAnchor, {
71
+ css: iconTooltipLinkStyles
72
+ }, chunks)
73
+ }
74
+ }))))),
75
+ trigger: icon
76
+ });
77
+ default:
78
+ return jsx(AIIndicatorContainer, {
79
+ icon: icon,
80
+ content: jsx(Inline, {
81
+ alignBlock: "center",
82
+ alignInline: "start",
83
+ space: "space.050"
84
+ }, jsx(Box, {
85
+ testId: `${testId}-done-message`
86
+ }, jsx(FormattedMessage, messages.ai_summarized)), jsx(AIIndicatorTooltip, {
87
+ content: jsx(Box, {
88
+ xcss: tooltipMsgStyles,
89
+ testId: `${testId}-done-tooltip`
90
+ }, jsx(FormattedMessage, _extends({}, messages.ai_summarized_info, {
91
+ values: {
92
+ a: chunks => jsx(AILearnMoreAnchor, null, chunks)
93
+ }
94
+ }))),
95
+ trigger: jsx(EditorPanelIcon, {
96
+ label: "Info",
97
+ size: "small",
98
+ testId: `${testId}-done-info`
99
+ })
100
+ })),
101
+ testId: `${testId}-done`
102
+ });
103
+ }
104
+ };
105
+ export default AIStateDone;
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { FormattedMessage } from 'react-intl-next';
3
+ import { Box } from '@atlaskit/primitives';
4
+ import { messages } from '../../../../../../messages';
5
+ import AIIconLoading from '../../../../../common/ai-icon-loading';
6
+ import AIIndicatorContainer from './ai-indicator-container';
7
+ const AIStateLoading = ({
8
+ appearance,
9
+ testId
10
+ }) => {
11
+ const icon = /*#__PURE__*/React.createElement(AIIconLoading, {
12
+ label: "AI",
13
+ size: "small",
14
+ testId: `${testId}-loading-icon`
15
+ });
16
+ switch (appearance) {
17
+ case 'icon-only':
18
+ return icon;
19
+ default:
20
+ return /*#__PURE__*/React.createElement(AIIndicatorContainer, {
21
+ icon: icon,
22
+ content: /*#__PURE__*/React.createElement(Box, {
23
+ testId: `${testId}-loading-message`
24
+ }, /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summarizing)),
25
+ testId: `${testId}-loading`
26
+ });
27
+ }
28
+ };
29
+ export default AIStateLoading;
@@ -0,0 +1,26 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import React from 'react';
4
+ import AIStateLoading from './ai-state-loading';
5
+ import AIStateDone from './ai-state-done';
6
+ const AIStateIndicator = ({
7
+ state,
8
+ appearance = 'default',
9
+ testId = 'ai-state-indicator'
10
+ }) => {
11
+ switch (state) {
12
+ case 'loading':
13
+ return jsx(AIStateLoading, {
14
+ appearance: appearance,
15
+ testId: testId
16
+ });
17
+ case 'done':
18
+ return jsx(AIStateDone, {
19
+ appearance: appearance,
20
+ testId: testId
21
+ });
22
+ default:
23
+ return null;
24
+ }
25
+ };
26
+ export default AIStateIndicator;
@@ -1,13 +1,15 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { useCallback, useMemo } from 'react';
2
+ import React, { useCallback, useMemo, useState } from 'react';
3
3
  import { FormattedMessage } from 'react-intl-next';
4
- import { ActionName, SmartLinkAlignment, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
5
- import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context';
4
+ import { Box, Inline } from '@atlaskit/primitives';
5
+ import { ActionName, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
6
6
  import ActionGroup from '../../action-group';
7
7
  import Block from '../../block';
8
8
  import ElementGroup from '../../element-group';
9
- import { filterActionItems, getActionGroupStyles, renderElementItems } from '../../utils';
9
+ import AIStateIndicator from '../ai-state-indicator';
10
+ import { renderElementItems } from '../../utils';
10
11
  import { messages } from '../../../../../../messages';
12
+ import AiIcon from '../../../../../common/ai-icon';
11
13
  const AISummaryBlockResolvedView = props => {
12
14
  const {
13
15
  actions = [],
@@ -17,26 +19,29 @@ const AISummaryBlockResolvedView = props => {
17
19
  onAIActionChange,
18
20
  size = SmartLinkSize.Medium
19
21
  } = props;
20
- const context = useFlexibleUiContext();
22
+ const [aiState, setAIState] = useState('ready');
21
23
  const metadataElements = renderElementItems(metadata);
22
24
  const onAIActionClick = useCallback(() => {
25
+ setAIState('loading');
23
26
  if (onAIActionChange) {
24
- onAIActionChange();
27
+ onAIActionChange('loading');
25
28
  }
26
29
  }, [onAIActionChange]);
27
30
  const combinedActions = useMemo(() => {
28
- const aiAction = {
29
- content: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summarize),
30
- name: ActionName.CustomAction,
31
- onClick: onAIActionClick,
32
- testId: `${testId}-ai-summary-action`
33
- };
34
- return [aiAction, ...actions];
35
- }, [actions, onAIActionClick, testId]);
36
- const hasActions = useMemo(() => {
37
- var _filterActionItems;
38
- return ((_filterActionItems = filterActionItems(combinedActions, context)) === null || _filterActionItems === void 0 ? void 0 : _filterActionItems.length) > 0;
39
- }, [combinedActions, context]);
31
+ if (aiState === 'ready') {
32
+ const aiAction = {
33
+ content: /*#__PURE__*/React.createElement(FormattedMessage, messages.ai_summarize),
34
+ name: ActionName.CustomAction,
35
+ onClick: onAIActionClick,
36
+ testId: `${testId}-ai-summary-action`,
37
+ icon: /*#__PURE__*/React.createElement(AiIcon, {
38
+ label: "AiIcon"
39
+ })
40
+ };
41
+ return [aiAction, ...actions];
42
+ }
43
+ return actions;
44
+ }, [actions, aiState, onAIActionClick, testId]);
40
45
  const onDropdownOpenChange = useCallback(isOpen => {
41
46
  if (onActionMenuOpenChange) {
42
47
  onActionMenuOpenChange({
@@ -46,17 +51,21 @@ const AISummaryBlockResolvedView = props => {
46
51
  }, [onActionMenuOpenChange]);
47
52
  return /*#__PURE__*/React.createElement(Block, _extends({}, props, {
48
53
  testId: `${testId}-resolved-view`
49
- }), /*#__PURE__*/React.createElement(ElementGroup, {
50
- width: SmartLinkWidth.Flexible
51
- }, metadataElements), hasActions && /*#__PURE__*/React.createElement(ElementGroup, {
52
- testId: "smart-element-group-actions",
53
- align: SmartLinkAlignment.Right,
54
- overrideCss: getActionGroupStyles(size),
55
- width: SmartLinkWidth.Flexible
56
- }, /*#__PURE__*/React.createElement(ActionGroup, {
54
+ }), /*#__PURE__*/React.createElement(Inline, {
55
+ alignBlock: "center",
56
+ alignInline: "end",
57
+ grow: "fill",
58
+ spread: "space-between"
59
+ }, /*#__PURE__*/React.createElement(Box, null, aiState === 'loading' || aiState === 'done' ? /*#__PURE__*/React.createElement(AIStateIndicator, {
60
+ state: aiState,
61
+ testId: testId
62
+ }) : /*#__PURE__*/React.createElement(ElementGroup, {
63
+ width: SmartLinkWidth.FitToContent
64
+ }, metadataElements)), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(ActionGroup, {
57
65
  onDropdownOpenChange: onDropdownOpenChange,
58
66
  items: combinedActions,
59
- appearance: "default"
60
- })));
67
+ appearance: "default",
68
+ size: size
69
+ }))));
61
70
  };
62
71
  export default AISummaryBlockResolvedView;
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback, useEffect, useMemo, useRef } from 'react';
3
- import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../../../constants';
4
- import { FooterBlock, MetadataBlock, RelatedUrlsBlock, SnippetBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
3
+ import { ActionName, CardDisplay, ElementName, SmartLinkPosition, SmartLinkSize } from '../../../../../constants';
4
+ import { FooterBlock, MetadataBlock, RelatedUrlsBlock, SnippetBlock, TitleBlock, AISummaryBlock } from '../../../../FlexibleCard/components/blocks';
5
5
  import { footerBlockCss, hiddenSnippetStyles, metadataBlockCss } from './styled';
6
6
  import FlexibleCard from '../../../../FlexibleCard';
7
7
  import { getSimulatedBetterMetadata } from '../../../utils';
@@ -11,6 +11,7 @@ import { messages } from '../../../../../messages';
11
11
  import { FormattedMessage } from 'react-intl-next';
12
12
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
13
13
  import { getCanBeDatasource } from '../../../../../state/helpers';
14
+ import { useSmartLinkContext } from '../../../../../state';
14
15
  export const toFooterActions = (cardActions, onActionClick) => {
15
16
  const followAction = {
16
17
  hideIcon: true,
@@ -55,7 +56,7 @@ const HoverCardResolvedView = ({
55
56
  extensionKey,
56
57
  url
57
58
  }) => {
58
- var _cardState$details;
59
+ var _cardState$details, _cardState$details2, _cardState$details2$m, _cardState$details2$m2;
59
60
  const canBeDatasource = getCanBeDatasource(cardState.details);
60
61
  useEffect(() => {
61
62
  // Since this hover view is only rendered on resolved status,
@@ -90,6 +91,10 @@ const HoverCardResolvedView = ({
90
91
  data: data,
91
92
  fallbackElementHeight: snippetHeight.current
92
93
  });
94
+ const {
95
+ isAdminHubAIEnabled
96
+ } = useSmartLinkContext();
97
+ const showAiView = getBooleanFF('platform.linking-platform.smart-card.hover-card-ai-summaries') && isAdminHubAIEnabled && ((_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : (_cardState$details2$m = _cardState$details2.meta) === null || _cardState$details2$m === void 0 ? void 0 : (_cardState$details2$m2 = _cardState$details2$m.supportedFeatures) === null || _cardState$details2$m2 === void 0 ? void 0 : _cardState$details2$m2.includes('AISummary'));
93
98
  return /*#__PURE__*/React.createElement(FlexibleCard, flexibleCardProps, imagePreview, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, titleBlockProps, {
94
99
  metadataPosition: SmartLinkPosition.Top
95
100
  })), /*#__PURE__*/React.createElement(MetadataBlock, {
@@ -111,7 +116,12 @@ const HoverCardResolvedView = ({
111
116
  }), getBooleanFF('platform.linking-platform.smart-card.enable-hover-card-related-urls') && /*#__PURE__*/React.createElement(RelatedUrlsBlock, {
112
117
  url: url,
113
118
  size: SmartLinkSize.Small
114
- }), /*#__PURE__*/React.createElement(FooterBlock, {
119
+ }), showAiView ? /*#__PURE__*/React.createElement(AISummaryBlock, {
120
+ metadata: [{
121
+ name: ElementName.Provider
122
+ }],
123
+ actions: footerActions
124
+ }) : /*#__PURE__*/React.createElement(FooterBlock, {
115
125
  actions: footerActions,
116
126
  size: SmartLinkSize.Large,
117
127
  overrideCss: footerBlockCss
@@ -7,7 +7,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
7
7
  import LinkWarningModal from './LinkWarningModal';
8
8
  const PACKAGE_DATA = {
9
9
  packageName: "@atlaskit/smart-card",
10
- packageVersion: "26.46.1",
10
+ packageVersion: "26.46.3",
11
11
  componentName: 'linkUrl'
12
12
  };
13
13
  const Link = withLinkClickedEvent('a');
@@ -0,0 +1,64 @@
1
+ /** @jsx jsx */
2
+ import { css, jsx, keyframes } from '@emotion/react';
3
+ import SVG from '@atlaskit/icon/svg';
4
+ import { aiThemeTokens } from '../ai-prism/constants';
5
+
6
+ /**
7
+ * The bulk of this file is originally from
8
+ * https://bitbucket.org/atlassian/barrel/src/master/ui/platform/ui-kit/ai
9
+ * with modifications
10
+ */
11
+
12
+ const bounce = keyframes`
13
+ from {
14
+ transform: translateY(0);
15
+ }
16
+
17
+ // 200ms of 1200ms = 16.67%
18
+ 16.67% {
19
+ transform: translateY(-2px);
20
+ }
21
+
22
+ // 400ms of 1200ms = 33.33%
23
+ 33.33% {
24
+ transform: translateY(0px);
25
+ }
26
+ `;
27
+ const BASE_DELAY = 400;
28
+ const QUEUE_DELAY = 200;
29
+ const animationStyles = css({
30
+ animation: `${bounce} 1.2s linear infinite normal`
31
+ });
32
+ const firstDelayStyles = css({
33
+ animationDelay: `${BASE_DELAY + QUEUE_DELAY}ms`
34
+ });
35
+ const secondDelayStyles = css({
36
+ animationDelay: `${BASE_DELAY + QUEUE_DELAY * 2}ms`
37
+ });
38
+ const thirdDelayStyles = css({
39
+ animationDelay: `${BASE_DELAY + QUEUE_DELAY * 3}ms`
40
+ });
41
+
42
+ /**
43
+ * this icon is theme agnostic, no need for tokens
44
+ */
45
+ const AIIconLoading = props => jsx(SVG, props, jsx("circle", {
46
+ css: [animationStyles, firstDelayStyles],
47
+ cx: "6",
48
+ cy: "12",
49
+ r: "1.5",
50
+ fill: aiThemeTokens.blue700
51
+ }), jsx("circle", {
52
+ css: [animationStyles, secondDelayStyles],
53
+ cx: "12",
54
+ cy: "12",
55
+ r: "1.5",
56
+ fill: aiThemeTokens.blue600
57
+ }), jsx("circle", {
58
+ css: [animationStyles, thirdDelayStyles],
59
+ cx: "17.5",
60
+ cy: "12",
61
+ r: "1.5",
62
+ fill: aiThemeTokens.blue500
63
+ }));
64
+ export default AIIconLoading;
@@ -1,6 +1,6 @@
1
1
  export var CONTENT_URL_SECURITY_AND_PERMISSIONS = 'https://support.atlassian.com/confluence-cloud/docs/insert-links-and-anchors/#Smart-links';
2
2
  export var CONTENT_URL_3P_ACCOUNT_AUTH = 'https://support.atlassian.com/confluence-cloud/docs/what-data-is-sent-and-received-when-pasting-a-smart-link/';
3
-
3
+ export var CONTENT_URL_AI = 'https://www.atlassian.com/trust/atlassian-intelligence';
4
4
  /**
5
5
  * The alignment of Flexible UI component.
6
6
  */
@@ -18,6 +18,21 @@ export var messages = defineMessages({
18
18
  defaultMessage: 'Summarize',
19
19
  description: 'Action to summarize link resource content with AI'
20
20
  },
21
+ ai_summarized: {
22
+ id: 'fabric.linking.ai_summarized',
23
+ defaultMessage: 'Summarized by Atlassian Intelligence',
24
+ description: 'Shown with the content summarised by AI.'
25
+ },
26
+ ai_summarized_info: {
27
+ id: 'fabric.linking.ai_summarized_info',
28
+ defaultMessage: 'Information quality may vary. <a>Learn more</a>',
29
+ description: 'Additional info about the content summarised by AI.'
30
+ },
31
+ ai_summarizing: {
32
+ id: 'fabric.linking.ai_summarizing',
33
+ defaultMessage: 'Atlassian Intelligence is working...',
34
+ description: 'Shown when AI summary is summarising the link resource content.'
35
+ },
21
36
  assigned_to: {
22
37
  id: 'fabric.linking.assigned_to',
23
38
  defaultMessage: 'Assigned to {context}',
@@ -15,7 +15,7 @@ export var ANALYTICS_CHANNEL = 'media';
15
15
  export var context = {
16
16
  componentName: 'smart-cards',
17
17
  packageName: "@atlaskit/smart-card",
18
- packageVersion: "26.46.1"
18
+ packageVersion: "26.46.3"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { Inline, xcss } from '@atlaskit/primitives';
3
+ var contentStyles = xcss({
4
+ color: 'color.text.subtle',
5
+ fontSize: '12px',
6
+ fontWeight: '400',
7
+ lineHeight: '16px'
8
+ });
9
+ var AIIndicatorContainer = function AIIndicatorContainer(_ref) {
10
+ var icon = _ref.icon,
11
+ content = _ref.content,
12
+ testId = _ref.testId;
13
+ return /*#__PURE__*/React.createElement(Inline, {
14
+ alignBlock: "center",
15
+ alignInline: "start",
16
+ space: "space.050",
17
+ xcss: contentStyles,
18
+ testId: testId
19
+ }, icon, content);
20
+ };
21
+ export default AIIndicatorContainer;
@@ -0,0 +1,25 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
+ var _templateObject;
4
+ import React from 'react';
5
+ import styled from '@emotion/styled';
6
+ import Tooltip, { TooltipPrimitive } from '@atlaskit/tooltip';
7
+ import { Box, xcss } from '@atlaskit/primitives';
8
+ var AIIndicatorTooltipPrimitive = styled(TooltipPrimitive)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-radius: ", ";\n background-color: ", ";\n box-shadow: ", ";\n box-sizing: content-box;\n padding: ", ";\n max-width: 350px;\n"])), "var(--ds-border-radius, 3px)", "var(--ds-surface-raised, white)", "var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))", "var(--ds-space-200, 16px)");
9
+ var triggerStyles = xcss({
10
+ display: 'inline-flex'
11
+ });
12
+ var AIIndicatorTooltip = function AIIndicatorTooltip(_ref) {
13
+ var content = _ref.content,
14
+ trigger = _ref.trigger;
15
+ return /*#__PURE__*/React.createElement(Tooltip, {
16
+ component: AIIndicatorTooltipPrimitive,
17
+ content: content,
18
+ tag: "span"
19
+ }, function (tooltipProps) {
20
+ return /*#__PURE__*/React.createElement(Box, _extends({
21
+ xcss: triggerStyles
22
+ }, tooltipProps), trigger);
23
+ });
24
+ };
25
+ export default AIIndicatorTooltip;
@@ -0,0 +1,15 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["children"];
4
+ import React from 'react';
5
+ import { CONTENT_URL_AI } from '../../../../../../constants';
6
+ var AILearnMoreAnchor = function AILearnMoreAnchor(_ref) {
7
+ var children = _ref.children,
8
+ props = _objectWithoutProperties(_ref, _excluded);
9
+ return /*#__PURE__*/React.createElement("a", _extends({
10
+ href: CONTENT_URL_AI,
11
+ target: "_blank",
12
+ rel: "noopener noreferrer"
13
+ }, props), children);
14
+ };
15
+ export default AILearnMoreAnchor;
@@ -0,0 +1,108 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /** @jsx jsx */
3
+ import React from 'react';
4
+ import { FormattedMessage } from 'react-intl-next';
5
+ import { css, jsx } from '@emotion/react';
6
+ import EditorPanelIcon from '@atlaskit/icon/glyph/editor/panel';
7
+ import { Box, Inline, Stack, xcss } from '@atlaskit/primitives';
8
+ import { messages } from '../../../../../../messages';
9
+ import AIIcon from '../../../../../common/ai-icon';
10
+ import AIIndicatorTooltip from './ai-indicator-tooltip';
11
+ import AIIndicatorContainer from './ai-indicator-container';
12
+ import AILearnMoreAnchor from './ai-learn-more-anchor';
13
+ var tooltipMsgStyles = xcss({
14
+ color: 'color.text',
15
+ fontSize: '14px',
16
+ fontWeight: '400',
17
+ lineHeight: '20px'
18
+ });
19
+ var iconTooltipLinkStyles = css({
20
+ color: "var(--ds-text-subtlest, #626F86)",
21
+ '&:link, :visited': {
22
+ color: "var(--ds-text-subtlest, #626F86)"
23
+ },
24
+ '&:hover': {
25
+ color: "var(--ds-text-subtle, #44546F)"
26
+ },
27
+ '&:active': {
28
+ color: "var(--ds-text, #172B4D)"
29
+ },
30
+ textDecoration: 'underline'
31
+ });
32
+ var iconTooltipTitleStyles = xcss({
33
+ color: 'color.text',
34
+ fontSize: '12px',
35
+ fontWeight: '400',
36
+ lineHeight: '16px'
37
+ });
38
+ var iconTooltipDescStyles = xcss({
39
+ color: 'color.text.subtlest',
40
+ fontSize: '11px',
41
+ fontWeight: '400',
42
+ lineHeight: '14px'
43
+ });
44
+ var AIStateDone = function AIStateDone(_ref) {
45
+ var appearance = _ref.appearance,
46
+ testId = _ref.testId;
47
+ var icon = jsx(AIIcon, {
48
+ label: "AI",
49
+ size: "small",
50
+ testId: "".concat(testId, "-done-icon")
51
+ });
52
+ switch (appearance) {
53
+ case 'icon-only':
54
+ return jsx(AIIndicatorTooltip, {
55
+ content: jsx(Inline, {
56
+ alignBlock: "center",
57
+ space: "space.100"
58
+ }, jsx(AIIcon, {
59
+ label: "AI",
60
+ size: "medium",
61
+ testId: "".concat(testId, "-done-tooltip-icon")
62
+ }), jsx(Stack, null, jsx(Box, {
63
+ xcss: iconTooltipTitleStyles,
64
+ testId: "".concat(testId, "-done-tooltip-title")
65
+ }, jsx(FormattedMessage, messages.ai_summarized)), jsx(Box, {
66
+ xcss: iconTooltipDescStyles
67
+ }, jsx(FormattedMessage, _extends({}, messages.ai_summarized_info, {
68
+ values: {
69
+ a: function a(chunks) {
70
+ return jsx(AILearnMoreAnchor, {
71
+ css: iconTooltipLinkStyles
72
+ }, chunks);
73
+ }
74
+ }
75
+ }))))),
76
+ trigger: icon
77
+ });
78
+ default:
79
+ return jsx(AIIndicatorContainer, {
80
+ icon: icon,
81
+ content: jsx(Inline, {
82
+ alignBlock: "center",
83
+ alignInline: "start",
84
+ space: "space.050"
85
+ }, jsx(Box, {
86
+ testId: "".concat(testId, "-done-message")
87
+ }, jsx(FormattedMessage, messages.ai_summarized)), jsx(AIIndicatorTooltip, {
88
+ content: jsx(Box, {
89
+ xcss: tooltipMsgStyles,
90
+ testId: "".concat(testId, "-done-tooltip")
91
+ }, jsx(FormattedMessage, _extends({}, messages.ai_summarized_info, {
92
+ values: {
93
+ a: function a(chunks) {
94
+ return jsx(AILearnMoreAnchor, null, chunks);
95
+ }
96
+ }
97
+ }))),
98
+ trigger: jsx(EditorPanelIcon, {
99
+ label: "Info",
100
+ size: "small",
101
+ testId: "".concat(testId, "-done-info")
102
+ })
103
+ })),
104
+ testId: "".concat(testId, "-done")
105
+ });
106
+ }
107
+ };
108
+ export default AIStateDone;