@atlaskit/smart-card 40.17.2 → 40.19.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 (98) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/cjs/extractors/action/extract-invoke-preview-action.js +9 -2
  3. package/dist/cjs/state/hooks-external/useSmartLinkActions.js +8 -1
  4. package/dist/cjs/utils/analytics/analytics.js +1 -1
  5. package/dist/cjs/utils/iframe-utils.js +40 -0
  6. package/dist/cjs/view/EmbedCard/components/ImageIcon.compiled.css +1 -1
  7. package/dist/cjs/view/EmbedCard/components/ImageIcon.js +1 -1
  8. package/dist/cjs/view/EmbedCard/components/styled.compiled.css +1 -1
  9. package/dist/cjs/view/EmbedCard/components/styled.js +2 -2
  10. package/dist/cjs/view/EmbedModal/utils.js +21 -3
  11. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/main.compiled.css +1 -1
  12. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/main.js +1 -1
  13. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule/main.compiled.css +1 -1
  14. package/dist/cjs/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule/main.js +2 -2
  15. package/dist/cjs/view/FlexibleCard/components/blocks/action-block/action-footer/index.compiled.css +1 -1
  16. package/dist/cjs/view/FlexibleCard/components/blocks/action-block/action-footer/index.js +1 -1
  17. package/dist/cjs/view/FlexibleCard/components/common/image-icon/index.compiled.css +1 -1
  18. package/dist/cjs/view/FlexibleCard/components/common/image-icon/index.js +1 -1
  19. package/dist/cjs/view/InlineCard/ForbiddenView/index.compiled.css +1 -1
  20. package/dist/cjs/view/InlineCard/ForbiddenView/index.js +1 -1
  21. package/dist/cjs/view/InlineCard/IconAndTitleLayout/index.compiled.css +1 -2
  22. package/dist/cjs/view/InlineCard/IconAndTitleLayout/index.js +2 -2
  23. package/dist/cjs/view/LinkUrl/HyperlinkResolver/error-boundary.js +17 -0
  24. package/dist/cjs/view/LinkUrl/HyperlinkResolver/hooks/useScheduledRegister.js +82 -0
  25. package/dist/cjs/view/LinkUrl/HyperlinkResolver/index.js +34 -0
  26. package/dist/cjs/view/LinkUrl/HyperlinkResolver/resolve-hyperlink.js +69 -0
  27. package/dist/cjs/view/LinkUrl/index.js +10 -3
  28. package/dist/es2019/extractors/action/extract-invoke-preview-action.js +6 -1
  29. package/dist/es2019/state/hooks-external/useSmartLinkActions.js +8 -1
  30. package/dist/es2019/utils/analytics/analytics.js +1 -1
  31. package/dist/es2019/utils/iframe-utils.js +34 -0
  32. package/dist/es2019/view/EmbedCard/components/ImageIcon.compiled.css +1 -1
  33. package/dist/es2019/view/EmbedCard/components/ImageIcon.js +1 -1
  34. package/dist/es2019/view/EmbedCard/components/styled.compiled.css +1 -1
  35. package/dist/es2019/view/EmbedCard/components/styled.js +2 -2
  36. package/dist/es2019/view/EmbedModal/utils.js +12 -0
  37. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/main.compiled.css +1 -1
  38. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/main.js +1 -1
  39. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule/main.compiled.css +1 -1
  40. package/dist/es2019/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule/main.js +2 -2
  41. package/dist/es2019/view/FlexibleCard/components/blocks/action-block/action-footer/index.compiled.css +1 -1
  42. package/dist/es2019/view/FlexibleCard/components/blocks/action-block/action-footer/index.js +1 -1
  43. package/dist/es2019/view/FlexibleCard/components/common/image-icon/index.compiled.css +1 -1
  44. package/dist/es2019/view/FlexibleCard/components/common/image-icon/index.js +1 -1
  45. package/dist/es2019/view/InlineCard/ForbiddenView/index.compiled.css +1 -1
  46. package/dist/es2019/view/InlineCard/ForbiddenView/index.js +1 -1
  47. package/dist/es2019/view/InlineCard/IconAndTitleLayout/index.compiled.css +1 -2
  48. package/dist/es2019/view/InlineCard/IconAndTitleLayout/index.js +2 -2
  49. package/dist/es2019/view/LinkUrl/HyperlinkResolver/error-boundary.js +8 -0
  50. package/dist/es2019/view/LinkUrl/HyperlinkResolver/hooks/useScheduledRegister.js +77 -0
  51. package/dist/es2019/view/LinkUrl/HyperlinkResolver/index.js +26 -0
  52. package/dist/es2019/view/LinkUrl/HyperlinkResolver/resolve-hyperlink.js +58 -0
  53. package/dist/es2019/view/LinkUrl/index.js +8 -2
  54. package/dist/esm/extractors/action/extract-invoke-preview-action.js +9 -2
  55. package/dist/esm/state/hooks-external/useSmartLinkActions.js +8 -1
  56. package/dist/esm/utils/analytics/analytics.js +1 -1
  57. package/dist/esm/utils/iframe-utils.js +34 -0
  58. package/dist/esm/view/EmbedCard/components/ImageIcon.compiled.css +1 -1
  59. package/dist/esm/view/EmbedCard/components/ImageIcon.js +1 -1
  60. package/dist/esm/view/EmbedCard/components/styled.compiled.css +1 -1
  61. package/dist/esm/view/EmbedCard/components/styled.js +2 -2
  62. package/dist/esm/view/EmbedModal/utils.js +21 -3
  63. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/main.compiled.css +1 -1
  64. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/header/main.js +1 -1
  65. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule/main.compiled.css +1 -1
  66. package/dist/esm/view/FlexibleCard/components/actions/automation-action/automation-manual-triggers/manual-triggers-modal/sub-components/rule/main.js +2 -2
  67. package/dist/esm/view/FlexibleCard/components/blocks/action-block/action-footer/index.compiled.css +1 -1
  68. package/dist/esm/view/FlexibleCard/components/blocks/action-block/action-footer/index.js +1 -1
  69. package/dist/esm/view/FlexibleCard/components/common/image-icon/index.compiled.css +1 -1
  70. package/dist/esm/view/FlexibleCard/components/common/image-icon/index.js +1 -1
  71. package/dist/esm/view/InlineCard/ForbiddenView/index.compiled.css +1 -1
  72. package/dist/esm/view/InlineCard/ForbiddenView/index.js +1 -1
  73. package/dist/esm/view/InlineCard/IconAndTitleLayout/index.compiled.css +1 -2
  74. package/dist/esm/view/InlineCard/IconAndTitleLayout/index.js +2 -2
  75. package/dist/esm/view/LinkUrl/HyperlinkResolver/error-boundary.js +10 -0
  76. package/dist/esm/view/LinkUrl/HyperlinkResolver/hooks/useScheduledRegister.js +76 -0
  77. package/dist/esm/view/LinkUrl/HyperlinkResolver/index.js +25 -0
  78. package/dist/esm/view/LinkUrl/HyperlinkResolver/resolve-hyperlink.js +60 -0
  79. package/dist/esm/view/LinkUrl/index.js +10 -3
  80. package/dist/types/common/analytics/generated/analytics.types.d.ts +19 -0
  81. package/dist/types/state/hooks-external/useSmartLinkActions.d.ts +6 -1
  82. package/dist/types/utils/iframe-utils.d.ts +5 -0
  83. package/dist/types/view/EmbedModal/types.d.ts +1 -0
  84. package/dist/types/view/LinkUrl/HyperlinkResolver/error-boundary.d.ts +4 -0
  85. package/dist/types/view/LinkUrl/HyperlinkResolver/hooks/useScheduledRegister.d.ts +5 -0
  86. package/dist/types/view/LinkUrl/HyperlinkResolver/index.d.ts +7 -0
  87. package/dist/types/view/LinkUrl/HyperlinkResolver/resolve-hyperlink.d.ts +3 -0
  88. package/dist/types/view/LinkUrl/types.d.ts +4 -0
  89. package/dist/types-ts4.5/common/analytics/generated/analytics.types.d.ts +19 -0
  90. package/dist/types-ts4.5/state/hooks-external/useSmartLinkActions.d.ts +6 -1
  91. package/dist/types-ts4.5/utils/iframe-utils.d.ts +5 -0
  92. package/dist/types-ts4.5/view/EmbedModal/types.d.ts +1 -0
  93. package/dist/types-ts4.5/view/LinkUrl/HyperlinkResolver/error-boundary.d.ts +4 -0
  94. package/dist/types-ts4.5/view/LinkUrl/HyperlinkResolver/hooks/useScheduledRegister.d.ts +5 -0
  95. package/dist/types-ts4.5/view/LinkUrl/HyperlinkResolver/index.d.ts +7 -0
  96. package/dist/types-ts4.5/view/LinkUrl/HyperlinkResolver/resolve-hyperlink.d.ts +3 -0
  97. package/dist/types-ts4.5/view/LinkUrl/types.d.ts +4 -0
  98. package/package.json +6 -6
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
4
4
  export var context = {
5
5
  componentName: 'smart-cards',
6
6
  packageName: "@atlaskit/smart-card",
7
- packageVersion: "40.17.1"
7
+ packageVersion: "0.0.0-development"
8
8
  };
