@atlaskit/smart-card 26.38.0 → 26.39.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 (88) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/utils/analytics/analytics.js +1 -1
  3. package/dist/cjs/view/BlockCard/actions/flexible/AuthorizeAction.js +1 -0
  4. package/dist/cjs/view/BlockCard/index.js +5 -18
  5. package/dist/cjs/view/BlockCard/views/flexible/FlexibleErroredView.js +12 -34
  6. package/dist/cjs/view/BlockCard/views/flexible/FlexibleForbiddenView.js +25 -51
  7. package/dist/cjs/view/BlockCard/views/flexible/FlexibleForbiddenViewOld.js +13 -32
  8. package/dist/cjs/view/BlockCard/views/flexible/FlexibleNotFoundView.js +9 -31
  9. package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +7 -18
  10. package/dist/cjs/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +28 -51
  11. package/dist/cjs/view/BlockCard/views/flexible/styled.js +5 -5
  12. package/dist/cjs/view/BlockCard/views/flexible/unresolved-view/index.js +41 -0
  13. package/dist/cjs/view/BlockCard/views/flexible/utils/index.js +30 -1
  14. package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/index.js +12 -57
  15. package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +65 -0
  16. package/dist/cjs/view/FlexibleCard/components/blocks/index.js +8 -1
  17. package/dist/cjs/view/FlexibleCard/components/blocks/title-block/errored/index.js +3 -2
  18. package/dist/cjs/view/FlexibleCard/components/blocks/title-block/index.js +5 -2
  19. package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolved/index.js +1 -2
  20. package/dist/cjs/view/FlexibleCard/components/blocks/title-block/resolving/index.js +3 -2
  21. package/dist/cjs/view/LinkUrl/index.js +1 -1
  22. package/dist/es2019/utils/analytics/analytics.js +1 -1
  23. package/dist/es2019/view/BlockCard/actions/flexible/AuthorizeAction.js +1 -0
  24. package/dist/es2019/view/BlockCard/index.js +1 -15
  25. package/dist/es2019/view/BlockCard/views/flexible/FlexibleErroredView.js +8 -32
  26. package/dist/es2019/view/BlockCard/views/flexible/FlexibleForbiddenView.js +25 -52
  27. package/dist/es2019/view/BlockCard/views/flexible/FlexibleForbiddenViewOld.js +12 -31
  28. package/dist/es2019/view/BlockCard/views/flexible/FlexibleNotFoundView.js +15 -41
  29. package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +10 -21
  30. package/dist/es2019/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +24 -43
  31. package/dist/es2019/view/BlockCard/views/flexible/styled.js +3 -4
  32. package/dist/es2019/view/BlockCard/views/flexible/unresolved-view/index.js +33 -0
  33. package/dist/es2019/view/BlockCard/views/flexible/utils/index.js +27 -2
  34. package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/index.js +11 -54
  35. package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +56 -0
  36. package/dist/es2019/view/FlexibleCard/components/blocks/index.js +4 -1
  37. package/dist/es2019/view/FlexibleCard/components/blocks/title-block/errored/index.js +2 -1
  38. package/dist/es2019/view/FlexibleCard/components/blocks/title-block/index.js +3 -1
  39. package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolved/index.js +1 -1
  40. package/dist/es2019/view/FlexibleCard/components/blocks/title-block/resolving/index.js +2 -1
  41. package/dist/es2019/view/LinkUrl/index.js +1 -1
  42. package/dist/esm/utils/analytics/analytics.js +1 -1
  43. package/dist/esm/view/BlockCard/actions/flexible/AuthorizeAction.js +1 -0
  44. package/dist/esm/view/BlockCard/index.js +3 -18
  45. package/dist/esm/view/BlockCard/views/flexible/FlexibleErroredView.js +12 -34
  46. package/dist/esm/view/BlockCard/views/flexible/FlexibleForbiddenView.js +26 -52
  47. package/dist/esm/view/BlockCard/views/flexible/FlexibleForbiddenViewOld.js +13 -32
  48. package/dist/esm/view/BlockCard/views/flexible/FlexibleNotFoundView.js +9 -31
  49. package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +10 -21
  50. package/dist/esm/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +25 -45
  51. package/dist/esm/view/BlockCard/views/flexible/styled.js +4 -4
  52. package/dist/esm/view/BlockCard/views/flexible/unresolved-view/index.js +35 -0
  53. package/dist/esm/view/BlockCard/views/flexible/utils/index.js +30 -1
  54. package/dist/esm/view/FlexibleCard/components/blocks/footer-block/index.js +13 -54
  55. package/dist/esm/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +55 -0
  56. package/dist/esm/view/FlexibleCard/components/blocks/index.js +4 -1
  57. package/dist/esm/view/FlexibleCard/components/blocks/title-block/errored/index.js +3 -2
  58. package/dist/esm/view/FlexibleCard/components/blocks/title-block/index.js +5 -2
  59. package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolved/index.js +1 -2
  60. package/dist/esm/view/FlexibleCard/components/blocks/title-block/resolving/index.js +3 -2
  61. package/dist/esm/view/LinkUrl/index.js +1 -1
  62. package/dist/types/view/BlockCard/views/flexible/FlexibleUnauthorisedView.d.ts +3 -1
  63. package/dist/types/view/BlockCard/views/flexible/styled.d.ts +0 -1
  64. package/dist/types/view/BlockCard/views/flexible/types.d.ts +2 -83
  65. package/dist/types/view/BlockCard/views/flexible/unresolved-view/index.d.ts +4 -0
  66. package/dist/types/view/BlockCard/views/flexible/unresolved-view/types.d.ts +7 -0
  67. package/dist/types/view/BlockCard/views/flexible/utils/index.d.ts +8 -0
  68. package/dist/types/view/FlexibleCard/components/blocks/footer-block/resolved/index.d.ts +4 -0
  69. package/dist/types/view/FlexibleCard/components/blocks/index.d.ts +1 -0
  70. package/dist/types-ts4.5/view/BlockCard/views/flexible/FlexibleUnauthorisedView.d.ts +3 -1
  71. package/dist/types-ts4.5/view/BlockCard/views/flexible/styled.d.ts +0 -1
  72. package/dist/types-ts4.5/view/BlockCard/views/flexible/types.d.ts +2 -83
  73. package/dist/types-ts4.5/view/BlockCard/views/flexible/unresolved-view/index.d.ts +4 -0
  74. package/dist/types-ts4.5/view/BlockCard/views/flexible/unresolved-view/types.d.ts +7 -0
  75. package/dist/types-ts4.5/view/BlockCard/views/flexible/utils/index.d.ts +8 -0
  76. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/footer-block/resolved/index.d.ts +4 -0
  77. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/index.d.ts +1 -0
  78. package/package.json +1 -1
  79. package/dist/cjs/view/BlockCard/components/flexible/footer/index.js +0 -56
  80. package/dist/es2019/view/BlockCard/components/flexible/footer/index.js +0 -52
  81. package/dist/esm/view/BlockCard/components/flexible/footer/index.js +0 -49
  82. package/dist/types/view/BlockCard/components/flexible/footer/index.d.ts +0 -12
  83. package/dist/types/view/BlockCard/components/flexible/footer/types.d.ts +0 -5
  84. package/dist/types-ts4.5/view/BlockCard/components/flexible/footer/index.d.ts +0 -12
  85. package/dist/types-ts4.5/view/BlockCard/components/flexible/footer/types.d.ts +0 -5
  86. /package/dist/cjs/view/BlockCard/{components/flexible/footer → views/flexible/unresolved-view}/types.js +0 -0
  87. /package/dist/es2019/view/BlockCard/{components/flexible/footer → views/flexible/unresolved-view}/types.js +0 -0
  88. /package/dist/esm/view/BlockCard/{components/flexible/footer → views/flexible/unresolved-view}/types.js +0 -0
