@atlaskit/smart-card 26.42.9 → 26.42.10

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 (60) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/constants.js +2 -1
  3. package/dist/cjs/messages.js +7 -2
  4. package/dist/cjs/state/helpers.js +4 -1
  5. package/dist/cjs/utils/analytics/analytics.js +1 -1
  6. package/dist/cjs/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +3 -1
  7. package/dist/cjs/view/EmbedCard/index.js +3 -0
  8. package/dist/cjs/view/EmbedCard/views/UnauthorisedView.js +4 -2
  9. package/dist/cjs/view/EmbedCard/views/unauthorized-view/index.js +4 -2
  10. package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +7 -16
  11. package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group/index.js +33 -0
  12. package/dist/cjs/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group/types.js +5 -0
  13. package/dist/cjs/view/HoverCard/components/views/unauthorised/index.js +3 -0
  14. package/dist/cjs/view/LinkUrl/index.js +1 -1
  15. package/dist/cjs/view/common/UnauthorisedViewContent.js +4 -2
  16. package/dist/es2019/constants.js +1 -0
  17. package/dist/es2019/messages.js +7 -2
  18. package/dist/es2019/state/helpers.js +2 -1
  19. package/dist/es2019/utils/analytics/analytics.js +1 -1
  20. package/dist/es2019/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +4 -2
  21. package/dist/es2019/view/EmbedCard/index.js +4 -1
  22. package/dist/es2019/view/EmbedCard/views/UnauthorisedView.js +4 -2
  23. package/dist/es2019/view/EmbedCard/views/unauthorized-view/index.js +3 -1
  24. package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +7 -11
  25. package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group/index.js +21 -0
  26. package/dist/es2019/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group/types.js +1 -0
  27. package/dist/es2019/view/HoverCard/components/views/unauthorised/index.js +3 -0
  28. package/dist/es2019/view/LinkUrl/index.js +1 -1
  29. package/dist/es2019/view/common/UnauthorisedViewContent.js +5 -3
  30. package/dist/esm/constants.js +1 -0
  31. package/dist/esm/messages.js +7 -2
  32. package/dist/esm/state/helpers.js +3 -0
  33. package/dist/esm/utils/analytics/analytics.js +1 -1
  34. package/dist/esm/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +4 -2
  35. package/dist/esm/view/EmbedCard/index.js +4 -1
  36. package/dist/esm/view/EmbedCard/views/UnauthorisedView.js +4 -2
  37. package/dist/esm/view/EmbedCard/views/unauthorized-view/index.js +4 -2
  38. package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/index.js +7 -13
  39. package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group/index.js +25 -0
  40. package/dist/esm/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group/types.js +1 -0
  41. package/dist/esm/view/HoverCard/components/views/unauthorised/index.js +3 -0
  42. package/dist/esm/view/LinkUrl/index.js +1 -1
  43. package/dist/esm/view/common/UnauthorisedViewContent.js +5 -3
  44. package/dist/types/constants.d.ts +1 -0
  45. package/dist/types/messages.d.ts +1 -1
  46. package/dist/types/state/helpers.d.ts +1 -0
  47. package/dist/types/view/EmbedCard/views/UnauthorisedView.d.ts +1 -0
  48. package/dist/types/view/EmbedCard/views/unauthorized-view/types.d.ts +1 -0
  49. package/dist/types/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group/index.d.ts +4 -0
  50. package/dist/types/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group/types.d.ts +7 -0
  51. package/dist/types/view/common/UnauthorisedViewContent.d.ts +6 -1
  52. package/dist/types-ts4.5/constants.d.ts +1 -0
  53. package/dist/types-ts4.5/messages.d.ts +1 -1
  54. package/dist/types-ts4.5/state/helpers.d.ts +1 -0
  55. package/dist/types-ts4.5/view/EmbedCard/views/UnauthorisedView.d.ts +1 -0
  56. package/dist/types-ts4.5/view/EmbedCard/views/unauthorized-view/types.d.ts +1 -0
  57. package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group/index.d.ts +4 -0
  58. package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/lozenge-action/lozenge-action-items-group/types.d.ts +7 -0
  59. package/dist/types-ts4.5/view/common/UnauthorisedViewContent.d.ts +6 -1
  60. package/package.json +1 -1
@@ -7,7 +7,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
7
7
  import LinkWarningModal from './LinkWarningModal';
8
8
  const PACKAGE_DATA = {
9
9
  packageName: "@atlaskit/smart-card",
10
- packageVersion: "26.42.9",
10
+ packageVersion: "26.42.10",
11
11
  componentName: 'linkUrl'
12
12
  };
13
13
  const Link = withLinkClickedEvent('a');
