@atlaskit/smart-card 26.13.0 → 26.13.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 26.13.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`72d087f0de3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/72d087f0de3) - [ux] Update smart link unauthorised view when there is no auth flow available
8
+
3
9
  ## 26.13.0
4
10
 
5
11
  ### Minor Changes
@@ -92,7 +92,7 @@ var messages = (0, _reactIntlNext.defineMessages)({
92
92
  description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view.'
93
93
  },
94
94
  connect_unauthorised_account_description_no_provider: {
95
- id: 'fabric.linking.connect_unauthorised_account_description',
95
+ id: 'fabric.linking.connect_unauthorised_account_description_no_provider',
96
96
  defaultMessage: 'Connect to Atlassian to view more details of your work and collaborate from one place.',
97
97
  description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view and we do not have the providers name.'
98
98
  },
@@ -392,6 +392,26 @@ var messages = (0, _reactIntlNext.defineMessages)({
392
392
  defaultMessage: 'The link {unsafeLinkText} is taking you to a different site, <a>actual link here</a>',
393
393
  description: 'Link safety check warning message'
394
394
  },
395
+ unauthorised_account_description: {
396
+ id: 'fabric.linking.unauthorised_account_description',
397
+ defaultMessage: "You're trying to preview a link to a private {context} page. We recommend you review the URL or contact the page owner.",
398
+ description: 'Explains that user does not have access to a link.'
399
+ },
400
+ unauthorised_account_description_no_provider: {
401
+ id: 'fabric.linking.unauthorised_account_description_no_provider',
402
+ defaultMessage: "You're trying to preview a link to a private page. We recommend you review the URL or contact the page owner.",
403
+ description: 'Explains that user does not have access to a link.'
404
+ },
405
+ unauthorised_account_name: {
406
+ id: 'fabric.linking.unauthorised_account_name',
407
+ defaultMessage: "We can't display private pages from {context}",
408
+ description: 'Shown when a user does not have access to a link.'
409
+ },
410
+ unauthorised_account_name_no_provider: {
411
+ id: 'fabric.linking.unauthorised_account_name_no_provider',
412
+ defaultMessage: "We can't display private pages",
413
+ description: 'Shown when a user does not have access to a link.'
414
+ },
395
415
  unlink_account: {
396
416
  id: 'fabric.linking.unlink_account',
397
417
  defaultMessage: 'Unlink Account',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.13.0",
3
+ "version": "26.13.1",
4
4
  "sideEffects": false
5
5
  }
@@ -6,8 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
10
11
  var _react = _interopRequireWildcard(require("react"));
12
+ var _reactIntlNext = require("react-intl-next");
11
13
  var _FlexibleCard = _interopRequireDefault(require("../../../FlexibleCard"));
12
14
  var _AuthorizeAction = require("../../actions/flexible/AuthorizeAction");
13
15
  var _footer = _interopRequireDefault(require("../../components/flexible/footer"));
@@ -17,6 +19,7 @@ var _linkExtractors = require("@atlaskit/link-extractors");
17
19
  var _UnauthorisedViewContent = _interopRequireDefault(require("../../../common/UnauthorisedViewContent"));
18
20
  var _react2 = require("@emotion/react");
19
21
  var _token = require("../../../../utils/token");
22
+ var _messages = require("../../../../messages");
20
23
  var _templateObject;
21
24
  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
25
  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; }
@@ -53,6 +56,17 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
53
56
  onAuthorize();
54
57
  }
55
58
  }, [onAuthorize, extensionKey, analytics.track]);
59
+ var content = (0, _react.useMemo)(function () {
60
+ return onAuthorize ? /*#__PURE__*/_react.default.createElement(_UnauthorisedViewContent.default, {
61
+ providerName: providerName,
62
+ analytics: analytics,
63
+ testId: testId
64
+ }) : /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.messages[providerName ? 'unauthorised_account_description' : 'unauthorised_account_description_no_provider'], {
65
+ values: {
66
+ context: providerName
67
+ }
68
+ }));
69
+ }, [analytics, onAuthorize, providerName, testId]);
56
70
  var actions = (0, _react.useMemo)(function () {
57
71
  return onAuthorize ? [(0, _AuthorizeAction.AuthorizeAction)(handleAuthorize, providerName)] : [];
58
72
  }, [handleAuthorize, onAuthorize, providerName]);
@@ -71,11 +85,7 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
71
85
  }), /*#__PURE__*/_react.default.createElement(_blocks.CustomBlock, {
72
86
  overrideCss: contentStyles,
73
87
  testId: "".concat(testId, "-content")
74
- }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_UnauthorisedViewContent.default, {
75
- providerName: providerName,
76
- analytics: analytics,
77
- testId: testId
78
- }))), /*#__PURE__*/_react.default.createElement(_blocks.CustomBlock, null, /*#__PURE__*/_react.default.createElement(_footer.default, {
88
+ }, /*#__PURE__*/_react.default.createElement("div", null, content)), /*#__PURE__*/_react.default.createElement(_blocks.CustomBlock, null, /*#__PURE__*/_react.default.createElement(_footer.default, {
79
89
  actions: actions,
80
90
  status: _constants.SmartLinkStatus.Unauthorized,
81
91
  actionGroupAppearance: "primary"
@@ -15,7 +15,6 @@ var _UnauthorisedViewContent = _interopRequireDefault(require("../../common/Unau
15
15
  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); }
16
16
  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; }
17
17
  var EmbedCardUnauthorisedView = function EmbedCardUnauthorisedView(_ref) {
18
- var _context$image;
19
18
  var analytics = _ref.analytics,
20
19
  link = _ref.link,
21
20
  context = _ref.context,
@@ -37,6 +36,36 @@ var EmbedCardUnauthorisedView = function EmbedCardUnauthorisedView(_ref) {
37
36
  onAuthorise();
38
37
  }
39
38
  }, [onAuthorise, analytics.track, extensionKey]);
39
+ var view = (0, _react.useMemo)(function () {
40
+ var _context$image2;
41
+ if (onAuthorise) {
42
+ var _context$image;
43
+ return /*#__PURE__*/_react.default.createElement(_UnresolvedView.EmbedCardUnresolvedView, {
44
+ button: {
45
+ appearance: 'primary',
46
+ text: 'connect_unauthorised_account_action',
47
+ testId: 'connect-account'
48
+ },
49
+ context: context && context.text,
50
+ description: "connect_unauthorised_account_description",
51
+ image: (_context$image = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image !== void 0 ? _context$image : _constants.UnauthorisedImage,
52
+ onClick: handleOnAuthorizeClick,
53
+ testId: testId,
54
+ title: "connect_link_account_card_name"
55
+ }, /*#__PURE__*/_react.default.createElement(_UnauthorisedViewContent.default, {
56
+ analytics: analytics,
57
+ providerName: context === null || context === void 0 ? void 0 : context.text,
58
+ testId: testId
59
+ }));
60
+ }
61
+ return /*#__PURE__*/_react.default.createElement(_UnresolvedView.EmbedCardUnresolvedView, {
62
+ description: context !== null && context !== void 0 && context.text ? 'unauthorised_account_description' : 'unauthorised_account_description_no_provider',
63
+ image: (_context$image2 = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image2 !== void 0 ? _context$image2 : _constants.LockImage,
64
+ context: context === null || context === void 0 ? void 0 : context.text,
65
+ testId: testId,
66
+ title: context !== null && context !== void 0 && context.text ? 'unauthorised_account_name' : 'unauthorised_account_name_no_provider'
67
+ });
68
+ }, [analytics, context, handleOnAuthorizeClick, onAuthorise, testId]);
40
69
  return /*#__PURE__*/_react.default.createElement(_ExpandedFrame.ExpandedFrame, {
41
70
  href: link,
42
71
  icon: icon,
@@ -47,22 +76,6 @@ var EmbedCardUnauthorisedView = function EmbedCardUnauthorisedView(_ref) {
47
76
  onClick: onClick,
48
77
  testId: testId,
49
78
  allowScrollBar: true
50
- }, /*#__PURE__*/_react.default.createElement(_UnresolvedView.EmbedCardUnresolvedView, {
51
- image: (_context$image = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image !== void 0 ? _context$image : _constants.UnauthorisedImage,
52
- title: "connect_link_account_card_name",
53
- description: "connect_unauthorised_account_description",
54
- context: context && context.text,
55
- button: onAuthorise ? {
56
- appearance: 'primary',
57
- text: 'connect_unauthorised_account_action',
58
- testId: 'connect-account'
59
- } : undefined,
60
- onClick: onAuthorise ? handleOnAuthorizeClick : undefined,
61
- testId: testId
62
- }, /*#__PURE__*/_react.default.createElement(_UnauthorisedViewContent.default, {
63
- analytics: analytics,
64
- providerName: context === null || context === void 0 ? void 0 : context.text,
65
- testId: testId
66
- })));
79
+ }, view);
67
80
  };
68
81
  exports.EmbedCardUnauthorisedView = EmbedCardUnauthorisedView;
@@ -86,7 +86,7 @@ export const messages = defineMessages({
86
86
  description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view.'
87
87
  },
88
88
  connect_unauthorised_account_description_no_provider: {
89
- id: 'fabric.linking.connect_unauthorised_account_description',
89
+ id: 'fabric.linking.connect_unauthorised_account_description_no_provider',
90
90
  defaultMessage: 'Connect to Atlassian to view more details of your work and collaborate from one place.',
91
91
  description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view and we do not have the providers name.'
92
92
  },
@@ -386,6 +386,26 @@ export const messages = defineMessages({
386
386
  defaultMessage: 'The link {unsafeLinkText} is taking you to a different site, <a>actual link here</a>',
387
387
  description: 'Link safety check warning message'
388
388
  },
389
+ unauthorised_account_description: {
390
+ id: 'fabric.linking.unauthorised_account_description',
391
+ defaultMessage: "You're trying to preview a link to a private {context} page. We recommend you review the URL or contact the page owner.",
392
+ description: 'Explains that user does not have access to a link.'
393
+ },
394
+ unauthorised_account_description_no_provider: {
395
+ id: 'fabric.linking.unauthorised_account_description_no_provider',
396
+ defaultMessage: "You're trying to preview a link to a private page. We recommend you review the URL or contact the page owner.",
397
+ description: 'Explains that user does not have access to a link.'
398
+ },
399
+ unauthorised_account_name: {
400
+ id: 'fabric.linking.unauthorised_account_name',
401
+ defaultMessage: "We can't display private pages from {context}",
402
+ description: 'Shown when a user does not have access to a link.'
403
+ },
404
+ unauthorised_account_name_no_provider: {
405
+ id: 'fabric.linking.unauthorised_account_name_no_provider',
406
+ defaultMessage: "We can't display private pages",
407
+ description: 'Shown when a user does not have access to a link.'
408
+ },
389
409
  unlink_account: {
390
410
  id: 'fabric.linking.unlink_account',
391
411
  defaultMessage: 'Unlink Account',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.13.0",
3
+ "version": "26.13.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,6 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import React, { useCallback, useMemo } from 'react';
3
+ import { FormattedMessage } from 'react-intl-next';
2
4
  import FlexibleCard from '../../../FlexibleCard';
3
5
  import { AuthorizeAction } from '../../actions/flexible/AuthorizeAction';
4
6
  import BlockCardFooter from '../../components/flexible/footer';
@@ -8,6 +10,7 @@ import { extractProvider } from '@atlaskit/link-extractors';
8
10
  import UnauthorisedViewContent from '../../../common/UnauthorisedViewContent';
9
11
  import { css } from '@emotion/react';
10
12
  import { tokens } from '../../../../utils/token';
13
+ import { messages } from '../../../../messages';
11
14
  const contentStyles = css`
