@atlaskit/smart-card 26.32.0 → 26.33.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 (35) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/extractors/common/context/extractAccessContext.js +2 -1
  3. package/dist/cjs/utils/analytics/analytics.js +1 -1
  4. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +1 -1
  5. package/dist/cjs/view/HoverCard/components/views/forbidden/index.js +15 -24
  6. package/dist/cjs/view/HoverCard/components/views/forbidden/styled.js +1 -1
  7. package/dist/cjs/view/LinkUrl/index.js +1 -1
  8. package/dist/cjs/view/RedesignedInlineCard/ErroredView/index.js +9 -1
  9. package/dist/cjs/view/RedesignedInlineCard/ForbiddenView/index.js +9 -1
  10. package/dist/cjs/view/RedesignedInlineCard/index.js +4 -2
  11. package/dist/es2019/extractors/common/context/extractAccessContext.js +2 -1
  12. package/dist/es2019/utils/analytics/analytics.js +1 -1
  13. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +1 -1
  14. package/dist/es2019/view/HoverCard/components/views/forbidden/index.js +13 -17
  15. package/dist/es2019/view/HoverCard/components/views/forbidden/styled.js +1 -0
  16. package/dist/es2019/view/LinkUrl/index.js +1 -1
  17. package/dist/es2019/view/RedesignedInlineCard/ErroredView/index.js +9 -1
  18. package/dist/es2019/view/RedesignedInlineCard/ForbiddenView/index.js +9 -1
  19. package/dist/es2019/view/RedesignedInlineCard/index.js +4 -2
  20. package/dist/esm/extractors/common/context/extractAccessContext.js +2 -1
  21. package/dist/esm/utils/analytics/analytics.js +1 -1
  22. package/dist/esm/view/HoverCard/components/HoverCardContent.js +1 -1
  23. package/dist/esm/view/HoverCard/components/views/forbidden/index.js +15 -21
  24. package/dist/esm/view/HoverCard/components/views/forbidden/styled.js +1 -1
  25. package/dist/esm/view/LinkUrl/index.js +1 -1
  26. package/dist/esm/view/RedesignedInlineCard/ErroredView/index.js +9 -1
  27. package/dist/esm/view/RedesignedInlineCard/ForbiddenView/index.js +9 -1
  28. package/dist/esm/view/RedesignedInlineCard/index.js +4 -2
  29. package/dist/types/view/RedesignedInlineCard/ErroredView/index.d.ts +2 -0
  30. package/dist/types/view/RedesignedInlineCard/ForbiddenView/index.d.ts +2 -0
  31. package/dist/types/view/types.d.ts +1 -0
  32. package/dist/types-ts4.5/view/RedesignedInlineCard/ErroredView/index.d.ts +2 -0
  33. package/dist/types-ts4.5/view/RedesignedInlineCard/ForbiddenView/index.d.ts +2 -0
  34. package/dist/types-ts4.5/view/types.d.ts +1 -0
  35. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 26.33.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#40996](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40996) [`b6d96384d32`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b6d96384d32) - [ux] Add forbidden hover card to inline cards
8
+
3
9
  ## 26.32.0
4
10
 
5
11
  ### Minor Changes
@@ -89,7 +89,8 @@ var extractRequestAccessContextImproved = exports.extractRequestAccessContextImp
89
89
  callToActionMessageKey: 'request_access_pending_crossjoin',
90
90
  action: (0, _ForbiddenAction.ForbiddenAction)(function () {
91
91
  return window.open(url);
92
- }, 'request_access_pending', _messages.messages.request_access_pending_crossjoin)
92
+ }, 'request_access_pending', _messages.messages.request_access_pending_crossjoin),
93
+ buttonDisabled: true
93
94
  });
94
95
  case 'DENIED_REQUEST_EXISTS':
95
96
  return _objectSpread(_objectSpread({}, requestAccess), {}, {
@@ -22,7 +22,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
22
22
  var context = exports.context = {
23
23
  componentName: 'smart-cards',
24
24
  packageName: "@atlaskit/smart-card",
25
- packageVersion: "26.32.0"
25
+ packageVersion: "26.33.0"
26
26
  };
27
27
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
28
28
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -183,7 +183,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
183
183
  });
184
184
  }
185
185
  if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.cross-join')) {
