@atlaskit/smart-card 26.33.2 → 26.34.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/utils/analytics/analytics.js +1 -1
  3. package/dist/cjs/utils/mocks.js +6 -1
  4. package/dist/cjs/utils/token.js +5 -0
  5. package/dist/cjs/view/EmbedCard/index.js +15 -1
  6. package/dist/cjs/view/EmbedCard/views/UnauthorisedView.js +4 -0
  7. package/dist/cjs/view/EmbedCard/views/forbidden-view/index.js +4 -4
  8. package/dist/cjs/view/EmbedCard/views/unauthorized-view/index.js +100 -0
  9. package/dist/cjs/view/EmbedCard/views/unauthorized-view/types.js +5 -0
  10. package/dist/cjs/view/FlexibleCard/components/actions/action/action-button/index.js +4 -2
  11. package/dist/cjs/view/FlexibleCard/components/actions/action/action-icon/index.js +5 -5
  12. package/dist/cjs/view/FlexibleCard/components/actions/action/index.js +5 -2
  13. package/dist/cjs/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +4 -2
  14. package/dist/cjs/view/LinkUrl/index.js +1 -1
  15. package/dist/es2019/utils/analytics/analytics.js +1 -1
  16. package/dist/es2019/utils/mocks.js +5 -0
  17. package/dist/es2019/utils/token.js +5 -0
  18. package/dist/es2019/view/EmbedCard/index.js +15 -1
  19. package/dist/es2019/view/EmbedCard/views/UnauthorisedView.js +4 -0
  20. package/dist/es2019/view/EmbedCard/views/forbidden-view/index.js +3 -3
  21. package/dist/es2019/view/EmbedCard/views/unauthorized-view/index.js +88 -0
  22. package/dist/es2019/view/EmbedCard/views/unauthorized-view/types.js +1 -0
  23. package/dist/es2019/view/FlexibleCard/components/actions/action/action-button/index.js +4 -2
  24. package/dist/es2019/view/FlexibleCard/components/actions/action/action-icon/index.js +5 -5
  25. package/dist/es2019/view/FlexibleCard/components/actions/action/index.js +5 -2
  26. package/dist/es2019/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +3 -1
  27. package/dist/es2019/view/LinkUrl/index.js +1 -1
  28. package/dist/esm/utils/analytics/analytics.js +1 -1
  29. package/dist/esm/utils/mocks.js +5 -0
  30. package/dist/esm/utils/token.js +5 -0
  31. package/dist/esm/view/EmbedCard/index.js +15 -1
  32. package/dist/esm/view/EmbedCard/views/UnauthorisedView.js +4 -0
  33. package/dist/esm/view/EmbedCard/views/forbidden-view/index.js +4 -4
  34. package/dist/esm/view/EmbedCard/views/unauthorized-view/index.js +90 -0
  35. package/dist/esm/view/EmbedCard/views/unauthorized-view/types.js +1 -0
  36. package/dist/esm/view/FlexibleCard/components/actions/action/action-button/index.js +4 -2
  37. package/dist/esm/view/FlexibleCard/components/actions/action/action-icon/index.js +5 -5
  38. package/dist/esm/view/FlexibleCard/components/actions/action/index.js +5 -2
  39. package/dist/esm/view/FlexibleCard/components/blocks/action-group/action-group-item/index.js +4 -2
  40. package/dist/esm/view/LinkUrl/index.js +1 -1
  41. package/dist/types/utils/mocks.d.ts +5 -0
  42. package/dist/types/utils/token.d.ts +5 -0
  43. package/dist/types/view/EmbedCard/views/UnauthorisedView.d.ts +4 -0
  44. package/dist/types/view/EmbedCard/views/forbidden-view/types.d.ts +1 -1
  45. package/dist/types/view/EmbedCard/views/unauthorized-view/index.d.ts +4 -0
  46. package/dist/types/view/EmbedCard/views/unauthorized-view/types.d.ts +9 -0
  47. package/dist/types/view/FlexibleCard/components/actions/action/action-button/types.d.ts +1 -0
  48. package/dist/types/view/FlexibleCard/components/actions/action/action-icon/types.d.ts +1 -0
  49. package/dist/types/view/FlexibleCard/components/actions/action/types.d.ts +4 -0
  50. package/dist/types/view/FlexibleCard/components/blocks/types.d.ts +8 -0
  51. package/dist/types-ts4.5/utils/mocks.d.ts +5 -0
  52. package/dist/types-ts4.5/utils/token.d.ts +5 -0
  53. package/dist/types-ts4.5/view/EmbedCard/views/UnauthorisedView.d.ts +4 -0
  54. package/dist/types-ts4.5/view/EmbedCard/views/forbidden-view/types.d.ts +1 -1
  55. package/dist/types-ts4.5/view/EmbedCard/views/unauthorized-view/index.d.ts +4 -0
  56. package/dist/types-ts4.5/view/EmbedCard/views/unauthorized-view/types.d.ts +9 -0
  57. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-button/types.d.ts +1 -0
  58. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/action-icon/types.d.ts +1 -0
  59. package/dist/types-ts4.5/view/FlexibleCard/components/actions/action/types.d.ts +4 -0
  60. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/types.d.ts +8 -0
  61. package/package.json +1 -3
  62. package/report.api.md +3 -0
  63. package/tmp/api-report-tmp.d.ts +3 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/smart-card