12
15
  color: ${tokens.text};
13
16
  margin-top: 0.5rem;
@@ -44,6 +47,15 @@ const FlexibleUnauthorisedView = ({
44
47
  onAuthorize();
45
48
  }
46
49
  }, [onAuthorize, extensionKey, analytics.track]);
50
+ const content = useMemo(() => onAuthorize ? /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
51
+ providerName: providerName,
52
+ analytics: analytics,
53
+ testId: testId
54
+ }) : /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[providerName ? 'unauthorised_account_description' : 'unauthorised_account_description_no_provider'], {
55
+ values: {
56
+ context: providerName
57
+ }
58
+ })), [analytics, onAuthorize, providerName, testId]);
47
59
  const actions = useMemo(() => onAuthorize ? [AuthorizeAction(handleAuthorize, providerName)] : [], [handleAuthorize, onAuthorize, providerName]);
48
60
  return /*#__PURE__*/React.createElement(FlexibleCard, {
49
61
  appearance: "block",
@@ -60,11 +72,7 @@ const FlexibleUnauthorisedView = ({
60
72
  }), /*#__PURE__*/React.createElement(CustomBlock, {
61
73
  overrideCss: contentStyles,
62
74
  testId: `${testId}-content`
63
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
64
- providerName: providerName,
65
- analytics: analytics,
66
- testId: testId
67
- }))), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
75
+ }, /*#__PURE__*/React.createElement("div", null, content)), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
68
76
  actions: actions,
