@atlaskit/smart-card 26.28.1 → 26.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +404 -388
  2. package/dist/cjs/extractors/common/context/extractAccessContext.js +67 -4
  3. package/dist/cjs/extractors/flexible/extract-preview.js +3 -0
  4. package/dist/cjs/messages.js +82 -0
  5. package/dist/cjs/utils/analytics/analytics.js +1 -1
  6. package/dist/cjs/view/BlockCard/actions/ForbiddenAction.js +2 -4
  7. package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/index.js +0 -3
  8. package/dist/cjs/view/FlexibleCard/utils.js +4 -1
  9. package/dist/cjs/view/HoverCard/components/HoverCardComponent.js +1 -1
  10. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +9 -0
  11. package/dist/cjs/view/HoverCard/components/views/forbidden/index.js +82 -0
  12. package/dist/cjs/view/HoverCard/components/views/forbidden/styled.js +18 -0
  13. package/dist/cjs/view/HoverCard/components/views/forbidden/types.js +5 -0
  14. package/dist/cjs/view/HoverCard/styled.js +2 -2
  15. package/dist/cjs/view/LinkUrl/index.js +1 -1
  16. package/dist/es2019/extractors/common/context/extractAccessContext.js +63 -2
  17. package/dist/es2019/extractors/flexible/extract-preview.js +3 -0
  18. package/dist/es2019/messages.js +82 -0
  19. package/dist/es2019/utils/analytics/analytics.js +1 -1
  20. package/dist/es2019/view/BlockCard/actions/ForbiddenAction.js +2 -4
  21. package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/index.js +0 -3
  22. package/dist/es2019/view/FlexibleCard/utils.js +4 -1
  23. package/dist/es2019/view/HoverCard/components/HoverCardComponent.js +1 -1
  24. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +9 -0
  25. package/dist/es2019/view/HoverCard/components/views/forbidden/index.js +72 -0
  26. package/dist/es2019/view/HoverCard/components/views/forbidden/styled.js +17 -0
  27. package/dist/es2019/view/HoverCard/components/views/forbidden/types.js +1 -0
  28. package/dist/es2019/view/HoverCard/styled.js +3 -2
  29. package/dist/es2019/view/LinkUrl/index.js +1 -1
  30. package/dist/esm/extractors/common/context/extractAccessContext.js +64 -2
  31. package/dist/esm/extractors/flexible/extract-preview.js +3 -0
  32. package/dist/esm/messages.js +82 -0
  33. package/dist/esm/utils/analytics/analytics.js +1 -1
  34. package/dist/esm/view/BlockCard/actions/ForbiddenAction.js +2 -4
  35. package/dist/esm/view/FlexibleCard/components/blocks/preview-block/index.js +0 -3
  36. package/dist/esm/view/FlexibleCard/utils.js +4 -1
  37. package/dist/esm/view/HoverCard/components/HoverCardComponent.js +1 -1
  38. package/dist/esm/view/HoverCard/components/HoverCardContent.js +9 -0
  39. package/dist/esm/view/HoverCard/components/views/forbidden/index.js +71 -0
  40. package/dist/esm/view/HoverCard/components/views/forbidden/styled.js +8 -0
  41. package/dist/esm/view/HoverCard/components/views/forbidden/types.js +1 -0
  42. package/dist/esm/view/HoverCard/styled.js +2 -2
  43. package/dist/esm/view/LinkUrl/index.js +1 -1
  44. package/dist/types/extractors/common/context/extractAccessContext.d.ts +5 -0
  45. package/dist/types/messages.d.ts +1 -1
  46. package/dist/types/view/BlockCard/actions/ForbiddenAction.d.ts +1 -1
  47. package/dist/types/view/HoverCard/components/CustomPopupContainer.d.ts +1 -1
  48. package/dist/types/view/HoverCard/components/views/forbidden/index.d.ts +4 -0
  49. package/dist/types/view/HoverCard/components/views/forbidden/styled.d.ts +3 -0
  50. package/dist/types/view/HoverCard/components/views/forbidden/types.d.ts +13 -0
  51. package/dist/types/view/HoverCard/styled.d.ts +1 -1
  52. package/dist/types/view/types.d.ts +1 -0
  53. package/dist/types-ts4.5/extractors/common/context/extractAccessContext.d.ts +5 -0
  54. package/dist/types-ts4.5/messages.d.ts +1 -1
  55. package/dist/types-ts4.5/view/BlockCard/actions/ForbiddenAction.d.ts +1 -1
  56. package/dist/types-ts4.5/view/HoverCard/components/CustomPopupContainer.d.ts +1 -1
  57. package/dist/types-ts4.5/view/HoverCard/components/views/forbidden/index.d.ts +4 -0
  58. package/dist/types-ts4.5/view/HoverCard/components/views/forbidden/styled.d.ts +3 -0
  59. package/dist/types-ts4.5/view/HoverCard/components/views/forbidden/types.d.ts +13 -0
  60. package/dist/types-ts4.5/view/HoverCard/styled.d.ts +1 -1
  61. package/dist/types-ts4.5/view/types.d.ts +1 -0
  62. package/package.json +6 -3