2
2
 
3
+ ## 26.34.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#41295](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41295) [`d18dc7aba6d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d18dc7aba6d) - [ux] Update embed unauth view styling (behind feature flag)
8
+
9
+ ## 26.34.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#41278](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41278) [`abf3bed4cf2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/abf3bed4cf2) - Flexible-UI: add isDisabled option to action items to show disabled view and disable clicks on button
14
+
3
15
  ## 26.33.2
4
16
 
5
17
  ### Patch Changes
@@ -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.33.2"
25
+ packageVersion: "26.34.1"
26
26
  };
27
27
  var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
28
28
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.waitFor = exports.mocks = exports.mockContext = exports.mockByUrl = exports.mockAnalytics = exports.fakeResponse = exports.fakeFactory = void 0;
7
+ exports.waitFor = exports.mocks = exports.mockGenerator = exports.mockContext = exports.mockByUrl = exports.mockAnalytics = exports.fakeResponse = exports.fakeFactory = void 0;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
@@ -23,6 +23,11 @@ var mockContext = exports.mockContext = {
23
23
  atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
24
24
  schema: 'http://schema.org/'
25
25
  };
26
+ var mockGenerator = exports.mockGenerator = {
27
+ '@type': 'Application',
28
+ '@id': 'https://www.atlassian.com/#Jira',
29
+ name: 'Jira'
30
+ };
26
31
  var mockByUrl = exports.mockByUrl = function mockByUrl(url) {
27
32
  return {
28
33
  meta: {
@@ -4,6 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.tokens = void 0;
7
+ /**
8
+ * @private
9
+ * @deprecated {@link https://product-fabric.atlassian.net/browse/EDM-8175 Internal documentation for deprecation (no external access)}\
10
+ * @deprecated Use the token directly in the file
11
+ */
7
12
  var tokens = exports.tokens = {
8
13
  actionIcon: "var(--ds-icon, #44546F)",
9
14
  background: "var(--ds-surface-raised, #FFFFFF)",
@@ -24,6 +24,7 @@ var _UnauthorisedView = require("./views/UnauthorisedView");
24
24
  var _ErroredView = require("./views/ErroredView");
25
25
  var _forbiddenView = _interopRequireDefault(require("./views/forbidden-view"));
26
26
  var _notFoundView = _interopRequireDefault(require("./views/not-found-view"));
27
+ var _unauthorizedView = _interopRequireDefault(require("./views/unauthorized-view"));
27
28
  var EmbedCard = exports.EmbedCard = /*#__PURE__*/_react.default.forwardRef(function (_ref, iframeRef) {
28
29
  var _details$meta, _forbiddenViewProps$c3;
29
30
  var url = _ref.url,
@@ -110,6 +111,19 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/_react.default.forwardRef(funct
110
111
  });
111
112
  }
112
113
  var unauthorisedViewProps = (0, _embed.extractEmbedProps)(data, meta, platform);
114
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.linking-platform.smart-card.cross-join')) {
115
+ return /*#__PURE__*/_react.default.createElement(_unauthorizedView.default, {
116
+ analytics: analytics,
117
+ context: unauthorisedViewProps.context,
118
+ extensionKey: extensionKey,
119
+ inheritDimensions: inheritDimensions,
120
+ isSelected: isSelected,
121
+ onAuthorize: handleAuthorize,
122
+ onClick: handleFrameClick,
123
+ testId: testId,
124
+ url: unauthorisedViewProps.link
125
+ });
126
+ }
113
127
  return /*#__PURE__*/_react.default.createElement(_UnauthorisedView.EmbedCardUnauthorisedView, (0, _extends2.default)({}, unauthorisedViewProps, {
114
128
  isSelected: isSelected,
115
129
  onAuthorise: handleAuthorize,
@@ -149,7 +163,7 @@ var EmbedCard = exports.EmbedCard = /*#__PURE__*/_react.default.forwardRef(funct
149
163
  context: forbiddenViewProps.context,
150
164
  inheritDimensions: inheritDimensions,
151
165
  isSelected: isSelected,
152
- onAuthorise: handleAuthorize,
166
+ onAuthorize: handleAuthorize,
153
167
  onClick: handleFrameClick,
154
168
  accessContext: accessContext,
155
169
  url: forbiddenViewProps.link
@@ -15,6 +15,10 @@ var _UnauthorisedViewContent = _interopRequireDefault(require("../../common/Unau
15
15
  var _utils = require("../utils");
16
16
  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); }
17
17
  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; }
18
+ /**
19
+ * @deprecated {@link https://product-fabric.atlassian.net/browse/EDM-7977 Internal documentation for deprecation (no external access)}\
20
+ * @deprecated Replaced by unauthorized-view
21
+ */
18
22
  var EmbedCardUnauthorisedView = exports.EmbedCardUnauthorisedView = function EmbedCardUnauthorisedView(_ref) {
19
23
  var analytics = _ref.analytics,
20
24
  link = _ref.link,
@@ -16,12 +16,12 @@ var _messages = require("../../../../messages");
16
16
  var _intlUtils = require("../../../../utils/intl-utils");
17
17
  var _unresolvedView = _interopRequireDefault(require("../unresolved-view"));
18
18
  var _utils = require("../../utils");
19
- var _excluded = ["context", "onAuthorise", "accessContext", "testId"];
19
+ var _excluded = ["context", "onAuthorize", "accessContext", "testId"];
20
20
  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); }
21
21
  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; }
22
22
  var ForbiddenView = function ForbiddenView(_ref) {
23
23
  var context = _ref.context,
24
- onAuthorise = _ref.onAuthorise,
24
+ onAuthorize = _ref.onAuthorize,
25
25
  accessContext = _ref.accessContext,
26
26
  _ref$testId = _ref.testId,
27
27
  testId = _ref$testId === void 0 ? 'embed-card-forbidden-view' : _ref$testId,
@@ -55,7 +55,7 @@ var ForbiddenView = function ForbiddenView(_ref) {
55
55
  */
56
56
  var button = (0, _react.useMemo)(function () {
57
57
  var _action$promise;
58
- var onEmbedCardClick = (_action$promise = action === null || action === void 0 ? void 0 : action.promise) !== null && _action$promise !== void 0 ? _action$promise : onAuthorise;
58
+ var onEmbedCardClick = (_action$promise = action === null || action === void 0 ? void 0 : action.promise) !== null && _action$promise !== void 0 ? _action$promise : onAuthorize;
59
59
  if (!onEmbedCardClick) {
60
60
  return null;
61
61
  }
@@ -67,7 +67,7 @@ var ForbiddenView = function ForbiddenView(_ref) {
67
67
  }, /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, (0, _intlUtils.toMessage)(_messages.messages.try_another_account, callToActionMessageKey), {
68
68
  values: values
69
69
  })));
70
- }, [accessType, action === null || action === void 0 ? void 0 : action.id, action === null || action === void 0 ? void 0 : action.promise, callToActionMessageKey, onAuthorise, values]);
70
+ }, [accessType, action === null || action === void 0 ? void 0 : action.id, action === null || action === void 0 ? void 0 : action.promise, callToActionMessageKey, onAuthorize, values]);
71
71
  return /*#__PURE__*/_react.default.createElement(_unresolvedView.default, (0, _extends2.default)({}, unresolvedViewProps, {
72
72
  icon: icon,
73
73
  image: image !== null && image !== void 0 ? image : (0, _utils.getUnresolvedEmbedCardImage)('forbidden'),
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _button = _interopRequireDefault(require("@atlaskit/button"));
12
+ var _react = _interopRequireWildcard(require("react"));
13
+ var _reactIntlNext = require("react-intl-next");
14
+ var _reactMagneticDi = require("react-magnetic-di");
15
+ var _messages = require("../../../../messages");
16
+ var _UnauthorisedViewContent = _interopRequireDefault(require("../../../common/UnauthorisedViewContent"));
17
+ var _utils = require("../../utils");
18
+ var _unresolvedView = _interopRequireDefault(require("../unresolved-view"));
19
+ var _excluded = ["analytics", "context", "extensionKey", "onAuthorize", "testId"];
20
+ 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); }
21
+ 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; }
22
+ var UnauthorizedView = function UnauthorizedView(_ref) {
23
+ var _context$image;
24
+ var analytics = _ref.analytics,
25
+ context = _ref.context,
26
+ extensionKey = _ref.extensionKey,
27
+ onAuthorize = _ref.onAuthorize,
28
+ _ref$testId = _ref.testId,
29
+ testId = _ref$testId === void 0 ? 'embed-card-unauthorized-view' : _ref$testId,
30
+ unresolvedViewProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
31
+ var handleOnAuthorizeClick = (0, _react.useCallback)(function () {
32
+ if (onAuthorize) {
33
+ analytics.track.appAccountAuthStarted({
34
+ extensionKey: extensionKey
35
+ });
36
+ onAuthorize();
37
+ }
38
+ }, [onAuthorize, analytics.track, extensionKey]);
39
+ var content = (0, _react.useMemo)(function () {
40
+ if (onAuthorize) {
41
+ var _context$text;
42
+ // Our title and button messages always expect the product name to be present
43
+ // while the description support when product name is not present.
44
+ // To be looked at https://product-fabric.atlassian.net/browse/EDM-8173
45
+ var _values = {
46
+ context: (_context$text = context === null || context === void 0 ? void 0 : context.text) !== null && _context$text !== void 0 ? _context$text : ''
47
+ };
48
+ if (_values) {
49
+ // title: Connect your {context} account
50
+ // button: Connect to {context}
51
+ return {
52
+ title: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.messages.connect_link_account_card_name, {
53
+ values: _values
54
+ })),
55
+ description: /*#__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
+ button: /*#__PURE__*/_react.default.createElement(_button.default, {
61
+ testId: "connect-account",
62
+ appearance: "primary",
63
+ onClick: handleOnAuthorizeClick
64
+ }, /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.messages.connect_unauthorised_account_action, {
65
+ values: _values
66
+ })))
67
+ };
68
+ }
69
+ }
70
+ var values = context !== null && context !== void 0 && context.text ? {
71
+ context: context === null || context === void 0 ? void 0 : context.text
72
+ } : undefined;
73
+ if (values) {
74
+ // title: We can't display private pages from {context}
75
+ // description: You're trying to preview a link to a private {context} page. We recommend you review the URL or contact the page owner.
76
+ return {
77
+ title: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.messages.unauthorised_account_name, {
78
+ values: values
79
+ })),
80
+ description: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.messages.unauthorised_account_description, {
81
+ values: values
82
+ }))
83
+ };
84
+ }
85
+
86
+ // title: We can't display private pages
87
+ // description: You're trying to preview a link to a private page. We recommend you review the URL or contact the page owner.
88
+ return {
89
+ title: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.unauthorised_account_name_no_provider),
90
+ description: /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, _messages.messages.unauthorised_account_description_no_provider)
91
+ };
92
+ }, [analytics, context === null || context === void 0 ? void 0 : context.text, handleOnAuthorizeClick, onAuthorize, testId]);
93
+ return /*#__PURE__*/_react.default.createElement(_unresolvedView.default, (0, _extends2.default)({}, unresolvedViewProps, content, {
94
+ icon: context === null || context === void 0 ? void 0 : context.icon,
95
+ image: (_context$image = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image !== void 0 ? _context$image : (0, _utils.getUnresolvedEmbedCardImage)('unauthorized'),
96
+ testId: testId,
97
+ text: context === null || context === void 0 ? void 0 : context.text
98
+ }));
99
+ };
100
+ var _default = exports.default = UnauthorizedView;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -41,7 +41,8 @@ var ActionButton = function ActionButton(_ref) {
41
41
  overrideCss = _ref.overrideCss,
42
42
  size = _ref.size,
43
43
  testId = _ref.testId,
44
- tooltipMessage = _ref.tooltipMessage;
44
+ tooltipMessage = _ref.tooltipMessage,
45
+ isDisabled = _ref.isDisabled;
45
46
  var iconOnly = !content;
46
47
  var onButtonClick = (0, _react.useCallback)(function (handler) {
47
48
  return function (e) {
@@ -70,7 +71,8 @@ var ActionButton = function ActionButton(_ref) {
70
71
  iconBefore: iconBefore,
71
72
  onClick: onButtonClick(onClick),
72
73
  spacing: _utils.sizeToButtonSpacing[size],
73
- testId: testId
74
+ testId: testId,
75
+ isDisabled: isDisabled
74
76
  }, content)));
75
77
  };