69
77
  status: SmartLinkStatus.Unauthorized,
70
78
  actionGroupAppearance: "primary"
@@ -1,6 +1,6 @@
1
- import React, { useCallback } from 'react';
1
+ import React, { useCallback, useMemo } from 'react';
2
2
  import { EmbedCardUnresolvedView } from './UnresolvedView';
3
- import { UnauthorisedImage } from '../constants';
3
+ import { LockImage, UnauthorisedImage } from '../constants';
4
4
  import { ExpandedFrame } from '../components/ExpandedFrame';
5
5
  import { ImageIcon } from '../components/ImageIcon';
6
6
  import UnauthorisedViewContent from '../../common/UnauthorisedViewContent';
@@ -15,7 +15,6 @@ export const EmbedCardUnauthorisedView = ({
15
15
  onClick,
16
16
  extensionKey
17
17
  }) => {
18
- var _context$image;
19
18
  const icon = context && context.icon && /*#__PURE__*/React.createElement(ImageIcon, {
20
19
  src: typeof context.icon === 'string' ? context.icon : undefined
21
20
  });
@@ -27,6 +26,36 @@ export const EmbedCardUnauthorisedView = ({
27
26
  onAuthorise();
28
27
  }
29
28
  }, [onAuthorise, analytics.track, extensionKey]);