186
- if (cardState.status === 'forbidden') {
186
+ if (cardState.status === 'forbidden' || cardState.status === 'not_found') {
187
187
  return (0, _react.jsx)(_forbidden.default, {
188
188
  flexibleCardProps: flexibleCardProps
189
189
  });
@@ -1,27 +1,23 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var _react = _interopRequireWildcard(require("react"));
9
+ var _react = _interopRequireDefault(require("react"));
11
10
  var _reactIntlNext = require("react-intl-next");
12
11
  var _FlexibleCard = _interopRequireDefault(require("../../../../FlexibleCard"));
13
12
  var _messages = require("../../../../../messages");
14
13
  var _blocks = require("../../../../FlexibleCard/components/blocks");
14
+ var _button = _interopRequireDefault(require("@atlaskit/button"));
15
15
  var _linkExtractors = require("@atlaskit/link-extractors");
16
16
  var _styled = require("./styled");
17
- var _actionGroup = _interopRequireDefault(require("../../../../FlexibleCard/components/blocks/action-group"));
18
- var _constants = require("../../../../../constants");
19
17
  var _styled2 = require("../../../styled");
20
18
  var _extractAccessContext = require("../../../../../extractors/common/context/extractAccessContext");
21
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
19
  var HoverCardForbiddenView = function HoverCardForbiddenView(_ref) {
24
- var _cardState$details, _cardState$details2, _extractProvider$text, _extractProvider;
20
+ var _cardState$details, _cardState$details2, _extractProvider$text, _extractProvider, _extractRequestAccess;
25
21
  var flexibleCardProps = _ref.flexibleCardProps,
26
22
  _ref$testId = _ref.testId,
27
23
  testId = _ref$testId === void 0 ? 'hover-card-forbidden-view' : _ref$testId;
@@ -30,22 +26,16 @@ var HoverCardForbiddenView = function HoverCardForbiddenView(_ref) {
30
26
  var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
31
27
  var meta = (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.meta;
32
28
  var product = (_extractProvider$text = (_extractProvider = (0, _linkExtractors.extractProvider)(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text) !== null && _extractProvider$text !== void 0 ? _extractProvider$text : '';
33
- var hostname = new URL(url).hostname;
34
- var _extractRequestAccess = (0, _extractAccessContext.extractRequestAccessContextImproved)({
29
+ var hostname = /*#__PURE__*/_react.default.createElement("b", null, new URL(url).hostname);
30
+ var _ref2 = (_extractRequestAccess = (0, _extractAccessContext.extractRequestAccessContextImproved)({
35
31
  jsonLd: meta,
36
32
  url: url,
37
33
  product: product
38
- }),
39
- action = _extractRequestAccess.action,
40
- descriptiveMessageKey = _extractRequestAccess.descriptiveMessageKey,
41
- titleMessageKey = _extractRequestAccess.titleMessageKey;
42
- var actions = (0, _react.useMemo)(function () {
43
- return [{
44
- name: _constants.ActionName.CustomAction,
45
- content: action === null || action === void 0 ? void 0 : action.text,
46
- onClick: action === null || action === void 0 ? void 0 : action.promise
47
- }];
48
- }, [action]);
34
+ })) !== null && _extractRequestAccess !== void 0 ? _extractRequestAccess : {},
35
+ action = _ref2.action,
36
+ descriptiveMessageKey = _ref2.descriptiveMessageKey,
37
+ titleMessageKey = _ref2.titleMessageKey,
38
+ buttonDisabled = _ref2.buttonDisabled;
49
39
  if (!titleMessageKey || !descriptiveMessageKey) {
50
40
  return null;
51
41
  }
@@ -73,9 +63,10 @@ var HoverCardForbiddenView = function HoverCardForbiddenView(_ref) {
73
63
  }))), action && /*#__PURE__*/_react.default.createElement(_blocks.CustomBlock, {
74
64
  overrideCss: _styled.connectButtonStyles,
75
65
  testId: "".concat(testId, "-button")
76
- }, /*#__PURE__*/_react.default.createElement(_actionGroup.default, {
77
- items: actions,
78
- appearance: "primary"
79
- })));
66
+ }, /*#__PURE__*/_react.default.createElement(_button.default, {
67
+ onClick: action === null || action === void 0 ? void 0 : action.promise,
68
+ appearance: "primary",
69
+ isDisabled: buttonDisabled
70
+ }, action === null || action === void 0 ? void 0 : action.text)));
80
71
  };
81
72
  var _default = exports.default = HoverCardForbiddenView;
@@ -11,5 +11,5 @@ var _templateObject, _templateObject2, _templateObject3;
11
11
  var blockGap = '0rem';
12
12
  var titleFontWeight = '600';
13
13
  var titleBlockStyles = exports.titleBlockStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n justify-content: center;\n font-weight: ", ";\n"])), titleFontWeight);
14
- var mainTextStyles = exports.mainTextStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n justify-content: center;\n margin-top: ", ";\n font-size: 0.75rem;\n text-align: center;\n"])), blockGap);
14
+ var mainTextStyles = exports.mainTextStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: inline;\n justify-content: center;\n margin-top: ", ";\n font-size: 0.75rem;\n text-align: center;\n"])), blockGap);
15
15
  var connectButtonStyles = exports.connectButtonStyles = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n justify-content: center;\n margin-top: ", ";\n"])), blockGap);