@@ -2,28 +2,30 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback } from 'react';
3
3
  import { FormattedMessage } from 'react-intl-next';
4
4
  import { messages } from '../../messages';
5
- import { CONTENT_URL_SECURITY_AND_PERMISSIONS } from '../../constants';
5
+ import { CONTENT_URL_3P_ACCOUNT_AUTH, CONTENT_URL_SECURITY_AND_PERMISSIONS } from '../../constants';
6
6
  /**
7
7
  * This component is used in unauthorized views of a smart link.
8
8
  * It represents the main text that provides a user with information on how to connect their account
9
9
  */
10
10
  const UnauthorisedViewContent = ({
11
11
  providerName,
12
+ isProductIntegrationSupported,
12
13
  testId = 'unauthorised-view-content',
13
14
  analytics
14
15
  }) => {
15
16
  const handleLearnMoreClick = useCallback(() => {
16
17
  analytics === null || analytics === void 0 ? void 0 : analytics.ui.learnMoreClickedEvent();
17
18
  }, [analytics === null || analytics === void 0 ? void 0 : analytics.ui]);
19
+ const learnMoreMessage = isProductIntegrationSupported ? messages.learn_more_about_connecting_account : messages.learn_more_about_smart_links;
18
20
  return /*#__PURE__*/React.createElement(React.Fragment, null, providerName ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_unauthorised_account_description, {
19
21
  values: {
20
22
  context: providerName
21
23
  }
22
24
  })) : /*#__PURE__*/React.createElement(FormattedMessage, messages.connect_unauthorised_account_description_no_provider), ' ', /*#__PURE__*/React.createElement("a", {
23
- href: CONTENT_URL_SECURITY_AND_PERMISSIONS,
25
+ href: isProductIntegrationSupported ? CONTENT_URL_3P_ACCOUNT_AUTH : CONTENT_URL_SECURITY_AND_PERMISSIONS,
24
26
  target: "_blank",
25
27
  "data-testid": `${testId}-learn-more`,
26
28
  onClick: handleLearnMoreClick
27
- }, /*#__PURE__*/React.createElement(FormattedMessage, messages.learn_more_about_smart_links)));
29
+ }, /*#__PURE__*/React.createElement(FormattedMessage, learnMoreMessage)));
28
30
  };
29
31
  export default UnauthorisedViewContent;
@@ -1,4 +1,5 @@
1
1
  export var CONTENT_URL_SECURITY_AND_PERMISSIONS = 'https://support.atlassian.com/confluence-cloud/docs/insert-links-and-anchors/#Smart-links';
2
+ export var CONTENT_URL_3P_ACCOUNT_AUTH = 'https://support.atlassian.com/confluence-cloud/docs/what-data-is-sent-and-received-when-pasting-a-smart-link/';
2
3
 