29
+ const view = useMemo(() => {
30
+ var _context$image2;
31
+ if (onAuthorise) {
32
+ var _context$image;
33
+ return /*#__PURE__*/React.createElement(EmbedCardUnresolvedView, {
34
+ button: {
35
+ appearance: 'primary',
36
+ text: 'connect_unauthorised_account_action',
37
+ testId: 'connect-account'
38
+ },
39
+ context: context && context.text,
40
+ description: "connect_unauthorised_account_description",
41
+ image: (_context$image = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image !== void 0 ? _context$image : UnauthorisedImage,
42
+ onClick: handleOnAuthorizeClick,
43
+ testId: testId,
44
+ title: "connect_link_account_card_name"
45
+ }, /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
46
+ analytics: analytics,
47
+ providerName: context === null || context === void 0 ? void 0 : context.text,
48
+ testId: testId
49
+ }));
50
+ }
51
+ return /*#__PURE__*/React.createElement(EmbedCardUnresolvedView, {
52
+ description: context !== null && context !== void 0 && context.text ? 'unauthorised_account_description' : 'unauthorised_account_description_no_provider',
53
+ image: (_context$image2 = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image2 !== void 0 ? _context$image2 : LockImage,
54
+ context: context === null || context === void 0 ? void 0 : context.text,
55
+ testId: testId,
56
+ title: context !== null && context !== void 0 && context.text ? 'unauthorised_account_name' : 'unauthorised_account_name_no_provider'
57
+ });
58
+ }, [analytics, context, handleOnAuthorizeClick, onAuthorise, testId]);
30
59
  return /*#__PURE__*/React.createElement(ExpandedFrame, {
31
60
  href: link,
32
61
  icon: icon,
@@ -37,21 +66,5 @@ export const EmbedCardUnauthorisedView = ({
37
66
  onClick: onClick,
38
67
  testId: testId,
39
68
  allowScrollBar: true
40
- }, /*#__PURE__*/React.createElement(EmbedCardUnresolvedView, {
41
- image: (_context$image = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image !== void 0 ? _context$image : UnauthorisedImage,
42
- title: "connect_link_account_card_name",
43
- description: "connect_unauthorised_account_description",
44
- context: context && context.text,
45
- button: onAuthorise ? {
46
- appearance: 'primary',
47
- text: 'connect_unauthorised_account_action',
48
- testId: 'connect-account'
49
- } : undefined,
50
- onClick: onAuthorise ? handleOnAuthorizeClick : undefined,
51
- testId: testId
52
- }, /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
53
- analytics: analytics,
54
- providerName: context === null || context === void 0 ? void 0 : context.text,
55
- testId: testId
56
- })));
69
+ }, view);
57
70
  };
