@atlaskit/smart-card 26.34.0 → 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 (36) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/utils/analytics/analytics.js +1 -1
  3. package/dist/cjs/utils/mocks.js +6 -1
  4. package/dist/cjs/view/EmbedCard/index.js +15 -1
  5. package/dist/cjs/view/EmbedCard/views/UnauthorisedView.js +4 -0
  6. package/dist/cjs/view/EmbedCard/views/forbidden-view/index.js +4 -4
  7. package/dist/cjs/view/EmbedCard/views/unauthorized-view/index.js +100 -0
  8. package/dist/cjs/view/EmbedCard/views/unauthorized-view/types.js +5 -0
  9. package/dist/cjs/view/LinkUrl/index.js +1 -1
  10. package/dist/es2019/utils/analytics/analytics.js +1 -1
  11. package/dist/es2019/utils/mocks.js +5 -0
  12. package/dist/es2019/view/EmbedCard/index.js +15 -1
  13. package/dist/es2019/view/EmbedCard/views/UnauthorisedView.js +4 -0
  14. package/dist/es2019/view/EmbedCard/views/forbidden-view/index.js +3 -3
  15. package/dist/es2019/view/EmbedCard/views/unauthorized-view/index.js +88 -0
  16. package/dist/es2019/view/EmbedCard/views/unauthorized-view/types.js +1 -0
  17. package/dist/es2019/view/LinkUrl/index.js +1 -1
  18. package/dist/esm/utils/analytics/analytics.js +1 -1
  19. package/dist/esm/utils/mocks.js +5 -0
  20. package/dist/esm/view/EmbedCard/index.js +15 -1
  21. package/dist/esm/view/EmbedCard/views/UnauthorisedView.js +4 -0
  22. package/dist/esm/view/EmbedCard/views/forbidden-view/index.js +4 -4
  23. package/dist/esm/view/EmbedCard/views/unauthorized-view/index.js +90 -0
  24. package/dist/esm/view/EmbedCard/views/unauthorized-view/types.js +1 -0
  25. package/dist/esm/view/LinkUrl/index.js +1 -1
  26. package/dist/types/utils/mocks.d.ts +5 -0
  27. package/dist/types/view/EmbedCard/views/UnauthorisedView.d.ts +4 -0
  28. package/dist/types/view/EmbedCard/views/forbidden-view/types.d.ts +1 -1
  29. package/dist/types/view/EmbedCard/views/unauthorized-view/index.d.ts +4 -0
  30. package/dist/types/view/EmbedCard/views/unauthorized-view/types.d.ts +9 -0
  31. package/dist/types-ts4.5/utils/mocks.d.ts +5 -0
  32. package/dist/types-ts4.5/view/EmbedCard/views/UnauthorisedView.d.ts +4 -0
  33. package/dist/types-ts4.5/view/EmbedCard/views/forbidden-view/types.d.ts +1 -1
  34. package/dist/types-ts4.5/view/EmbedCard/views/unauthorized-view/index.d.ts +4 -0
  35. package/dist/types-ts4.5/view/EmbedCard/views/unauthorized-view/types.d.ts +9 -0
  36. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## 26.34.0
4
10
 
5
11
  ### Minor 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.34.0"
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: {
@@ -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
+ });
@@ -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.34.0",
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.34.0"
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: {
@@ -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;
@@ -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.34.0",
11
+ packageVersion: "26.34.1",
12
12
  componentName: 'linkUrl'
13
13
  };
14
14
  const Link = withLinkClickedEvent('a');
@@ -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.34.0"
18
+ packageVersion: "26.34.1"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -16,6 +16,11 @@ export var mockContext = {
16
16
  atlassian: 'https://schema.atlassian.com/ns/vocabulary#',
17
17
  schema: 'http://schema.org/'
18
18
  };
