@atlaskit/smart-card 26.5.4 → 26.5.6

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 (81) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/extractors/common/actions/extractPreviewAction.js +2 -2
  3. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +3 -4
  4. package/dist/cjs/state/hooks-external/useSmartLinkActions.js +4 -25
  5. package/dist/cjs/utils/analytics/analytics.js +134 -147
  6. package/dist/cjs/version.json +1 -1
  7. package/dist/cjs/view/BlockCard/actions/PreviewAction.js +3 -3
  8. package/dist/cjs/view/BlockCard/index.js +9 -2
  9. package/dist/cjs/view/BlockCard/views/flexible/FlexibleErroredView.js +4 -2
  10. package/dist/cjs/view/BlockCard/views/flexible/FlexibleForbiddenView.js +4 -2
  11. package/dist/cjs/view/BlockCard/views/flexible/FlexibleNotFoundView.js +4 -2
  12. package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +3 -1
  13. package/dist/cjs/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +4 -2
  14. package/dist/cjs/view/FlexibleCard/components/elements/link/index.js +10 -5
  15. package/dist/cjs/view/FlexibleCard/components/elements/lozenge/index.js +4 -30
  16. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +2 -6
  17. package/dist/cjs/view/HoverCard/utils.js +2 -33
  18. package/dist/es2019/extractors/common/actions/extractPreviewAction.js +1 -4
  19. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +4 -6
  20. package/dist/es2019/state/hooks-external/useSmartLinkActions.js +3 -24
  21. package/dist/es2019/utils/analytics/analytics.js +0 -13
  22. package/dist/es2019/version.json +1 -1
  23. package/dist/es2019/view/BlockCard/actions/PreviewAction.js +1 -2
  24. package/dist/es2019/view/BlockCard/index.js +6 -1
  25. package/dist/es2019/view/BlockCard/views/flexible/FlexibleErroredView.js +3 -1
  26. package/dist/es2019/view/BlockCard/views/flexible/FlexibleForbiddenView.js +3 -1
  27. package/dist/es2019/view/BlockCard/views/flexible/FlexibleNotFoundView.js +3 -1
  28. package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +3 -1
  29. package/dist/es2019/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +3 -1
  30. package/dist/es2019/view/FlexibleCard/components/elements/link/index.js +9 -5
  31. package/dist/es2019/view/FlexibleCard/components/elements/lozenge/index.js +3 -20
  32. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +3 -7
  33. package/dist/es2019/view/HoverCard/utils.js +0 -20
  34. package/dist/esm/extractors/common/actions/extractPreviewAction.js +2 -2
  35. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +4 -5
  36. package/dist/esm/state/hooks-external/useSmartLinkActions.js +5 -26
  37. package/dist/esm/utils/analytics/analytics.js +130 -142
  38. package/dist/esm/version.json +1 -1
  39. package/dist/esm/view/BlockCard/actions/PreviewAction.js +3 -3
  40. package/dist/esm/view/BlockCard/index.js +9 -2
  41. package/dist/esm/view/BlockCard/views/flexible/FlexibleErroredView.js +4 -2
  42. package/dist/esm/view/BlockCard/views/flexible/FlexibleForbiddenView.js +4 -2
  43. package/dist/esm/view/BlockCard/views/flexible/FlexibleNotFoundView.js +4 -2
  44. package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +3 -1
  45. package/dist/esm/view/BlockCard/views/flexible/FlexibleUnauthorisedView.js +4 -2
  46. package/dist/esm/view/FlexibleCard/components/elements/link/index.js +10 -5
  47. package/dist/esm/view/FlexibleCard/components/elements/lozenge/index.js +4 -27
  48. package/dist/esm/view/HoverCard/components/views/resolved/index.js +3 -7
  49. package/dist/esm/view/HoverCard/utils.js +0 -29
  50. package/dist/types/model/invoke-opts.d.ts +1 -1
  51. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +2 -1
  52. package/dist/types/state/hooks-external/useSmartLinkActions.d.ts +1 -5
  53. package/dist/types/utils/analytics/analytics.d.ts +0 -3
  54. package/dist/types/view/BlockCard/components/Action.d.ts +1 -1
  55. package/dist/types/view/BlockCard/views/flexible/FlexibleErroredView.d.ts +1 -1
  56. package/dist/types/view/BlockCard/views/flexible/FlexibleForbiddenView.d.ts +1 -1
  57. package/dist/types/view/BlockCard/views/flexible/FlexibleNotFoundView.d.ts +1 -1
  58. package/dist/types/view/BlockCard/views/flexible/FlexibleResolvedView.d.ts +1 -1
  59. package/dist/types/view/BlockCard/views/flexible/FlexibleUnauthorisedView.d.ts +1 -1
  60. package/dist/types/view/BlockCard/views/flexible/types.d.ts +9 -4
  61. package/dist/types/view/FlexibleCard/components/elements/lozenge/types.d.ts +0 -5
  62. package/dist/types/view/HoverCard/utils.d.ts +0 -3
  63. package/dist/types-ts4.5/model/invoke-opts.d.ts +1 -1
  64. package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +2 -1
  65. package/dist/types-ts4.5/state/hooks-external/useSmartLinkActions.d.ts +1 -5
  66. package/dist/types-ts4.5/utils/analytics/analytics.d.ts +0 -3
  67. package/dist/types-ts4.5/view/BlockCard/components/Action.d.ts +1 -1
  68. package/dist/types-ts4.5/view/BlockCard/views/flexible/FlexibleErroredView.d.ts +1 -1
  69. package/dist/types-ts4.5/view/BlockCard/views/flexible/FlexibleForbiddenView.d.ts +1 -1
  70. package/dist/types-ts4.5/view/BlockCard/views/flexible/FlexibleNotFoundView.d.ts +1 -1
  71. package/dist/types-ts4.5/view/BlockCard/views/flexible/FlexibleResolvedView.d.ts +1 -1
  72. package/dist/types-ts4.5/view/BlockCard/views/flexible/FlexibleUnauthorisedView.d.ts +1 -1
  73. package/dist/types-ts4.5/view/BlockCard/views/flexible/types.d.ts +9 -4
  74. package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/types.d.ts +0 -5
  75. package/dist/types-ts4.5/view/HoverCard/utils.d.ts +0 -3
  76. package/package.json +5 -2
  77. package/dist/cjs/extractors/common/lozenge/extractLozengeText.js +0 -16
  78. package/dist/es2019/extractors/common/lozenge/extractLozengeText.js +0 -10
  79. package/dist/esm/extractors/common/lozenge/extractLozengeText.js +0 -9
  80. package/dist/types/extractors/common/lozenge/extractLozengeText.d.ts +0 -2
  81. package/dist/types-ts4.5/extractors/common/lozenge/extractLozengeText.d.ts +0 -2