@@ -86,7 +86,7 @@ export var messages = defineMessages({
86
86
  description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view.'
87
87
  },
88
88
  connect_unauthorised_account_description_no_provider: {
89
- id: 'fabric.linking.connect_unauthorised_account_description',
89
+ id: 'fabric.linking.connect_unauthorised_account_description_no_provider',
90
90
  defaultMessage: 'Connect to Atlassian to view more details of your work and collaborate from one place.',
91
91
  description: 'Shown when a user does not have access to a link, but can connect their external account to view the link on card view and we do not have the providers name.'
92
92
  },
@@ -386,6 +386,26 @@ export var messages = defineMessages({
386
386
  defaultMessage: 'The link {unsafeLinkText} is taking you to a different site, <a>actual link here</a>',
387
387
  description: 'Link safety check warning message'
388
388
  },
389
+ unauthorised_account_description: {
390
+ id: 'fabric.linking.unauthorised_account_description',
391
+ defaultMessage: "You're trying to preview a link to a private {context} page. We recommend you review the URL or contact the page owner.",
392
+ description: 'Explains that user does not have access to a link.'
393
+ },
394
+ unauthorised_account_description_no_provider: {
395
+ id: 'fabric.linking.unauthorised_account_description_no_provider',
396
+ defaultMessage: "You're trying to preview a link to a private page. We recommend you review the URL or contact the page owner.",
397
+ description: 'Explains that user does not have access to a link.'
398
+ },
399
+ unauthorised_account_name: {
400
+ id: 'fabric.linking.unauthorised_account_name',
401
+ defaultMessage: "We can't display private pages from {context}",
402
+ description: 'Shown when a user does not have access to a link.'
403
+ },
404
+ unauthorised_account_name_no_provider: {
405
+ id: 'fabric.linking.unauthorised_account_name_no_provider',
406
+ defaultMessage: "We can't display private pages",
407
+ description: 'Shown when a user does not have access to a link.'
408
+ },
389
409
  unlink_account: {
390
410
  id: 'fabric.linking.unlink_account',
391
411
  defaultMessage: 'Unlink Account',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.13.0",
3
+ "version": "26.13.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,8 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
3
  var _templateObject;
3
4
  import React, { useCallback, useMemo } from 'react';
5
+ import { FormattedMessage } from 'react-intl-next';
4
6
  import FlexibleCard from '../../../FlexibleCard';
5
7
  import { AuthorizeAction } from '../../actions/flexible/AuthorizeAction';
6
8
  import BlockCardFooter from '../../components/flexible/footer';
@@ -10,6 +12,7 @@ import { extractProvider } from '@atlaskit/link-extractors';
10
12
  import UnauthorisedViewContent from '../../../common/UnauthorisedViewContent';
11
13
  import { css } from '@emotion/react';
12
14
  import { tokens } from '../../../../utils/token';
15
+ import { messages } from '../../../../messages';
13
16
  var contentStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n margin-top: 0.5rem;\n font-size: 0.75rem;\n"])), tokens.text);
14
17
 
15
18
  /**
@@ -43,6 +46,17 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
43
46
  onAuthorize();
44
47
  }
45
48
  }, [onAuthorize, extensionKey, analytics.track]);
49
+ var content = useMemo(function () {
50
+ return onAuthorize ? /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
51
+ providerName: providerName,
52
+ analytics: analytics,
53
+ testId: testId
54
+ }) : /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[providerName ? 'unauthorised_account_description' : 'unauthorised_account_description_no_provider'], {
55
+ values: {
56
+ context: providerName
57
+ }
58
+ }));
59
+ }, [analytics, onAuthorize, providerName, testId]);
46
60
  var actions = useMemo(function () {
47
61
  return onAuthorize ? [AuthorizeAction(handleAuthorize, providerName)] : [];
48
62
  }, [handleAuthorize, onAuthorize, providerName]);
@@ -61,11 +75,7 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
61
75
  }), /*#__PURE__*/React.createElement(CustomBlock, {
62
76
  overrideCss: contentStyles,
63
77
  testId: "".concat(testId, "-content")
64
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
65
- providerName: providerName,
66
- analytics: analytics,
67
- testId: testId
68
- }))), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
78
+ }, /*#__PURE__*/React.createElement("div", null, content)), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(BlockCardFooter, {
69
79
  actions: actions,
70
80
  status: SmartLinkStatus.Unauthorized,
71
81
  actionGroupAppearance: "primary"
@@ -1,11 +1,10 @@
1
- import React, { useCallback } from 'react';
1
+ import React, { useCallback, useMemo } from 'react';
2
2
  import { EmbedCardUnresolvedView } from './UnresolvedView';
3
- import { UnauthorisedImage } from '../constants';
3
+ import { LockImage, UnauthorisedImage } from '../constants';
4
4
  import { ExpandedFrame } from '../components/ExpandedFrame';
5
5
  import { ImageIcon } from '../components/ImageIcon';
6
6
  import UnauthorisedViewContent from '../../common/UnauthorisedViewContent';
7
7
  export var EmbedCardUnauthorisedView = function EmbedCardUnauthorisedView(_ref) {
8
- var _context$image;
9
8
  var analytics = _ref.analytics,
10
9
  link = _ref.link,
11
10
  context = _ref.context,
@@ -27,6 +26,36 @@ export var EmbedCardUnauthorisedView = function EmbedCardUnauthorisedView(_ref)
27
26
  onAuthorise();
28
27
  }
29
28
  }, [onAuthorise, analytics.track, extensionKey]);