19
+ export var mockGenerator = {
20
+ '@type': 'Application',
21
+ '@id': 'https://www.atlassian.com/#Jira',
22
+ name: 'Jira'
23
+ };
19
24
  export var mockByUrl = function mockByUrl(url) {
20
25
  return {
21
26
  meta: {
@@ -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 var EmbedCard = /*#__PURE__*/React.forwardRef(function (_ref, iframeRef) {
21
22
  var _details$meta, _forbiddenViewProps$c3;
22
23
  var url = _ref.url,
@@ -103,6 +104,19 @@ export var EmbedCard = /*#__PURE__*/React.forwardRef(function (_ref, iframeRef)
103
104
  });
104
105
  }
105
106
  var unauthorisedViewProps = extractEmbedProps(data, meta, platform);
107
+ if (getBooleanFF('platform.linking-platform.smart-card.cross-join')) {
108
+ return /*#__PURE__*/React.createElement(UnauthorizedView, {
109
+ analytics: analytics,
110
+ context: unauthorisedViewProps.context,
111
+ extensionKey: extensionKey,
112
+ inheritDimensions: inheritDimensions,
113
+ isSelected: isSelected,
114
+ onAuthorize: handleAuthorize,
115
+ onClick: handleFrameClick,
116
+ testId: testId,
117
+ url: unauthorisedViewProps.link
118
+ });
119
+ }
106
120
  return /*#__PURE__*/React.createElement(EmbedCardUnauthorisedView, _extends({}, unauthorisedViewProps, {
107
121
  isSelected: isSelected,
108
122
  onAuthorise: handleAuthorize,
@@ -142,7 +156,7 @@ export var EmbedCard = /*#__PURE__*/React.forwardRef(function (_ref, iframeRef)
142
156
  context: forbiddenViewProps.context,
143
157
  inheritDimensions: inheritDimensions,
144
158
  isSelected: isSelected,
145
- onAuthorise: handleAuthorize,
159
+ onAuthorize: handleAuthorize,
146
160
  onClick: handleFrameClick,
147
161
  accessContext: accessContext,
148
162
  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 var EmbedCardUnauthorisedView = function EmbedCardUnauthorisedView(_ref) {
9
13
  var analytics = _ref.analytics,
10
14
  link = _ref.link,
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["context", "onAuthorise", "accessContext", "testId"];
3
+ var _excluded = ["context", "onAuthorize", "accessContext", "testId"];
4
4
  import Button from '@atlaskit/button';
5
5
  import React, { useMemo } from 'react';
6
6
  import { FormattedMessage } from 'react-intl-next';
@@ -11,7 +11,7 @@ import UnresolvedView from '../unresolved-view';
11
11
  import { getUnresolvedEmbedCardImage } from '../../utils';
12
12
  var ForbiddenView = function ForbiddenView(_ref) {
13
13
  var context = _ref.context,
14
- onAuthorise = _ref.onAuthorise,
14
+ onAuthorize = _ref.onAuthorize,
15
15
  accessContext = _ref.accessContext,
16
16
  _ref$testId = _ref.testId,
17
17
  testId = _ref$testId === void 0 ? 'embed-card-forbidden-view' : _ref$testId,
@@ -45,7 +45,7 @@ var ForbiddenView = function ForbiddenView(_ref) {
45
45
  */
46
46
  var button = useMemo(function () {
47
47
  var _action$promise;
48
- var onEmbedCardClick = (_action$promise = action === null || action === void 0 ? void 0 : action.promise) !== null && _action$promise !== void 0 ? _action$promise : onAuthorise;
48
+ var onEmbedCardClick = (_action$promise = action === null || action === void 0 ? void 0 : action.promise) !== null && _action$promise !== void 0 ? _action$promise : onAuthorize;
49
49
  if (!onEmbedCardClick) {
50
50
  return null;
51
51
  }
@@ -57,7 +57,7 @@ var ForbiddenView = function ForbiddenView(_ref) {
57
57
  }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, toMessage(messages.try_another_account, callToActionMessageKey), {
58
58
  values: values
59
59
  })));
60
- }, [accessType, action === null || action === void 0 ? void 0 : action.id, action === null || action === void 0 ? void 0 : action.promise, callToActionMessageKey, onAuthorise, values]);
60
+ }, [accessType, action === null || action === void 0 ? void 0 : action.id, action === null || action === void 0 ? void 0 : action.promise, callToActionMessageKey, onAuthorize, values]);
61
61
  return /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, unresolvedViewProps, {
62
62
  icon: icon,
63
63
  image: image !== null && image !== void 0 ? image : getUnresolvedEmbedCardImage('forbidden'),
@@ -0,0 +1,90 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["analytics", "context", "extensionKey", "onAuthorize", "testId"];
4
+ import Button from '@atlaskit/button';
5
+ import React, { useCallback, useMemo } from 'react';
6
+ import { FormattedMessage } from 'react-intl-next';
7
+ import { di } from 'react-magnetic-di';
8
+ import { messages } from '../../../../messages';
9
+ import UnauthorisedViewContent from '../../../common/UnauthorisedViewContent';
10
+ import { getUnresolvedEmbedCardImage } from '../../utils';
11
+ import UnresolvedView from '../unresolved-view';
12
+ var UnauthorizedView = function UnauthorizedView(_ref) {
13
+ var _context$image;
14
+ var analytics = _ref.analytics,
15
+ context = _ref.context,
16
+ extensionKey = _ref.extensionKey,
17
+ onAuthorize = _ref.onAuthorize,
18
+ _ref$testId = _ref.testId,
19
+ testId = _ref$testId === void 0 ? 'embed-card-unauthorized-view' : _ref$testId,
20
+ unresolvedViewProps = _objectWithoutProperties(_ref, _excluded);
21
+ var handleOnAuthorizeClick = useCallback(function () {
22
+ if (onAuthorize) {
23
+ analytics.track.appAccountAuthStarted({
24
+ extensionKey: extensionKey
25
+ });
26
+ onAuthorize();
27
+ }
28
+ }, [onAuthorize, analytics.track, extensionKey]);
29
+ var content = useMemo(function () {
30
+ if (onAuthorize) {
31
+ var _context$text;
32
+ // Our title and button messages always expect the product name to be present
33
+ // while the description support when product name is not present.
34
+ // To be looked at https://product-fabric.atlassian.net/browse/EDM-8173
35
+ var _values = {
36
+ context: (_context$text = context === null || context === void 0 ? void 0 : context.text) !== null && _context$text !== void 0 ? _context$text : ''
37
+ };
38
+ if (_values) {
39
+ // title: Connect your {context} account
40
+ // button: Connect to {context}
41
+ return {
42
+ title: /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_link_account_card_name, {
43
+ values: _values
44
+ })),
45
+ description: /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
46
+ analytics: analytics,
47
+ providerName: context === null || context === void 0 ? void 0 : context.text,
48
+ testId: testId
49
+ }),
50
+ button: /*#__PURE__*/React.createElement(Button, {
51
+ testId: "connect-account",
52
+ appearance: "primary",
53
+ onClick: handleOnAuthorizeClick
54
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_unauthorised_account_action, {
55
+ values: _values
56
+ })))
57
+ };
58
+ }
59
+ }
60
+ var values = context !== null && context !== void 0 && context.text ? {
61
+ context: context === null || context === void 0 ? void 0 : context.text
62
+ } : undefined;
63
+ if (values) {
64
+ // title: We can't display private pages from {context}
65
+ // description: You're trying to preview a link to a private {context} page. We recommend you review the URL or contact the page owner.
66
+ return {
67
+ title: /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.unauthorised_account_name, {
68
+ values: values
69
+ })),
70
+ description: /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.unauthorised_account_description, {
71
+ values: values
72
+ }))
73
+ };
74
+ }
75
+
76
+ // title: We can't display private pages
77
+ // description: You're trying to preview a link to a private page. We recommend you review the URL or contact the page owner.
78
+ return {
79
+ title: /*#__PURE__*/React.createElement(FormattedMessage, messages.unauthorised_account_name_no_provider),
80
+ description: /*#__PURE__*/React.createElement(FormattedMessage, messages.unauthorised_account_description_no_provider)
81
+ };
82
+ }, [analytics, context === null || context === void 0 ? void 0 : context.text, handleOnAuthorizeClick, onAuthorize, testId]);
83
+ return /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, unresolvedViewProps, content, {
84
+ icon: context === null || context === void 0 ? void 0 : context.icon,
85
+ image: (_context$image = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image !== void 0 ? _context$image : getUnresolvedEmbedCardImage('unauthorized'),
86
+ testId: testId,
87
+ text: context === null || context === void 0 ? void 0 : context.text
88
+ }));
89
+ };
90
+ export default UnauthorizedView;
@@ -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.34.0",
14
+ packageVersion: "26.34.1",
15
15
  componentName: 'linkUrl'