76
78
  var _default = exports.default = ActionButton;
@@ -9,7 +9,6 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
9
9
  var _react = _interopRequireDefault(require("react"));
10
10
  var _react2 = require("@emotion/react");
11
11
  var _constants = require("../../../../../../constants");
12
- var _token = require("../../../../../../utils/token");
13
12
  var _utils = require("../../../utils");
14
13
  var _templateObject;
15
14
  /** @jsx jsx */
@@ -24,15 +23,16 @@ var getIconWidth = function getIconWidth(size) {
24
23
  return '1rem';
25
24
  }
26
25
  };
27
- var getIconStyles = function getIconStyles(size) {
28
- return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n ", ";\n"])), _token.tokens.actionIcon, (0, _utils.getIconSizeStyles)(getIconWidth(size)));
26
+ var getIconStyles = function getIconStyles(size, isDisabled) {
27
+ return (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n ", ";\n"])), isDisabled ? "var(--ds-text-disabled, #6B778C)" : "var(--ds-icon, #44546F)", (0, _utils.getIconSizeStyles)(getIconWidth(size)));
29
28
  };
30
29
  var ActionIcon = function ActionIcon(_ref) {
31
30
  var size = _ref.size,
32
31
  testId = _ref.testId,
33
- icon = _ref.icon;
32
+ icon = _ref.icon,
33
+ isDisabled = _ref.isDisabled;
34
34
  return (0, _react2.jsx)("span", {
35
- css: getIconStyles(size),
35
+ css: getIconStyles(size, isDisabled),
36
36
  "data-testid": "".concat(testId, "-icon")
37
37
  }, icon);
38
38
  };
@@ -37,11 +37,13 @@ var Action = function Action(_ref) {
37
37
  iconPosition = _ref$iconPosition === void 0 ? 'before' : _ref$iconPosition,
38
38
  tooltipMessage = _ref.tooltipMessage,
39
39
  asDropDownItem = _ref.asDropDownItem,
40
- overrideCss = _ref.overrideCss;
40
+ overrideCss = _ref.overrideCss,
41
+ isDisabled = _ref.isDisabled;
41
42
  if (!onClick) {
42
43
  return null;
43
44
  }
44
45
  var actionIcon = icon && (0, _react2.jsx)(_actionIcon.default, {
46
+ isDisabled: isDisabled,
45
47
  icon: icon,
46
48
  size: size,
47
49
  testId: testId
@@ -68,7 +70,8 @@ var Action = function Action(_ref) {
68
70
  overrideCss: overrideCss,
69
71
  size: size,
70
72
  testId: testId,
71
- tooltipMessage: tooltipMessage || content
73
+ tooltipMessage: tooltipMessage || content,
74
+ isDisabled: isDisabled
72
75
  });
73
76
  }
74
77
  };
@@ -13,7 +13,7 @@ var _react = require("@emotion/react");
13
13
  var _react2 = _interopRequireWildcard(require("react"));
14
14
  var Actions = _interopRequireWildcard(require("../../../actions"));
15
15
  var _utils = require("../../utils");
16
- var _excluded = ["name", "hideContent", "hideIcon", "onClick"];
16
+ var _excluded = ["name", "hideContent", "hideIcon", "onClick", "isDisabled"];
17
17
  /** @jsx jsx */
18
18
  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); }
19
19
  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; }