3
4
  /**
4
5
  * The alignment of Flexible UI component.
@@ -90,12 +90,12 @@ export var messages = defineMessages({
90
90
  },
91
91
  connect_unauthorised_account_description: {
92
92
  id: 'fabric.linking.connect_unauthorised_account_description',
93
- defaultMessage: 'Connect {context} to Atlassian to view more details of your work and collaborate from one place.',
93
+ defaultMessage: 'Connect your {context} account to collaborate on work across Atlassian products.',
94
94
  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.'
95
95
  },
96
96
  connect_unauthorised_account_description_no_provider: {
97
97
  id: 'fabric.linking.connect_unauthorised_account_description_no_provider',
98
- defaultMessage: 'Connect to Atlassian to view more details of your work and collaborate from one place.',
98
+ defaultMessage: 'Connect your account to collaborate on work across Atlassian products.',
99
99
  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.'
100
100
  },
101
101
  continue: {
@@ -178,6 +178,11 @@ export var messages = defineMessages({
178
178
  defaultMessage: 'Learn more about Smart Links.',
179
179
  description: 'An anchor link to redirect user to a page about Smart Links.'
180
180
  },
181
+ learn_more_about_connecting_account: {
182
+ id: 'fabric.linking.learn_more_about_connecting_account',
183
+ defaultMessage: 'Learn more about connecting your account to Atlassian products.',
184
+ description: 'An anchor link to redirect user to a page about authorization with 3rd party accounts.'
185
+ },
181
186
  loading: {
182
187
  id: 'fabric.linking.loading',
183
188
  defaultMessage: 'Loading...',
@@ -62,4 +62,7 @@ export var getDatasources = function getDatasources(details) {
62
62
  export var getCanBeDatasource = function getCanBeDatasource(details) {
63
63
  var datasources = getDatasources(details);
64
64
  return !!datasources && datasources.length > 0;
65
+ };
66
+ export var hasAuthScopeOverrides = function hasAuthScopeOverrides(details) {
67
+ return !!(details !== null && details !== void 0 && details.meta.hasScopeOverrides);
65
68
  };
@@ -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.42.9"
18
+ packageVersion: "26.42.10"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -7,7 +7,7 @@ var _templateObject;
7
7
  import { css, jsx } from '@emotion/react';
8
8
  import { useCallback, useMemo } from 'react';
9
9
  import { FormattedMessage } from 'react-intl-next';
10
- import { getExtensionKey } from '../../../../state/helpers';
10
+ import { getExtensionKey, hasAuthScopeOverrides } from '../../../../state/helpers';
11
11
  import { AuthorizeAction } from '../../actions/flexible/AuthorizeAction';
12
12
  import { extractProvider } from '@atlaskit/link-extractors';
13
13
  import UnauthorisedViewContent from '../../../common/UnauthorisedViewContent';
@@ -34,6 +34,7 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
34
34
  var extensionKey = (_getExtensionKey = getExtensionKey(cardState === null || cardState === void 0 ? void 0 : cardState.details)) !== null && _getExtensionKey !== void 0 ? _getExtensionKey : '';
35
35
  var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
36
36
  var providerName = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
37
+ var isProductIntegrationSupported = hasAuthScopeOverrides(cardState === null || cardState === void 0 ? void 0 : cardState.details);
37
38
  var handleAuthorize = useCallback(function () {
38
39
  if (onAuthorize) {
39
40
  analytics === null || analytics === void 0 || analytics.track.appAccountAuthStarted({
@@ -45,6 +46,7 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
45
46
  var content = useMemo(function () {
46
47
  return onAuthorize ? jsx(UnauthorisedViewContent, {
47
48
  providerName: providerName,
49
+ isProductIntegrationSupported: isProductIntegrationSupported,
48
50
  analytics: analytics,
49
51
  testId: testId
50
52
  }) : jsx(FormattedMessage, _extends({}, messages[providerName ? 'unauthorised_account_description' : 'unauthorised_account_description_no_provider'], {
@@ -52,7 +54,7 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
52
54
  context: providerName
53
55
  }
54
56
  }));
55
- }, [analytics, onAuthorize, providerName, testId]);
57
+ }, [analytics, isProductIntegrationSupported, onAuthorize, providerName, testId]);
56
58
  var actions = useMemo(function () {
57
59
  return onAuthorize ? [AuthorizeAction(handleAuthorize, providerName)] : [];
58
60
  }, [handleAuthorize, onAuthorize, providerName]);
@@ -6,7 +6,7 @@ import { extractEmbedProps } from '../../extractors/embed';
6
6
  import { getEmptyJsonLd, getForbiddenJsonLd } from '../../utils/jsonld';
7
7
  import { extractInlineProps } from '../../extractors/inline';
8
8
  import { extractBlockProps } from '../../extractors/block';
9
- import { getExtensionKey } from '../../state/helpers';
9
+ import { getExtensionKey, hasAuthScopeOverrides } from '../../state/helpers';
10
10
  import { extractRequestAccessContext } from '../../extractors/common/context';
11
11
  import { BlockCardResolvedView, BlockCardResolvingView } from '../BlockCard';
12
12
  import { InlineCardResolvedView } from '../RedesignedInlineCard/ResolvedView';
@@ -47,6 +47,7 @@ export var EmbedCard = /*#__PURE__*/React.forwardRef(function (_ref, iframeRef)
47
47
  var data = details && details.data || getEmptyJsonLd();
48
48
  var meta = details && details.meta;
49
49
  var extensionKey = getExtensionKey(details);
50
+ var isProductIntegrationSupported = hasAuthScopeOverrides(details);
50
51
  switch (status) {
51
52
  case 'pending':
52
53
  case 'resolving':
@@ -112,6 +113,7 @@ export var EmbedCard = /*#__PURE__*/React.forwardRef(function (_ref, iframeRef)
112
113
  analytics: analytics,
113
114
  context: unauthorisedViewProps.context,
114
115
  extensionKey: extensionKey,
116
+ isProductIntegrationSupported: isProductIntegrationSupported,
115
117
  inheritDimensions: inheritDimensions,
116
118
  isSelected: isSelected,
117
119
  onAuthorize: handleAuthorize,
@@ -127,6 +129,7 @@ export var EmbedCard = /*#__PURE__*/React.forwardRef(function (_ref, iframeRef)
127
129
  onClick: handleFrameClick,
128
130
  analytics: analytics,
129
131
  extensionKey: extensionKey,
132
+ isProductIntegrationSupported: isProductIntegrationSupported,
130
133
  testId: testId
131
134
  }));
132
135
  case 'forbidden':
@@ -19,7 +19,8 @@ export var EmbedCardUnauthorisedView = function EmbedCardUnauthorisedView(_ref)
19
19
  onAuthorise = _ref.onAuthorise,
20
20
  inheritDimensions = _ref.inheritDimensions,
21
21
  onClick = _ref.onClick,
22
- extensionKey = _ref.extensionKey;
22
+ extensionKey = _ref.extensionKey,
23
+ isProductIntegrationSupported = _ref.isProductIntegrationSupported;
23
24
  var icon = context && context.icon && /*#__PURE__*/React.createElement(ImageIcon, {
24
25
  src: typeof context.icon === 'string' ? context.icon : undefined
25
26
  });
@@ -50,6 +51,7 @@ export var EmbedCardUnauthorisedView = function EmbedCardUnauthorisedView(_ref)
50
51
  }, /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