@@ -1,6 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
4
  var _templateObject;
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
7
  /** @jsx jsx */
5
8
 
6
9
  import { getExtensionKey } from '../../state/helpers';
@@ -25,6 +28,7 @@ import { tokens } from '../../utils/token';
25
28
  import { css, jsx } from '@emotion/react';
26
29
  import { handleClickCommon } from './utils/handlers';
27
30
  import { useFeatureFlag } from '@atlaskit/link-provider';
31
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
28
32
  export { default as PreviewAction } from './actions/PreviewAction';
29
33
  export { ForbiddenAction, AuthorizeAction, BlockCardResolvedView, BlockCardResolvingView, BlockCardUnauthorisedView, BlockCardForbiddenView, BlockCardErroredView, BlockCardNotFoundView };
30
34
  var flexibleBlockCardElevationStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-radius: 1.5px;\n box-shadow: ", ";\n margin: ", ";\n"])), tokens.elevation, "var(--ds-space-025, 2px)");
@@ -64,7 +68,8 @@ export var BlockCard = function BlockCard(_ref) {
64
68
  var ui = {
65
69
  hideElevation: true
66
70
  };
67
- var flexibleProps = {
71
+ var anchorTarget = getBooleanFF('platform.linking-platform.smart-card.enable-block-card-clicks-opening-in-same-tab') ? '_self' : undefined;
72
+ var flexibleProps = _objectSpread({
68
73
  id: id,
69
74
  cardState: cardState,
70
75
  url: url,
@@ -79,7 +84,9 @@ export var BlockCard = function BlockCard(_ref) {
79
84
  ui: ui,
80
85
  analytics: analytics,
81
86
  extensionKey: extensionKey
82
- };
87
+ }, anchorTarget ? {
88
+ anchorTarget: anchorTarget
89
+ } : {});
83
90
  switch (status) {
84
91
  case 'pending':
85
92
  case 'resolving':
@@ -15,7 +15,8 @@ import Text from '../../../FlexibleCard/components/elements/text';
15
15
  * @see FlexibleCardProps
16
16
  */
17
17
  var FlexibleErroredView = function FlexibleErroredView(_ref) {
18
- var cardState = _ref.cardState,
18
+ var anchorTarget = _ref.anchorTarget,
19
+ cardState = _ref.cardState,
19
20
  onAuthorize = _ref.onAuthorize,
20
21
  onError = _ref.onError,
21
22
  ui = _ref.ui,
@@ -36,7 +37,8 @@ var FlexibleErroredView = function FlexibleErroredView(_ref) {
36
37
  ui: ui,
37
38
  url: url
38
39
  }, /*#__PURE__*/React.createElement(TitleBlock, {
39
- hideRetry: true
40
+ hideRetry: true,
41
+ anchorTarget: anchorTarget
40
42
  }), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(WarningIcon, {
41
43
  label: "errored-warning-icon",
42
44
  size: "small",
@@ -22,7 +22,8 @@ import { extractRequestAccessContext } from '../../../../extractors/common/conte
22
22
  */
23
23
  var FlexibleForbiddenView = function FlexibleForbiddenView(_ref) {
24
24
  var _details$meta;
25
- var cardState = _ref.cardState,
25
+ var anchorTarget = _ref.anchorTarget,
26
+ cardState = _ref.cardState,
26
27
  onAuthorize = _ref.onAuthorize,
27
28
  onClick = _ref.onClick,
28
29
  onError = _ref.onError,
@@ -61,7 +62,8 @@ var FlexibleForbiddenView = function FlexibleForbiddenView(_ref) {
61
62
  ui: ui,
62
63
  url: url
63
64
  }, /*#__PURE__*/React.createElement(TitleBlock, {
64
- hideRetry: true
65
+ hideRetry: true,
66
+ anchorTarget: anchorTarget
65
67
  }), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(LockIcon, {
66
68
  label: "forbidden-lock-icon",
67
69
  size: "small",
@@ -14,7 +14,8 @@ import { CustomBlock } from '../../../FlexibleCard/components/blocks';
14
14
  * @see FlexibleCardProps
15
15
  */
16
16
  var FlexibleNotFoundView = function FlexibleNotFoundView(_ref) {
17
- var cardState = _ref.cardState,
17
+ var anchorTarget = _ref.anchorTarget,
18
+ cardState = _ref.cardState,
18
19
  onAuthorize = _ref.onAuthorize,
19
20
  onError = _ref.onError,
20
21
  ui = _ref.ui,
@@ -33,7 +34,8 @@ var FlexibleNotFoundView = function FlexibleNotFoundView(_ref) {
33
34
  ui: ui,
34
35
  url: url
35
36
  }, /*#__PURE__*/React.createElement(TitleBlock, {
36
- hideRetry: true
37
+ hideRetry: true,
38
+ anchorTarget: anchorTarget
37
39
  }), /*#__PURE__*/React.createElement(CustomBlock, null, /*#__PURE__*/React.createElement(WarningIcon, {
38
40
  label: "not-found-warning-icon",
39
41
  size: "small",
@@ -19,6 +19,7 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
19
19
  onError = _ref.onError,
20
20
  onResolve = _ref.onResolve,
21
21
  showServerActions = _ref.showServerActions,
22
+ anchorTarget = _ref.anchorTarget,
22
23
  _ref$testId = _ref.testId,
23
24
  testId = _ref$testId === void 0 ? 'smart-block-resolved-view' : _ref$testId,
24
25
  ui = _ref.ui,
@@ -84,7 +85,8 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
84
85
  subtitle: [{
85
86
  name: ElementName.Location
86
87
  }],
87
- metadataPosition: SmartLinkPosition.Top
88
+ metadataPosition: SmartLinkPosition.Top,
89
+ anchorTarget: anchorTarget
88
90
  }), /*#__PURE__*/React.createElement(MetadataBlock, {
89
91
  primary: metadata,
90
92
  maxLines: 1
@@ -21,7 +21,8 @@ var contentStyles = css(_templateObject || (_templateObject = _taggedTemplateLit
21
21
  */
22
22
  var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
23
23
  var _cardState$details, _extractProvider;
24
- var analytics = _ref.analytics,
24
+ var anchorTarget = _ref.anchorTarget,
25
+ analytics = _ref.analytics,
25
26
  cardState = _ref.cardState,
26
27
  _ref$extensionKey = _ref.extensionKey,
27
28
  extensionKey = _ref$extensionKey === void 0 ? '' : _ref$extensionKey,
@@ -55,7 +56,8 @@ var FlexibleUnauthorisedView = function FlexibleUnauthorisedView(_ref) {
55
56
  ui: ui,
56
57
  url: url
57
58
  }, /*#__PURE__*/React.createElement(TitleBlock, {
58
- hideRetry: true
59
+ hideRetry: true,
60
+ anchorTarget: anchorTarget
59
61
  }), /*#__PURE__*/React.createElement(CustomBlock, {
60
62
  overrideCss: contentStyles,
61
63
  testId: "".concat(testId, "-content")
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
3
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
3
4
  /** @jsx jsx */
@@ -68,21 +69,25 @@ var Link = function Link(_ref) {
68
69
  theme = _ref$theme === void 0 ? SmartLinkTheme.Link : _ref$theme,
69
70
  url = _ref.url,
70
71
  onClick = _ref.onClick,
71
- target = _ref.target;
72
+ _ref$target = _ref.target,
73
+ target = _ref$target === void 0 ? '_blank' : _ref$target;
72
74
  var onMouseDown = useMouseDownEvent();
73
75
  var hasSpace = useMemo(function () {
74
76
  return text ? hasWhiteSpace(text) : false;
75
77
  }, [text]);
76
- var anchor = jsx("a", {
78
+ var anchor = jsx("a", _extends({
77
79
  css: [getAnchorStyles(size, theme, getMaxLines(maxLines), hasSpace), overrideCss],
78
80
  "data-smart-element": name,
79
81
  "data-smart-element-link": true,
80
82
  "data-testid": testId,
81
83
  onClick: onClick,
82
84
  onMouseDown: onMouseDown,
83
- href: url,
84
- target: target || '_blank'
85
- }, text);
85
+ href: url
86
+ // We do not want set the target if it is the default value of '_self'. This prevents link
87
+ // click issues in Confluence and Trello which rely on it not being set unless necessary.
88
+ }, target !== '_self' && {
89
+ target: target
90
+ }), text);
86
91
  return jsx("span", {
87
92
  css: containerStyles
88
93
  }, hideTooltip || text === undefined ? anchor : withTooltip(anchor, text, testId));
@@ -1,14 +1,12 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
3
- var _templateObject, _templateObject2;
2
+ var _templateObject;
4
3
  /** @jsx jsx */
5
- import React, { useCallback, useState } from 'react';
4
+ import React from 'react';
6
5
  import { css, jsx } from '@emotion/react';
7
6
  import AtlaskitLozenge from '@atlaskit/lozenge';
8
7
  import LozengeAction from '../../common/lozenge-action';
9
8
  import { useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
10
9
  var styles = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n line-height: inherit;\n"])));
11
- var actionStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow: visible;\n"])));
12
10
 
13
11
  /**
14
12
  * A base element that displays a Lozenge.
@@ -21,27 +19,11 @@ var Lozenge = function Lozenge(_ref) {
21
19
  _ref$appearance = _ref.appearance,
22
20
  appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
23
21
  name = _ref.name,
24
- onClick = _ref.onClick,
25
22
  overrideCss = _ref.overrideCss,
26
23
  text = _ref.text,
27
24
  _ref$testId = _ref.testId,
28
25
  testId = _ref$testId === void 0 ? 'smart-element-lozenge' : _ref$testId;
29
26
  var ui = useFlexibleUiOptionContext();
30
- var _useState = useState(false),
31
- _useState2 = _slicedToArray(_useState, 2),
32
- isBold = _useState2[0],
33
- setIsBold = _useState2[1];
34
- var onHover = useCallback(function (isHover) {
35
- if (onClick) {
36
- setIsBold(isHover);
37
- }
38
- }, [onClick]);
39
- var onMouseEnter = useCallback(function () {
40
- return onHover(true);
41
- }, [onHover]);
42
- var onMouseLeave = useCallback(function () {
43
- return onHover(false);
44
- }, [onHover]);
45
27
  if (!text) {
46
28
  return null;
47
29
  }
@@ -53,19 +35,14 @@ var Lozenge = function Lozenge(_ref) {
53
35
  zIndex: ui === null || ui === void 0 ? void 0 : ui.zIndex
54
36
  }) : jsx(AtlaskitLozenge, {
55
37
  appearance: appearance,
56
- isBold: isBold,
57
38
  testId: "".concat(testId, "-lozenge")
58
39
  }, text);
59
40
  return jsx("span", {
60
- css: [styles, onClick ? actionStyles : undefined, overrideCss],
41
+ css: [styles, overrideCss],
61
42
  "data-fit-to-content": true,
62
43
  "data-smart-element": name,
63
44
  "data-smart-element-lozenge": true,
64
- "data-testid": testId,
65
- onClick: onClick,
66
- onMouseEnter: onMouseEnter,
67
- onMouseLeave: onMouseLeave,
68
- tabIndex: onClick ? 0 : -1
45
+ "data-testid": testId
69
46
  }, lozenge);
70
47
  };
71
48
  export default Lozenge;
@@ -4,12 +4,11 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
4
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
5
  import React, { useCallback, useEffect, useMemo, useRef } from 'react';
6
6
  import { useFeatureFlag } from '@atlaskit/link-provider';
7
- import { extractType } from '@atlaskit/linking-common/extractors';
8
7
  import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../../../constants';
9
8
  import { FooterBlock, MetadataBlock, SnippetBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
10
9
  import { footerBlockCss, hiddenSnippetStyles, metadataBlockCss } from './styled';
11
10
  import FlexibleCard from '../../../../FlexibleCard';
12
- import { getSimulatedMetadata, toActionableMetadata } from '../../../utils';
11
+ import { getSimulatedMetadata } from '../../../utils';
13
12
  import SnippetOrPreview from '../../SnippetOrPreview';
14
13
  import { extractMetadata } from '../../../../../extractors/hover/extractMetadata';
15
14
  import { messages } from '../../../../../messages';
@@ -59,7 +58,6 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
59
58
  cardActions = _ref$cardActions === void 0 ? [] : _ref$cardActions,
60
59
  onActionClick = _ref.onActionClick,
61
60
  extensionKey = _ref.extensionKey;
62
- var showActionableElement = useFeatureFlag('enableActionableElement');
63
61
  var enableImprovedPreviewAction = useFeatureFlag('enableImprovedPreviewAction');
64
62
  useEffect(function () {
65
63
  // Since this hover view is only rendered on resolved status,
@@ -74,16 +72,14 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
74
72
  }, [cardActions, onActionClick, enableImprovedPreviewAction]);
75
73
  var data = (_cardState$details = cardState.details) === null || _cardState$details === void 0 ? void 0 : _cardState$details.data;
76
74
  var _useMemo = useMemo(function () {
77
- var types = data ? extractType(data) : undefined;
78
75
  //TODO: EDM-3224 deleted simulated and use real JsonLd
79
76
  var metadata = extractMetadata(getSimulatedMetadata(extensionKey, data));
80
- var primary = showActionableElement ? toActionableMetadata(onActionClick, extensionKey, types, cardActions, metadata.primary) : metadata.primary;
81
77
  return {
82
- primary: primary,
78
+ primary: metadata.primary,
83
79
  secondary: metadata.secondary,
84
80
  subtitle: metadata.subtitle
85
81
  };
86
- }, [cardActions, data, extensionKey, onActionClick, showActionableElement]),
82
+ }, [data, extensionKey]),
87
83
  primary = _useMemo.primary,
88
84
  secondary = _useMemo.secondary;
89
85
  var snippetHeight = React.useRef(0);
@@ -1,6 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
1
  import { ElementName } from '../../constants';
5
2
  import { extractType } from '@atlaskit/linking-common/extractors';
6
3
  import { extractOwnedBy } from '../../extractors/flexible/utils';
@@ -78,30 +75,4 @@ export var getSimulatedMetadata = function getSimulatedMetadata() {
78
75
  }
79
76
  };
80
77
  }
81
- };
82
- export var toActionableMetadata = function toActionableMetadata(onActionClick, extensionKey) {
83
- var types = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
84
- var cardActions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
85
- var elementItems = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
86
- // Actionable State for Jira issue
87
- if (extensionKey === 'jira-object-provider' && types !== null && types !== void 0 && types.includes('atlassian:Task')) {
88
- var previewAction = cardActions.find(function (action) {
89
- return action.id === 'preview-content';
90
- });
91
- if (previewAction) {
92
- return elementItems.map(function (elementItem) {
93
- return elementItem.name === ElementName.State ? _objectSpread(_objectSpread({}, elementItem), {}, {
94
- onClick: function onClick() {
95
- if (onActionClick) {
96
- onActionClick(previewAction.id);
97
- }
98
- return previewAction.invoke({
99
- isReloadRequired: true
100
- });
101
- }
102
- }) : elementItem;
103
- });
104
- }
105
- }
106
- return elementItems;
107
78
  };
@@ -13,5 +13,5 @@ export type InvokeServerOpts = InvokeOpts<ServerActionOpts> & {
13
13
  };
14
14
  export interface ClientActionOpts {
15
15
  type: string;
16
- promise: <T>(opts?: T) => Promise<void>;
16
+ promise: () => Promise<void>;
17
17
  }
@@ -241,7 +241,8 @@ export declare const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: A
241
241
  */
242
242
  appAccountAuthStarted: ({ extensionKey, location, }: TrackAppAccountConnectedProps) => void;
243
243
  /**
244
- * This fires a tracking event before and after link updated.
244
+ * Removed in EDM-5153: This is an even from an experiment.
245
+ * @deprecated
245
246
  */
246
247
  linkUpdated: (props: CommonEventProps & {
247
248
  [key: string]: any;
@@ -2,9 +2,6 @@
2
2
  import { JsonLd } from 'json-ld-types';
3
3
  import type { AnalyticsHandler, AnalyticsOrigin } from '../../utils/types';
4
4
  import type { CardInnerAppearance } from '../../view/Card/types';
5
- type ExperimentInvokeOpts = {
6
- isReloadRequired?: boolean;
7
- };
8
5
  export interface LinkAction {
9
6
  /**
10
7
  * Unique ID for the action.
@@ -21,7 +18,7 @@ export interface LinkAction {
21
18
  * Promise to invoke on triggering this action.
22
19
  * @example Clicking on `Delete` leading to deletion of content.
23
20
  */
24
- invoke: (opts?: ExperimentInvokeOpts) => Promise<any>;
21
+ invoke: () => Promise<any>;
25
22
  }
26
23
  export interface UseSmartLinkActionsOpts {
27
24
  /**
@@ -53,4 +50,3 @@ export interface UseSmartLinkActionsOpts {
53
50
  origin?: AnalyticsOrigin;
54
51
  }
55
52
  export declare function useSmartLinkActions({ url, appearance, analyticsHandler, platform, origin, }: UseSmartLinkActionsOpts): LinkAction[];
56
- export {};
@@ -29,9 +29,6 @@ export declare const connectSucceededEvent: ({ definitionId, extensionKey, desti
29
29
  export declare const connectFailedEvent: ({ definitionId, extensionKey, destinationProduct, destinationSubproduct, location, reason, }: ConnectFailedEventProps) => AnalyticsPayload;
30
30
  export declare const trackAppAccountConnected: ({ definitionId, extensionKey, destinationProduct, destinationSubproduct, location, }: TrackAppAccountConnectedProps) => AnalyticsPayload;
31
31
  export declare const trackAppAccountAuthStarted: ({ extensionKey, location, }: TrackAppAccountConnectedProps) => AnalyticsPayload;
32
- export declare const trackLinkUpdated: ({ actionSubjectId, ...attributes }: CommonEventProps & {
33
- [key: string]: any;
34
- }) => AnalyticsPayload;
35
32
  export declare const trackSmartLinkQuickActionStarted: ({ smartLinkActionType, ...attributes }: CommonEventProps & {
36
33
  smartLinkActionType: SmartLinkActionType | TrackQuickActionType;
37
34
  }) => AnalyticsPayload;
@@ -5,7 +5,7 @@ import { Appearance } from '@atlaskit/button/types';
5
5
  export interface ActionProps {
6
6
  id: string;
7
7
  text: React.ReactNode;
8
- promise: <T>(opts?: T) => Promise<any>;
8
+ promise: () => Promise<any>;
9
9
  buttonAppearance?: Appearance;
10
10
  }
11
11
  export type ActionState = 'init' | 'loading' | 'success' | 'failure';
@@ -6,5 +6,5 @@ import { FlexibleBlockCardProps } from './types';
6
6
  * @see SmartLinkStatus
7
7
  * @see FlexibleCardProps
8
8
  */
9
- declare const FlexibleErroredView: ({ cardState, onAuthorize, onError, ui, url, onClick, testId, }: FlexibleBlockCardProps) => JSX.Element;
9
+ declare const FlexibleErroredView: ({ anchorTarget, cardState, onAuthorize, onError, ui, url, onClick, testId, }: FlexibleBlockCardProps) => JSX.Element;
10
10
  export default FlexibleErroredView;
@@ -7,5 +7,5 @@ import { FlexibleBlockCardProps } from './types';
7
7
  * @see SmartLinkStatus
8
8
  * @see FlexibleCardProps
9
9
  */
10
- declare const FlexibleForbiddenView: ({ cardState, onAuthorize, onClick, onError, testId, ui, url, }: FlexibleBlockCardProps) => JSX.Element;
10
+ declare const FlexibleForbiddenView: ({ anchorTarget, cardState, onAuthorize, onClick, onError, testId, ui, url, }: FlexibleBlockCardProps) => JSX.Element;
11
11
  export default FlexibleForbiddenView;
@@ -6,5 +6,5 @@ import { FlexibleBlockCardProps } from './types';
6
6
  * @see SmartLinkStatus
7
7
  * @see FlexibleCardProps
8
8
  */
9
- declare const FlexibleNotFoundView: ({ cardState, onAuthorize, onError, ui, url, onClick, testId, }: FlexibleBlockCardProps) => JSX.Element;
9
+ declare const FlexibleNotFoundView: ({ anchorTarget, cardState, onAuthorize, onError, ui, url, onClick, testId, }: FlexibleBlockCardProps) => JSX.Element;
10
10
  export default FlexibleNotFoundView;
@@ -5,5 +5,5 @@ import { FlexibleBlockCardProps } from './types';
5
5
  * @see SmartLinkStatus
6
6
  * @see FlexibleCardProps
7
7
  */
8
- declare const FlexibleResolvedView: ({ id, cardState, onClick, onError, onResolve, showServerActions, testId, ui, url, analytics, }: FlexibleBlockCardProps) => JSX.Element;
8
+ declare const FlexibleResolvedView: ({ id, cardState, onClick, onError, onResolve, showServerActions, anchorTarget, testId, ui, url, analytics, }: FlexibleBlockCardProps) => JSX.Element;
9
9
  export default FlexibleResolvedView;
@@ -7,5 +7,5 @@ import { FlexibleBlockCardProps } from './types';
7
7
  * @see SmartLinkStatus
8
8
  * @see FlexibleCardProps
9
9
  */
10
- declare const FlexibleUnauthorisedView: ({ analytics, cardState, extensionKey, onAuthorize, onClick, onError, testId, ui, url, }: FlexibleBlockCardProps) => JSX.Element;
10
+ declare const FlexibleUnauthorisedView: ({ anchorTarget, analytics, cardState, extensionKey, onAuthorize, onClick, onError, testId, ui, url, }: FlexibleBlockCardProps) => JSX.Element;
11
11
  export default FlexibleUnauthorisedView;
@@ -5,11 +5,16 @@ import { FlexibleUiOptions } from '../../../FlexibleCard/types';
5
5
  import { OnResolveCallback } from '../../../Card/types';
6
6
  import { CardProviderRenderers } from '@atlaskit/link-provider';
7
7
  import { AnalyticsFacade } from '../../../../state/analytics';
8
+ import { AnchorTarget } from '../../../FlexibleCard/components/types';
8
9
  export type FlexibleBlockCardProps = {
9
10
  /**
10
11
  * An AnalyticsFacade object used for calling analytics.
11
12
  */
12
13
  analytics: AnalyticsFacade;
14
+ /**
15
+ * Determines the anchor target to be passed to the title block.
16
+ */
17
+ anchorTarget?: AnchorTarget;
13
18
  /**
14
19
  * Determines the status and data of the Smart Link.
15
20
  * @internal
@@ -42,15 +47,15 @@ export type FlexibleBlockCardProps = {
42
47
  * function to be called after a flexible card has rendered its resolved state
43
48
  */
44
49
  onResolve?: OnResolveCallback;
50
+ /**
51
+ * A name of the provider, needed to specify to user which account has to be connected
52
+ */
53
+ providerName?: string;
45
54
  /**
46
55
  * Any additional renderers required by Flexible UI. Currently used by icon
47
56
  * to render Emoji.
48
57
  */
49
58
  renderers?: CardProviderRenderers;
50
- /**
51
- * A name of the provider, needed to specify to user which account has to be connected
52
- */
53
- providerName?: string;
54
59
  /**
55
60
  * Determines whether to show available server actions.
56
61
  */
@@ -11,11 +11,6 @@ export type LozengeProps = ElementProps & {
11
11
  * Determines the appearance of the Atlaskit lozenge.
12
12
  */
13
13
  appearance?: LozengeAppearance;
14
- /**
15
- * DO NOT USE! This is an experiment code and may be removed at any given time.
16
- * @internal
17
- */
18
- onClick?: () => void;
19
14
  /**
20
15
  * The text to display within the lozenge.
21
16
  */
@@ -1,5 +1,2 @@
1
1
  import { JsonLd } from 'json-ld-types';
2
- import { LinkAction } from '../../state/hooks-external/useSmartLinkActions';
3
- import { ElementItem } from '../FlexibleCard/components/blocks/types';
4
2
  export declare const getSimulatedMetadata: (extensionKey: string | undefined, data: JsonLd.Data.BaseData) => JsonLd.Primitives.Property<any>;
5
- export declare const toActionableMetadata: (onActionClick: (actionId: string) => void, extensionKey?: string, types?: JsonLd.Primitives.ObjectType[], cardActions?: LinkAction[], elementItems?: ElementItem[]) => ElementItem[];
@@ -13,5 +13,5 @@ export type InvokeServerOpts = InvokeOpts<ServerActionOpts> & {
13
13
  };
14
14
  export interface ClientActionOpts {
15
15
  type: string;
16
- promise: <T>(opts?: T) => Promise<void>;
16
+ promise: () => Promise<void>;
17
17
  }
@@ -241,7 +241,8 @@ export declare const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: A
241
241
  */
242
242
  appAccountAuthStarted: ({ extensionKey, location, }: TrackAppAccountConnectedProps) => void;
243
243
  /**
244
- * This fires a tracking event before and after link updated.
244
+ * Removed in EDM-5153: This is an even from an experiment.
245
+ * @deprecated
245
246
  */
246
247
  linkUpdated: (props: CommonEventProps & {
247
248
  [key: string]: any;
@@ -2,9 +2,6 @@
2
2
  import { JsonLd } from 'json-ld-types';
3
3
  import type { AnalyticsHandler, AnalyticsOrigin } from '../../utils/types';
4
4
  import type { CardInnerAppearance } from '../../view/Card/types';
5
- type ExperimentInvokeOpts = {
6
- isReloadRequired?: boolean;
7
- };
8
5
  export interface LinkAction {
9
6
  /**
10
7
  * Unique ID for the action.
@@ -21,7 +18,7 @@ export interface LinkAction {
21
18
  * Promise to invoke on triggering this action.
22
19
  * @example Clicking on `Delete` leading to deletion of content.
23
20
  */
24
- invoke: (opts?: ExperimentInvokeOpts) => Promise<any>;
21
+ invoke: () => Promise<any>;
25
22
  }
26
23
  export interface UseSmartLinkActionsOpts {
27
24
  /**
@@ -53,4 +50,3 @@ export interface UseSmartLinkActionsOpts {
53
50
  origin?: AnalyticsOrigin;
54
51
  }
55
52
  export declare function useSmartLinkActions({ url, appearance, analyticsHandler, platform, origin, }: UseSmartLinkActionsOpts): LinkAction[];
56
- export {};
@@ -29,9 +29,6 @@ export declare const connectSucceededEvent: ({ definitionId, extensionKey, desti
29
29
  export declare const connectFailedEvent: ({ definitionId, extensionKey, destinationProduct, destinationSubproduct, location, reason, }: ConnectFailedEventProps) => AnalyticsPayload;
30
30
  export declare const trackAppAccountConnected: ({ definitionId, extensionKey, destinationProduct, destinationSubproduct, location, }: TrackAppAccountConnectedProps) => AnalyticsPayload;
31
31
  export declare const trackAppAccountAuthStarted: ({ extensionKey, location, }: TrackAppAccountConnectedProps) => AnalyticsPayload;
32
- export declare const trackLinkUpdated: ({ actionSubjectId, ...attributes }: CommonEventProps & {
33
- [key: string]: any;
34
- }) => AnalyticsPayload;
35
32
  export declare const trackSmartLinkQuickActionStarted: ({ smartLinkActionType, ...attributes }: CommonEventProps & {
36
33
  smartLinkActionType: SmartLinkActionType | TrackQuickActionType;
37
34
  }) => AnalyticsPayload;
@@ -5,7 +5,7 @@ import { Appearance } from '@atlaskit/button/types';
5
5
  export interface ActionProps {
6
6
  id: string;
7
7
  text: React.ReactNode;
8
- promise: <T>(opts?: T) => Promise<any>;
8
+ promise: () => Promise<any>;
9
9
  buttonAppearance?: Appearance;
10
10
  }
11
11
  export type ActionState = 'init' | 'loading' | 'success' | 'failure';
@@ -6,5 +6,5 @@ import { FlexibleBlockCardProps } from './types';
6
6
  * @see SmartLinkStatus
7
7
  * @see FlexibleCardProps
8
8
  */
9
- declare const FlexibleErroredView: ({ cardState, onAuthorize, onError, ui, url, onClick, testId, }: FlexibleBlockCardProps) => JSX.Element;
9
+ declare const FlexibleErroredView: ({ anchorTarget, cardState, onAuthorize, onError, ui, url, onClick, testId, }: FlexibleBlockCardProps) => JSX.Element;
10
10
  export default FlexibleErroredView;
@@ -7,5 +7,5 @@ import { FlexibleBlockCardProps } from './types';
7
7
  * @see SmartLinkStatus
8
8
  * @see FlexibleCardProps
9
9
  */
10
- declare const FlexibleForbiddenView: ({ cardState, onAuthorize, onClick, onError, testId, ui, url, }: FlexibleBlockCardProps) => JSX.Element;
10
+ declare const FlexibleForbiddenView: ({ anchorTarget, cardState, onAuthorize, onClick, onError, testId, ui, url, }: FlexibleBlockCardProps) => JSX.Element;
11
11
  export default FlexibleForbiddenView;
@@ -6,5 +6,5 @@ import { FlexibleBlockCardProps } from './types';
6
6
  * @see SmartLinkStatus
7
7
  * @see FlexibleCardProps
8
8
  */
9
- declare const FlexibleNotFoundView: ({ cardState, onAuthorize, onError, ui, url, onClick, testId, }: FlexibleBlockCardProps) => JSX.Element;
9
+ declare const FlexibleNotFoundView: ({ anchorTarget, cardState, onAuthorize, onError, ui, url, onClick, testId, }: FlexibleBlockCardProps) => JSX.Element;
10
10
  export default FlexibleNotFoundView;
@@ -5,5 +5,5 @@ import { FlexibleBlockCardProps } from './types';
5
5
  * @see SmartLinkStatus
6
6
  * @see FlexibleCardProps
7
7
  */
8
- declare const FlexibleResolvedView: ({ id, cardState, onClick, onError, onResolve, showServerActions, testId, ui, url, analytics, }: FlexibleBlockCardProps) => JSX.Element;
8
+ declare const FlexibleResolvedView: ({ id, cardState, onClick, onError, onResolve, showServerActions, anchorTarget, testId, ui, url, analytics, }: FlexibleBlockCardProps) => JSX.Element;
9
9
  export default FlexibleResolvedView;
@@ -7,5 +7,5 @@ import { FlexibleBlockCardProps } from './types';
7
7
  * @see SmartLinkStatus
8
8
  * @see FlexibleCardProps
9
9
  */
10
- declare const FlexibleUnauthorisedView: ({ analytics, cardState, extensionKey, onAuthorize, onClick, onError, testId, ui, url, }: FlexibleBlockCardProps) => JSX.Element;
10
+ declare const FlexibleUnauthorisedView: ({ anchorTarget, analytics, cardState, extensionKey, onAuthorize, onClick, onError, testId, ui, url, }: FlexibleBlockCardProps) => JSX.Element;
11
11
  export default FlexibleUnauthorisedView;
@@ -5,11 +5,16 @@ import { FlexibleUiOptions } from '../../../FlexibleCard/types';
5
5
  import { OnResolveCallback } from '../../../Card/types';
6
6
  import { CardProviderRenderers } from '@atlaskit/link-provider';
7
7
  import { AnalyticsFacade } from '../../../../state/analytics';
8
+ import { AnchorTarget } from '../../../FlexibleCard/components/types';
8
9
  export type FlexibleBlockCardProps = {
9
10
  /**
10
11
  * An AnalyticsFacade object used for calling analytics.
11
12
  */
12
13
  analytics: AnalyticsFacade;
14
+ /**
15
+ * Determines the anchor target to be passed to the title block.
16
+ */
17
+ anchorTarget?: AnchorTarget;
13
18
  /**
14
19
  * Determines the status and data of the Smart Link.
15
20
  * @internal
@@ -42,15 +47,15 @@ export type FlexibleBlockCardProps = {
42
47
  * function to be called after a flexible card has rendered its resolved state
43
48
  */
44
49
  onResolve?: OnResolveCallback;
50
+ /**
51
+ * A name of the provider, needed to specify to user which account has to be connected
52
+ */
53
+ providerName?: string;
45
54
  /**
46
55
  * Any additional renderers required by Flexible UI. Currently used by icon
47
56
  * to render Emoji.
48
57
  */
49
58
  renderers?: CardProviderRenderers;
50
- /**
51
- * A name of the provider, needed to specify to user which account has to be connected
52
- */
53
- providerName?: string;
54
59
  /**
55
60
  * Determines whether to show available server actions.
56
61
  */