@@ -1,20 +1,20 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
3
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
4
+ var _excluded = ["testId"];
3
5
  var _templateObject;
4
- import React, { useCallback, useMemo } from 'react';
6
+ /** @jsx jsx */
7
+ import { css, jsx } from '@emotion/react';
8
+ import { useCallback, useMemo } from 'react';
5
9
  import { FormattedMessage } from 'react-intl-next';
6
- import FlexibleCard from '../../../FlexibleCard';
10
+ import { getExtensionKey } from '../../../../state/helpers';
7
11
  import { AuthorizeAction } from '../../actions/flexible/AuthorizeAction';
8
- import BlockCardFooter from '../../components/flexible/footer';
9
- import { CustomBlock, TitleBlock } from '../../../FlexibleCard/components/blocks';
10
- import { SmartLinkStatus } from '../../../../constants';
11
12
  import { extractProvider } from '@atlaskit/link-extractors';
12
13
  import UnauthorisedViewContent from '../../../common/UnauthorisedViewContent';
13
- import { css } from '@emotion/react';
14
- import { tokens } from '../../../../utils/token';
15
14
  import { messages } from '../../../../messages';
15
+ import UnresolvedView from './unresolved-view';
16
16
  import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
17
- var contentStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n margin-top: 0.5rem;\n font-size: 0.75rem;\n"])), tokens.text);
17
+ var contentStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n margin-top: 0.5rem;\n font-size: 0.75rem;\n"])), "var(--ds-text-subtlest, #626F86)");
18
18
 
19
19
  /**
20
20
  * This view represents a Block card that has an 'Unauthorized' status .
@@ -24,35 +24,30 @@ var contentStyles = css(_templateObject || (_templateObject = _taggedTemplateLit
24
24
  * @see FlexibleCardProps
25
25
  */
26
26
  var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
27
- var _cardState$details, _extractProvider;
28
- var anchorTarget = _ref.anchorTarget,
29
- analytics = _ref.analytics,
30
- cardState = _ref.cardState,
31
- _ref$extensionKey = _ref.extensionKey,
32
- extensionKey = _ref$extensionKey === void 0 ? '' : _ref$extensionKey,
33
- onAuthorize = _ref.onAuthorize,
34
- onClick = _ref.onClick,
35
- onError = _ref.onError,
36
- _ref$testId = _ref.testId,
27
+ var _getExtensionKey, _cardState$details, _extractProvider;
28
+ var _ref$testId = _ref.testId,
37
29
  testId = _ref$testId === void 0 ? 'smart-block-unauthorized-view' : _ref$testId,
38
- url = _ref.url,
39
- titleBlockProps = _ref.titleBlockProps;
30
+ props = _objectWithoutProperties(_ref, _excluded);
31
+ var analytics = props.analytics,
32
+ cardState = props.cardState,
33
+ onAuthorize = props.onAuthorize;
34
+ var extensionKey = (_getExtensionKey = getExtensionKey(cardState === null || cardState === void 0 ? void 0 : cardState.details)) !== null && _getExtensionKey !== void 0 ? _getExtensionKey : '';
40
35
  var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
41
36
  var providerName = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
42
37
  var handleAuthorize = useCallback(function () {
43
38
  if (onAuthorize) {
44
- analytics.track.appAccountAuthStarted({
39
+ analytics === null || analytics === void 0 || analytics.track.appAccountAuthStarted({
45
40
  extensionKey: extensionKey
46
41
  });
47
42
  onAuthorize();
48
43
  }
49
- }, [onAuthorize, extensionKey, analytics.track]);
44
+ }, [onAuthorize, extensionKey, analytics === null || analytics === void 0 ? void 0 : analytics.track]);
50
45
  var content = useMemo(function () {
51
- return onAuthorize ? /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
46
+ return onAuthorize ? jsx(UnauthorisedViewContent, {
52
47
  providerName: providerName,
53
48
  analytics: analytics,
54
49
  testId: testId
55
- }) : /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[providerName ? 'unauthorised_account_description' : 'unauthorised_account_description_no_provider'], {
50
+ }) : jsx(FormattedMessage, _extends({}, messages[providerName ? 'unauthorised_account_description' : 'unauthorised_account_description_no_provider'], {
56
51
  values: {
57
52
  context: providerName
58
53
  }
@@ -61,27 +56,12 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
61
56
  var actions = useMemo(function () {
62
57
  return onAuthorize ? [AuthorizeAction(handleAuthorize, providerName)] : [];
63
58
  }, [handleAuthorize, onAuthorize, providerName]);
64
- return /*#__PURE__*/React.createElement(FlexibleCard, {
65
- appearance: "block",
66
- cardState: cardState,
67
- onAuthorize: onAuthorize,
68
- onClick: onClick,
69
- onError: onError,
70
- testId: testId,
71
- ui: {
72
- hideElevation: true
73
- },
74
- url: url
75
- }, /*#__PURE__*/React.createElement(TitleBlock, _extends({
76
- hideRetry: true,
77
- anchorTarget: anchorTarget
78
- }, titleBlockProps)), /*#__PURE__*/React.createElement(CustomBlock, {
79
- overrideCss: contentStyles,
80
- testId: "".concat(testId, "-content")
81
- }, /*#__PURE__*/React.createElement("div", null, content)), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
59
+ return jsx(UnresolvedView, _extends({}, props, {
82
60
  actions: actions,
83
- status: SmartLinkStatus.Unauthorized,
84
- actionGroupAppearance: "primary"
85
- })));
61
+ testId: testId
62
+ }), jsx("div", {
63
+ css: contentStyles,
64
+ "data-testid": "".concat(testId, "-content")
65
+ }, content));
86
66
  };
87
67
  export default withFlexibleUIBlockCardStyle(FlexibleUnauthorisedView);
@@ -1,15 +1,15 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
3
3
  import { tokens } from '../../../../utils/token';
4
4
  import { css } from '@emotion/react';
5
5
  import { N40 } from '@atlaskit/theme/colors';
6
6
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
7
 
8
8
  // in editor prosemirror adds padding-left so we need to overwrite it
9
- export var metadataBlockCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* primary element group */\n span[data-smart-element-avatar-group] {\n > ul {\n padding-left: 0px;\n }\n }\n [data-smart-element-group] {\n line-height: 1rem;\n }\n"])));
9
+ // renderer overwrites the margin-right so we need to add it here
10
+ export var metadataBlockCss = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* primary element group */\n span[data-smart-element-avatar-group] {\n > ul {\n padding-left: 0px;\n margin-right: 0.5rem;\n }\n }\n [data-smart-element-group] {\n line-height: 1rem;\n }\n"])));
10
11
  export var titleBlockCss = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n ", "\n"])), getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? "gap: 0.5em;" : "", getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? "[data-smart-element=\"Title\"] {\n font-weight: 600;\n }" : "");
11
12
  export var footerBlockCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: 1.5rem;\n\n .actions-button-group {\n button,\n button:hover,\n button:focus,\n button:active {\n font-size: 0.875rem;\n }\n }\n"])));
12
13
  var flexibleBlockCardElevationStyle = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border-radius: 1.5px;\n box-shadow: ", ";\n margin: ", ";\n"])), tokens.elevation, "var(--ds-space-025, 2px)");
13
14
  var refreshedFlexibleBlockCardStyle = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n & > div {\n border-radius: ", ";\n border: 1px solid ", ";\n }\n"])), "var(--ds-border-radius-200, 8px)", "var(--ds-border, ".concat(N40, ")"));
14
- export var flexibleBlockCardStyle = getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? refreshedFlexibleBlockCardStyle : flexibleBlockCardElevationStyle;
15
- export var forbiddenViewTitleStyle = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n font-weight: 600;\n"])));
15
+ export var flexibleBlockCardStyle = getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? refreshedFlexibleBlockCardStyle : flexibleBlockCardElevationStyle;
@@ -0,0 +1,35 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import { CustomBlock, PreviewBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
3
+ import React from 'react';
4
+ import FlexibleCard from '../../../../FlexibleCard';
5
+ import { InternalFooterBlock } from '../../../../FlexibleCard/components/blocks';
6
+ import { FlexibleCardUiOptions, getFooterBlockOptions, PreviewBlockOptions, getTitleBlockOptions } from '../utils';
7
+ var UnresolvedView = function UnresolvedView(_ref) {
8
+ var actions = _ref.actions,
9
+ cardState = _ref.cardState,
10
+ children = _ref.children,
11
+ onAuthorize = _ref.onAuthorize,
12
+ onClick = _ref.onClick,
13
+ onError = _ref.onError,
14
+ _ref$showPreview = _ref.showPreview,
15
+ showPreview = _ref$showPreview === void 0 ? false : _ref$showPreview,
16
+ testId = _ref.testId,
17
+ title = _ref.title,
18
+ url = _ref.url;
19
+ return /*#__PURE__*/React.createElement(FlexibleCard, {
20
+ appearance: "block",
21
+ cardState: cardState,
22
+ onAuthorize: onAuthorize,
23
+ onClick: onClick,
24
+ onError: onError,
25
+ testId: testId,
26
+ ui: FlexibleCardUiOptions,
27
+ url: url
28
+ }, /*#__PURE__*/React.createElement(TitleBlock, _extends({}, getTitleBlockOptions(), {
29
+ text: title
30
+ })), /*#__PURE__*/React.createElement(CustomBlock, null, children), showPreview && /*#__PURE__*/React.createElement(PreviewBlock, PreviewBlockOptions), /*#__PURE__*/React.createElement(InternalFooterBlock, _extends({}, getFooterBlockOptions(), {
31
+ actions: actions,
32
+ testId: "smart-block-card-footer"
33
+ })));
34
+ };
35
+ export default UnresolvedView;
@@ -1,6 +1,8 @@
1
- import { ElementName } from '../../../../../constants';
1
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
2
+ import { ElementName, MediaPlacement, SmartLinkPosition, SmartLinkSize } from '../../../../../constants';
2
3
  import { extractOwnedBy } from '../../../../../extractors/flexible/utils';
3
4
  import { getExtensionKey } from '../../../../../state/helpers';
5
+ import { footerBlockCss, titleBlockCss } from '../styled';
4
6
  var baseTopMetadata = [{
5
7
  name: ElementName.ModifiedOn
6
8
  }, {
@@ -134,4 +136,31 @@ export var getSimulatedMetadata = function getSimulatedMetadata(cardDetails) {
134
136
  titleMetadata: titleMetadata,
135
137
  topMetadata: topMetadata
136
138
  };
139
+ };
140
+ export var FlexibleCardUiOptions = {
141
+ hideElevation: true
142
+ };
143
+
144
+ // Due to the use of getBooleanFF(), this has to be a function.
145
+ // Make this a const object after ff cleanup.
146
+ export var getTitleBlockOptions = function getTitleBlockOptions() {
147
+ return {
148
+ anchorTarget: getBooleanFF('platform.linking-platform.smart-card.enable-block-card-clicks-opening-in-same-tab') ? '_self' : undefined,
149
+ position: SmartLinkPosition.Center,
150
+ overrideCss: titleBlockCss,
151
+ hideRetry: true,
152
+ size: getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? SmartLinkSize.Large : undefined
153
+ };
154
+ };
155
+ export var PreviewBlockOptions = {
156
+ placement: MediaPlacement.Right,
157
+ ignoreContainerPadding: true
158
+ };
159
+
160
+ // Due to the use of getBooleanFF(), this has to be a function.
161
+ // Make this a const object after ff cleanup.
162
+ export var getFooterBlockOptions = function getFooterBlockOptions() {
163
+ return {
164
+ overrideCss: getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? footerBlockCss : undefined
165
+ };
137
166
  };
@@ -1,23 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
- var _templateObject;
4
- import React, { useCallback, useMemo } from 'react';
5
- import { css } from '@emotion/react';
6
- import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkStatus, SmartLinkWidth } from '../../../../../constants';
7
- import Block from '../block';
8
- import ElementGroup from '../element-group';
9
- import { Provider } from '../../elements';
10
- import ActionGroup from '../action-group';
11
- import { filterActionItems } from '../utils';
12
- import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
13
- var getActionGroupStyles = function getActionGroupStyles(size) {
14
- if (size === SmartLinkSize.XLarge) {
15
- // The biggest height of the action button exceeds the max line-height
16
- // of the elements causing the action on the block with x-large size to
17
- // get cut at the bottom.
18
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n max-height: 2rem;\n "])));
19
- }
20
- };
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["status", "testId"];
4
+ import React from 'react';
5
+ import FooterBlockResolvedView from './resolved';
6
+ import { SmartLinkStatus } from '../../../../../constants';
21
7
 
22
8
  /**
23
9
  * Represents a FooterBlock, designed to contain elements and actions that should appear
@@ -26,43 +12,16 @@ var getActionGroupStyles = function getActionGroupStyles(size) {
26
12
  * @param {FooterBlockProps} FooterBlockProps
27
13
  * @see Block
28
14
  */
29
- var FooterBlock = function FooterBlock(props) {
30
- var status = props.status,
31
- actions = props.actions,
32
- _props$size = props.size,
33
- size = _props$size === void 0 ? SmartLinkSize.Medium : _props$size,
34
- _props$testId = props.testId,
35
- testId = _props$testId === void 0 ? 'smart-footer-block' : _props$testId,
36
- onActionMenuOpenChange = props.onActionMenuOpenChange;
37
- var context = useFlexibleUiContext();
38
- var hasActions = useMemo(function () {
39
- var _filterActionItems;
40
- return ((_filterActionItems = filterActionItems(actions, context)) === null || _filterActionItems === void 0 ? void 0 : _filterActionItems.length) > 0;
41
- }, [actions, context]);
42
- var onDropdownOpenChange = useCallback(function (isOpen) {
43
- if (onActionMenuOpenChange) {
44
- onActionMenuOpenChange({
45
- isOpen: isOpen
46
- });
47
- }
48
- }, [onActionMenuOpenChange]);
15
+ var FooterBlock = function FooterBlock(_ref) {
16
+ var status = _ref.status,
17
+ _ref$testId = _ref.testId,
18
+ testId = _ref$testId === void 0 ? 'smart-footer-block' : _ref$testId,
19
+ props = _objectWithoutProperties(_ref, _excluded);
49
20
  if (status !== SmartLinkStatus.Resolved) {
50
21
  return null;
51
22
  }
52
- return /*#__PURE__*/React.createElement(Block, _extends({}, props, {
53
- testId: "".concat(testId, "-resolved-view")
54
- }), /*#__PURE__*/React.createElement(Provider, {
55
- testId: "".concat(testId, "-provider")
56
- }), actions && hasActions ? /*#__PURE__*/React.createElement(ElementGroup, {
57
- testId: "smart-element-group-actions",
58
- align: SmartLinkAlignment.Right,
59
- direction: SmartLinkDirection.Horizontal,
60
- overrideCss: getActionGroupStyles(size),
61
- width: SmartLinkWidth.Flexible
62
- }, /*#__PURE__*/React.createElement(ActionGroup, {
63
- onDropdownOpenChange: onDropdownOpenChange,
64
- items: actions,
65
- appearance: "default"
66
- })) : null);
23
+ return /*#__PURE__*/React.createElement(FooterBlockResolvedView, _extends({}, props, {
24
+ testId: testId
25
+ }));
67
26
  };
68
27
  export default FooterBlock;
@@ -0,0 +1,55 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
+ var _templateObject;
4
+ import { css } from '@emotion/react';
5
+ import React, { useCallback, useMemo } from 'react';
6
+ import { SmartLinkAlignment, SmartLinkDirection, SmartLinkSize, SmartLinkWidth } from '../../../../../../constants';
7
+ import { useFlexibleUiContext } from '../../../../../../state/flexible-ui-context';
8
+ import { Provider } from '../../../elements';
9
+ import ActionGroup from '../../action-group';
10
+ import Block from '../../block';
11
+ import ElementGroup from '../../element-group';
12
+ import { filterActionItems } from '../../utils';
13
+ var getActionGroupStyles = function getActionGroupStyles(size) {
14
+ if (size === SmartLinkSize.XLarge) {
15
+ // The biggest height of the action button exceeds the max line-height
16
+ // of the elements causing the action on the block with x-large size to
17
+ // get cut at the bottom.
18
+ return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n max-height: 2rem;\n "])));
19
+ }
20
+ };
21
+ var FooterBlockResolvedView = function FooterBlockResolvedView(props) {
22
+ var actions = props.actions,
23
+ testId = props.testId,
24
+ onActionMenuOpenChange = props.onActionMenuOpenChange,
25
+ _props$size = props.size,
26
+ size = _props$size === void 0 ? SmartLinkSize.Medium : _props$size;
27
+ var context = useFlexibleUiContext();
28
+ var hasActions = useMemo(function () {
29
+ var _filterActionItems;
30
+ return ((_filterActionItems = filterActionItems(actions, context)) === null || _filterActionItems === void 0 ? void 0 : _filterActionItems.length) > 0;
31
+ }, [actions, context]);
32
+ var onDropdownOpenChange = useCallback(function (isOpen) {
33
+ if (onActionMenuOpenChange) {
34
+ onActionMenuOpenChange({
35
+ isOpen: isOpen
36
+ });
37
+ }
38
+ }, [onActionMenuOpenChange]);
39
+ return /*#__PURE__*/React.createElement(Block, _extends({}, props, {
40
+ testId: "".concat(testId, "-resolved-view")
41
+ }), /*#__PURE__*/React.createElement(Provider, {
42
+ testId: "".concat(testId, "-provider")
43
+ }), actions && hasActions ? /*#__PURE__*/React.createElement(ElementGroup, {
44
+ testId: "smart-element-group-actions",
45
+ align: SmartLinkAlignment.Right,
46
+ direction: SmartLinkDirection.Horizontal,
47
+ overrideCss: getActionGroupStyles(size),
48
+ width: SmartLinkWidth.Flexible
49
+ }, /*#__PURE__*/React.createElement(ActionGroup, {
50
+ onDropdownOpenChange: onDropdownOpenChange,
51
+ items: actions,
52
+ appearance: "default"
53
+ })) : null);
54
+ };
55
+ export default FooterBlockResolvedView;
@@ -3,4 +3,7 @@ export { default as MetadataBlock } from './metadata-block';
3
3
  export { default as PreviewBlock } from './preview-block';
4
4
  export { default as SnippetBlock } from './snippet-block';
5
5
  export { default as TitleBlock } from './title-block';
6
- export { default as CustomBlock } from './block';
6
+ export { default as CustomBlock } from './block';
7
+
8
+ // Internal components to be used within @atlaskit/smart-card only.
9
+ export { default as InternalFooterBlock } from './footer-block/resolved';
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
4
- var _excluded = ["actionGroup", "retry", "position", "testId", "title"];
4
+ var _excluded = ["actionGroup", "retry", "position", "testId", "title", "hideIcon"];
5
5
  var _templateObject, _templateObject2;
6
6
  /** @jsx jsx */
7
7
  import React from 'react';
@@ -32,6 +32,7 @@ var TitleBlockErroredView = function TitleBlockErroredView(_ref) {
32
32
  position = _ref.position,
33
33
  testId = _ref.testId,
34
34
  title = _ref.title,
35
+ hideIcon = _ref.hideIcon,
35
36
  blockProps = _objectWithoutProperties(_ref, _excluded);
36
37
  var _ref2 = retry || {},
37
38
  descriptor = _ref2.descriptor,
@@ -42,7 +43,7 @@ var TitleBlockErroredView = function TitleBlockErroredView(_ref) {
42
43
  var hasAction = onClick !== undefined;
43
44
  return jsx(Block, _extends({}, blockProps, {
44
45
  testId: "".concat(testId, "-errored-view")
45
- }), jsx(LinkIcon, {
46
+ }), !hideIcon && jsx(LinkIcon, {
46
47
  position: position
47
48
  }), title, descriptor && jsx(ElementGroup, {
48
49
  direction: SmartLinkDirection.Horizontal,
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
5
- var _excluded = ["actions", "anchorTarget", "hideTitleTooltip", "maxLines", "onActionMenuOpenChange", "onClick", "overrideCss", "status", "showActionOnHover", "testId", "text", "theme", "hideRetry", "metadataPosition"];
5
+ var _excluded = ["actions", "anchorTarget", "hideTitleTooltip", "maxLines", "onActionMenuOpenChange", "onClick", "overrideCss", "status", "showActionOnHover", "testId", "text", "theme", "hideRetry", "metadataPosition", "hideIcon"];
6
6
  var _templateObject, _templateObject2;
7
7
  import React, { useCallback, useState } from 'react';
8
8
  import { css } from '@emotion/react';
@@ -65,6 +65,8 @@ var TitleBlock = function TitleBlock(_ref) {
65
65
  theme = _ref.theme,
66
66
  hideRetry = _ref.hideRetry,
67
67
  metadataPosition = _ref.metadataPosition,
68
+ _ref$hideIcon = _ref.hideIcon,
69
+ hideIcon = _ref$hideIcon === void 0 ? false : _ref$hideIcon,
68
70
  props = _objectWithoutProperties(_ref, _excluded);
69
71
  if (hideRetry && props.retry) {
70
72
  delete props.retry;
@@ -106,7 +108,8 @@ var TitleBlock = function TitleBlock(_ref) {
106
108
  overrideCss: combinedCss,
107
109
  testId: testId,
108
110
  title: title,
109
- metadataPosition: metadataPosition
111
+ metadataPosition: metadataPosition,
112
+ hideIcon: hideIcon
110
113
  }));
111
114
  };
112
115
  export default TitleBlock;
@@ -27,8 +27,7 @@ var TitleBlockResolvedView = function TitleBlockResolvedView(_ref) {
27
27
  text = _ref.text,
28
28
  title = _ref.title,
29
29
  metadataPosition = _ref.metadataPosition,
30
- _ref$hideIcon = _ref.hideIcon,
31
- hideIcon = _ref$hideIcon === void 0 ? false : _ref$hideIcon,
30
+ hideIcon = _ref.hideIcon,
32
31
  blockProps = _objectWithoutProperties(_ref, _excluded);
33
32
  var metadataElements = renderElementItems(metadata);
34
33
  var subtitleElements = renderElementItems(subtitle);
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["actionGroup", "testId", "title"];
3
+ var _excluded = ["actionGroup", "testId", "title", "hideIcon"];
4
4
  /** @jsx jsx */
5
5
  import React from 'react';
6
6
  import { jsx } from '@emotion/react';
@@ -19,6 +19,7 @@ var TitleBlockResolvingView = function TitleBlockResolvingView(_ref) {
19
19
  var actionGroup = _ref.actionGroup,
20
20
  testId = _ref.testId,
21
21
  title = _ref.title,
22
+ hideIcon = _ref.hideIcon,
22
23
  blockProps = _objectWithoutProperties(_ref, _excluded);
23
24
  var _blockProps$size = blockProps.size,
24
25
  size = _blockProps$size === void 0 ? SmartLinkSize.Medium : _blockProps$size;
@@ -26,7 +27,7 @@ var TitleBlockResolvingView = function TitleBlockResolvingView(_ref) {
26
27
  var iconStyles = getIconSizeStyles(iconWidth);
27
28
  return jsx(Block, _extends({}, blockProps, {
28
29
  testId: "".concat(testId, "-resolving-view")
29
- }), jsx("span", {
30
+ }), !hideIcon && jsx("span", {
30
31
  css: iconStyles,
31
32
  "data-testid": "".concat(testId, "-icon")
32
33
  }, jsx(LoadingSkeleton, {
@@ -11,7 +11,7 @@ import LinkWarningModal from './LinkWarningModal';
11
11
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
12
12
  var PACKAGE_DATA = {
13
13
  packageName: "@atlaskit/smart-card",
14
- packageVersion: "26.38.0",
14
+ packageVersion: "26.39.0",
15
15
  componentName: 'linkUrl'
16
16
  };
17
17
  var Link = withLinkClickedEvent('a');
@@ -1,3 +1,5 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
1
3
  import { FlexibleBlockCardProps } from './types';
2
- declare const _default: (props: FlexibleBlockCardProps) => import("@emotion/react").jsx.JSX.Element;
4
+ declare const _default: (props: FlexibleBlockCardProps) => jsx.JSX.Element;
3
5
  export default _default;
@@ -2,4 +2,3 @@ export declare const metadataBlockCss: import("@emotion/react").SerializedStyles
2
2
  export declare const titleBlockCss: import("@emotion/react").SerializedStyles;
3
3
  export declare const footerBlockCss: import("@emotion/react").SerializedStyles;
4
4
  export declare const flexibleBlockCardStyle: import("@emotion/react").SerializedStyles;
5
- export declare const forbiddenViewTitleStyle: import("@emotion/react").SerializedStyles;
@@ -1,83 +1,2 @@
1
- /// <reference types="react" />
2
- import { CardState } from '@atlaskit/linking-common';
3
- import { OnErrorCallback } from '../../../types';
4
- import { FlexibleUiOptions } from '../../../FlexibleCard/types';
5
- import { OnResolveCallback } from '../../../Card/types';
6
- import { CardProviderRenderers } from '@atlaskit/link-provider';
7
- import { AnalyticsFacade } from '../../../../state/analytics';
8
- import { AnchorTarget } from '../../../FlexibleCard/components/types';
9
- import { TitleBlockProps } from '../../../FlexibleCard/components/blocks/title-block/types';
10
- export type FlexibleBlockCardProps = {
11
- /**
12
- * An AnalyticsFacade object used for calling analytics.
13
- */
14
- analytics: AnalyticsFacade;
15
- /**
16
- * Determines the anchor target to be passed to the title block.
17
- */
18
- anchorTarget?: AnchorTarget;
19
- /**
20
- * Determines the status and data of the Smart Link.
21
- * @internal
22
- */
23
- cardState: CardState;
24
- /**
25
- * Provides the extensionKey of a Smart Link resolver invoked.
26
- */
27
- extensionKey?: string;
28
- /**
29
- * A unique id for this Smart Link instance, used for analytics.
30
- */
31
- id?: string;
32
- /**
33
- * An additional action that can be performed when link is not resolved, e.g.
34
- * connect account to gain access to 403 link.
35
- * @internal
36
- */
37
- onAuthorize?: () => void;
38
- /**
39
- * Determines the onClick behaviour of Flexible UI. This will proxy to the
40
- * TitleBlock if supplied.
41
- */
42
- onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
43
- /**
44
- * function to be called after a flexible card has rendered its error states
45
- */
46
- onError?: OnErrorCallback;
47
- /**
48
- * function to be called after a flexible card has rendered its resolved state
49
- */
50
- onResolve?: OnResolveCallback;
51
- /**
52
- * A name of the provider, needed to specify to user which account has to be connected
53
- */
54
- providerName?: string;
55
- /**
56
- * Any additional renderers required by Flexible UI. Currently used by icon
57
- * to render Emoji.
58
- */
59
- renderers?: CardProviderRenderers;
60
- /**
61
- * Determines whether to show available server actions.
62
- */
63
- showServerActions?: boolean;
64
- /**
65
- * A `testId` prop is provided for specified elements, which is a unique
66
- * string that appears as a data attribute `data-testid` in the rendered code,
67
- * serving as a hook for automated tests
68
- */
69
- testId?: string;
70
- /**
71
- * Determines the appearance of Flexible UI.
72
- * @see FlexibleUiOptions
73
- */
74
- ui?: FlexibleUiOptions;
75
- /**
76
- * Determines the URL of the Smart Link.
77
- */
78
- url: string;
79
- /**
80
- * Determines a style of the Title Block.
81
- */
82
- titleBlockProps?: TitleBlockProps;
83
- };
1
+ import { FlexibleCardProps } from '../../../FlexibleCard/types';
2
+ export type FlexibleBlockCardProps = Pick<FlexibleCardProps, 'analytics' | 'cardState' | 'id' | 'onAuthorize' | 'onClick' | 'onError' | 'onResolve' | 'renderers' | 'showServerActions' | 'testId' | 'url'>;
@@ -0,0 +1,4 @@
1
+ import { type FC } from 'react';
2
+ import { UnresolvedViewProps } from './types';
3
+ declare const UnresolvedView: FC<UnresolvedViewProps>;
4
+ export default UnresolvedView;
@@ -0,0 +1,7 @@
1
+ import type { ActionItem } from '../../../../FlexibleCard/components/blocks/types';
2
+ import type { FlexibleBlockCardProps } from '../types';
3
+ export type UnresolvedViewProps = FlexibleBlockCardProps & {
4
+ actions?: ActionItem[];
5
+ showPreview?: boolean;
6
+ title?: string;
7
+ };
@@ -1,4 +1,8 @@
1
1
  import { JsonLd } from 'json-ld-types';
2
+ import type { FlexibleUiOptions } from '../../../../FlexibleCard/types';
3
+ import type { FooterBlockProps } from '../../../../FlexibleCard/components/blocks/footer-block/types';
4
+ import type { PreviewBlockProps } from '../../../../FlexibleCard/components/blocks/preview-block/types';
5
+ import type { TitleBlockProps } from '../../../../FlexibleCard/components/blocks/title-block/types';
2
6
  import { ElementItem } from '../../../../FlexibleCard/components/blocks/types';
3
7
  export declare const getSimulatedBetterMetadata: (cardDetails?: JsonLd.Response) => SimulatedMetadata;
4
8
  export declare const getSimulatedMetadata: (cardDetails?: JsonLd.Response) => SimulatedMetadata;
@@ -7,4 +11,8 @@ type SimulatedMetadata = {
7
11
  topMetadata: ElementItem[];
8
12
  bottomMetadata?: ElementItem[];
9
13
  };
14
+ export declare const FlexibleCardUiOptions: FlexibleUiOptions;
15
+ export declare const getTitleBlockOptions: () => Partial<TitleBlockProps>;
16
+ export declare const PreviewBlockOptions: Partial<PreviewBlockProps>;
17
+ export declare const getFooterBlockOptions: () => Partial<FooterBlockProps>;
10
18
  export {};
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { FooterBlockProps } from '../types';
3
+ declare const FooterBlockResolvedView: React.FC<FooterBlockProps>;
4
+ export default FooterBlockResolvedView;
@@ -4,3 +4,4 @@ export { default as PreviewBlock } from './preview-block';
4
4
  export { default as SnippetBlock } from './snippet-block';
5
5
  export { default as TitleBlock } from './title-block';
6
6
  export { default as CustomBlock } from './block';
7
+ export { default as InternalFooterBlock } from './footer-block/resolved';
@@ -1,3 +1,5 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
1
3
  import { FlexibleBlockCardProps } from './types';
2
- declare const _default: (props: FlexibleBlockCardProps) => import("@emotion/react").jsx.JSX.Element;
4
+ declare const _default: (props: FlexibleBlockCardProps) => jsx.JSX.Element;
3
5
  export default _default;
@@ -2,4 +2,3 @@ export declare const metadataBlockCss: import("@emotion/react").SerializedStyles
2
2
  export declare const titleBlockCss: import("@emotion/react").SerializedStyles;
3
3
  export declare const footerBlockCss: import("@emotion/react").SerializedStyles;
4
4
  export declare const flexibleBlockCardStyle: import("@emotion/react").SerializedStyles;
5
- export declare const forbiddenViewTitleStyle: import("@emotion/react").SerializedStyles;