51
52
  analytics: analytics,
52
53
  providerName: context === null || context === void 0 ? void 0 : context.text,
54
+ isProductIntegrationSupported: isProductIntegrationSupported,
53
55
  testId: testId
54
56
  }));
55
57
  }
@@ -60,7 +62,7 @@ export var EmbedCardUnauthorisedView = function EmbedCardUnauthorisedView(_ref)
60
62
  testId: testId,
61
63
  title: context !== null && context !== void 0 && context.text ? 'unauthorised_account_name' : 'unauthorised_account_name_no_provider'
62
64
  });
63
- }, [analytics, context, handleOnAuthorizeClick, onAuthorise, testId]);
65
+ }, [analytics, context, handleOnAuthorizeClick, isProductIntegrationSupported, onAuthorise, testId]);
64
66
  return /*#__PURE__*/React.createElement(ExpandedFrame, {
65
67
  href: link,
66
68
  icon: icon,
@@ -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 = ["analytics", "context", "extensionKey", "onAuthorize", "testId"];
3
+ var _excluded = ["analytics", "context", "extensionKey", "isProductIntegrationSupported", "onAuthorize", "testId"];
4
4
  import Button from '@atlaskit/button';
5
5
  import React, { useCallback, useMemo } from 'react';
6
6
  import { FormattedMessage } from 'react-intl-next';
@@ -14,6 +14,7 @@ var UnauthorizedView = function UnauthorizedView(_ref) {
14
14
  var analytics = _ref.analytics,
15
15
  context = _ref.context,
16
16
  extensionKey = _ref.extensionKey,
17
+ isProductIntegrationSupported = _ref.isProductIntegrationSupported,
17
18
  onAuthorize = _ref.onAuthorize,
18
19
  _ref$testId = _ref.testId,
19
20
  testId = _ref$testId === void 0 ? 'embed-card-unauthorized-view' : _ref$testId,
@@ -45,6 +46,7 @@ var UnauthorizedView = function UnauthorizedView(_ref) {
45
46
  description: /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
46
47
  analytics: analytics,
47
48
  providerName: context === null || context === void 0 ? void 0 : context.text,
49
+ isProductIntegrationSupported: isProductIntegrationSupported,
48
50
  testId: testId
49
51
  }),
50
52
  button: /*#__PURE__*/React.createElement(Button, {
@@ -79,7 +81,7 @@ var UnauthorizedView = function UnauthorizedView(_ref) {
79
81
  title: /*#__PURE__*/React.createElement(FormattedMessage, messages.unauthorised_account_name_no_provider),
80
82
  description: /*#__PURE__*/React.createElement(FormattedMessage, messages.unauthorised_account_description_no_provider)
81
83
  };
82
- }, [analytics, context === null || context === void 0 ? void 0 : context.text, handleOnAuthorizeClick, onAuthorize, testId]);
84
+ }, [analytics, context === null || context === void 0 ? void 0 : context.text, handleOnAuthorizeClick, isProductIntegrationSupported, onAuthorize, testId]);
83
85
  return /*#__PURE__*/React.createElement(UnresolvedView, _extends({}, unresolvedViewProps, content, {
84
86
  icon: context === null || context === void 0 ? void 0 : context.icon,
85
87
  image: (_context$image = context === null || context === void 0 ? void 0 : context.image) !== null && _context$image !== void 0 ? _context$image : getUnresolvedEmbedCardImage('unauthorized'),
@@ -5,12 +5,10 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
5
5
  /** @jsx jsx */
6
6
  import { jsx } from '@emotion/react';
7
7
  import { useCallback, useEffect, useMemo, useState } from 'react';
8
- import DropdownMenu, { DropdownItemGroup } from '@atlaskit/dropdown-menu';
9
- import LozengeActionItem from './lozenge-action-item';
8
+ import DropdownMenu from '@atlaskit/dropdown-menu';
10
9
  import LozengeActionTrigger from './lozenge-action-trigger';
11
10
  import LozengeActionError from './lozenge-action-error';
12
11
  import withErrorBoundary from './error-boundary';
13
- import { dropdownItemGroupStyles } from './styled';
14
12
  import useInvoke from '../../../../../../state/hooks/use-invoke';
15
13
  import extractLozengeActionItems from '../../../../../../extractors/action/extract-lozenge-action-items';
16
14
  import createStatusUpdateRequest from '../../../../../../utils/actions/create-status-update-request';
@@ -20,6 +18,7 @@ import { isInvokeCustomError } from '../../../../../../state/hooks/use-invoke/ut
20
18
  import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
21
19
  import { TrackQuickActionType } from '../../../../../../utils/analytics/analytics';
22
20
  import { permissionLoadErrorAnalyticsPayload, unknownLoadErrorAnalyticsPayload, unknownUpdateErrorAnalyticsPayload, validationUpdateErrorAnalyticsPayload } from './lozenge-action-analytics';
21
+ import LozengeActionItemsGroup from './lozenge-action-items-group';
23
22
  var validateItems = function validateItems() {
24
23
  var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
25
24
  var text = arguments.length > 1 ? arguments[1] : undefined;
@@ -213,16 +212,11 @@ var LozengeAction = function LozengeAction(_ref) {
213
212
  });
214
213
  }
215
214
  if (items && items.length > 0) {
216
- return jsx("span", {
217
- css: dropdownItemGroupStyles,
218
- "data-testid": "".concat(testId, "-item-group")
219
- }, jsx(DropdownItemGroup, null, items.map(function (item, idx) {
220
- return jsx(LozengeActionItem, _extends({}, item, {
221
- key: idx,
222
- onClick: handleItemClick,
223
- testId: "".concat(testId, "-item-").concat(idx)
224
- }));
225
- })));
215
+ return jsx(LozengeActionItemsGroup, {
216
+ testId: testId,
217
+ items: items,
218
+ onClick: handleItemClick
219
+ });
226
220
  }
227
221
  }, [errorMessage, handleItemClick, items, previewData, testId, url]);