9
9
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
10
10
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -0,0 +1,34 @@
1
+ export var isInIframe = function isInIframe() {
2
+ try {
3
+ return window !== window.top;
4
+ } catch (_unused) {
5
+ // If we can't access window.top due to cross-origin restrictions, assume we're in an iframe
6
+ return true;
7
+ }
8
+ };
9
+ export var isWithinPreviewPanel = function isWithinPreviewPanel() {
10
+ try {
11
+ var params = new URLSearchParams(window.location.search);
12
+ return params.has('previewPanels') || params.get('embeddedConfluenceSource') === 'confluence-page-preview-panel';
13
+ } catch (_unused2) {
14
+ return false;
15
+ }
16
+ };
17
+ export var isModalWithinPreviewPanelIFrame = function isModalWithinPreviewPanelIFrame() {
18
+ return isInIframe() && isWithinPreviewPanel();
19
+ };
20
+
21
+ // Signals parent product to open embed modal via postMessage when in iframe context
22
+ export var openEmbedModalInParent = function openEmbedModalInParent(modalProps) {
23
+ if (!isInIframe()) {
24
+ return;
25
+ }
26
+ window.parent.postMessage({
27
+ type: 'OPEN_EMBED_MODAL',
28
+ payload: {
29
+ modal: {
30
+ url: (modalProps === null || modalProps === void 0 ? void 0 : modalProps.url) || ''
31
+ }
32
+ }
33
+ }, '*');
34
+ };
@@ -1 +1 @@
1
- ._2rko1twn{border-radius:var(--ds-border-radius-circle,9999px)}
1
+ ._2rko1rr0{border-radius:var(--ds-radius-full,9999px)}
@@ -8,7 +8,7 @@ import ImageLoader from 'react-render-image';
8
8
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
9
  import { Image } from './styled';