29
+ var view = useMemo(function () {
30
+ var _context$image2;
31
+ if (onAuthorise) {
32
+ var _context$image;
33
+ return /*#__PURE__*/React.createElement(EmbedCardUnresolvedView, {
34
+ button: {
35
+ appearance: 'primary',
36
+ text: 'connect_unauthorised_account_action',
37
+ testId: 'connect-account'
38
+ },
39
+ context: context && context.text,
40
+ description: "connect_unauthorised_account_description",
41
+ image: (_context$image = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image !== void 0 ? _context$image : UnauthorisedImage,
42
+ onClick: handleOnAuthorizeClick,
43
+ testId: testId,
44
+ title: "connect_link_account_card_name"
45
+ }, /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
46
+ analytics: analytics,
47
+ providerName: context === null || context === void 0 ? void 0 : context.text,
48
+ testId: testId
49
+ }));
50
+ }
51
+ return /*#__PURE__*/React.createElement(EmbedCardUnresolvedView, {
52
+ description: context !== null && context !== void 0 && context.text ? 'unauthorised_account_description' : 'unauthorised_account_description_no_provider',
53
+ image: (_context$image2 = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image2 !== void 0 ? _context$image2 : LockImage,
54
+ context: context === null || context === void 0 ? void 0 : context.text,
55
+ testId: testId,
56
+ title: context !== null && context !== void 0 && context.text ? 'unauthorised_account_name' : 'unauthorised_account_name_no_provider'
57
+ });
58
+ }, [analytics, context, handleOnAuthorizeClick, onAuthorise, testId]);
30
59
  return /*#__PURE__*/React.createElement(ExpandedFrame, {
31
60
  href: link,
32
61
  icon: icon,
@@ -37,21 +66,5 @@ export var EmbedCardUnauthorisedView = function EmbedCardUnauthorisedView(_ref)
37
66
  onClick: onClick,
38
67
  testId: testId,
39
68
  allowScrollBar: true
40
- }, /*#__PURE__*/React.createElement(EmbedCardUnresolvedView, {
41
- image: (_context$image = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image !== void 0 ? _context$image : UnauthorisedImage,
42
- title: "connect_link_account_card_name",
43
- description: "connect_unauthorised_account_description",
44
- context: context && context.text,
45
- button: onAuthorise ? {
46
- appearance: 'primary',
47
- text: 'connect_unauthorised_account_action',
48
- testId: 'connect-account'
49
- } : undefined,
50
- onClick: onAuthorise ? handleOnAuthorizeClick : undefined,
51
- testId: testId
52
- }, /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
53
- analytics: analytics,
54
- providerName: context === null || context === void 0 ? void 0 : context.text,
55
- testId: testId
56
- })));
69
+ }, view);
57
70
  };