@@ -18,7 +18,7 @@ var _excluded = ["href", "children", "checkSafety", "onClick", "testId"],
18
18
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
19
19
  var PACKAGE_DATA = {
20
20
  packageName: "@atlaskit/smart-card",
21
- packageVersion: "26.32.0",
21
+ packageVersion: "26.33.0",
22
22
  componentName: 'linkUrl'
23
23
  };
24
24
  var Link = (0, _click.withLinkClickedEvent)('a');
@@ -23,6 +23,8 @@ var _messages = require("../../../messages");
23
23
  var _reactIntlNext = require("react-intl-next");
24
24
  var _styled = require("../styled");
25
25
  var _withFrameStyleControl = _interopRequireDefault(require("../utils/withFrameStyleControl"));
26
+ var _HoverCard = require("../../HoverCard");
27
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
26
28
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
27
29
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
28
30
  var InlineCardErroredView = exports.InlineCardErroredView = /*#__PURE__*/function (_React$Component) {
@@ -67,7 +69,7 @@ var InlineCardErroredView = exports.InlineCardErroredView = /*#__PURE__*/functio
67
69
  testId = _this$props$testId === void 0 ? 'inline-card-errored-view' : _this$props$testId,
68
70
  icon = _this$props.icon,
69
71
  message = _this$props.message;
70
- return /*#__PURE__*/_react.default.createElement(_Frame.Frame, {
72
+ var content = /*#__PURE__*/_react.default.createElement(_Frame.Frame, {
71
73
  testId: testId,
72
74
  isSelected: isSelected,
73
75
  ref: this.frameRef
@@ -83,6 +85,12 @@ var InlineCardErroredView = exports.InlineCardErroredView = /*#__PURE__*/functio
83
85
  onClick: onClick,
84
86
  rightSide: message
85
87
  }), this.renderActionButton());
88
+ if (this.props.showHoverPreview && (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.cross-join')) {
89
+ return /*#__PURE__*/_react.default.createElement(_HoverCard.HoverCard, {
90
+ url: url
91
+ }, content);
92
+ }
93
+ return content;
86
94
  }
87
95
  }]);
88
96
  return InlineCardErroredView;
@@ -26,6 +26,8 @@ var _styled = require("../styled");
26
26
  var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
27
27
  var _styled2 = require("../IconAndTitleLayout/styled");
28
28
  var _withFrameStyleControl = _interopRequireDefault(require("../utils/withFrameStyleControl"));
29
+ var _HoverCard = require("../../HoverCard");
30
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
29
31
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
30
32
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
31
33
  var FallbackForbiddenIcon = /*#__PURE__*/_react.default.createElement(_Icon.AKIconWrapper, null, /*#__PURE__*/_react.default.createElement(_lockFilled.default, {
@@ -111,7 +113,7 @@ var InlineCardForbiddenView = exports.InlineCardForbiddenView = /*#__PURE__*/fun
111
113
  isSelected = _this$props4.isSelected,
112
114
  _this$props4$testId = _this$props4.testId,
113
115
  testId = _this$props4$testId === void 0 ? 'inline-card-forbidden-view' : _this$props4$testId;
114
- return /*#__PURE__*/_react.default.createElement(_Frame.Frame, {
116
+ var content = /*#__PURE__*/_react.default.createElement(_Frame.Frame, {
115
117
  testId: testId,
116
118
  isSelected: isSelected,
117
119
  ref: this.frameRef
@@ -122,6 +124,12 @@ var InlineCardForbiddenView = exports.InlineCardForbiddenView = /*#__PURE__*/fun
122
124
  onClick: onClick,
123
125
  titleColor: "var(--ds-text-subtle, ".concat(_colors.N500, ")")
124
126
  }), this.renderActionButton());
127
+ if (this.props.showHoverPreview && (0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.cross-join')) {
128
+ return /*#__PURE__*/_react.default.createElement(_HoverCard.HoverCard, {
129
+ url: url
130
+ }, content);
131
+ }
132
+ return content;
125
133
  }
126
134
  }]);
127
135
  return InlineCardForbiddenView;
@@ -145,7 +145,8 @@ var InlineCard = exports.InlineCard = function InlineCard(_ref) {
145
145
  onClick: handleFrameClick,
146
146
  onAuthorise: handleAuthorize,
147
147
  testId: testIdWithStatus,
148
- requestAccessContext: requestAccessContext
148
+ requestAccessContext: requestAccessContext,
149
+ showHoverPreview: showHoverPreview
149
150
  });
150
151
  case 'not_found':