10
10
  var styles = {
11
- roundedImage: "_2rko1twn"
11
+ roundedImage: "_2rko1rr0"
12
12
  };
13
13
  export var ImageIcon = function ImageIcon(_ref) {
14
14
  var _ref$alt = _ref.alt,
@@ -1,5 +1,5 @@
1
1
 
2
- ._2rko1sit{border-radius:var(--ds-border-radius,3px)}._18m915vq{overflow-y:hidden}
2
+ ._2rkofajl{border-radius:var(--ds-radius-small,3px)}._18m915vq{overflow-y:hidden}
3
3
  ._18u0utpp{margin-left:var(--ds-space-150,9pt)}
4
4
  ._19pk1b66{margin-top:var(--ds-space-050,4px)}
5
5
  ._1aaxusic{float:right}
@@ -32,7 +32,7 @@ export var Image = forwardRef(function (_ref, __cmplr) {
32
32
  "--_rcxkve": ix(getSizeWithUnit(__cmplp.size))
33
33
  }),
34
34
  ref: __cmplr,
35
- className: ax(["_2rko1sit _1reo15vq _18m915vq _1bsb17ym _4t3i17ym", __cmplp.className])
35
+ className: ax(["_2rkofajl _1reo15vq _18m915vq _1bsb17ym _4t3i17ym", __cmplp.className])
36
36
  }));
37
37
  });
38
38
 
@@ -50,7 +50,7 @@ export var Thumbnail = forwardRef(function (_ref2, __cmplr) {
50
50
  "--_13orr8u": ix("url(".concat(__cmplp.src, ")"))
51
51
  }),
52
52
  ref: __cmplr,
53
- className: ax(["_2rko1sit _1bsbckbl _4t3ickbl _1aaxusic _19pk1b66 _2hwxidpf _otyrutpp _18u0utpp _bfhkqrzy _1lrw1dfr _1itk2pcs", __cmplp.className])
53
+ className: ax(["_2rkofajl _1bsbckbl _4t3ickbl _1aaxusic _19pk1b66 _2hwxidpf _otyrutpp _18u0utpp _bfhkqrzy _1lrw1dfr _1itk2pcs", __cmplp.className])
54
54
  }));
55
55
  });
56
56
  if (process.env.NODE_ENV !== 'production') {
@@ -1,11 +1,16 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
4
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
5
  var _excluded = ["onClose"];
5
6
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
8
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
9
  import React from 'react';
7
10
  import ReactDOM from 'react-dom';
8
11
  import { IntlProvider } from 'react-intl-next';
12
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
+ import { openEmbedModalInParent } from '../../utils/iframe-utils';
9
14
  var IFRAME_NAME = 'twp-editor-preview-iframe';
10
15
  var POPUP_MOUNT_POINT_ID = 'twp-editor-preview-iframe';
11
16
 
@@ -39,6 +44,19 @@ function _openEmbedModal() {
39
44
  case 0:
40
45
  _ref = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
41
46
  _ref$onClose = _ref.onClose, _onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose, props = _objectWithoutProperties(_ref, _excluded);
47
+ if (!expValEquals('platform_hover_card_preview_panel', 'cohort', 'test')) {
48
+ _context2.next = 6;
49
+ break;
50
+ }
51
+ if (!props.isInPreviewPanel) {
52
+ _context2.next = 6;
53
+ break;
54
+ }
55
+ openEmbedModalInParent(_objectSpread({
56
+ onClose: _onClose
57
+ }, props));
58
+ return _context2.abrupt("return");
59
+ case 6:
42
60
  popupMountPoint = document.getElementById(POPUP_MOUNT_POINT_ID);
43
61
  if (!popupMountPoint) {
44
62
  popupMountPoint = document.createElement('div');
@@ -46,9 +64,9 @@ function _openEmbedModal() {
46
64
  popupMountPoint.setAttribute('data-testid', 'preview-modal');
47
65
  document.body.appendChild(popupMountPoint);
48
66
  }
49
- _context2.next = 6;
67
+ _context2.next = 10;
50
68
  return import('./index');
51
- case 6:
69
+ case 10:
52
70
  Modal = _context2.sent;
53
71
  ReactDOM.render( /*#__PURE__*/React.createElement(IntlProvider, {
54
72
  locale: "en"
@@ -64,7 +82,7 @@ function _openEmbedModal() {
64
82
  },
65
83
  showModal: true
66
84
  }))), popupMountPoint);
67
- case 8:
85
+ case 12:
68
86
  case "end":
69
87
  return _context2.stop();
70
88
  }
@@ -1,5 +1,5 @@
1
1
 
