@atlaskit/smart-card 26.5.3 → 26.5.5

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 (56) hide show
  1. package/CHANGELOG.md +13 -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/FlexibleCard/components/elements/lozenge/index.js +4 -30
  9. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +2 -6
  10. package/dist/cjs/view/HoverCard/components/views/resolving/index.js +28 -7
  11. package/dist/cjs/view/HoverCard/components/views/resolving/styled.js +9 -3
  12. package/dist/cjs/view/HoverCard/utils.js +2 -33
  13. package/dist/es2019/extractors/common/actions/extractPreviewAction.js +1 -4
  14. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +4 -6
  15. package/dist/es2019/state/hooks-external/useSmartLinkActions.js +3 -24
  16. package/dist/es2019/utils/analytics/analytics.js +0 -13
  17. package/dist/es2019/version.json +1 -1
  18. package/dist/es2019/view/BlockCard/actions/PreviewAction.js +1 -2
  19. package/dist/es2019/view/FlexibleCard/components/elements/lozenge/index.js +3 -20
  20. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +3 -7
  21. package/dist/es2019/view/HoverCard/components/views/resolving/index.js +28 -7
  22. package/dist/es2019/view/HoverCard/components/views/resolving/styled.js +14 -0
  23. package/dist/es2019/view/HoverCard/utils.js +0 -20
  24. package/dist/esm/extractors/common/actions/extractPreviewAction.js +2 -2
  25. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +4 -5
  26. package/dist/esm/state/hooks-external/useSmartLinkActions.js +5 -26
  27. package/dist/esm/utils/analytics/analytics.js +130 -142
  28. package/dist/esm/version.json +1 -1
  29. package/dist/esm/view/BlockCard/actions/PreviewAction.js +3 -3
  30. package/dist/esm/view/FlexibleCard/components/elements/lozenge/index.js +4 -27
  31. package/dist/esm/view/HoverCard/components/views/resolved/index.js +3 -7
  32. package/dist/esm/view/HoverCard/components/views/resolving/index.js +29 -8
  33. package/dist/esm/view/HoverCard/components/views/resolving/styled.js +6 -2
  34. package/dist/esm/view/HoverCard/utils.js +0 -29
  35. package/dist/types/model/invoke-opts.d.ts +1 -1
  36. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +2 -1
  37. package/dist/types/state/hooks-external/useSmartLinkActions.d.ts +1 -5
  38. package/dist/types/utils/analytics/analytics.d.ts +0 -3
  39. package/dist/types/view/BlockCard/components/Action.d.ts +1 -1
  40. package/dist/types/view/FlexibleCard/components/elements/lozenge/types.d.ts +0 -5
  41. package/dist/types/view/HoverCard/components/views/resolving/styled.d.ts +5 -2
  42. package/dist/types/view/HoverCard/utils.d.ts +0 -3
  43. package/dist/types-ts4.5/model/invoke-opts.d.ts +1 -1
  44. package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +2 -1
  45. package/dist/types-ts4.5/state/hooks-external/useSmartLinkActions.d.ts +1 -5
  46. package/dist/types-ts4.5/utils/analytics/analytics.d.ts +0 -3
  47. package/dist/types-ts4.5/view/BlockCard/components/Action.d.ts +1 -1
  48. package/dist/types-ts4.5/view/FlexibleCard/components/elements/lozenge/types.d.ts +0 -5
  49. package/dist/types-ts4.5/view/HoverCard/components/views/resolving/styled.d.ts +5 -2
  50. package/dist/types-ts4.5/view/HoverCard/utils.d.ts +0 -3
  51. package/package.json +3 -3
  52. package/dist/cjs/extractors/common/lozenge/extractLozengeText.js +0 -16
  53. package/dist/es2019/extractors/common/lozenge/extractLozengeText.js +0 -10
  54. package/dist/esm/extractors/common/lozenge/extractLozengeText.js +0 -9
  55. package/dist/types/extractors/common/lozenge/extractLozengeText.d.ts +0 -2
  56. package/dist/types-ts4.5/extractors/common/lozenge/extractLozengeText.d.ts +0 -2