@@ -17,9 +17,6 @@ const PreviewBlock = ({
17
17
  overrideUrl,
18
18
  ...blockProps
19
19
  }) => {
20
- if (status !== SmartLinkStatus.Resolved) {
21
- return null;
22
- }
23
20
  return jsx(PreviewBlockResolvedView, _extends({}, blockProps, {
24
21
  testId: testId,
25
22
  overrideUrl: overrideUrl
@@ -7,6 +7,7 @@ import { extractErrorIcon } from '../../extractors/flexible/icon';
7
7
  import { handleOnClick } from '../../utils';
8
8
  import { extractProvider } from '@atlaskit/link-extractors';
9
9
  import extractProviderIcon from '../../extractors/flexible/icon/extract-provider-icon';
10
+ import extractPreview from '../../extractors/flexible/extract-preview';
10
11
  export const getContextByStatus = params => {
11
12
  const {
12
13
  response,
@@ -28,13 +29,15 @@ export const getContextByStatus = params => {
28
29
  case SmartLinkStatus.Errored:
29
30
  case SmartLinkStatus.Fallback:
30
31
  default:
32
+ const preview = extractPreview(response === null || response === void 0 ? void 0 : response.data);
31
33
  const linkIcon = extractErrorIcon(response, status);
32
34
  const provider = extractProviderIcon(response === null || response === void 0 ? void 0 : response.data);
33
35
  return {
34
36
  linkIcon,
35
37
  title: url,
36
38
  url,
37
- provider
39
+ provider,
40
+ preview
38
41
  };
39
42
  }
40
43
  };
@@ -192,7 +192,7 @@ export const HoverCardComponent = ({
192
192
  id: id,
193
193
  source: HOVER_CARD_SOURCE
194
194
  }, jsx(HoverCardContent, hoverCardContentProps));
195
- }, [initHideCard, initShowCard, filteredActions, linkState, onActionClick, renderers, showServerActions, url, id]);
195
+ }, [initShowCard, initHideCard, filteredActions, linkState, onActionClick, renderers, showServerActions, url, id]);
196
196
  const trigger = useCallback(triggerProps => jsx("span", {
197
197
  ref: parentSpan
198
198
  }, jsx("span", _extends({}, triggerProps, {
@@ -17,6 +17,8 @@ import { FormattedMessage } from 'react-intl-next';
17
17
  import { messages } from '../../../messages';
18
18
  import { fireLinkClickedEvent } from '../../../utils/analytics/click';
19
19
  import { useSmartCardState } from '../../../state/store';
20
+ import HoverCardForbiddenView from './views/forbidden';
21
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
20
22
  export const hoverCardClassName = 'smart-links-hover-preview';
21
23
  export const getCopyAction = url => ({
22
24
  name: ActionName.CustomAction,
@@ -141,6 +143,13 @@ const HoverCardContent = ({
141
143
  url: url
142
144
  });
143
145
  }
146
+ if (getBooleanFF('platform.linking-platform.smart-card.cross-join')) {
147
+ if (cardState.status === 'forbidden') {
148
+ return jsx(HoverCardForbiddenView, {
149
+ flexibleCardProps: flexibleCardProps
150
+ });
151
+ }
152
+ }
144
153
  if (cardState.status === 'resolved') {
145
154
  return jsx(HoverCardResolvedView, {
146
155
  id: id,
@@ -0,0 +1,72 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { useMemo } from 'react';
3
+ import { FormattedMessage } from 'react-intl-next';
4
+ import FlexibleCard from '../../../../FlexibleCard';
5
+ import { messages } from '../../../../../messages';
6
+ import { CustomBlock, PreviewBlock } from '../../../../FlexibleCard/components/blocks';
7
+ import { extractProvider } from '@atlaskit/link-extractors';
8
+ import { connectButtonStyles, mainTextStyles, titleBlockStyles } from './styled';
9
+ import ActionGroup from '../../../../FlexibleCard/components/blocks/action-group';
10
+ import { ActionName } from '../../../../../constants';
11
+ import { getPreviewBlockStyles } from '../../../styled';
12
+ import { extractRequestAccessContextImproved } from '../../../../../extractors/common/context/extractAccessContext';
13
+ const HoverCardForbiddenView = ({
14
+ flexibleCardProps,
15
+ testId = 'hover-card-forbidden-view'
16
+ }) => {
17
+ var _cardState$details, _cardState$details2, _extractProvider$text, _extractProvider;
18
+ const {
19
+ cardState,
20
+ url
21
+ } = flexibleCardProps;
22
+ const data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
23
+ const meta = (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.meta;
24
+ const product = (_extractProvider$text = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text) !== null && _extractProvider$text !== void 0 ? _extractProvider$text : '';
25
+ const hostname = new URL(url).hostname;
26
+ const {
27
+ action,
28
+ descriptiveMessageKey,
29
+ titleMessageKey
30
+ } = extractRequestAccessContextImproved({
31
+ jsonLd: meta,
32
+ url,
33
+ product
34
+ });
35
+ const actions = useMemo(() => [{
36
+ name: ActionName.CustomAction,
37
+ content: action === null || action === void 0 ? void 0 : action.text,
38
+ onClick: action === null || action === void 0 ? void 0 : action.promise
39
+ }], [action]);
40
+ if (!titleMessageKey || !descriptiveMessageKey) {
41
+ return null;
42
+ }
43
+ return /*#__PURE__*/React.createElement(FlexibleCard, _extends({}, flexibleCardProps, {
44
+ testId: testId
45
+ }), /*#__PURE__*/React.createElement(PreviewBlock, {
46
+ ignoreContainerPadding: true,
47
+ overrideCss: getPreviewBlockStyles(),
48
+ testId: testId
49
+ }), /*#__PURE__*/React.createElement(CustomBlock, {
50
+ overrideCss: titleBlockStyles,
51
+ testId: `${testId}-title`
52
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[titleMessageKey], {
53
+ values: {
54
+ product
55
+ }
56
+ }))), /*#__PURE__*/React.createElement(CustomBlock, {
57
+ overrideCss: mainTextStyles,
58
+ testId: `${testId}-content`
59
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[descriptiveMessageKey], {
60
+ values: {
61
+ product,
62
+ hostname
63
+ }
64
+ }))), action && /*#__PURE__*/React.createElement(CustomBlock, {
65
+ overrideCss: connectButtonStyles,
66
+ testId: `${testId}-button`
67
+ }, /*#__PURE__*/React.createElement(ActionGroup, {
68
+ items: actions,
69
+ appearance: "primary"
70
+ })));
71
+ };
72
+ export default HoverCardForbiddenView;
@@ -0,0 +1,17 @@
1
+ import { css } from '@emotion/react';
2
+ const blockGap = '0rem';
3
+ const titleFontWeight = '600';
4
+ export const titleBlockStyles = css`
5
+ justify-content: center;
6
+ font-weight: ${titleFontWeight};
7
+ `;
8
+ export const mainTextStyles = css`
9
+ justify-content: center;
10
+ margin-top: ${blockGap};
11
+ font-size: 0.75rem;
12
+ text-align: center;
13
+ `;
14
+ export const connectButtonStyles = css`
15
+ justify-content: center;
16
+ margin-top: ${blockGap};
17
+ `;
@@ -76,8 +76,9 @@ export const popupContainerStyles = css`
76
76
  dark: "var(--ds-shadow-overlay, 0px 0px 0px rgba(188, 214, 240, 0.12),0px 8px 12px rgba(3, 4, 4, 0.36),0px 0px 1px rgba(3, 4, 4, 0.5))"
77
77
  })()};
78
78
  `;
79
- export const getPreviewBlockStyles = snippetHeight => css`
80
- height: ${snippetHeight}px;
79
+ export const getPreviewBlockStyles = previewHeight => css`
80
+ ${previewHeight ? `height: ${previewHeight}px;` : ''}
81
+
81
82
  ${getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? ` border-top-left-radius: ${"var(--ds-border-radius-200, 8px)"};
82
83
  border-top-right-radius: ${"var(--ds-border-radius-200, 8px)"};
83
84
  margin-bottom: ${blockGap};
@@ -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.28.1",
11
+ packageVersion: "26.29.0",
12
12
  componentName: 'linkUrl'
13
13
  };
14
14
  const Link = withLinkClickedEvent('a');
@@ -15,7 +15,9 @@ export var extractRequestAccessContext = function extractRequestAccessContext(_r
15
15
  descriptiveMessageKey: 'click_to_join_description',
16
16
  action: ForbiddenAction(function () {
17
17
  return window.open(url);
18
- }, 'click_to_join', messages.click_to_join, context)
18
+ }, 'click_to_join', messages.click_to_join, {
19
+ context: context
20
+ })
19
21
  });
20
22
  case 'REQUEST_ACCESS':
21
23
  return _objectSpread(_objectSpread({}, jsonLd === null || jsonLd === void 0 ? void 0 : jsonLd.requestAccess), {}, {
@@ -23,7 +25,9 @@ export var extractRequestAccessContext = function extractRequestAccessContext(_r
23
25
  descriptiveMessageKey: 'request_access_description',
24
26
  action: ForbiddenAction(function () {
25
27
  return window.open(url);
26
- }, 'request_access', messages.request_access, context)
28
+ }, 'request_access', messages.request_access, {
29
+ context: context
30
+ })
27
31
  });
28
32
  case 'PENDING_REQUEST_EXISTS':
29
33
  return _objectSpread(_objectSpread({}, jsonLd === null || jsonLd === void 0 ? void 0 : jsonLd.requestAccess), {}, {
@@ -40,4 +44,62 @@ export var extractRequestAccessContext = function extractRequestAccessContext(_r
40
44
  default:
41
45
  return jsonLd === null || jsonLd === void 0 ? void 0 : jsonLd.requestAccess;
42
46
  }
47
+ };
48
+ export var extractRequestAccessContextImproved = function extractRequestAccessContextImproved(_ref2) {
49
+ var _jsonLd$requestAccess2;
50
+ var jsonLd = _ref2.jsonLd,
51
+ url = _ref2.url,
52
+ product = _ref2.product;
53
+ switch (jsonLd === null || jsonLd === void 0 ? void 0 : (_jsonLd$requestAccess2 = jsonLd.requestAccess) === null || _jsonLd$requestAccess2 === void 0 ? void 0 : _jsonLd$requestAccess2.accessType) {
54
+ case 'DIRECT_ACCESS':
55
+ return _objectSpread(_objectSpread({}, jsonLd === null || jsonLd === void 0 ? void 0 : jsonLd.requestAccess), {}, {
56
+ titleMessageKey: 'direct_access_title_crossjoin',
57
+ descriptiveMessageKey: 'direct_access_description_crossjoin',
58
+ callToActionMessageKey: 'direct_access_crossjoin',
59
+ action: ForbiddenAction(function () {
60
+ return window.open(url);
61
+ }, 'direct_access', messages.direct_access_crossjoin, {
62
+ product: product
63
+ })
64
+ });
65
+ case 'REQUEST_ACCESS':
66
+ return _objectSpread(_objectSpread({}, jsonLd === null || jsonLd === void 0 ? void 0 : jsonLd.requestAccess), {}, {
67
+ titleMessageKey: 'default_no_access_title_crossjoin',
68
+ descriptiveMessageKey: 'request_access_description_crossjoin',
69
+ callToActionMessageKey: 'request_access_crossjoin',
70
+ action: ForbiddenAction(function () {
71
+ return window.open(url);
72
+ }, 'request_access', messages.request_access_crossjoin)
73
+ });
74
+ case 'PENDING_REQUEST_EXISTS':
75
+ return _objectSpread(_objectSpread({}, jsonLd === null || jsonLd === void 0 ? void 0 : jsonLd.requestAccess), {}, {
76
+ titleMessageKey: 'request_access_pending_title_crossjoin',
77
+ descriptiveMessageKey: 'request_access_pending_description_crossjoin',
78
+ callToActionMessageKey: 'request_access_pending_crossjoin',
79
+ action: ForbiddenAction(function () {
80
+ return window.open(url);
81
+ }, 'request_access_pending', messages.request_access_pending_crossjoin)
82
+ });
83
+ case 'DENIED_REQUEST_EXISTS':
84
+ return _objectSpread(_objectSpread({}, jsonLd === null || jsonLd === void 0 ? void 0 : jsonLd.requestAccess), {}, {
85
+ titleMessageKey: 'default_no_access_title_crossjoin',
86
+ descriptiveMessageKey: 'request_denied_description_crossjoin'
87
+ });
88
+ case 'ACCESS_EXISTS':
89
+ return _objectSpread(_objectSpread({}, jsonLd === null || jsonLd === void 0 ? void 0 : jsonLd.requestAccess), {}, {
90
+ titleMessageKey: 'default_no_access_title_crossjoin',
91
+ descriptiveMessageKey: 'access_exists_description_crossjoin',
92
+ callToActionMessageKey: 'request_access_crossjoin',
93
+ action: ForbiddenAction(function () {
94
+ return window.open(url);
95
+ }, 'access_exists', messages.request_access_crossjoin)
96
+ });
97
+ case 'FORBIDDEN':
98
+ return _objectSpread(_objectSpread({}, jsonLd === null || jsonLd === void 0 ? void 0 : jsonLd.requestAccess), {}, {
99
+ titleMessageKey: 'forbidden_title_crossjoin',
100
+ descriptiveMessageKey: 'forbidden_description_crossjoin'
101
+ });
102
+ default:
103
+ return jsonLd === null || jsonLd === void 0 ? void 0 : jsonLd.requestAccess;
104
+ }
43
105
  };
@@ -1,6 +1,9 @@
1
1
  import { extractImage } from '@atlaskit/link-extractors';
2
2
  import { MediaType } from '../../constants';
3
3
  var extractPreview = function extractPreview(data) {
4
+ if (!data) {
5
+ return undefined;
6
+ }
4
7
  var url = extractImage(data);
5
8
  return url ? {
6
9
  type: MediaType.Image,
@@ -1,4 +1,7 @@
1
1
  import { defineMessages } from 'react-intl-next';
2
+
3
+ // | 'forbidden_access_crossjoin'
4
+ // | 'forbidden_description_crossjoin';
2
5
  export var messages = defineMessages({
3
6
  actions: {
4
7
  id: 'fabric.linking.actions',
@@ -454,5 +457,84 @@ export var messages = defineMessages({
454
457
  id: 'fabric.linking.srclinkunknown',
455
458
  defaultMessage: 'View Original',
456
459
  description: "We have a link in our preview modals to the original document. This is for when we don't know the provider name"
460
+ },
461
+ /**
462
+ * Temp messages to put behind a feature flag for the cross join stream, replace the messages with the message of the same
463
+ * title (without _crossjoin) during cleanup in EDM-7977 [https://product-fabric.atlassian.net/browse/EDM-7977].
464
+ */
465
+ default_no_access_title_crossjoin: {
466
+ id: 'fabric.linking.no_access_title_crossjoin',
467
+ defaultMessage: "You don't have access to this content",
468
+ description: 'Informs the user that they dont have access to certain content'
469
+ },
470
+ direct_access_title_crossjoin: {
471
+ id: 'fabric.linking.direct_access_title_crossjoin',
472
+ defaultMessage: 'Join your team in {product}',
473
+ description: 'Informs the user that they have access to this product, and can sign up or join right away.'
474
+ },
475
+ direct_access_description_crossjoin: {
476
+ id: 'fabric.linking.direct_access_description_crossjoin',
477
+ defaultMessage: 'All accounts with your same email domain are approved to access {hostname} in {product}.',
478
+ description: 'Informs the user that they have access to this product, and can sign up or join right away.'
479
+ },
480
+ direct_access_crossjoin: {
481
+ id: 'fabric.linking.direct_access_crossjoin',
482
+ defaultMessage: 'Go to {product}',
483
+ description: 'Allows the user join the product or service immediately'
484
+ },
485
+ request_access_description_crossjoin: {
486
+ id: 'fabric.linking.request_access_description_crossjoin',
487
+ defaultMessage: 'Contact your admin to request access.',
488
+ description: 'Informs the user to request access to a product by talking to the website administrator'
489
+ },
490
+ request_access_crossjoin: {
491
+ id: 'fabric.linking.request_access_crossjoin',
492
+ defaultMessage: 'Request access',
493
+ description: 'Allows the user to request access to a product or service'
494
+ },
495
+ request_access_pending_title_crossjoin: {
496
+ id: 'fabric.linking.request_access_pending_title_crossjoin',
497
+ defaultMessage: 'Access to {product} pending',
498
+ description: 'Informs the user that their request to view this content is pending'
499
+ },
500
+ request_access_pending_description_crossjoin: {
501
+ id: 'fabric.linking.request_access_pending_description_crossjoin',
502
+ defaultMessage: 'Your request to access {hostname} is awaiting admin approval.',
503
+ description: 'Informs the user that their request to view this content is pending website administrator approval'
504
+ },
505
+ request_access_pending_crossjoin: {
506
+ id: 'fabric.linking.request_access_pending_crossjoin',
507
+ defaultMessage: 'Pending approval',
508
+ description: 'Informs the user that their request to view this content is pending'
509
+ },
510
+ request_denied_description_crossjoin: {
511
+ id: 'fabric.linking.request_denied_description_crossjoin',
512
+ defaultMessage: "Your admin didn't approve your request to view {product} pages from {hostname}.",
513
+ description: 'Informs the user that their request to view this content was denied'
514
+ },
515
+ access_exists_description_crossjoin: {
516
+ id: 'fabric.linking.access_exists_description',
517
+ defaultMessage: 'Contact your admin and request access to view this content from {hostname}.',
518
+ description: 'Informs the user to contact the website administrator to request access to a product'
519
+ },
520
+ not_found_description_crossjoin: {
521
+ id: 'fabric.linking.not_found_description_crossjoin',
522
+ defaultMessage: "The page doesn't exist or it may have changed after this link was added.",
523
+ description: 'Error case for when a provided item is not found within the list of items'
524
+ },
525
+ not_found_title_crossjoin: {
526
+ id: 'fabric.linking.not_found_title_crossjoin',
527
+ defaultMessage: "We can't show you this {product} page",
528
+ description: 'Error case for when a provided link is not found'
529
+ },
530
+ forbidden_title_crossjoin: {
531
+ id: 'fabric.linking.forbidden_title_crossjoin',
532
+ defaultMessage: "You don't have access to this content",
533
+ description: 'Informs the user that they do not have access to the linked content.'
534
+ },
535
+ forbidden_description_crossjoin: {
536
+ id: 'fabric.linking.forbidden_description_crossjoin',
537
+ defaultMessage: 'Contact your admin to request access.',
538
+ description: 'Informs the user that they must contact the site administrator for access.'
457
539
  }
458
540
  });
@@ -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.28.1"
18
+ packageVersion: "26.29.0"
19
19
  };
20
20
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
21
21
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -5,13 +5,11 @@ import { messages } from '../../../messages';
5
5
  export var ForbiddenAction = function ForbiddenAction(handler) {
6
6
  var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'connect-other-account';
7
7
  var message = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : messages.try_another_account;
8
- var context = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
8
+ var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
9
9
  return {
10
10
  id: id,
11
11
  text: /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, message, {
12
- values: {
13
- context: context
14
- }
12
+ values: values
15
13
  })),
16
14
  promise: function promise() {
17
15
  return new Promise(function (resolve) {
@@ -20,9 +20,6 @@ var PreviewBlock = function PreviewBlock(_ref) {
20
20
  testId = _ref$testId === void 0 ? 'smart-block-preview' : _ref$testId,
21
21
  overrideUrl = _ref.overrideUrl,
22
22
  blockProps = _objectWithoutProperties(_ref, _excluded);
23
- if (status !== SmartLinkStatus.Resolved) {
24
- return null;
25
- }
26
23
  return jsx(PreviewBlockResolvedView, _extends({}, blockProps, {
27
24
  testId: testId,
28
25
  overrideUrl: overrideUrl
@@ -7,6 +7,7 @@ import { extractErrorIcon } from '../../extractors/flexible/icon';
7
7
  import { handleOnClick } from '../../utils';
8
8
  import { extractProvider } from '@atlaskit/link-extractors';
9
9
  import extractProviderIcon from '../../extractors/flexible/icon/extract-provider-icon';
10
+ import extractPreview from '../../extractors/flexible/extract-preview';
10
11
  export var getContextByStatus = function getContextByStatus(params) {
11
12
  var _ref = params !== null && params !== void 0 ? params : {},
12
13
  response = _ref.response,
@@ -27,13 +28,15 @@ export var getContextByStatus = function getContextByStatus(params) {
27
28
  case SmartLinkStatus.Errored:
28
29
  case SmartLinkStatus.Fallback:
29
30
  default:
31
+ var preview = extractPreview(response === null || response === void 0 ? void 0 : response.data);
30
32
  var linkIcon = extractErrorIcon(response, status);
31
33
  var provider = extractProviderIcon(response === null || response === void 0 ? void 0 : response.data);
32
34
  return {
33
35
  linkIcon: linkIcon,
34
36
  title: url,
35
37
  url: url,
36
- provider: provider
38
+ provider: provider,
39
+ preview: preview
37
40
  };
38
41
  }
39
42
  };
@@ -208,7 +208,7 @@ export var HoverCardComponent = function HoverCardComponent(_ref) {
208
208
  id: id,
209
209
  source: HOVER_CARD_SOURCE
210
210
  }, jsx(HoverCardContent, hoverCardContentProps));
211
- }, [initHideCard, initShowCard, filteredActions, linkState, onActionClick, renderers, showServerActions, url, id]);
211
+ }, [initShowCard, initHideCard, filteredActions, linkState, onActionClick, renderers, showServerActions, url, id]);
212
212
  var trigger = useCallback(function (triggerProps) {
213
213
  return jsx("span", {
214
214
  ref: parentSpan
@@ -19,6 +19,8 @@ import { FormattedMessage } from 'react-intl-next';
19
19
  import { messages } from '../../../messages';
20
20
  import { fireLinkClickedEvent } from '../../../utils/analytics/click';
21
21
  import { useSmartCardState } from '../../../state/store';
22
+ import HoverCardForbiddenView from './views/forbidden';
23
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
22
24
  export var hoverCardClassName = 'smart-links-hover-preview';
23
25
  export var getCopyAction = function getCopyAction(url) {
24
26
  return {
@@ -169,6 +171,13 @@ var HoverCardContent = function HoverCardContent(_ref) {
169
171
  url: url
170
172
  });
171
173
  }
174
+ if (getBooleanFF('platform.linking-platform.smart-card.cross-join')) {
175
+ if (cardState.status === 'forbidden') {
176
+ return jsx(HoverCardForbiddenView, {
177
+ flexibleCardProps: flexibleCardProps
178
+ });
179
+ }
180
+ }
172
181
  if (cardState.status === 'resolved') {
173
182
  return jsx(HoverCardResolvedView, {
174
183
  id: id,
@@ -0,0 +1,71 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { useMemo } from 'react';
3
+ import { FormattedMessage } from 'react-intl-next';
4
+ import FlexibleCard from '../../../../FlexibleCard';
5
+ import { messages } from '../../../../../messages';
6
+ import { CustomBlock, PreviewBlock } from '../../../../FlexibleCard/components/blocks';
7
+ import { extractProvider } from '@atlaskit/link-extractors';
8
+ import { connectButtonStyles, mainTextStyles, titleBlockStyles } from './styled';
9
+ import ActionGroup from '../../../../FlexibleCard/components/blocks/action-group';
10
+ import { ActionName } from '../../../../../constants';
11
+ import { getPreviewBlockStyles } from '../../../styled';
12
+ import { extractRequestAccessContextImproved } from '../../../../../extractors/common/context/extractAccessContext';
13
+ var HoverCardForbiddenView = function HoverCardForbiddenView(_ref) {
14
+ var _cardState$details, _cardState$details2, _extractProvider$text, _extractProvider;
15
+ var flexibleCardProps = _ref.flexibleCardProps,
16
+ _ref$testId = _ref.testId,
17
+ testId = _ref$testId === void 0 ? 'hover-card-forbidden-view' : _ref$testId;
18
+ var cardState = flexibleCardProps.cardState,
19
+ url = flexibleCardProps.url;
20
+ var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
21
+ var meta = (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.meta;
22
+ var product = (_extractProvider$text = (_extractProvider = extractProvider(data)) === null || _extractProvider === void 0 ? void 0 : _extractProvider.text) !== null && _extractProvider$text !== void 0 ? _extractProvider$text : '';
23
+ var hostname = new URL(url).hostname;
24
+ var _extractRequestAccess = extractRequestAccessContextImproved({
25
+ jsonLd: meta,
26
+ url: url,
27
+ product: product
28
+ }),
29
+ action = _extractRequestAccess.action,
30
+ descriptiveMessageKey = _extractRequestAccess.descriptiveMessageKey,
31
+ titleMessageKey = _extractRequestAccess.titleMessageKey;
32
+ var actions = useMemo(function () {
33
+ return [{
34
+ name: ActionName.CustomAction,
35
+ content: action === null || action === void 0 ? void 0 : action.text,
36
+ onClick: action === null || action === void 0 ? void 0 : action.promise
37
+ }];
38
+ }, [action]);
39
+ if (!titleMessageKey || !descriptiveMessageKey) {
40
+ return null;
41
+ }
42
+ return /*#__PURE__*/React.createElement(FlexibleCard, _extends({}, flexibleCardProps, {
43
+ testId: testId
44
+ }), /*#__PURE__*/React.createElement(PreviewBlock, {
45
+ ignoreContainerPadding: true,
46
+ overrideCss: getPreviewBlockStyles(),
47
+ testId: testId
48
+ }), /*#__PURE__*/React.createElement(CustomBlock, {
49
+ overrideCss: titleBlockStyles,
50
+ testId: "".concat(testId, "-title")
51
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[titleMessageKey], {
52
+ values: {
53
+ product: product
54
+ }
55
+ }))), /*#__PURE__*/React.createElement(CustomBlock, {
56
+ overrideCss: mainTextStyles,
57
+ testId: "".concat(testId, "-content")
58
+ }, /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, messages[descriptiveMessageKey], {
59
+ values: {
60
+ product: product,
61
+ hostname: hostname
62
+ }
63
+ }))), action && /*#__PURE__*/React.createElement(CustomBlock, {
64
+ overrideCss: connectButtonStyles,
65
+ testId: "".concat(testId, "-button")
66
+ }, /*#__PURE__*/React.createElement(ActionGroup, {
67
+ items: actions,
68
+ appearance: "primary"
69
+ })));
70
+ };
71
+ export default HoverCardForbiddenView;
@@ -0,0 +1,8 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+ var _templateObject, _templateObject2, _templateObject3;
3
+ import { css } from '@emotion/react';
4
+ var blockGap = '0rem';
5
+ var titleFontWeight = '600';
6
+ export var titleBlockStyles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n justify-content: center;\n font-weight: ", ";\n"])), titleFontWeight);
7
+ export var mainTextStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n justify-content: center;\n margin-top: ", ";\n font-size: 0.75rem;\n text-align: center;\n"])), blockGap);
8
+ export var connectButtonStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n justify-content: center;\n margin-top: ", ";\n"])), blockGap);
@@ -40,6 +40,6 @@ export var popupContainerStyles = css(_templateObject5 || (_templateObject5 = _t
40
40
  light: "var(--ds-shadow-overlay, 0px 8px 12px rgba(9, 30, 66, 0.15),0px 0px 1px rgba(9, 30, 66, 0.31))",
41
41
  dark: "var(--ds-shadow-overlay, 0px 0px 0px rgba(188, 214, 240, 0.12),0px 8px 12px rgba(3, 4, 4, 0.36),0px 0px 1px rgba(3, 4, 4, 0.5))"
42
42
  })());
43
- export var getPreviewBlockStyles = function getPreviewBlockStyles(snippetHeight) {
44
- return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n height: ", "px;\n ", "\n"])), snippetHeight, getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? " border-top-left-radius: ".concat("var(--ds-border-radius-200, 8px)", ";\n border-top-right-radius: ", "var(--ds-border-radius-200, 8px)", ";\n margin-bottom: ", blockGap, ";\n }") : "");
43
+ export var getPreviewBlockStyles = function getPreviewBlockStyles(previewHeight) {
44
+ return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n\n ", "\n"])), previewHeight ? "height: ".concat(previewHeight, "px;") : '', getBooleanFF('platform.linking-platform.smart-card.show-smart-links-refreshed-design') ? " border-top-left-radius: ".concat("var(--ds-border-radius-200, 8px)", ";\n border-top-right-radius: ", "var(--ds-border-radius-200, 8px)", ";\n margin-bottom: ", blockGap, ";\n }") : "");
45
45
  };
@@ -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.28.1",
14
+ packageVersion: "26.29.0",
15
15
  componentName: 'linkUrl'
16
16
  };
17
17
  var Link = withLinkClickedEvent('a');
@@ -5,3 +5,8 @@ export declare const extractRequestAccessContext: ({ jsonLd, url, context, }: {
5
5
  url: string;
6
6
  context?: string | undefined;
7
7
  }) => RequestAccessContextProps;
8
+ export declare const extractRequestAccessContextImproved: ({ jsonLd, url, product, }: {
9
+ jsonLd: JsonLd.Meta.BaseMeta;
10
+ url: string;
11
+ product: string;
12
+ }) => RequestAccessContextProps;
@@ -1,5 +1,5 @@
1
1
  import { MessageDescriptor } from 'react-intl-next';
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';
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
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;
4
4
  type Messages = {
5
5
  [K in MessageKey]: MessageDescriptor;
@@ -1,2 +1,2 @@
1
1
  import { ActionProps } from '../components/Action';
2
- export declare const ForbiddenAction: (handler: () => void, id?: string, message?: import("react-intl-next").MessageDescriptor, context?: string) => ActionProps;
2
+ export declare const ForbiddenAction: (handler: () => void, id?: string, message?: import("react-intl-next").MessageDescriptor, values?: {}) => ActionProps;
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import { PopupComponentProps } from '@atlaskit/popup';
4
- declare const CustomPopupContainer: React.ForwardRefExoticComponent<Pick<PopupComponentProps, "children" | "style" | "id" | "tabIndex" | "data-testid" | "data-placement"> & React.RefAttributes<HTMLDivElement>>;
4
+ declare const CustomPopupContainer: React.ForwardRefExoticComponent<Pick<PopupComponentProps, "children" | "style" | "id" | "tabIndex" | "data-testid" | "shouldRenderToParent" | "data-placement"> & React.RefAttributes<HTMLDivElement>>;
5
5
  export default CustomPopupContainer;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { HoverCardForbiddenProps } from './types';
3
+ declare const HoverCardForbiddenView: React.FC<HoverCardForbiddenProps>;
4
+ export default HoverCardForbiddenView;
@@ -0,0 +1,3 @@
1
+ export declare const titleBlockStyles: import("@emotion/react").SerializedStyles;
2
+ export declare const mainTextStyles: import("@emotion/react").SerializedStyles;
3
+ export declare const connectButtonStyles: import("@emotion/react").SerializedStyles;