@@ -29,6 +29,7 @@ var ActionGroupItem = function ActionGroupItem(_ref) {
29
29
  hideContent = item.hideContent,
30
30
  hideIcon = item.hideIcon,
31
31
  onClick = item.onClick,
32
+ isDisabled = item.isDisabled,
32
33
  props = (0, _objectWithoutProperties2.default)(item, _excluded);
33
34
  var handleOnClick = (0, _react2.useCallback)(function () {
34
35
  if (onActionItemClick) {
@@ -54,7 +55,8 @@ var ActionGroupItem = function ActionGroupItem(_ref) {
54
55
  asDropDownItem: asDropDownItems,
55
56
  size: size,
56
57
  appearance: appearance,
57
- onClick: handleOnClick
58
+ onClick: handleOnClick,
59
+ isDisabled: isDisabled
58
60
  }, actionProps));
59
61
  if (!(0, _utils.isJSXElementNull)(action)) {
60
62
  return action;
@@ -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.33.2",
21
+ packageVersion: "26.34.1",
22
22
  componentName: 'linkUrl'
23
23
  };
24
24
  var Link = (0, _click.withLinkClickedEvent)('a');
@@ -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.33.2"
7
+ packageVersion: "26.34.1"
8
8
  };
9
9
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -4,6 +4,11 @@ export const mockContext = {
4
4
  atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
5
5
  schema: 'http://schema.org/'
6
6
  };
7
+ export const mockGenerator = {
8
+ '@type': 'Application',
9
+ '@id': 'https://www.atlassian.com/#Jira',
10
+ name: 'Jira'
11
+ };
7
12
  export const mockByUrl = url => {
8
13
  return {
9
14
  meta: {
@@ -1,3 +1,8 @@
1
+ /**
2
+ * @private
3
+ * @deprecated {@link https://product-fabric.atlassian.net/browse/EDM-8175 Internal documentation for deprecation (no external access)}\
4
+ * @deprecated Use the token directly in the file
5
+ */
1
6
  export const tokens = {
2
7
  actionIcon: "var(--ds-icon, #44546F)",
3
8
  background: "var(--ds-surface-raised, #FFFFFF)",
@@ -17,6 +17,7 @@ import { EmbedCardUnauthorisedView } from './views/UnauthorisedView';
17
17
  import { EmbedCardErroredView } from './views/ErroredView';
18
18
  import ForbiddenView from './views/forbidden-view';
19
19
  import NotFoundView from './views/not-found-view';
20
+ import UnauthorizedView from './views/unauthorized-view';
20
21
  export const EmbedCard = /*#__PURE__*/React.forwardRef(({
21
22
  url,
22
23
  cardState: {
@@ -105,6 +106,19 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
105
106
  });
106
107
  }
107
108
  const unauthorisedViewProps = extractEmbedProps(data, meta, platform);
109
+ if (getBooleanFF('platform.linking-platform.smart-card.cross-join')) {
110
+ return /*#__PURE__*/React.createElement(UnauthorizedView, {
111
+ analytics: analytics,
112
+ context: unauthorisedViewProps.context,
113
+ extensionKey: extensionKey,
114
+ inheritDimensions: inheritDimensions,
115
+ isSelected: isSelected,
116
+ onAuthorize: handleAuthorize,
117
+ onClick: handleFrameClick,
118
+ testId: testId,
119
+ url: unauthorisedViewProps.link
120
+ });
121
+ }
108
122
  return /*#__PURE__*/React.createElement(EmbedCardUnauthorisedView, _extends({}, unauthorisedViewProps, {
109
123
  isSelected: isSelected,
110
124
  onAuthorise: handleAuthorize,
@@ -144,7 +158,7 @@ export const EmbedCard = /*#__PURE__*/React.forwardRef(({
144
158
  context: forbiddenViewProps.context,
145
159
  inheritDimensions: inheritDimensions,
146
160
  isSelected: isSelected,
147
- onAuthorise: handleAuthorize,
161
+ onAuthorize: handleAuthorize,
148
162
  onClick: handleFrameClick,
149
163
  accessContext: accessContext,
150
164
  url: forbiddenViewProps.link
@@ -5,6 +5,10 @@ import { ExpandedFrame } from '../components/ExpandedFrame';
5
5
  import { ImageIcon } from '../components/ImageIcon';
6
6
  import UnauthorisedViewContent from '../../common/UnauthorisedViewContent';
7
7
  import { getUnresolvedEmbedCardImage } from '../utils';
8
+ /**
9
+ * @deprecated {@link https://product-fabric.atlassian.net/browse/EDM-7977 Internal documentation for deprecation (no external access)}\
10
+ * @deprecated Replaced by unauthorized-view
11
+ */
8
12
  export const EmbedCardUnauthorisedView = ({
9
13
  analytics,
10
14
  link,
@@ -9,7 +9,7 @@ import UnresolvedView from '../unresolved-view';
9
9
  import { getUnresolvedEmbedCardImage } from '../../utils';
10
10
  const ForbiddenView = ({
11
11
  context,
12
- onAuthorise,
12
+ onAuthorize,
13
13
  accessContext,
14
14
  testId = 'embed-card-forbidden-view',
15
15
  ...unresolvedViewProps
@@ -44,7 +44,7 @@ const ForbiddenView = ({
44
44
  */
45
45
  const button = useMemo(() => {
46
46
  var _action$promise;
47
- const onEmbedCardClick = (_action$promise = action === null || action === void 0 ? void 0 : action.promise) !== null && _action$promise !== void 0 ? _action$promise : onAuthorise;
47
+ const onEmbedCardClick = (_action$promise = action === null || action === void 0 ? void 0 : action.promise) !== null && _action$promise !== void 0 ? _action$promise : onAuthorize;
48
48
  if (!onEmbedCardClick) {
49
49
  return null;
50
50
  }
@@ -56,7 +56,7 @@ const ForbiddenView = ({
56
56
  }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, toMessage(messages.try_another_account, callToActionMessageKey), {
57
57
  values: values
58
58
  })));
59
- }, [accessType, action === null || action === void 0 ? void 0 : action.id, action === null || action === void 0 ? void 0 : action.promise, callToActionMessageKey, onAuthorise, values]);
59
+ }, [accessType, action === null || action === void 0 ? void 0 : action.id, action === null || action === void 0 ? void 0 : action.promise, callToActionMessageKey, onAuthorize, values]);
60
60
  return /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, unresolvedViewProps, {
61
61
  icon: icon,
62
62
  image: image !== null && image !== void 0 ? image : getUnresolvedEmbedCardImage('forbidden'),
@@ -0,0 +1,88 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import Button from '@atlaskit/button';
3
+ import React, { useCallback, useMemo } from 'react';
4
+ import { FormattedMessage } from 'react-intl-next';
5
+ import { di } from 'react-magnetic-di';
6
+ import { messages } from '../../../../messages';
7
+ import UnauthorisedViewContent from '../../../common/UnauthorisedViewContent';
8
+ import { getUnresolvedEmbedCardImage } from '../../utils';
9
+ import UnresolvedView from '../unresolved-view';
10
+ const UnauthorizedView = ({
11
+ analytics,
12
+ context,
13
+ extensionKey,
14
+ onAuthorize,
15
+ testId = 'embed-card-unauthorized-view',
16
+ ...unresolvedViewProps
17
+ }) => {
18
+ var _context$image;
19
+ const handleOnAuthorizeClick = useCallback(() => {
20
+ if (onAuthorize) {
21
+ analytics.track.appAccountAuthStarted({
22
+ extensionKey
23
+ });
24
+ onAuthorize();
25
+ }
26
+ }, [onAuthorize, analytics.track, extensionKey]);
27
+ const content = useMemo(() => {
28
+ if (onAuthorize) {
29
+ var _context$text;
30
+ // Our title and button messages always expect the product name to be present
31
+ // while the description support when product name is not present.
32
+ // To be looked at https://product-fabric.atlassian.net/browse/EDM-8173
33
+ const values = {
34
+ context: (_context$text = context === null || context === void 0 ? void 0 : context.text) !== null && _context$text !== void 0 ? _context$text : ''
35
+ };
36
+ if (values) {
37
+ // title: Connect your {context} account
38
+ // button: Connect to {context}
39
+ return {
40
+ title: /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_link_account_card_name, {
41
+ values: values
42
+ })),
43
+ description: /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
44
+ analytics: analytics,
45
+ providerName: context === null || context === void 0 ? void 0 : context.text,
46
+ testId: testId
47
+ }),
48
+ button: /*#__PURE__*/React.createElement(Button, {
49
+ testId: "connect-account",
50
+ appearance: "primary",
51
+ onClick: handleOnAuthorizeClick
52
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_unauthorised_account_action, {
53
+ values: values
54
+ })))
55
+ };
56
+ }
57
+ }
58
+ const values = context !== null && context !== void 0 && context.text ? {
59
+ context: context === null || context === void 0 ? void 0 : context.text
60
+ } : undefined;
61
+ if (values) {
62
+ // title: We can't display private pages from {context}
63
+ // description: You're trying to preview a link to a private {context} page. We recommend you review the URL or contact the page owner.
64
+ return {
65
+ title: /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.unauthorised_account_name, {
66
+ values: values
67
+ })),
68
+ description: /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.unauthorised_account_description, {
69
+ values: values
70
+ }))
71
+ };
72
+ }
73
+
74
+ // title: We can't display private pages
75
+ // description: You're trying to preview a link to a private page. We recommend you review the URL or contact the page owner.
76
+ return {
77
+ title: /*#__PURE__*/React.createElement(FormattedMessage, messages.unauthorised_account_name_no_provider),
78
+ description: /*#__PURE__*/React.createElement(FormattedMessage, messages.unauthorised_account_description_no_provider)
79
+ };
80
+ }, [analytics, context === null || context === void 0 ? void 0 : context.text, handleOnAuthorizeClick, onAuthorize, testId]);
81
+ return /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, unresolvedViewProps, content, {
82
+ icon: context === null || context === void 0 ? void 0 : context.icon,
83
+ image: (_context$image = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image !== void 0 ? _context$image : getUnresolvedEmbedCardImage('unauthorized'),
84
+ testId: testId,
85
+ text: context === null || context === void 0 ? void 0 : context.text
86
+ }));
87
+ };
88
+ export default UnauthorizedView;
@@ -55,7 +55,8 @@ const ActionButton = ({
55
55
  overrideCss,
56
56
  size,
57
57
  testId,
58
- tooltipMessage
58
+ tooltipMessage,
59
+ isDisabled
59
60
  }) => {
60
61
  const iconOnly = !content;
61
62
  const onButtonClick = useCallback(handler => e => {
@@ -83,7 +84,8 @@ const ActionButton = ({
83
84
  iconBefore: iconBefore,
84
85
  onClick: onButtonClick(onClick),
85
86
  spacing: sizeToButtonSpacing[size],
86
- testId: testId
87
+ testId: testId,
88
+ isDisabled: isDisabled
87
89
  }, content)));
88
90
  };
89
91
  export default ActionButton;
@@ -2,7 +2,6 @@
2
2
  import React from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
4
  import { SmartLinkSize } from '../../../../../../constants';
5
- import { tokens } from '../../../../../../utils/token';
6
5
  import { getIconSizeStyles } from '../../../utils';
7
6
  const getIconWidth = size => {
8
7
  switch (size) {
@@ -15,16 +14,17 @@ const getIconWidth = size => {
15
14
  return '1rem';
16
15
  }
17
16
  };
18
- const getIconStyles = size => css`
19
- color: ${tokens.actionIcon};
17
+ const getIconStyles = (size, isDisabled) => css`
18
+ color: ${isDisabled ? "var(--ds-text-disabled, #6B778C)" : "var(--ds-icon, #44546F)"};
20
19
  ${getIconSizeStyles(getIconWidth(size))};
21
20
  `;
22
21
  const ActionIcon = ({
23
22
  size,
24
23
  testId,
25
- icon
24
+ icon,
25
+ isDisabled
26
26
  }) => jsx("span", {
27
- css: getIconStyles(size),
27
+ css: getIconStyles(size, isDisabled),
28
28
  "data-testid": `${testId}-icon`
29
29
  }, icon);
30
30
  export default ActionIcon;