16
16
  };
17
17
  var Link = withLinkClickedEvent('a');
@@ -4,6 +4,11 @@ export declare const mockContext: {
4
4
  readonly atlassian: "https://schema.atlassian.com/ns/vocabulary#";
5
5
  readonly schema: "http://schema.org/";
6
6
  };
7
+ export declare const mockGenerator: {
8
+ '@type': string;
9
+ '@id': string;
10
+ name: string;
11
+ };
7
12
  export declare const mockByUrl: (url: string) => JsonLd.Response<JsonLd.Data.BaseData>;
8
13
  export declare const mocks: {
9
14
  success: JsonLd.Response<JsonLd.Data.BaseData>;
@@ -12,4 +12,8 @@ export interface EmbedCardUnauthorisedViewProps {
12
12
  onClick?: (evt: React.MouseEvent) => void;
13
13
  extensionKey?: string;
14
14
  }
15
+ /**
16
+ * @deprecated {@link https://product-fabric.atlassian.net/browse/EDM-7977 Internal documentation for deprecation (no external access)}\
17
+ * @deprecated Replaced by unauthorized-view
18
+ */
15
19
  export declare const EmbedCardUnauthorisedView: FC<EmbedCardUnauthorisedViewProps>;
@@ -3,6 +3,6 @@ import { ContextViewModel } from '../../types';
3
3
  import { UnresolvedViewProps } from '../unresolved-view/types';
4
4
  export type ForbiddenViewProps = Pick<UnresolvedViewProps, 'inheritDimensions' | 'isSelected' | 'onClick' | 'testId' | 'url'> & {
5
5
  context?: ContextViewModel;
6
- onAuthorise?: () => void;
6
+ onAuthorize?: () => void;
7
7
  accessContext: RequestAccessContextProps;
8
8
  };
@@ -0,0 +1,4 @@
1
+ import { type FC } from 'react';
2
+ import { UnauthorizedViewProps } from './types';
3
+ declare const UnauthorizedView: FC<UnauthorizedViewProps>;
4
+ export default UnauthorizedView;
@@ -0,0 +1,9 @@
1
+ import type { AnalyticsFacade } from '../../../../state/analytics';
2
+ import { ContextViewModel } from '../../types';
3
+ import { UnresolvedViewProps } from '../unresolved-view/types';
4
+ export type UnauthorizedViewProps = Pick<UnresolvedViewProps, 'inheritDimensions' | 'isSelected' | 'onClick' | 'testId' | 'url'> & {
5
+ analytics: AnalyticsFacade;
6
+ context?: ContextViewModel;
7
+ extensionKey?: string;
8
+ onAuthorize?: () => void;
9
+ };
@@ -4,6 +4,11 @@ export declare const mockContext: {
4
4
  readonly atlassian: "https://schema.atlassian.com/ns/vocabulary#";
5
5
  readonly schema: "http://schema.org/";
6
6
  };
7
+ export declare const mockGenerator: {
8
+ '@type': string;
9
+ '@id': string;
10
+ name: string;
11
+ };
7
12
  export declare const mockByUrl: (url: string) => JsonLd.Response<JsonLd.Data.BaseData>;
8
13
  export declare const mocks: {
9
14
  success: JsonLd.Response<JsonLd.Data.BaseData>;
@@ -12,4 +12,8 @@ export interface EmbedCardUnauthorisedViewProps {
12
12
  onClick?: (evt: React.MouseEvent) => void;
13
13
  extensionKey?: string;
14
14
  }
15
+ /**
16
+ * @deprecated {@link https://product-fabric.atlassian.net/browse/EDM-7977 Internal documentation for deprecation (no external access)}\
17
+ * @deprecated Replaced by unauthorized-view
18
+ */
15
19
  export declare const EmbedCardUnauthorisedView: FC<EmbedCardUnauthorisedViewProps>;
@@ -3,6 +3,6 @@ import { ContextViewModel } from '../../types';
3
3
  import { UnresolvedViewProps } from '../unresolved-view/types';
4
4
  export type ForbiddenViewProps = Pick<UnresolvedViewProps, 'inheritDimensions' | 'isSelected' | 'onClick' | 'testId' | 'url'> & {
5
5
  context?: ContextViewModel;
6
- onAuthorise?: () => void;
6
+ onAuthorize?: () => void;
7
7
  accessContext: RequestAccessContextProps;
8
8
  };
@@ -0,0 +1,4 @@
1
+ import { type FC } from 'react';
2
+ import { UnauthorizedViewProps } from './types';
3
+ declare const UnauthorizedView: FC<UnauthorizedViewProps>;
4
+ export default UnauthorizedView;
@@ -0,0 +1,9 @@
1
+ import type { AnalyticsFacade } from '../../../../state/analytics';
2
+ import { ContextViewModel } from '../../types';
3
+ import { UnresolvedViewProps } from '../unresolved-view/types';
4
+ export type UnauthorizedViewProps = Pick<UnresolvedViewProps, 'inheritDimensions' | 'isSelected' | 'onClick' | 'testId' | 'url'> & {
5
+ analytics: AnalyticsFacade;
6
+ context?: ContextViewModel;
7
+ extensionKey?: string;
8
+ onAuthorize?: () => void;
9
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.34.0",
3
+ "version": "26.34.1",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"