228
222
  return jsx(DropdownMenu, {
@@ -0,0 +1,25 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /** @jsx jsx */
3
+ import { jsx } from '@emotion/react';
4
+ import LozengeActionItem from '../lozenge-action-item';
5
+ import { dropdownItemGroupStyles } from '../styled';
6
+ import { DropdownItemGroup } from '@atlaskit/dropdown-menu';
7
+ var LozengeActionItemsGroup = function LozengeActionItemsGroup(_ref) {
8
+ var items = _ref.items,
9
+ testId = _ref.testId,
10
+ onClick = _ref.onClick;
11
+ return (
12
+ // eslint-disable-next-line @atlaskit/design-system/prefer-primitives
13
+ jsx("span", {
14
+ css: dropdownItemGroupStyles,
15
+ "data-testid": "".concat(testId, "-item-group")
16
+ }, jsx(DropdownItemGroup, null, items.map(function (item, idx) {
17
+ return jsx(LozengeActionItem, _extends({}, item, {
18
+ key: idx,
19
+ onClick: onClick,
20
+ testId: "".concat(testId, "-item-").concat(idx)
21
+ }));
22
+ })))
23
+ );
24
+ };
25
+ export default LozengeActionItemsGroup;
@@ -11,6 +11,7 @@ import ActionGroup from '../../../../FlexibleCard/components/blocks/action-group
11
11
  import { LinkIcon } from '../../../../FlexibleCard/components/elements';
12
12
  import { ActionName, CardDisplay } from '../../../../../constants';
13
13
  import { useSmartCardActions } from '../../../../../state/actions';
14
+ import { hasAuthScopeOverrides } from '../../../../../state/helpers';
14
15
  var HoverCardUnauthorisedView = function HoverCardUnauthorisedView(_ref) {
15
16
  var _cardState$details, _extractProvider;
16
17
  var analytics = _ref.analytics,
@@ -24,6 +25,7 @@ var HoverCardUnauthorisedView = function HoverCardUnauthorisedView(_ref) {
24
25
  var cardState = flexibleCardProps.cardState;
25
26
  var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
26
27
  var providerName = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text;
28
+ var isProductIntegrationSupported = hasAuthScopeOverrides(cardState.details);
27
29
  var _useSmartCardActions = useSmartCardActions(id, url, analytics),
28
30
  authorize = _useSmartCardActions.authorize;
29
31
  var handleAuthorize = useCallback(function () {
@@ -59,6 +61,7 @@ var HoverCardUnauthorisedView = function HoverCardUnauthorisedView(_ref) {
59
61
  testId: "".concat(testId, "-content")
60
62
  }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(UnauthorisedViewContent, {
61
63
  providerName: providerName,
64
+ isProductIntegrationSupported: isProductIntegrationSupported,
62
65
  analytics: analytics
63
66
  }))), /*#__PURE__*/React.createElement(CustomBlock, {
64
67
  overrideCss: connectButtonStyles,
@@ -10,7 +10,7 @@ import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-m
10
10
  import LinkWarningModal from './LinkWarningModal';
11
11
  var PACKAGE_DATA = {
12
12
  packageName: "@atlaskit/smart-card",
13
- packageVersion: "26.42.9",
13
+ packageVersion: "26.42.10",
14
14
  componentName: 'linkUrl'
15
15
  };
16
16
  var Link = withLinkClickedEvent('a');
@@ -2,28 +2,30 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback } from 'react';
3
3
  import { FormattedMessage } from 'react-intl-next';
4
4
  import { messages } from '../../messages';
5
- import { CONTENT_URL_SECURITY_AND_PERMISSIONS } from '../../constants';
5
+ import { CONTENT_URL_3P_ACCOUNT_AUTH, CONTENT_URL_SECURITY_AND_PERMISSIONS } from '../../constants';
6
6
  /**
7
7
  * This component is used in unauthorized views of a smart link.
8
8
  * It represents the main text that provides a user with information on how to connect their account
9
9
  */
10
10
  var UnauthorisedViewContent = function UnauthorisedViewContent(_ref) {
11
11
  var providerName = _ref.providerName,
12
+ isProductIntegrationSupported = _ref.isProductIntegrationSupported,
12
13
  _ref$testId = _ref.testId,
13
14
  testId = _ref$testId === void 0 ? 'unauthorised-view-content' : _ref$testId,
14
15
  analytics = _ref.analytics;
15
16
  var handleLearnMoreClick = useCallback(function () {
16
17
  analytics === null || analytics === void 0 || analytics.ui.learnMoreClickedEvent();
17
18
  }, [analytics === null || analytics === void 0 ? void 0 : analytics.ui]);
19
+ var learnMoreMessage = isProductIntegrationSupported ? messages.learn_more_about_connecting_account : messages.learn_more_about_smart_links;
18
20
  return /*#__PURE__*/React.createElement(React.Fragment, null, providerName ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages.connect_unauthorised_account_description, {
19
21
  values: {
20
22
  context: providerName
21
23
  }
22
24
  })) : /*#__PURE__*/React.createElement(FormattedMessage, messages.connect_unauthorised_account_description_no_provider), ' ', /*#__PURE__*/React.createElement("a", {
23
- href: CONTENT_URL_SECURITY_AND_PERMISSIONS,
25
+ href: isProductIntegrationSupported ? CONTENT_URL_3P_ACCOUNT_AUTH : CONTENT_URL_SECURITY_AND_PERMISSIONS,
24
26
  target: "_blank",
25
27
  "data-testid": "".concat(testId, "-learn-more"),
26
28
  onClick: handleLearnMoreClick
27
- }, /*#__PURE__*/React.createElement(FormattedMessage, messages.learn_more_about_smart_links)));
29
+ }, /*#__PURE__*/React.createElement(FormattedMessage, learnMoreMessage)));
28
30
  };