@@ -5,26 +5,47 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
9
  var _react = require("@emotion/react");
9
10
  var _react2 = _interopRequireDefault(require("react"));
10
11
  var _loadingSkeleton = _interopRequireDefault(require("../../../../FlexibleCard/components/common/loading-skeleton"));
11
- var _FlexibleCard = _interopRequireDefault(require("../../../../FlexibleCard"));
12
- var _blocks = require("../../../../FlexibleCard/components/blocks");
13
12
  var _styled = require("../../../styled");
14
13
  var _styled2 = require("./styled");
14
+ var _actionGroup = _interopRequireDefault(require("../../../../FlexibleCard/components/blocks/action-group"));
15
+ var _blocks = require("../../../../FlexibleCard/components/blocks");
16
+ var _icon = _interopRequireDefault(require("../../../../FlexibleCard/components/elements/icon"));
15
17
  /** @jsx jsx */
16
18
 
17
19
  var HoverCardLoadingView = function HoverCardLoadingView(_ref) {
18
- var flexibleCardProps = _ref.flexibleCardProps,
19
- titleBlockProps = _ref.titleBlockProps;
20
+ var titleBlockProps = _ref.titleBlockProps;
21
+ var testId = 'hover-card-loading-view';
20
22
  var lineHeightRem = 1.25;
21
23
  var skeletonWidth = _styled.CARD_WIDTH_REM - 2;
24
+ var size = titleBlockProps.size,
25
+ actions = titleBlockProps.actions;
26
+ var actionGroup = (actions === null || actions === void 0 ? void 0 : actions.length) && (actions === null || actions === void 0 ? void 0 : actions.length) > 0 && (0, _react.jsx)(_actionGroup.default, {
27
+ items: actions,
28
+ visibleButtonsNum: 2
29
+ });
22
30
  return (0, _react.jsx)("div", {
23
31
  css: _styled2.loadingViewContainer,
24
- "data-testid": "hover-card-loading-view"
25
- }, (0, _react.jsx)(_FlexibleCard.default, flexibleCardProps, (0, _react.jsx)(_blocks.TitleBlock, titleBlockProps)), (0, _react.jsx)("div", {
32
+ "data-testid": testId
33
+ }, (0, _react.jsx)("div", {
26
34
  css: _styled2.skeletonContainer
27
- }, (0, _react.jsx)("span", null), (0, _react.jsx)(_loadingSkeleton.default, {
35
+ }, (0, _react.jsx)(_blocks.CustomBlock, (0, _extends2.default)({}, titleBlockProps, {
36
+ overrideCss: _styled2.titleBlockStyles,
37
+ testId: "".concat(testId, "-title-block")
38
+ }), (0, _react.jsx)(_icon.default, {
39
+ render: function render() {
40
+ return (0, _react.jsx)(_loadingSkeleton.default, null);
41
+ },
42
+ size: size
43
+ }), (0, _react.jsx)("span", {
44
+ css: (0, _styled2.getTitleStyles)(lineHeightRem),
45
+ "data-testid": "".concat(testId, "-title")
46
+ }, (0, _react.jsx)(_loadingSkeleton.default, {
47
+ height: lineHeightRem
48
+ })), actionGroup), (0, _react.jsx)(_loadingSkeleton.default, {
28
49
  width: skeletonWidth,
29
50
  height: lineHeightRem
30
51
  }), (0, _react.jsx)(_loadingSkeleton.default, {
@@ -4,11 +4,17 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.skeletonContainer = exports.loadingViewContainer = void 0;
7
+ exports.titleBlockStyles = exports.skeletonContainer = exports.loadingViewContainer = exports.getTitleStyles = void 0;
8
8
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
9
  var _react = require("@emotion/react");
10
- var _templateObject, _templateObject2;
10
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
11
11
  var loadingViewContainer = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n"])));
12
12
  exports.loadingViewContainer = loadingViewContainer;
13
13
  var skeletonContainer = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n gap: 0.625rem;\n align-items: center;\n"])));
14
- exports.skeletonContainer = skeletonContainer;
14
+ exports.skeletonContainer = skeletonContainer;
15
+ var getTitleStyles = function getTitleStyles(height) {
16
+ return (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n flex: 1 0 auto;\n height: ", "rem;\n\n span {\n width: 100%;\n }\n "])), height);
17
+ };
18
+ exports.getTitleStyles = getTitleStyles;
19
+ var titleBlockStyles = (0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n gap: 0.5rem;\n"])));
20
+ exports.titleBlockStyles = titleBlockStyles;
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- exports.toActionableMetadata = exports.getSimulatedMetadata = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
6
+ exports.getSimulatedMetadata = void 0;
9
7
  var _constants = require("../../constants");
10
8
  var _extractors = require("@atlaskit/linking-common/extractors");
11
9
  var _utils = require("../../extractors/flexible/utils");
12
- 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; }
13
- 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) { (0, _defineProperty2.default)(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; }
14
10
  var getSimulatedMetadata = function getSimulatedMetadata() {
15
11
  var extensionKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
16
12
  var data = arguments.length > 1 ? arguments[1] : undefined;
@@ -86,31 +82,4 @@ var getSimulatedMetadata = function getSimulatedMetadata() {
86
82
  };
87
83
  }
88
84
  };
89
- exports.getSimulatedMetadata = getSimulatedMetadata;
90
- var toActionableMetadata = function toActionableMetadata(onActionClick, extensionKey) {
91
- var types = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
92
- var cardActions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
93
- var elementItems = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
94
- // Actionable State for Jira issue
95
- if (extensionKey === 'jira-object-provider' && types !== null && types !== void 0 && types.includes('atlassian:Task')) {
96
- var previewAction = cardActions.find(function (action) {
97
- return action.id === 'preview-content';
98
- });
99
- if (previewAction) {
100
- return elementItems.map(function (elementItem) {
101
- return elementItem.name === _constants.ElementName.State ? _objectSpread(_objectSpread({}, elementItem), {}, {
102
- onClick: function onClick() {
103
- if (onActionClick) {
104
- onActionClick(previewAction.id);
105
- }
106
- return previewAction.invoke({
107
- isReloadRequired: true
108
- });
109
- }
110
- }) : elementItem;
111
- });
112
- }
113
- }
114
- return elementItems;
115
- };
116
- exports.toActionableMetadata = toActionableMetadata;
85
+ exports.getSimulatedMetadata = getSimulatedMetadata;
@@ -80,10 +80,7 @@ export const extractPreviewAction = ({
80
80
  // - Promise invoked by the action invocation handler; open preview.
81
81
  previewActionProps.action.promise = previewAction.promise;
82
82
  // - Promise invoked on click of `Preview` on block card; trigger above promise.
83
- previewAction.promise = opts => handleInvoke({
84
- ...previewActionProps,
85
- ...opts
86
- });
83
+ previewAction.promise = () => handleInvoke(previewActionProps);
87
84
  return previewAction;
88
85
  }
89
86
  };
@@ -4,7 +4,7 @@ import { chunkloadFailedEvent, connectFailedEvent, connectSucceededEvent, contex
4
4
  import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './ufoExperiences';
5
5
  import { getDefinitionId, getExtensionKey, getProduct, getResourceType, getSubproduct } from '../helpers';
6
6
  import { useSmartLinkContext } from '@atlaskit/link-provider';
7
- import { trackLinkUpdated, trackSmartLinkQuickActionFailed, trackSmartLinkQuickActionStarted, trackSmartLinkQuickActionSuccess, uiIframeDwelledEvent, uiIframeFocusedEvent } from '../../utils/analytics/analytics';
7
+ import { trackSmartLinkQuickActionFailed, trackSmartLinkQuickActionStarted, trackSmartLinkQuickActionSuccess, uiIframeDwelledEvent, uiIframeFocusedEvent } from '../../utils/analytics/analytics';
8
8
  import { useDispatchAnalytics } from './useDispatchAnalytics';
9
9
  const applyCommonAttributes = (event, commonAttributes) => {
10
10
  if (event && event.attributes) {
@@ -733,12 +733,10 @@ export const useSmartLinkAnalytics = (url, _dispatchAnalytics, id, defaultLocati
733
733
  location
734
734
  }), commonAttributes)),
735
735
  /**
736
- * This fires a tracking event before and after link updated.
736
+ * Removed in EDM-5153: This is an even from an experiment.
737
+ * @deprecated
737
738
  */
738
- linkUpdated: props => dispatchAnalytics(applyCommonAttributes(trackLinkUpdated({
739
- ...commonAttributes,
740
- ...props
741
- }), commonAttributes)),
739
+ linkUpdated: props => {},
742
740
  /**
743
741
  * This fires a tracking event before an action invoke api call is made
744
742
  */
@@ -1,11 +1,10 @@
1
- import { useCallback, useEffect, useMemo, useState } from 'react';
1
+ import { useEffect, useMemo, useState } from 'react';
2
2
  import uuid from 'uuid';
3
3
  import { extractBlockProps as extractCardProps } from '../../extractors/block';
4
4
  import { useSmartCardActions as useLinkActions } from '../actions';
5
5
  import { useSmartLinkAnalytics as useLinkAnalytics } from '../analytics';
6
6
  import { useSmartCardState as useLinkState } from '../store';
7
7
  import { getExtensionKey } from '../helpers';
8
- import { useFeatureFlag } from '@atlaskit/link-provider';
9
8
  export function useSmartLinkActions({
10
9
  url,
11
10
  appearance,
@@ -18,32 +17,12 @@ export function useSmartLinkActions({
18
17
  const linkState = useLinkState(url);
19
18
  const linkAnalytics = useLinkAnalytics(url, analyticsHandler, id);
20
19
  const linkActions = useLinkActions(id, url, linkAnalytics);
21
-
22
- // Start: Smart ink Actions experiment
23
- const enableActionableElement = useFeatureFlag('enableActionableElement');
24
- const reload = useCallback(() => linkActions.reload(), [linkActions]);
25
- const handleInvoke = useCallback(opts => {
26
- var _opts$action;
27
- if (enableActionableElement && opts.type === 'client' && opts.isReloadRequired && ((_opts$action = opts.action) === null || _opts$action === void 0 ? void 0 : _opts$action.type) === 'PreviewAction') {
28
- // Reload when embed preview modal close
29
- const {
30
- promise
31
- } = opts.action;
32
- opts.action.type = 'StatusAction';
33
- opts.action.promise = () => promise({
34
- onClose: reload
35
- });
36
- }
37
- return linkActions.invoke(opts, appearance);
38
- }, [appearance, enableActionableElement, linkActions, reload]);
39
- // End: Smart ink Actions experiment
40
-
41
20
  useEffect(() => {
42
21
  if (!linkState.details) {
43
22
  return;
44
23
  }
45
24
  const cardProperties = extractCardProps(linkState.details.data, linkState.details.meta, {
46
- handleInvoke,
25
+ handleInvoke: opts => linkActions.invoke(opts, appearance),
47
26
  analytics: linkAnalytics,
48
27
  origin,
49
28
  extensionKey: getExtensionKey(linkState.details),
@@ -58,6 +37,6 @@ export function useSmartLinkActions({
58
37
  invoke: action.promise
59
38
  }));
60
39
  setActions(cardActions);
61
- }, [linkState, linkActions, linkAnalytics, appearance, platform, origin, handleInvoke]);
40
+ }, [linkState, linkActions, linkAnalytics, appearance, platform, origin]);
62
41
  return actions;
63
42
  }
@@ -231,19 +231,6 @@ export const trackAppAccountAuthStarted = ({
231
231
  location
232
232
  }
233
233
  });
234
- export const trackLinkUpdated = ({
235
- actionSubjectId,
236
- ...attributes
237
- }) => ({
238
- action: 'updated',
239
- actionSubject: 'link',
240
- actionSubjectId,
241
- eventType: 'track',
242
- attributes: {
243
- ...context,
244
- ...attributes
245
- }
246
- });
247
234
  export const trackSmartLinkQuickActionStarted = ({
248
235
  smartLinkActionType,
249
236
  ...attributes
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.5.3",
3
+ "version": "26.5.5",
4
4
  "sideEffects": false
5
5
  }
@@ -56,13 +56,12 @@ export default (({
56
56
  return {
57
57
  id: 'preview-content',
58
58
  text: /*#__PURE__*/React.createElement(FormattedMessage, previewText),
59
- promise: props => previewFunction({
59
+ promise: () => previewFunction({
60
60
  popupMountPointId: 'twp-editor-preview-iframe',
61
61
  providerName: 'Preview',
62
62
  showModal: true,
63
63
  iframeName: 'twp-editor-preview-iframe',
64
64
  onClose: () => {},
65
- ...props,
66
65
  ...rest
67
66
  })
68
67
  };
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import React, { useCallback, useState } from 'react';
2
+ import React from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
4
  import AtlaskitLozenge from '@atlaskit/lozenge';
5
5
  import LozengeAction from '../../common/lozenge-action';
@@ -8,9 +8,6 @@ const styles = css`
8
8
  display: inline-flex;
9
9
  line-height: inherit;
10
10
  `;
11
- const actionStyles = css`
12
- overflow: visible;
13
- `;
14
11
 
15
12
  /**
16
13
  * A base element that displays a Lozenge.
@@ -22,20 +19,11 @@ const Lozenge = ({
22
19
  action,
23
20
  appearance = 'default',
24
21
  name,
25
- onClick,
26
22
  overrideCss,
27
23
  text,
28
24
  testId = 'smart-element-lozenge'
29
25
  }) => {
30
26
  const ui = useFlexibleUiOptionContext();
31
- const [isBold, setIsBold] = useState(false);
32
- const onHover = useCallback(isHover => {
33
- if (onClick) {
34
- setIsBold(isHover);
35
- }
36
- }, [onClick]);
37
- const onMouseEnter = useCallback(() => onHover(true), [onHover]);
38
- const onMouseLeave = useCallback(() => onHover(false), [onHover]);
39
27
  if (!text) {
40
28
  return null;
41
29
  }
@@ -47,19 +35,14 @@ const Lozenge = ({
47
35
  zIndex: ui === null || ui === void 0 ? void 0 : ui.zIndex
48
36
  }) : jsx(AtlaskitLozenge, {
49
37
  appearance: appearance,
50
- isBold: isBold,
51
38
  testId: `${testId}-lozenge`
52
39
  }, text);
53
40
  return jsx("span", {
54
- css: [styles, onClick ? actionStyles : undefined, overrideCss],
41
+ css: [styles, overrideCss],
55
42
  "data-fit-to-content": true,
56
43
  "data-smart-element": name,
57
44
  "data-smart-element-lozenge": true,
58
- "data-testid": testId,
59
- onClick: onClick,
60
- onMouseEnter: onMouseEnter,
61
- onMouseLeave: onMouseLeave,
62
- tabIndex: onClick ? 0 : -1
45
+ "data-testid": testId
63
46
  }, lozenge);
64
47
  };
65
48
  export default Lozenge;
@@ -1,12 +1,11 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback, useEffect, useMemo, useRef } from 'react';
3
3
  import { useFeatureFlag } from '@atlaskit/link-provider';
4
- import { extractType } from '@atlaskit/linking-common/extractors';
5
4
  import { ActionName, CardDisplay, SmartLinkPosition, SmartLinkSize } from '../../../../../constants';
6
5
  import { FooterBlock, MetadataBlock, SnippetBlock, TitleBlock } from '../../../../FlexibleCard/components/blocks';
7
6
  import { footerBlockCss, hiddenSnippetStyles, metadataBlockCss } from './styled';
8
7
  import FlexibleCard from '../../../../FlexibleCard';
9
- import { getSimulatedMetadata, toActionableMetadata } from '../../../utils';
8
+ import { getSimulatedMetadata } from '../../../utils';
10
9
  import SnippetOrPreview from '../../SnippetOrPreview';
11
10
  import { extractMetadata } from '../../../../../extractors/hover/extractMetadata';
12
11
  import { messages } from '../../../../../messages';
@@ -56,7 +55,6 @@ const HoverCardResolvedView = ({
56
55
  extensionKey
57
56
  }) => {
58
57
  var _cardState$details;
59
- const showActionableElement = useFeatureFlag('enableActionableElement');
60
58
  const enableImprovedPreviewAction = useFeatureFlag('enableImprovedPreviewAction');
61
59
  useEffect(() => {
62
60
  // Since this hover view is only rendered on resolved status,
@@ -72,16 +70,14 @@ const HoverCardResolvedView = ({
72
70
  primary,
73
71
  secondary
74
72
  } = useMemo(() => {
75
- const types = data ? extractType(data) : undefined;
76
73
  //TODO: EDM-3224 deleted simulated and use real JsonLd
77
74
  const metadata = extractMetadata(getSimulatedMetadata(extensionKey, data));
78
- const primary = showActionableElement ? toActionableMetadata(onActionClick, extensionKey, types, cardActions, metadata.primary) : metadata.primary;
79
75
  return {
80
- primary,
76
+ primary: metadata.primary,
81
77
  secondary: metadata.secondary,
82
78
  subtitle: metadata.subtitle
83
79
  };
84
- }, [cardActions, data, extensionKey, onActionClick, showActionableElement]);
80
+ }, [data, extensionKey]);
85
81
  const snippetHeight = React.useRef(0);
86
82
  const snippetBlockRef = useRef(null);
87
83
  const onSnippetRender = useCallback(() => {
@@ -1,23 +1,44 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  /** @jsx jsx */
2
3
  import { jsx } from '@emotion/react';
3
4
  import React from 'react';
4
5
  import LoadingSkeleton from '../../../../FlexibleCard/components/common/loading-skeleton';
5
- import FlexibleCard from '../../../../FlexibleCard';
6
- import { TitleBlock } from '../../../../FlexibleCard/components/blocks';
7
6
  import { CARD_WIDTH_REM } from '../../../styled';
8
- import { loadingViewContainer, skeletonContainer } from './styled';
7
+ import { getTitleStyles, loadingViewContainer, skeletonContainer, titleBlockStyles } from './styled';
8
+ import ActionGroup from '../../../../FlexibleCard/components/blocks/action-group';
9
+ import { CustomBlock } from '../../../../FlexibleCard/components/blocks';
10
+ import Icon from '../../../../FlexibleCard/components/elements/icon';
9
11
  const HoverCardLoadingView = ({
10
- flexibleCardProps,
11
12
  titleBlockProps
12
13
  }) => {
14
+ const testId = 'hover-card-loading-view';
13
15
  const lineHeightRem = 1.25;
14
16
  const skeletonWidth = CARD_WIDTH_REM - 2;
17
+ const {
18
+ size,
19
+ actions
20
+ } = titleBlockProps;
21
+ const actionGroup = (actions === null || actions === void 0 ? void 0 : actions.length) && (actions === null || actions === void 0 ? void 0 : actions.length) > 0 && jsx(ActionGroup, {
22
+ items: actions,
23
+ visibleButtonsNum: 2
24
+ });
15
25
  return jsx("div", {
16
26
  css: loadingViewContainer,
17
- "data-testid": "hover-card-loading-view"
18
- }, jsx(FlexibleCard, flexibleCardProps, jsx(TitleBlock, titleBlockProps)), jsx("div", {
27
+ "data-testid": testId
28
+ }, jsx("div", {
19
29
  css: skeletonContainer
20
- }, jsx("span", null), jsx(LoadingSkeleton, {
30
+ }, jsx(CustomBlock, _extends({}, titleBlockProps, {
31
+ overrideCss: titleBlockStyles,
32
+ testId: `${testId}-title-block`
33
+ }), jsx(Icon, {
34
+ render: () => jsx(LoadingSkeleton, null),
35
+ size: size
36
+ }), jsx("span", {
37
+ css: getTitleStyles(lineHeightRem),
38
+ "data-testid": `${testId}-title`
39
+ }, jsx(LoadingSkeleton, {
40
+ height: lineHeightRem
41
+ })), actionGroup), jsx(LoadingSkeleton, {
21
42
  width: skeletonWidth,
22
43
  height: lineHeightRem
23
44
  }), jsx(LoadingSkeleton, {
@@ -8,4 +8,18 @@ export const skeletonContainer = css`
8
8
  flex-direction: column;
9
9
  gap: 0.625rem;
10
10
  align-items: center;
11
+ `;
12
+ export const getTitleStyles = height => {
13
+ return css`
14
+ flex: 1 0 auto;
15
+ height: ${height}rem;
16
+
17
+ span {
18
+ width: 100%;
19
+ }
20
+ `;
21
+ };
22
+ export const titleBlockStyles = css`
23
+ width: 100%;
24
+ gap: 0.5rem;
11
25
  `;
@@ -73,24 +73,4 @@ export const getSimulatedMetadata = (extensionKey = '', data) => {
73
73
  }
74
74
  };
75
75
  }
76
- };
77
- export const toActionableMetadata = (onActionClick, extensionKey, types = [], cardActions = [], elementItems = []) => {
78
- // Actionable State for Jira issue
79
- if (extensionKey === 'jira-object-provider' && types !== null && types !== void 0 && types.includes('atlassian:Task')) {
80
- const previewAction = cardActions.find(action => action.id === 'preview-content');
81
- if (previewAction) {
82
- return elementItems.map(elementItem => elementItem.name === ElementName.State ? {
83
- ...elementItem,
84
- onClick: () => {
85
- if (onActionClick) {
86
- onActionClick(previewAction.id);
87
- }
88
- return previewAction.invoke({
89
- isReloadRequired: true
90
- });
91
- }
92
- } : elementItem);
93
- }
94
- }
95
- return elementItems;
96
76
  };
@@ -86,8 +86,8 @@ export var extractPreviewAction = function extractPreviewAction(_ref) {
86
86
  // - Promise invoked by the action invocation handler; open preview.
87
87
  previewActionProps.action.promise = previewAction.promise;
88
88
  // - Promise invoked on click of `Preview` on block card; trigger above promise.
89
- previewAction.promise = function (opts) {
90
- return handleInvoke(_objectSpread(_objectSpread({}, previewActionProps), opts));
89
+ previewAction.promise = function () {
90
+ return handleInvoke(previewActionProps);
91
91
  };
92
92
  return previewAction;
93
93
  }
@@ -8,7 +8,7 @@ import { chunkloadFailedEvent as _chunkloadFailedEvent, connectFailedEvent as _c
8
8
  import { failUfoExperience, startUfoExperience, succeedUfoExperience } from './ufoExperiences';
9
9
  import { getDefinitionId, getExtensionKey, getProduct, getResourceType, getSubproduct } from '../helpers';
10
10
  import { useSmartLinkContext } from '@atlaskit/link-provider';
11
- import { trackLinkUpdated, trackSmartLinkQuickActionFailed, trackSmartLinkQuickActionStarted, trackSmartLinkQuickActionSuccess, uiIframeDwelledEvent, uiIframeFocusedEvent } from '../../utils/analytics/analytics';
11
+ import { trackSmartLinkQuickActionFailed, trackSmartLinkQuickActionStarted, trackSmartLinkQuickActionSuccess, uiIframeDwelledEvent, uiIframeFocusedEvent } from '../../utils/analytics/analytics';
12
12
  import { useDispatchAnalytics } from './useDispatchAnalytics';
13
13
  var applyCommonAttributes = function applyCommonAttributes(event, commonAttributes) {
14
14
  if (event && event.attributes) {
@@ -746,11 +746,10 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
746
746
  })), commonAttributes));
747
747
  },
748
748
  /**
749
- * This fires a tracking event before and after link updated.
749
+ * Removed in EDM-5153: This is an even from an experiment.
750
+ * @deprecated
750
751
  */
751
- linkUpdated: function linkUpdated(props) {
752
- return dispatchAnalytics(applyCommonAttributes(trackLinkUpdated(_objectSpread(_objectSpread({}, commonAttributes), props)), commonAttributes));
753
- },
752
+ linkUpdated: function linkUpdated(props) {},
754
753
  /**
755
754
  * This fires a tracking event before an action invoke api call is made
756
755
  */
@@ -1,12 +1,11 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import { useCallback, useEffect, useMemo, useState } from 'react';
2
+ import { useEffect, useMemo, useState } from 'react';
3
3
  import uuid from 'uuid';
4
4
  import { extractBlockProps as extractCardProps } from '../../extractors/block';
5
5
  import { useSmartCardActions as useLinkActions } from '../actions';
6
6
  import { useSmartLinkAnalytics as useLinkAnalytics } from '../analytics';
7
7
  import { useSmartCardState as useLinkState } from '../store';
8
8
  import { getExtensionKey } from '../helpers';
9
- import { useFeatureFlag } from '@atlaskit/link-provider';
10
9
  export function useSmartLinkActions(_ref) {
11
10
  var url = _ref.url,
12
11
  appearance = _ref.appearance,
@@ -24,34 +23,14 @@ export function useSmartLinkActions(_ref) {
24
23
  var linkState = useLinkState(url);
25
24
  var linkAnalytics = useLinkAnalytics(url, analyticsHandler, id);
26
25
  var linkActions = useLinkActions(id, url, linkAnalytics);
27
-
28
- // Start: Smart ink Actions experiment
29
- var enableActionableElement = useFeatureFlag('enableActionableElement');
30
- var reload = useCallback(function () {
31
- return linkActions.reload();
32
- }, [linkActions]);
33
- var handleInvoke = useCallback(function (opts) {
34
- var _opts$action;
35
- if (enableActionableElement && opts.type === 'client' && opts.isReloadRequired && ((_opts$action = opts.action) === null || _opts$action === void 0 ? void 0 : _opts$action.type) === 'PreviewAction') {
36
- // Reload when embed preview modal close
37
- var promise = opts.action.promise;
38
- opts.action.type = 'StatusAction';
39
- opts.action.promise = function () {
40
- return promise({
41
- onClose: reload
42
- });
43
- };
44
- }
45
- return linkActions.invoke(opts, appearance);
46
- }, [appearance, enableActionableElement, linkActions, reload]);
47
- // End: Smart ink Actions experiment
48
-
49
26
  useEffect(function () {
50
27
  if (!linkState.details) {
51
28
  return;
52
29
  }
53
30
  var cardProperties = extractCardProps(linkState.details.data, linkState.details.meta, {
54
- handleInvoke: handleInvoke,
31
+ handleInvoke: function handleInvoke(opts) {
32
+ return linkActions.invoke(opts, appearance);
33
+ },
55
34
  analytics: linkAnalytics,
56
35
  origin: origin,
57
36
  extensionKey: getExtensionKey(linkState.details),
@@ -68,6 +47,6 @@ export function useSmartLinkActions(_ref) {
68
47
  };
69
48
  });
70
49
  setActions(cardActions);
71
- }, [linkState, linkActions, linkAnalytics, appearance, platform, origin, handleInvoke]);
50
+ }, [linkState, linkActions, linkAnalytics, appearance, platform, origin]);
72
51
  return actions;
73
52
  }