2
- ._2rkoglpi{border-radius:var(--ds-border-radius,4px)}._18zr1b66{padding-inline:var(--ds-space-050,4px)}
2
+ ._2rko12b0{border-radius:var(--ds-radius-small,4px)}._18zr1b66{padding-inline:var(--ds-space-050,4px)}
3
3
  ._1rjcv77o{padding-block:var(--ds-space-025,2px)}
4
4
  ._19pkutpp{margin-top:var(--ds-space-150,9pt)}
5
5
  ._2hwxutpp{margin-right:var(--ds-space-150,9pt)}
@@ -11,7 +11,7 @@ import { Box, Inline, Stack } from '@atlaskit/primitives/compiled';
11
11
  import { G50 } from '@atlaskit/theme/colors';
12
12
  import { useAutomationMenu } from '../../menu-context';
13
13
  var styles = {
14
- iconStyle: "_2rkoglpi _18zr1b66 _1rjcv77o _2hwxutpp",
14
+ iconStyle: "_2rko12b0 _18zr1b66 _1rjcv77o _2hwxutpp",
15
15
  modalDescriptionStyle: "_19pkutpp"
16
16
  };
17
17
  var i18n = defineMessages({
@@ -1,5 +1,5 @@
1
1
 
2
- ._2rkoglpi{border-radius:var(--ds-border-radius,4px)}._189e1bk5{border-width:var(--ds-border-width-outline,2px)}
2
+ ._2rko12b0{border-radius:var(--ds-radius-small,4px)}._189e1bk5{border-width:var(--ds-border-width-outline,2px)}
3
3
  ._189ee4h9{border-width:var(--ds-border-width,1px)}
4
4
  ._1dqonqa1{border-style:solid}
5
5
  ._1h6d15qp{border-color:var(--ds-border-accent-blue,#1d7afc)}
@@ -8,8 +8,8 @@ import { Box, Stack } from '@atlaskit/primitives/compiled';
8
8
  import Spinner from '@atlaskit/spinner';
9
9
  import { useAutomationMenu } from '../../menu-context';
10
10
  var styles = {
11
- ruleButtonStyle: "_2rkoglpi _1h6dmuej _1dqonqa1 _189ee4h9",
12
- selectedRuleButtonStyle: "_2rkoglpi _1h6d15qp _1dqonqa1 _189e1bk5",
11
+ ruleButtonStyle: "_2rko12b0 _1h6dmuej _1dqonqa1 _189ee4h9",
12
+ selectedRuleButtonStyle: "_2rko12b0 _1h6d15qp _1dqonqa1 _189e1bk5",
13
13
  ruleNameStyle: "_4t3i1f4h"
14
14
  };
15
15
  export var AutomationModalRule = function AutomationModalRule(_ref) {
@@ -1,6 +1,6 @@
1
1
 
2
2
  ._kkk2n7od{all:unset}._11c8dcr7{font:var(--ds-font-body-UNSAFE_small,normal 400 9pt/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
3
- ._2rkoglpi{border-radius:var(--ds-border-radius,4px)}
3
+ ._2rko12b0{border-radius:var(--ds-radius-small,4px)}
4
4
  ._18zru2gc{padding-inline:var(--ds-space-100,8px)}
5
5
  ._1rjc12x7{padding-block:var(--ds-space-075,6px)}
6
6
  ._18u0u2gc{margin-left:var(--ds-space-100,8px)}
@@ -6,7 +6,7 @@ import ErrorIcon from '@atlaskit/icon/core/migration/status-error--error';
6
6
  import { Box, Inline } from '@atlaskit/primitives/compiled';
7
7
  import MotionWrapper from '../../../common/motion-wrapper';
8
8
  var styles = {
9
- containerStyles: "_kkk2n7od _2rkoglpi _1rjc12x7 _18zru2gc _19pku2gc _2hwxu2gc _otyrze3t _18u0u2gc _1bsb1osq _fiawglyw",
9
+ containerStyles: "_kkk2n7od _2rko12b0 _1rjc12x7 _18zru2gc _19pku2gc _2hwxu2gc _otyrze3t _18u0u2gc _1bsb1osq _fiawglyw",
10
10
  errorContentStyles: "_bozgv77o",
11
11
  titleStyles: "_11c8dcr7 _syaz1gjq"
12
12
  };
@@ -1 +1 @@
1
- ._2rko1twn{border-radius:var(--ds-border-radius-circle,9999px)}
1
+ ._2rko1rr0{border-radius:var(--ds-radius-full,9999px)}
@@ -7,7 +7,7 @@ import { useEffect, useState } from 'react';
7
7
  import ImageLoader from 'react-render-image';
8
8
  import { LoadingSkeleton } from '../loading-skeleton';
9
9
  var styles = {
10
- roundImg: "_2rko1twn"
10
+ roundImg: "_2rko1rr0"
11
11
  };
12
12
  var ImageIcon = function ImageIcon(_ref) {
13
13
  var defaultIcon = _ref.defaultIcon,
@@ -1,5 +1,5 @@
1
1
 
2
- ._2rkogqwt{border-radius:var(--ds-border-radius-050,2px)}._19bvze3t{padding-left:var(--ds-space-0,0)}
2
+ ._2rkolb4i{border-radius:var(--ds-radius-xsmall,2px)}._19bvze3t{padding-left:var(--ds-space-0,0)}
3
3
  ._bfhksm61{background-color:var(--ds-background-neutral-subtle,#00000000)}
4
4
  ._ca0qze3t{padding-top:var(--ds-space-0,0)}
5
5
  ._n3tdze3t{padding-bottom:var(--ds-space-0,0)}
@@ -17,7 +17,7 @@ import InlineLozenge from '../common/inline-lozenge';
17
17
  import { Frame } from '../Frame';
18
18
  import { IconAndTitleLayout } from '../IconAndTitleLayout';
19
19
  var styles = {
20
- actionButtonLozengeStyle: "_2rkogqwt _bfhksm61 _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t _p12f1osq"
20
+ actionButtonLozengeStyle: "_2rkolb4i _bfhksm61 _ca0qze3t _u5f3ze3t _n3tdze3t _19bvze3t _p12f1osq"
21
21
  };
22
22
  var fallbackForbiddenIcon = function fallbackForbiddenIcon() {
23
23
  return /*#__PURE__*/React.createElement(LockLockedIcon, {
@@ -1,6 +1,5 @@
1
1
  ._11c81o8v{font:var(--ds-font-body-small,normal 400 11px/1pc ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
2
- ._2rko1twn{border-radius:var(--ds-border-radius-circle,9999px)}
3
- ._2rkogqwt{border-radius:var(--ds-border-radius-050,2px)}
2
+ ._2rko1rr0{border-radius:var(--ds-radius-full,9999px)}
4
3
  ._2rkolb4i{border-radius:var(--ds-radius-xsmall,2px)}
5
4
  ._154i1ssb{top:50%}
6
5
  ._16d9qvcn{-webkit-box-decoration-break:clone;box-decoration-break:clone}
@@ -21,9 +21,9 @@ var styles = {
21
21
  iconEmptyStyle: "_1bsb7vkz _4t3i1osq _1e0c1o8l _tzy4idpf",
22
22
  iconOuterWrapperStyle: "_1e0c1o8l _2hwx1b66 _kqswh2mm",
23
23
  iconTitleWrapperStyle: "_o5721jtm _1nmz9jpi _16d9qvcn _ca0qv77o _u5f31b66 _n3tdv77o _19bv1b66",
24
- linkStyle: "_2rkogqwt",
24
+ linkStyle: "_2rkolb4i",
25
25
  noLinkAppearanceStyle: "_syaz131l _18u01b66",
26
- roundImageStyle: "_2rko1twn"
26
+ roundImageStyle: "_2rko1rr0"
27
27
  };
28
28
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-styled,@atlaskit/design-system/no-html-anchor -- Ignored via go/DSP-18766
29
29
  var LinkAppearance = forwardRef(function (_ref, __cmplr) {
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { ErrorBoundary } from 'react-error-boundary';
3
+ var withErrorBoundary = function withErrorBoundary(Component) {
4
+ return function (props) {
5
+ return /*#__PURE__*/React.createElement(ErrorBoundary, {
6
+ fallback: null
7
+ }, /*#__PURE__*/React.createElement(Component, props));
8
+ };
9
+ };
10
+ export default withErrorBoundary;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * This is a scheduled batched register mechanism for resolving blue hyperlinks while the page is idle.
3
+ * i.e. SharePoint tenants with the same hostname will be grouped together before the register is made.
4
+ */
5
+
6
+ import { useCallback, useRef } from 'react';
7
+ var batchQueue = new Map();
8
+ var batchTimeouts = new Map();
9
+ var BATCH_DELAY = 250;
10
+ var executeBatch = function executeBatch(hostname) {
11
+ var items = batchQueue.get(hostname) || [];
12
+ if (items.length === 0) {
13
+ return;
14
+ }
15
+ batchQueue.delete(hostname);
16
+ batchTimeouts.delete(hostname);
17
+ items.forEach(function (_ref) {
18
+ var register = _ref.register,
19
+ resolve = _ref.resolve,
20
+ reject = _ref.reject;
21
+ register().then(resolve).catch(reject);
22
+ });
23
+ };
24
+ var addToBatch = function addToBatch(hostname, item) {
25
+ if (!batchQueue.has(hostname)) {
26
+ batchQueue.set(hostname, []);
27
+ }
28
+ batchQueue.get(hostname).push(item);
29
+ if (batchTimeouts.has(hostname)) {
30
+ clearTimeout(batchTimeouts.get(hostname));
31
+ }
32
+ batchTimeouts.set(hostname, setTimeout(function () {
33
+ executeBatch(hostname);
34
+ }, BATCH_DELAY));
35
+ };
36
+ export var useScheduledRegister = function useScheduledRegister(href, register) {
37
+ var isScheduled = useRef(false);
38
+ var scheduledRegister = useCallback(function () {
39
+ if (!href || !register || isScheduled.current) {
40
+ return Promise.resolve();
41
+ }
42
+ isScheduled.current = true;
43
+ return new Promise(function (_resolve, _reject) {
44
+ var scheduleRegister = function scheduleRegister() {
45
+ try {
46
+ var hostname = new URL(href).hostname;
47
+ addToBatch(hostname, {
48
+ href: href,
49
+ register: register,
50
+ resolve: function resolve(value) {
51
+ isScheduled.current = false;
52
+ _resolve(value);
53
+ },
54
+ reject: function reject(error) {
55
+ isScheduled.current = false;
56
+ _reject(error);
57
+ }
58
+ });
59
+ } catch (error) {
60
+ isScheduled.current = false;
61
+ register().then(_resolve).catch(_reject);
62
+ }
63
+ };
64
+ if (typeof window !== 'undefined') {
65
+ if ('requestIdleCallback' in window) {
66
+ window.requestIdleCallback(scheduleRegister);
67
+ } else {
68
+ setTimeout(scheduleRegister, 0);
69
+ }
70
+ } else {
71
+ scheduleRegister();
72
+ }
73
+ });
74
+ }, [href, register]);
75
+ return scheduledRegister;
76
+ };
@@ -0,0 +1,25 @@
1
+ import React, { useContext } from 'react';
2
+ import FeatureGates from '@atlaskit/feature-gate-js-client';
3
+ import { SmartCardContext } from '../../../state';
4
+ import withErrorBoundary from './error-boundary';
5
+ import { ResolveHyperlink } from './resolve-hyperlink';
6
+ export var isSharePointDomain = function isSharePointDomain(href) {
7
+ try {
8
+ var hostname = new URL(href).hostname.toLowerCase();
9
+ return hostname.includes('sharepoint.com') || hostname.includes('onedrive.com') || hostname.includes('.live.com');
10
+ } catch (_unused) {
11
+ return false;
12
+ }
13
+ };
14
+ var HyperlinkResolver = function HyperlinkResolver(_ref) {
15
+ var href = _ref.href;
16
+ var hasSmartCardProvider = !!useContext(SmartCardContext);
17
+ var isHyperlinkResolveExperimentEnabled = FeatureGates.getExperimentValue('platform_editor_resolve_hyperlinks_confluence', 'isEnabled', false) || FeatureGates.getExperimentValue('platform_editor_resolve_hyperlinks_jira', 'isEnabled', false);
18
+ if (!isSharePointDomain(href) || !hasSmartCardProvider || !isHyperlinkResolveExperimentEnabled) {
19
+ return null;
20
+ }
21
+ return /*#__PURE__*/React.createElement(ResolveHyperlink, {
22
+ href: href
23
+ });
24
+ };
25
+ export default withErrorBoundary(HyperlinkResolver);
@@ -0,0 +1,60 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import { useEffect, useState } from 'react';
3
+ import uuid from 'uuid';
4
+ import { useAnalyticsEvents } from '../../../common/analytics/generated/use-analytics-events';
5
+ import { useSmartCardActions } from '../../../state/actions';
6
+ import { getDefinitionId, getExtensionKey, getResourceType } from '../../../state/helpers';
7
+ import { useSmartCardState } from '../../../state/store';
8
+ import * as measure from '../../../utils/performance';
9
+ import { useScheduledRegister } from './hooks/useScheduledRegister';
10
+ export var ResolveHyperlink = function ResolveHyperlink(_ref) {
11
+ var href = _ref.href;
12
+ var _useState = useState(function () {
13
+ return uuid();
14
+ }),
15
+ _useState2 = _slicedToArray(_useState, 1),
16
+ id = _useState2[0];
17
+ var state = useSmartCardState(href);
18
+ var definitionId = getDefinitionId(state.details);
19
+ var extensionKey = getExtensionKey(state.details);
20
+ var resourceType = getResourceType(state.details);
21
+ var _useSmartCardActions = useSmartCardActions(id, href),
22
+ register = _useSmartCardActions.register;
23
+ var scheduledRegister = useScheduledRegister(href, register);
24
+ var _useAnalyticsEvents = useAnalyticsEvents(),
25
+ fireEvent = _useAnalyticsEvents.fireEvent;
26
+ useEffect(function () {
27
+ scheduledRegister().catch(function (error) {
28
+ throw error;
29
+ });
30
+ }, [scheduledRegister]);
31
+ useEffect(function () {
32
+ measure.mark(id, state.status);
33
+ if (state.status !== 'pending' && state.status !== 'resolving') {
34
+ var _state$error, _state$error2;
35
+ measure.create(id, state.status);
36
+ if (state.status === 'resolved') {
37
+ var _measure$getMeasure$d, _measure$getMeasure;
38
+ fireEvent('operational.hyperlink.resolved', {
39
+ definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
40
+ extensionKey: extensionKey !== null && extensionKey !== void 0 ? extensionKey : null,
41
+ resourceType: resourceType !== null && resourceType !== void 0 ? resourceType : null,
42
+ duration: (_measure$getMeasure$d = (_measure$getMeasure = measure.getMeasure(id, state.status)) === null || _measure$getMeasure === void 0 ? void 0 : _measure$getMeasure.duration) !== null && _measure$getMeasure$d !== void 0 ? _measure$getMeasure$d : null
43
+ });
44
+ } else if (((_state$error = state.error) === null || _state$error === void 0 ? void 0 : _state$error.type) !== 'ResolveUnsupportedError' && ((_state$error2 = state.error) === null || _state$error2 === void 0 ? void 0 : _state$error2.type) !== 'UnsupportedError') {
45
+ fireEvent('operational.hyperlink.unresolved', {
46
+ definitionId: definitionId !== null && definitionId !== void 0 ? definitionId : null,
47
+ extensionKey: extensionKey !== null && extensionKey !== void 0 ? extensionKey : null,
48
+ resourceType: resourceType !== null && resourceType !== void 0 ? resourceType : null,
49
+ reason: state.status,
50
+ error: state.error === undefined ? null : {
51
+ name: state.error.name,
52
+ kind: state.error.kind,
53
+ type: state.error.type
54
+ }
55
+ });
56
+ }
57
+ }
58
+ }, [id, state.status, state.error, definitionId, extensionKey, resourceType, fireEvent]);
59
+ return null;
60
+ };
@@ -1,18 +1,20 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLinkComponent"],
3
+ var _excluded = ["href", "children", "checkSafety", "onClick", "testId", "isLinkComponent", "enableResolve"],
4
4
  _excluded2 = ["isLinkSafe", "showSafetyWarningModal"];
5
5
  import React from 'react';
6
6
  import { di } from 'react-magnetic-di';
7
7
  import { withAnalyticsContext } from '@atlaskit/analytics-next';
8
+ import FeatureGates from '@atlaskit/feature-gate-js-client';
8
9
  import AKLink from '@atlaskit/link';
9
10
  import { withLinkClickedEvent } from '../../utils/analytics/click';
10
11
  import { LinkAnalyticsContext } from '../../utils/analytics/LinkAnalyticsContext';
12
+ import HyperlinkResolver from './HyperlinkResolver';
11
13
  import LinkWarningModal from './LinkWarningModal';
12
14
  import { useLinkWarningModal } from './LinkWarningModal/hooks/use-link-warning-modal';
13
15
  var PACKAGE_DATA = {
14
16
  packageName: "@atlaskit/smart-card",
15
- packageVersion: "40.17.1",
17
+ packageVersion: "0.0.0-development",
16
18
  componentName: 'linkUrl'
17
19
  };
18
20
  var Anchor = withLinkClickedEvent('a');
@@ -27,12 +29,15 @@ var LinkUrl = function LinkUrl(_ref) {
27
29
  testId = _ref$testId === void 0 ? 'link-with-safety' : _ref$testId,
28
30
  _ref$isLinkComponent = _ref.isLinkComponent,
29
31
  isLinkComponent = _ref$isLinkComponent === void 0 ? false : _ref$isLinkComponent,
32
+ _ref$enableResolve = _ref.enableResolve,
33
+ enableResolve = _ref$enableResolve === void 0 ? false : _ref$enableResolve,
30
34
  props = _objectWithoutProperties(_ref, _excluded);
31
35
  var _useLinkWarningModal = useLinkWarningModal(),
32
36
  isLinkSafe = _useLinkWarningModal.isLinkSafe,
33
37
  showSafetyWarningModal = _useLinkWarningModal.showSafetyWarningModal,
34
38
  linkWarningModalProps = _objectWithoutProperties(_useLinkWarningModal, _excluded2);
35
39
  var Link = isLinkComponent ? LinkComponent : Anchor;
40
+ var resolveHyperlinkFG = FeatureGates.checkGate('platform_editor_resolve_hyperlinks_killswitch');
36
41
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LinkAnalyticsContext, {
37
42
  url: href,
38
43
  display: "url"
@@ -55,6 +60,8 @@ var LinkUrl = function LinkUrl(_ref) {
55
60
  showSafetyWarningModal(e, href);
56
61
  }
57
62
  }
58
- }, props), children)), checkSafety && /*#__PURE__*/React.createElement(LinkWarningModal, linkWarningModalProps));
63
+ }, props), children)), checkSafety && /*#__PURE__*/React.createElement(LinkWarningModal, linkWarningModalProps), enableResolve && href && resolveHyperlinkFG && /*#__PURE__*/React.createElement(HyperlinkResolver, {
64
+ href: href
65
+ }));
59
66
  };
60
67
  export default withAnalyticsContext(PACKAGE_DATA)(LinkUrl);
@@ -181,6 +181,19 @@ export type SmartLinkClickedTitleGoToLinkAttributesType = {
181
181
  definitionId: string | null;
182
182
  isModifierKeyPressed: boolean | null;
183
183
  };
184
+ export type HyperlinkResolvedAttributesType = {
185
+ definitionId: string | null;
186
+ extensionKey: string | null;
187
+ resourceType: string | null;
188
+ duration: number | null;
189
+ };
190
+ export type HyperlinkUnresolvedAttributesType = {
191
+ definitionId: string | null;
192
+ extensionKey: string | null;
193
+ resourceType: string | null;
194
+ error: Record<string, unknown> | null;
195
+ reason: string;
196
+ };
184
197
  export type HoverCardViewedAttributesType = {
185
198
  previewDisplay: 'card' | 'embed';
186
199
  previewInvokeMethod: 'keyboard' | 'mouse_hover' | 'mouse_click' | null;
@@ -339,6 +352,12 @@ export type AnalyticsEventAttributes = {
339
352
  /**
340
353
  * Fires an event when a Smart Link action is failed to resolved. */
341
354
  'operational.smartLinkAction.unresolved': SmartLinkActionUnresolvedAttributesType;
355
+ /**
356
+ * Fires an event when a Hyperlink is successfully resolved. */
357
+ 'operational.hyperlink.resolved': HyperlinkResolvedAttributesType;
358
+ /**
359
+ * Fires an event when a Hyperlink is failed to resolve. */
360
+ 'operational.hyperlink.unresolved': HyperlinkUnresolvedAttributesType;
342
361
  /**
343
362
  * fires an event that represents when a user clicks on a Smart Link. */
344
363
  'ui.smartLink.clicked': SmartLinkClickedAttributesType;
@@ -38,13 +38,18 @@ export interface UseSmartLinkActionsOpts {
38
38
  * @default 'web'
39
39
  */
40
40
  platform?: JsonLd.Primitives.Platforms;
41
+ /**
42
+ * Whether to prefetch the link.
43
+ * @default false
44
+ */
45
+ prefetch?: boolean;
41
46
  /**
42
47
  * Smart Link URL for which actions will be invoked.
43
48
  * @example https://start.atlassian.com
44
49
  */
45
50
  url: string;
46
51
  }
47
- export declare function useSmartLinkActions({ url, appearance, origin, actionOptions, }: UseSmartLinkActionsOpts): {
52
+ export declare function useSmartLinkActions({ url, appearance, origin, actionOptions, prefetch, }: UseSmartLinkActionsOpts): {
48
53
  id: string;
49
54
  text: import("react").JSX.Element;
50
55
  invoke: () => Promise<void>;
@@ -0,0 +1,5 @@
1
+ import type { EmbedModalProps } from '../view/EmbedModal/types';
2
+ export declare const isInIframe: () => boolean;
3
+ export declare const isWithinPreviewPanel: () => boolean;
4
+ export declare const isModalWithinPreviewPanelIFrame: () => boolean;
5
+ export declare const openEmbedModalInParent: (modalProps: Partial<EmbedModalProps>) => void;
@@ -16,6 +16,7 @@ export type EmbedModalProps = {
16
16
  iframeName: string;
17
17
  invokeDownloadAction?: InvokeClientActionProps;
18
18
  invokeViewAction?: InvokeClientActionProps;
19
+ isInPreviewPanel?: boolean;
19
20
  isSupportTheming?: boolean;
20
21
  isTrusted?: boolean;
21
22
  linkIcon?: Icon;
@@ -0,0 +1,4 @@
1
+ import React, { type ComponentType } from 'react';
2
+ import type { HyperlinkResolverProps } from './index';
3
+ declare const withErrorBoundary: (Component: ComponentType<HyperlinkResolverProps>) => (props: HyperlinkResolverProps) => React.JSX.Element;
4
+ export default withErrorBoundary;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * This is a scheduled batched register mechanism for resolving blue hyperlinks while the page is idle.
3
+ * i.e. SharePoint tenants with the same hostname will be grouped together before the register is made.
4
+ */
5
+ export declare const useScheduledRegister: (href: string, register: (() => Promise<any>) | null) => () => Promise<void>;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export interface HyperlinkResolverProps {
3
+ href: string;
4
+ }
5
+ export declare const isSharePointDomain: (href: string) => boolean;
6
+ declare const _default: (props: HyperlinkResolverProps) => React.JSX.Element;
7
+ export default _default;
@@ -0,0 +1,3 @@
1
+ export declare const ResolveHyperlink: ({ href }: {
2
+ href: string;
3
+ }) => null;
@@ -3,6 +3,10 @@ export interface LinkUrlProps extends React.AnchorHTMLAttributes<HTMLAnchorEleme
3
3
  * Determines if we want to perform a link safety check. True by default.
4
4
  */
5
5
  checkSafety?: boolean;
6
+ /**
7
+ * Determines if we want to resolve the URL in the background for Rovo indexing. This has no impact on the UI/UX. False by default.
8
+ */
9
+ enableResolve?: boolean;
6
10
  isLinkComponent?: boolean;
7
11
  testId?: string;
8
12
  }
@@ -181,6 +181,19 @@ export type SmartLinkClickedTitleGoToLinkAttributesType = {
181
181
  definitionId: string | null;
182
182
  isModifierKeyPressed: boolean | null;
183
183
  };
184
+ export type HyperlinkResolvedAttributesType = {
185
+ definitionId: string | null;
186
+ extensionKey: string | null;
187
+ resourceType: string | null;
188
+ duration: number | null;
189
+ };
190
+ export type HyperlinkUnresolvedAttributesType = {
191
+ definitionId: string | null;
192
+ extensionKey: string | null;
193
+ resourceType: string | null;
194
+ error: Record<string, unknown> | null;
195
+ reason: string;
196
+ };
184
197
  export type HoverCardViewedAttributesType = {
185
198
  previewDisplay: 'card' | 'embed';
186
199
  previewInvokeMethod: 'keyboard' | 'mouse_hover' | 'mouse_click' | null;
@@ -339,6 +352,12 @@ export type AnalyticsEventAttributes = {
339
352
  /**
340
353
  * Fires an event when a Smart Link action is failed to resolved. */
341
354
  'operational.smartLinkAction.unresolved': SmartLinkActionUnresolvedAttributesType;
355
+ /**
356
+ * Fires an event when a Hyperlink is successfully resolved. */
357
+ 'operational.hyperlink.resolved': HyperlinkResolvedAttributesType;
358
+ /**
359
+ * Fires an event when a Hyperlink is failed to resolve. */
360
+ 'operational.hyperlink.unresolved': HyperlinkUnresolvedAttributesType;
342
361
  /**
343
362
  * fires an event that represents when a user clicks on a Smart Link. */
344
363
  'ui.smartLink.clicked': SmartLinkClickedAttributesType;