29
31
  export default UnauthorisedViewContent;
@@ -1,4 +1,5 @@
1
1
  export declare const CONTENT_URL_SECURITY_AND_PERMISSIONS = "https://support.atlassian.com/confluence-cloud/docs/insert-links-and-anchors/#Smart-links";
2
+ export declare const CONTENT_URL_3P_ACCOUNT_AUTH = "https://support.atlassian.com/confluence-cloud/docs/what-data-is-sent-and-received-when-pasting-a-smart-link/";
2
3
  /**
3
4
  * The alignment of Flexible UI component.
4
5
  */
@@ -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' | 'default_no_access_title_crossjoin' | 'direct_access_title_crossjoin' | 'direct_access_description_crossjoin' | 'direct_access_crossjoin' | 'request_access_description_crossjoin' | 'request_access_crossjoin' | 'request_access_pending_title_crossjoin' | 'request_access_pending_description_crossjoin' | 'request_access_pending_crossjoin' | 'request_denied_description_crossjoin' | 'access_exists_description_crossjoin' | 'not_found_description_crossjoin' | 'not_found_title_crossjoin';
3
- export type MessageKey = 'assigned_to' | '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' | 'follow' | '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_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' | 'read_time' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'sent_on_relative' | 'sent_on_absolute' | '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' | 'unassigned' | 'unfollow' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey | 'related_work_items_not_found' | 'last_mentioned_in' | 'related' | 'generic_error_message';
3
+ export type MessageKey = 'assigned_to' | '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' | 'follow' | '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' | 'learn_more_about_connecting_account' | '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_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' | 'read_time' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'sent_on_relative' | 'sent_on_absolute' | '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' | 'unassigned' | 'unfollow' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey | 'related_work_items_not_found' | 'last_mentioned_in' | 'related' | 'generic_error_message';
4
4
  type Messages = {
5
5
  [K in MessageKey]: MessageDescriptor;
6
6
  };