151
152
  if (onError) {
@@ -161,7 +162,8 @@ var InlineCard = exports.InlineCard = function InlineCard(_ref) {
161
162
  isSelected: isSelected,
162
163
  message: "Can't find link",
163
164
  onClick: handleFrameClick,
164
- testId: testIdWithStatus || 'inline-card-not-found-view'
165
+ testId: testIdWithStatus || 'inline-card-not-found-view',
166
+ showHoverPreview: showHoverPreview
165
167
  });
166
168
  case 'fallback':
167
169
  case 'errored':
@@ -80,7 +80,8 @@ export const extractRequestAccessContextImproved = ({
80
80
  titleMessageKey: 'request_access_pending_title_crossjoin',
81
81
  descriptiveMessageKey: 'request_access_pending_description_crossjoin',
82
82
  callToActionMessageKey: 'request_access_pending_crossjoin',
83
- action: ForbiddenAction(() => window.open(url), 'request_access_pending', messages.request_access_pending_crossjoin)
83
+ action: ForbiddenAction(() => window.open(url), 'request_access_pending', messages.request_access_pending_crossjoin),
84
+ buttonDisabled: true
84
85
  };
85
86
  case 'DENIED_REQUEST_EXISTS':
86
87
  return {
@@ -4,7 +4,7 @@ export const ANALYTICS_CHANNEL = 'media';
4
4
  export const context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card",
7
- packageVersion: "26.32.0"
7
+ packageVersion: "26.33.0"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -144,7 +144,7 @@ const HoverCardContent = ({
144
144
  });
145
145
  }
146
146
  if (getBooleanFF('platform.linking-platform.smart-card.cross-join')) {
147
- if (cardState.status === 'forbidden') {
147
+ if (cardState.status === 'forbidden' || cardState.status === 'not_found') {
148
148
  return jsx(HoverCardForbiddenView, {
149
149
  flexibleCardProps: flexibleCardProps
150
150
  });
@@ -1,20 +1,19 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { useMemo } from 'react';
2
+ import React from 'react';
3
3
  import { FormattedMessage } from 'react-intl-next';
4
4
  import FlexibleCard from '../../../../FlexibleCard';
5
5
  import { messages } from '../../../../../messages';
6
6
  import { CustomBlock, PreviewBlock } from '../../../../FlexibleCard/components/blocks';
7
+ import Button from '@atlaskit/button';
7
8
  import { extractProvider } from '@atlaskit/link-extractors';
8
9
  import { connectButtonStyles, mainTextStyles, titleBlockStyles } from './styled';
9
- import ActionGroup from '../../../../FlexibleCard/components/blocks/action-group';
10
- import { ActionName } from '../../../../../constants';
11
10
  import { getPreviewBlockStyles } from '../../../styled';
12
11
  import { extractRequestAccessContextImproved } from '../../../../../extractors/common/context/extractAccessContext';
13
12
  const HoverCardForbiddenView = ({
14
13
  flexibleCardProps,
15
14
  testId = 'hover-card-forbidden-view'
16
15
  }) => {
17
- var _cardState$details, _cardState$details2, _extractProvider$text, _extractProvider;
16
+ var _cardState$details, _cardState$details2, _extractProvider$text, _extractProvider, _extractRequestAccess;
18
17
  const {
19
18
  cardState,
20
19
  url
@@ -22,21 +21,17 @@ const HoverCardForbiddenView = ({
22
21
  const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
23
22
  const meta = (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.meta;
24
23
  const product = (_extractProvider$text = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text) !== null && _extractProvider$text !== void 0 ? _extractProvider$text : '';
25
- const hostname = new URL(url).hostname;
24
+ const hostname = /*#__PURE__*/React.createElement("b", null, new URL(url).hostname);
26
25
  const {
27
26
  action,
28
27
  descriptiveMessageKey,
29
- titleMessageKey
30
- } = extractRequestAccessContextImproved({
28
+ titleMessageKey,
29
+ buttonDisabled
30
+ } = (_extractRequestAccess = extractRequestAccessContextImproved({
31
31
  jsonLd: meta,
32
32
  url,
33
33
  product
34
- });
35
- const actions = useMemo(() => [{
36
- name: ActionName.CustomAction,
37
- content: action === null || action === void 0 ? void 0 : action.text,
38
- onClick: action === null || action === void 0 ? void 0 : action.promise
39
- }], [action]);
34
+ })) !== null && _extractRequestAccess !== void 0 ? _extractRequestAccess : {};
40
35
  if (!titleMessageKey || !descriptiveMessageKey) {
41
36
  return null;
42
37
  }
@@ -64,9 +59,10 @@ const HoverCardForbiddenView = ({
64
59
  }))), action && /*#__PURE__*/React.createElement(CustomBlock, {
65
60
  overrideCss: connectButtonStyles,
66
61
  testId: `${testId}-button`
67
- }, /*#__PURE__*/React.createElement(ActionGroup, {
68
- items: actions,
69
- appearance: "primary"
70
- })));
62
+ }, /*#__PURE__*/React.createElement(Button, {
63
+ onClick: action === null || action === void 0 ? void 0 : action.promise,
64
+ appearance: "primary",
65
+ isDisabled: buttonDisabled
66
+ }, action === null || action === void 0 ? void 0 : action.text)));
71
67
  };
72
68
  export default HoverCardForbiddenView;
@@ -6,6 +6,7 @@ export const titleBlockStyles = css`
6
6
  font-weight: ${titleFontWeight};
7
7
  `;
8
8
  export const mainTextStyles = css`
9
+ display: inline;
9
10
  justify-content: center;
10
11
  margin-top: ${blockGap};
11
12
  font-size: 0.75rem;
@@ -8,7 +8,7 @@ import LinkWarningModal from './LinkWarningModal';
8
8
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
9
  const PACKAGE_DATA = {
10
10
  packageName: "@atlaskit/smart-card",
11
- packageVersion: "26.32.0",
11
+ packageVersion: "26.33.0",
12
12
  componentName: 'linkUrl'
13
13
  };
14
14
  const Link = withLinkClickedEvent('a');
@@ -10,6 +10,8 @@ import { messages } from '../../../messages';
10
10
  import { FormattedMessage } from 'react-intl-next';
11
11
  import { IconStyledButton } from '../styled';
12
12
  import withFrameStyleControl from '../utils/withFrameStyleControl';
13
+ import { HoverCard } from '../../HoverCard';
14
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
13
15
  export class InlineCardErroredView extends React.Component {
14
16
  constructor(...args) {
15
17
  super(...args);
@@ -46,7 +48,7 @@ export class InlineCardErroredView extends React.Component {
46
48
  icon,
47
49
  message
48
50
  } = this.props;
49
- return /*#__PURE__*/React.createElement(Frame, {
51
+ const content = /*#__PURE__*/React.createElement(Frame, {
50
52
  testId: testId,
51
53
  isSelected: isSelected,
52
54
  ref: this.frameRef
@@ -62,5 +64,11 @@ export class InlineCardErroredView extends React.Component {
62
64
  onClick: onClick,
63
65
  rightSide: message
64
66
  }), this.renderActionButton());
67
+ if (this.props.showHoverPreview && getBooleanFF('platform.linking-platform.smart-card.cross-join')) {
68
+ return /*#__PURE__*/React.createElement(HoverCard, {
69
+ url: url
70
+ }, content);
71
+ }
72
+ return content;
65
73
  }
66
74
  }
@@ -13,6 +13,8 @@ import { IconStyledButton } from '../styled';
13
13
  import Lozenge from '@atlaskit/lozenge';
14
14
  import { LozengeWrapper } from '../IconAndTitleLayout/styled';
15
15
  import withFrameStyleControl from '../utils/withFrameStyleControl';
16
+ import { HoverCard } from '../../HoverCard';
17
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
16
18
  const FallbackForbiddenIcon = /*#__PURE__*/React.createElement(AKIconWrapper, null, /*#__PURE__*/React.createElement(LockIcon, {
17
19
  label: "error",
18
20
  size: "small",
@@ -92,7 +94,7 @@ export class InlineCardForbiddenView extends React.Component {
92
94
  isSelected,
93
95
  testId = 'inline-card-forbidden-view'
94
96
  } = this.props;
95
- return /*#__PURE__*/React.createElement(Frame, {
97
+ const content = /*#__PURE__*/React.createElement(Frame, {
96
98
  testId: testId,
97
99
  isSelected: isSelected,
98
100
  ref: this.frameRef
@@ -103,5 +105,11 @@ export class InlineCardForbiddenView extends React.Component {
103
105
  onClick: onClick,
104
106
  titleColor: `var(--ds-text-subtle, ${N500})`
105
107
  }), this.renderActionButton());
108
+ if (this.props.showHoverPreview && getBooleanFF('platform.linking-platform.smart-card.cross-join')) {
109
+ return /*#__PURE__*/React.createElement(HoverCard, {
110
+ url: url
111
+ }, content);
112
+ }
113
+ return content;
106
114
  }
107
115
  }
@@ -112,7 +112,8 @@ export const InlineCard = ({
112
112
  onClick: handleFrameClick,
113
113
  onAuthorise: handleAuthorize,
114
114
  testId: testIdWithStatus,
115
- requestAccessContext: requestAccessContext
115
+ requestAccessContext: requestAccessContext,
116
+ showHoverPreview: showHoverPreview
116
117
  });
117
118
  case 'not_found':
118
119
  if (onError) {
@@ -128,7 +129,8 @@ export const InlineCard = ({
128
129
  isSelected: isSelected,
129
130
  message: "Can't find link",
130
131
  onClick: handleFrameClick,
131
- testId: testIdWithStatus || 'inline-card-not-found-view'
132
+ testId: testIdWithStatus || 'inline-card-not-found-view',
133
+ showHoverPreview: showHoverPreview
132
134
  });
133
135
  case 'fallback':
134
136
  case 'errored':
@@ -82,7 +82,8 @@ export var extractRequestAccessContextImproved = function extractRequestAccessCo
82
82
  callToActionMessageKey: 'request_access_pending_crossjoin',
83
83
  action: ForbiddenAction(function () {
84
84
  return window.open(url);
85
- }, 'request_access_pending', messages.request_access_pending_crossjoin)
85
+ }, 'request_access_pending', messages.request_access_pending_crossjoin),
86
+ buttonDisabled: true
86
87
  });
87
88
  case 'DENIED_REQUEST_EXISTS':
88
89
  return _objectSpread(_objectSpread({}, requestAccess), {}, {
@@ -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.32.0"
18
+ packageVersion: "26.33.0"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -172,7 +172,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
172
172
  });
173
173
  }
174
174
  if (getBooleanFF('platform.linking-platform.smart-card.cross-join')) {
175
- if (cardState.status === 'forbidden') {
175
+ if (cardState.status === 'forbidden' || cardState.status === 'not_found') {
176
176
  return jsx(HoverCardForbiddenView, {
177
177
  flexibleCardProps: flexibleCardProps
178
178
  });
@@ -1,17 +1,16 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { useMemo } from 'react';
2
+ import React from 'react';
3
3
  import { FormattedMessage } from 'react-intl-next';
4
4
  import FlexibleCard from '../../../../FlexibleCard';
5
5
  import { messages } from '../../../../../messages';
6
6
  import { CustomBlock, PreviewBlock } from '../../../../FlexibleCard/components/blocks';
7
+ import Button from '@atlaskit/button';
7
8
  import { extractProvider } from '@atlaskit/link-extractors';
8
9
  import { connectButtonStyles, mainTextStyles, titleBlockStyles } from './styled';
9
- import ActionGroup from '../../../../FlexibleCard/components/blocks/action-group';
10
- import { ActionName } from '../../../../../constants';
11
10
  import { getPreviewBlockStyles } from '../../../styled';
12
11
  import { extractRequestAccessContextImproved } from '../../../../../extractors/common/context/extractAccessContext';
13
12
  var HoverCardForbiddenView = function HoverCardForbiddenView(_ref) {
14
- var _cardState$details, _cardState$details2, _extractProvider$text, _extractProvider;
13
+ var _cardState$details, _cardState$details2, _extractProvider$text, _extractProvider, _extractRequestAccess;
15
14
  var flexibleCardProps = _ref.flexibleCardProps,
16
15
  _ref$testId = _ref.testId,
17
16
  testId = _ref$testId === void 0 ? 'hover-card-forbidden-view' : _ref$testId;
@@ -20,22 +19,16 @@ var HoverCardForbiddenView = function HoverCardForbiddenView(_ref) {
20
19
  var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
21
20
  var meta = (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.meta;
22
21
  var product = (_extractProvider$text = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text) !== null && _extractProvider$text !== void 0 ? _extractProvider$text : '';
23
- var hostname = new URL(url).hostname;
24
- var _extractRequestAccess = extractRequestAccessContextImproved({
22
+ var hostname = /*#__PURE__*/React.createElement("b", null, new URL(url).hostname);
23
+ var _ref2 = (_extractRequestAccess = extractRequestAccessContextImproved({
25
24
  jsonLd: meta,
26
25
  url: url,
27
26
  product: product
28
- }),
29
- action = _extractRequestAccess.action,
30
- descriptiveMessageKey = _extractRequestAccess.descriptiveMessageKey,
31
- titleMessageKey = _extractRequestAccess.titleMessageKey;
32
- var actions = useMemo(function () {
33
- return [{
34
- name: ActionName.CustomAction,
35
- content: action === null || action === void 0 ? void 0 : action.text,
36
- onClick: action === null || action === void 0 ? void 0 : action.promise
37
- }];
38
- }, [action]);
27
+ })) !== null && _extractRequestAccess !== void 0 ? _extractRequestAccess : {},
28
+ action = _ref2.action,
29
+ descriptiveMessageKey = _ref2.descriptiveMessageKey,
30
+ titleMessageKey = _ref2.titleMessageKey,
31
+ buttonDisabled = _ref2.buttonDisabled;
39
32
  if (!titleMessageKey || !descriptiveMessageKey) {
40
33
  return null;
41
34
  }
@@ -63,9 +56,10 @@ var HoverCardForbiddenView = function HoverCardForbiddenView(_ref) {
63
56
  }))), action && /*#__PURE__*/React.createElement(CustomBlock, {
64
57
  overrideCss: connectButtonStyles,
65
58
  testId: "".concat(testId, "-button")
66
- }, /*#__PURE__*/React.createElement(ActionGroup, {
67
- items: actions,
68
- appearance: "primary"
69
- })));
59
+ }, /*#__PURE__*/React.createElement(Button, {
60
+ onClick: action === null || action === void 0 ? void 0 : action.promise,
61
+ appearance: "primary",
62
+ isDisabled: buttonDisabled
63
+ }, action === null || action === void 0 ? void 0 : action.text)));
70
64
  };
71
65
  export default HoverCardForbiddenView;
@@ -4,5 +4,5 @@ import { css } from '@emotion/react';
4
4
  var blockGap = '0rem';
5
5
  var titleFontWeight = '600';
6
6
  export var titleBlockStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n justify-content: center;\n font-weight: ", ";\n"])), titleFontWeight);
7
- export var mainTextStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n justify-content: center;\n margin-top: ", ";\n font-size: 0.75rem;\n text-align: center;\n"])), blockGap);
7
+ export var mainTextStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: inline;\n justify-content: center;\n margin-top: ", ";\n font-size: 0.75rem;\n text-align: center;\n"])), blockGap);
8
8
  export var connectButtonStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n justify-content: center;\n margin-top: ", ";\n"])), blockGap);
@@ -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.32.0",
14
+ packageVersion: "26.33.0",
15
15
  componentName: 'linkUrl'
16
16
  };
17
17
  var Link = withLinkClickedEvent('a');
@@ -18,6 +18,8 @@ import { messages } from '../../../messages';
18
18
  import { FormattedMessage } from 'react-intl-next';
19
19
  import { IconStyledButton } from '../styled';
20
20
  import withFrameStyleControl from '../utils/withFrameStyleControl';
21
+ import { HoverCard } from '../../HoverCard';
22
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
21
23
  export var InlineCardErroredView = /*#__PURE__*/function (_React$Component) {
22
24
  _inherits(InlineCardErroredView, _React$Component);
23
25
  var _super = _createSuper(InlineCardErroredView);
@@ -60,7 +62,7 @@ export var InlineCardErroredView = /*#__PURE__*/function (_React$Component) {
60
62
  testId = _this$props$testId === void 0 ? 'inline-card-errored-view' : _this$props$testId,
61
63
  icon = _this$props.icon,
62
64
  message = _this$props.message;
63
- return /*#__PURE__*/React.createElement(Frame, {
65
+ var content = /*#__PURE__*/React.createElement(Frame, {
64
66
  testId: testId,
65
67
  isSelected: isSelected,
66
68
  ref: this.frameRef
@@ -76,6 +78,12 @@ export var InlineCardErroredView = /*#__PURE__*/function (_React$Component) {
76
78
  onClick: onClick,
77
79
  rightSide: message
78
80
  }), this.renderActionButton());
81
+ if (this.props.showHoverPreview && getBooleanFF('platform.linking-platform.smart-card.cross-join')) {
82
+ return /*#__PURE__*/React.createElement(HoverCard, {
83
+ url: url
84
+ }, content);
85
+ }
86
+ return content;
79
87
  }
80
88
  }]);
81
89
  return InlineCardErroredView;
@@ -21,6 +21,8 @@ import { IconStyledButton } from '../styled';
21
21
  import Lozenge from '@atlaskit/lozenge';
22
22
  import { LozengeWrapper } from '../IconAndTitleLayout/styled';
23
23
  import withFrameStyleControl from '../utils/withFrameStyleControl';
24
+ import { HoverCard } from '../../HoverCard';
25
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
24
26
  var FallbackForbiddenIcon = /*#__PURE__*/React.createElement(AKIconWrapper, null, /*#__PURE__*/React.createElement(LockIcon, {
25
27
  label: "error",
26
28
  size: "small",
@@ -104,7 +106,7 @@ export var InlineCardForbiddenView = /*#__PURE__*/function (_React$Component) {
104
106
  isSelected = _this$props4.isSelected,
105
107
  _this$props4$testId = _this$props4.testId,
106
108
  testId = _this$props4$testId === void 0 ? 'inline-card-forbidden-view' : _this$props4$testId;
107
- return /*#__PURE__*/React.createElement(Frame, {
109
+ var content = /*#__PURE__*/React.createElement(Frame, {
108
110
  testId: testId,
109
111
  isSelected: isSelected,
110
112
  ref: this.frameRef
@@ -115,6 +117,12 @@ export var InlineCardForbiddenView = /*#__PURE__*/function (_React$Component) {
115
117
  onClick: onClick,
116
118
  titleColor: "var(--ds-text-subtle, ".concat(N500, ")")
117
119
  }), this.renderActionButton());
120
+ if (this.props.showHoverPreview && getBooleanFF('platform.linking-platform.smart-card.cross-join')) {
121
+ return /*#__PURE__*/React.createElement(HoverCard, {
122
+ url: url
123
+ }, content);
124
+ }
125
+ return content;
118
126
  }
119
127
  }]);
120
128
  return InlineCardForbiddenView;
@@ -109,7 +109,8 @@ export var InlineCard = function InlineCard(_ref) {
109
109
  onClick: handleFrameClick,
110
110
  onAuthorise: handleAuthorize,
111
111
  testId: testIdWithStatus,
112
- requestAccessContext: requestAccessContext
112
+ requestAccessContext: requestAccessContext,
113
+ showHoverPreview: showHoverPreview
113
114
  });
114
115
  case 'not_found':
115
116
  if (onError) {
@@ -125,7 +126,8 @@ export var InlineCard = function InlineCard(_ref) {
125
126
  isSelected: isSelected,
126
127
  message: "Can't find link",
127
128
  onClick: handleFrameClick,
128
- testId: testIdWithStatus || 'inline-card-not-found-view'
129
+ testId: testIdWithStatus || 'inline-card-not-found-view',
130
+ showHoverPreview: showHoverPreview
129
131
  });
130
132
  case 'fallback':
131
133
  case 'errored':
@@ -13,6 +13,8 @@ export interface InlineCardErroredViewProps {
13
13
  /** A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests */
14
14
  testId?: string;
15
15
  icon?: React.ReactNode;
16
+ /** Enables showing a custom preview on hover of link */
17
+ showHoverPreview?: boolean;
16
18
  }
17
19
  export declare class InlineCardErroredView extends React.Component<InlineCardErroredViewProps> {
18
20
  private frameRef;
@@ -16,6 +16,8 @@ export interface InlineCardForbiddenViewProps {
16
16
  /** A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests */
17
17
  testId?: string;
18
18
  requestAccessContext?: RequestAccessContextProps;
19
+ /** Enables showing a custom preview on hover of link */
20
+ showHoverPreview?: boolean;
19
21
  }
20
22
  export declare class InlineCardForbiddenView extends React.Component<InlineCardForbiddenViewProps> {
21
23
  private frameRef;
@@ -22,6 +22,7 @@ export interface RequestAccessContextProps extends AccessContext {
22
22
  descriptiveMessageKey?: RequestAccessMessageKey;
23
23
  titleMessageKey?: RequestAccessMessageKey;
24
24
  hostname?: string;
25
+ buttonDisabled?: boolean;
25
26
  }
26
27
  export type InlinePreloaderStyle = 'on-left-with-skeleton' | 'on-right-without-skeleton';
27
28
  export type ErrorCardType = 'errored' | 'fallback' | 'forbidden' | 'not_found' | 'unauthorized';
@@ -13,6 +13,8 @@ export interface InlineCardErroredViewProps {
13
13
  /** A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests */
14
14
  testId?: string;
15
15
  icon?: React.ReactNode;
16
+ /** Enables showing a custom preview on hover of link */
17
+ showHoverPreview?: boolean;
16
18
  }
17
19
  export declare class InlineCardErroredView extends React.Component<InlineCardErroredViewProps> {
18
20
  private frameRef;
@@ -16,6 +16,8 @@ export interface InlineCardForbiddenViewProps {
16
16
  /** A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests */
17
17
  testId?: string;
18
18
  requestAccessContext?: RequestAccessContextProps;
19
+ /** Enables showing a custom preview on hover of link */
20
+ showHoverPreview?: boolean;
19
21
  }
20
22
  export declare class InlineCardForbiddenView extends React.Component<InlineCardForbiddenViewProps> {
21
23
  private frameRef;
@@ -22,6 +22,7 @@ export interface RequestAccessContextProps extends AccessContext {
22
22
  descriptiveMessageKey?: RequestAccessMessageKey;
23
23
  titleMessageKey?: RequestAccessMessageKey;
24
24
  hostname?: string;
25
+ buttonDisabled?: boolean;
25
26
  }
26
27
  export type InlinePreloaderStyle = 'on-left-with-skeleton' | 'on-right-without-skeleton';
27
28
  export type ErrorCardType = 'errored' | 'fallback' | 'forbidden' | 'not_found' | 'unauthorized';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.32.0",
3
+ "version": "26.33.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"