@@ -1,6 +1,6 @@
1
1
  import { MessageDescriptor } from 'react-intl-next';
2
2
  export type RequestAccessMessageKey = 'click_to_join' | 'click_to_join_description' | 'forbidden_description' | 'request_access' | 'request_access_description' | 'request_access_pending' | 'request_access_pending_description' | 'request_denied_description';
3
- export type MessageKey = 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview_improved' | 'preview' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey;
3
+ export type MessageKey = 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview_improved' | 'preview' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'unauthorised_account_description' | 'unauthorised_account_description_no_provider' | 'unauthorised_account_name' | 'unauthorised_account_name_no_provider' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey;
4
4
  type Messages = {
5
5
  [K in MessageKey]: MessageDescriptor;
6
6
  };
@@ -1,6 +1,6 @@
1
1
  import { MessageDescriptor } from 'react-intl-next';
2
2
  export type RequestAccessMessageKey = 'click_to_join' | 'click_to_join_description' | 'forbidden_description' | 'request_access' | 'request_access_description' | 'request_access_pending' | 'request_access_pending_description' | 'request_denied_description';
3
- export type MessageKey = 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview_improved' | 'preview' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey;
3
+ export type MessageKey = 'cannot_find_link' | 'connect_link_account_card' | 'connect_link_account_card_name' | 'connect_link_account_card_description' | 'connect_unauthorised_account_action' | 'connect_unauthorised_account_description' | 'connect_unauthorised_account_description_no_provider' | 'continue' | 'copy_url_to_clipboard' | 'could_not_load_link' | 'download' | 'go_back' | 'invalid_permissions' | 'invalid_permissions_description' | 'join_to_view' | 'connect_link_account' | 'created_by' | 'created_on_relative' | 'created_on_absolute' | 'check_this_link' | 'delete' | 'edit' | 'learn_more_about_smart_links' | 'loading' | 'link_safety_warning_message' | 'modified_by' | 'modified_on_relative' | 'modified_on_absolute' | 'more_actions' | 'not_found_title' | 'not_found_description' | 'open_issue_in_jira' | 'open_link_in_a_new_tab' | 'owned_by' | 'preview_improved' | 'preview' | 'preview_close' | 'preview_max_size' | 'preview_min_size' | 'priority_blocker' | 'priority_critical' | 'priority_high' | 'priority_highest' | 'priority_low' | 'priority_lowest' | 'priority_major' | 'priority_medium' | 'priority_minor' | 'priority_trivial' | 'priority_undefined' | 'forbidden_access' | 'pending_request' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'status_change_load_error' | 'status_change_permission_error' | 'status_change_update_error' | 'try_again' | 'try_another_account' | 'unauthorised_account_description' | 'unauthorised_account_description_no_provider' | 'unauthorised_account_name' | 'unauthorised_account_name_no_provider' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey;
4
4
  type Messages = {
5
5
  [K in MessageKey]: MessageDescriptor;
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.13.0",
3
+ "version": "26.13.1",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -37,7 +37,7 @@
37
37
  "@atlaskit/link-analytics": "^8.2.0",
38
38
  "@atlaskit/link-client-extension": "^1.5.0",
39
39
  "@atlaskit/link-extractors": "^1.1.0",
40
- "@atlaskit/linking-common": "^4.2.0",
40
+ "@atlaskit/linking-common": "^4.3.0",
41
41
  "@atlaskit/linking-types": "^8.2.0",
42
42
  "@atlaskit/logo": "^13.14.0",
43
43
  "@atlaskit/lozenge": "^11.4.0",