@@ -17,3 +17,4 @@ export declare const getStatusDetails: (details?: JsonLd.Response) => string | u
17
17
  export declare const isFinalState: (status: CardType) => boolean;
18
18
  export declare const getDatasources: (details?: JsonLdDatasourceResponse) => DatasourceResolveResponse[] | undefined;
19
19
  export declare const getCanBeDatasource: (details?: JsonLdDatasourceResponse) => boolean;
20
+ export declare const hasAuthScopeOverrides: (details?: JsonLd.Response) => boolean;
@@ -11,6 +11,7 @@ export interface EmbedCardUnauthorisedViewProps {
11
11
  inheritDimensions?: boolean;
12
12
  onClick?: (evt: React.MouseEvent) => void;
13
13
  extensionKey?: string;
14
+ isProductIntegrationSupported?: boolean;
14
15
  }
15
16
  /**
16
17
  * @deprecated {@link https://product-fabric.atlassian.net/browse/EDM-7977 Internal documentation for deprecation (no external access)}\
@@ -5,5 +5,6 @@ export type UnauthorizedViewProps = Pick<UnresolvedViewProps, 'inheritDimensions
5
5
  analytics: AnalyticsFacade;
6
6
  context?: ContextViewModel;
7
7
  extensionKey?: string;
8
+ isProductIntegrationSupported?: boolean;
8
9
  onAuthorize?: () => void;
9
10
  };
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import type { LozengeActionItemsGroupProps } from './types';
3
+ declare const LozengeActionItemsGroup: FC<LozengeActionItemsGroupProps>;
4
+ export default LozengeActionItemsGroup;
@@ -0,0 +1,7 @@
1
+ import { LozengeItem } from '../types';
2
+ import { ThemeAppearance } from '@atlaskit/lozenge';
3
+ export type LozengeActionItemsGroupProps = {
4
+ items: LozengeItem[];
5
+ testId?: string;
6
+ onClick?: (id: string, text: string, appearance?: ThemeAppearance) => Promise<void>;
7
+ };
@@ -6,6 +6,11 @@ type UnauthorisedViewContentProps = {
6
6
  * Eg. Google, Microsoft etc
7
7
  */
8
8
  providerName?: string;
9
+ /**
10
+ * If `true`, display an alternative message which prompts user to connect all
11
+ * Atlassian products (vs. smart links only) to the 3rd party account.
12
+ */
13
+ isProductIntegrationSupported?: boolean;
9
14
  /**
10
15
  * A `testId` prop is provided for specified elements, which is a unique
11
16
  * string that appears as a data attribute `data-testid` in the rendered code,
@@ -22,5 +27,5 @@ type UnauthorisedViewContentProps = {
22
27
  * This component is used in unauthorized views of a smart link.
23
28
  * It represents the main text that provides a user with information on how to connect their account
24
29
  */
25
- declare const UnauthorisedViewContent: ({ providerName, testId, analytics, }: UnauthorisedViewContentProps) => JSX.Element;
30
+ declare const UnauthorisedViewContent: ({ providerName, isProductIntegrationSupported, testId, analytics, }: UnauthorisedViewContentProps) => JSX.Element;
26
31
  export default UnauthorisedViewContent;
@@ -1,4 +1,5 @@
1
1
  export declare const CONTENT_URL_SECURITY_AND_PERMISSIONS = "https://support.atlassian.com/confluence-cloud/docs/insert-links-and-anchors/#Smart-links";
2
+ export declare const CONTENT_URL_3P_ACCOUNT_AUTH = "https://support.atlassian.com/confluence-cloud/docs/what-data-is-sent-and-received-when-pasting-a-smart-link/";
2
3
  /**
3
4
  * The alignment of Flexible UI component.
4
5
  */
@@ -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' | 'default_no_access_title_crossjoin' | 'direct_access_title_crossjoin' | 'direct_access_description_crossjoin' | 'direct_access_crossjoin' | 'request_access_description_crossjoin' | 'request_access_crossjoin' | 'request_access_pending_title_crossjoin' | 'request_access_pending_description_crossjoin' | 'request_access_pending_crossjoin' | 'request_denied_description_crossjoin' | 'access_exists_description_crossjoin' | 'not_found_description_crossjoin' | 'not_found_title_crossjoin';
3
- export type MessageKey = 'assigned_to' | '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' | 'follow' | '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_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' | 'read_time' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'sent_on_relative' | 'sent_on_absolute' | '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' | 'unassigned' | 'unfollow' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey | 'related_work_items_not_found' | 'last_mentioned_in' | 'related' | 'generic_error_message';
3
+ export type MessageKey = 'assigned_to' | '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' | 'follow' | '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' | 'learn_more_about_connecting_account' | '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_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' | 'read_time' | 'restricted_link' | 'request_access_to_view' | 'request_denied' | 'sent_on_relative' | 'sent_on_absolute' | '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' | 'unassigned' | 'unfollow' | 'view' | 'viewIn' | 'viewOriginal' | 'actions' | 'add_account' | 'cancel' | 'close' | 'connect_to' | 'connect_account_description' | 'retry' | 'save' | 'unlink_account' | RequestAccessMessageKey | 'related_work_items_not_found' | 'last_mentioned_in' | 'related' | 'generic_error_message';
4
4
  type Messages = {
5
5
  [K in MessageKey]: MessageDescriptor;
6
6
  };
@@ -17,3 +17,4 @@ export declare const getStatusDetails: (details?: JsonLd.Response) => string | u
17
17
  export declare const isFinalState: (status: CardType) => boolean;
18
18
  export declare const getDatasources: (details?: JsonLdDatasourceResponse) => DatasourceResolveResponse[] | undefined;
19
19
  export declare const getCanBeDatasource: (details?: JsonLdDatasourceResponse) => boolean;
20
+ export declare const hasAuthScopeOverrides: (details?: JsonLd.Response) => boolean;
@@ -11,6 +11,7 @@ export interface EmbedCardUnauthorisedViewProps {
11
11
  inheritDimensions?: boolean;
12
12
  onClick?: (evt: React.MouseEvent) => void;
13
13
  extensionKey?: string;
14
+ isProductIntegrationSupported?: boolean;
14
15
  }
15
16
  /**
16
17
  * @deprecated {@link https://product-fabric.atlassian.net/browse/EDM-7977 Internal documentation for deprecation (no external access)}\
@@ -5,5 +5,6 @@ export type UnauthorizedViewProps = Pick<UnresolvedViewProps, 'inheritDimensions
5
5
  analytics: AnalyticsFacade;
6
6
  context?: ContextViewModel;
7
7
  extensionKey?: string;
8
+ isProductIntegrationSupported?: boolean;
8
9
  onAuthorize?: () => void;
9
10
  };
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import type { LozengeActionItemsGroupProps } from './types';
3
+ declare const LozengeActionItemsGroup: FC<LozengeActionItemsGroupProps>;
4
+ export default LozengeActionItemsGroup;
@@ -0,0 +1,7 @@
1
+ import { LozengeItem } from '../types';
2
+ import { ThemeAppearance } from '@atlaskit/lozenge';
3
+ export type LozengeActionItemsGroupProps = {
4
+ items: LozengeItem[];
5
+ testId?: string;
6
+ onClick?: (id: string, text: string, appearance?: ThemeAppearance) => Promise<void>;
7
+ };
@@ -6,6 +6,11 @@ type UnauthorisedViewContentProps = {
6
6
  * Eg. Google, Microsoft etc
7
7
  */
8
8
  providerName?: string;
9
+ /**
10
+ * If `true`, display an alternative message which prompts user to connect all
11
+ * Atlassian products (vs. smart links only) to the 3rd party account.
12
+ */
13
+ isProductIntegrationSupported?: boolean;
9
14
  /**
10
15
  * A `testId` prop is provided for specified elements, which is a unique
11
16
  * string that appears as a data attribute `data-testid` in the rendered code,
@@ -22,5 +27,5 @@ type UnauthorisedViewContentProps = {
22
27
  * This component is used in unauthorized views of a smart link.
23
28
  * It represents the main text that provides a user with information on how to connect their account
24
29
  */
25
- declare const UnauthorisedViewContent: ({ providerName, testId, analytics, }: UnauthorisedViewContentProps) => JSX.Element;
30
+ declare const UnauthorisedViewContent: ({ providerName, isProductIntegrationSupported, testId, analytics, }: UnauthorisedViewContentProps) => JSX.Element;
26
31
  export default UnauthorisedViewContent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.42.9",
3
+ "version": "26.42.10",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"