@atlaskit/smart-card 26.24.0 → 26.25.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 (68) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/cjs/extractors/block/index.js +1 -1
  3. package/dist/cjs/extractors/common/actions/extractActions.js +3 -31
  4. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +7 -15
  5. package/dist/cjs/state/hooks/use-invoke-client-action/index.js +20 -14
  6. package/dist/cjs/utils/analytics/analytics.js +1 -1
  7. package/dist/cjs/view/BlockCard/views/flexible/FlexibleErroredView.js +1 -0
  8. package/dist/cjs/view/BlockCard/views/flexible/FlexibleResolvedView.js +3 -45
  9. package/dist/cjs/view/FlexibleCard/components/actions/action/download-action/index.js +33 -1
  10. package/dist/cjs/view/FlexibleCard/components/actions/action/preview-action/index.js +41 -15
  11. package/dist/cjs/view/FlexibleCard/components/actions/action/view-action/index.js +33 -1
  12. package/dist/cjs/view/FlexibleCard/components/utils.js +9 -20
  13. package/dist/cjs/view/FlexibleCard/index.js +14 -1
  14. package/dist/cjs/view/HoverCard/components/HoverCardContent.js +1 -0
  15. package/dist/cjs/view/LinkUrl/index.js +1 -1
  16. package/dist/es2019/extractors/block/index.js +2 -2
  17. package/dist/es2019/extractors/common/actions/extractActions.js +2 -23
  18. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +7 -15
  19. package/dist/es2019/state/hooks/use-invoke-client-action/index.js +14 -8
  20. package/dist/es2019/utils/analytics/analytics.js +1 -1
  21. package/dist/es2019/view/BlockCard/views/flexible/FlexibleErroredView.js +1 -0
  22. package/dist/es2019/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -42
  23. package/dist/es2019/view/FlexibleCard/components/actions/action/download-action/index.js +15 -1
  24. package/dist/es2019/view/FlexibleCard/components/actions/action/preview-action/index.js +18 -7
  25. package/dist/es2019/view/FlexibleCard/components/actions/action/view-action/index.js +15 -1
  26. package/dist/es2019/view/FlexibleCard/components/utils.js +3 -17
  27. package/dist/es2019/view/FlexibleCard/index.js +11 -1
  28. package/dist/es2019/view/HoverCard/components/HoverCardContent.js +1 -0
  29. package/dist/es2019/view/LinkUrl/index.js +1 -1
  30. package/dist/esm/extractors/block/index.js +2 -2
  31. package/dist/esm/extractors/common/actions/extractActions.js +2 -30
  32. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +7 -15
  33. package/dist/esm/state/hooks/use-invoke-client-action/index.js +20 -14
  34. package/dist/esm/utils/analytics/analytics.js +1 -1
  35. package/dist/esm/view/BlockCard/views/flexible/FlexibleErroredView.js +1 -0
  36. package/dist/esm/view/BlockCard/views/flexible/FlexibleResolvedView.js +4 -46
  37. package/dist/esm/view/FlexibleCard/components/actions/action/download-action/index.js +33 -1
  38. package/dist/esm/view/FlexibleCard/components/actions/action/preview-action/index.js +41 -15
  39. package/dist/esm/view/FlexibleCard/components/actions/action/view-action/index.js +33 -1
  40. package/dist/esm/view/FlexibleCard/components/utils.js +9 -20
  41. package/dist/esm/view/FlexibleCard/index.js +14 -1
  42. package/dist/esm/view/HoverCard/components/HoverCardContent.js +1 -0
  43. package/dist/esm/view/LinkUrl/index.js +1 -1
  44. package/dist/types/extractors/common/__mocks__/jsonld.d.ts +0 -1
  45. package/dist/types/extractors/common/actions/extractActions.d.ts +1 -1
  46. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +4 -4
  47. package/dist/types/state/flexible-ui-context/index.d.ts +3 -119
  48. package/dist/types/state/flexible-ui-context/types.d.ts +6 -0
  49. package/dist/types/state/hooks/useSmartLink.d.ts +3 -3
  50. package/dist/types/utils/analytics/types.d.ts +3 -3
  51. package/dist/types/utils/mocks.d.ts +3 -3
  52. package/dist/types/view/Card/index.d.ts +1 -1
  53. package/dist/types/view/FlexibleCard/components/utils.d.ts +2 -63
  54. package/dist/types/view/FlexibleCard/types.d.ts +2 -3
  55. package/dist/types-ts4.5/extractors/common/__mocks__/jsonld.d.ts +0 -1
  56. package/dist/types-ts4.5/extractors/common/actions/extractActions.d.ts +1 -1
  57. package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +4 -4
  58. package/dist/types-ts4.5/state/flexible-ui-context/index.d.ts +3 -119
  59. package/dist/types-ts4.5/state/flexible-ui-context/types.d.ts +6 -0
  60. package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +3 -3
  61. package/dist/types-ts4.5/utils/analytics/types.d.ts +3 -3
  62. package/dist/types-ts4.5/utils/mocks.d.ts +3 -3
  63. package/dist/types-ts4.5/view/Card/index.d.ts +1 -1
  64. package/dist/types-ts4.5/view/FlexibleCard/components/utils.d.ts +2 -63
  65. package/dist/types-ts4.5/view/FlexibleCard/types.d.ts +2 -3
  66. package/package.json +1 -1
  67. package/report.api.md +6 -6
  68. package/tmp/api-report-tmp.d.ts +6 -6
@@ -3,6 +3,9 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { useCallback } from 'react';
4
4
  import uuid from 'uuid';
5
5
  import * as measure from '../../../utils/performance';
6
+ import { failUfoExperience, startUfoExperience, succeedUfoExperience } from '../../analytics';
7
+ var ACTION_EXPERIENCE_NAME = 'smart-link-action-invocation';
8
+
6
9
  /**
7
10
  * Invoke client action such as preview, download and open link
8
11
  */
@@ -19,45 +22,48 @@ var useInvokeClientAction = function useInvokeClientAction(_ref) {
19
22
  markName = "".concat(experienceId, "-").concat(actionType);
20
23
  measure.mark(markName, 'pending');
21
24
  _context.prev = 4;
22
- // Begin analytics instrumentation.
23
- analytics === null || analytics === void 0 ? void 0 : analytics.ui.actionClickedEvent({
24
- id: experienceId,
25
- extensionKey: extensionKey,
25
+ // Begin UFO experience
26
+ startUfoExperience(ACTION_EXPERIENCE_NAME, experienceId, {
26
27
  actionType: actionType,
27
28
  display: display,
29
+ extensionKey: extensionKey,
28
30
  invokeType: 'client'
29
31
  });
30
32
 
33
+ // Begin analytics instrumentation.
34
+ analytics === null || analytics === void 0 ? void 0 : analytics.ui.actionClickedEvent({
35
+ actionType: actionType,
36
+ display: display
37
+ });
38
+
31
39
  // Invoke action
32
- _context.next = 8;
40
+ _context.next = 9;
33
41
  return actionFn();
34
- case 8:
42
+ case 9:
35
43
  result = _context.sent;
36
44
  measure.mark(markName, 'resolved');
45
+ succeedUfoExperience(ACTION_EXPERIENCE_NAME, experienceId);
37
46
  analytics === null || analytics === void 0 ? void 0 : analytics.operational.invokeSucceededEvent({
38
- id: experienceId,
39
- extensionKey: extensionKey,
40
47
  actionType: actionType,
41
48
  display: display
42
49
  });
43
50
  return _context.abrupt("return", result);
44
- case 14:
45
- _context.prev = 14;
51
+ case 16:
52
+ _context.prev = 16;
46
53
  _context.t0 = _context["catch"](4);
47
54
  measure.mark(markName, 'errored');
55
+ failUfoExperience(ACTION_EXPERIENCE_NAME, experienceId);
48
56
  reason = typeof _context.t0 === 'string' ? _context.t0 : _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message;
49
57
  analytics === null || analytics === void 0 ? void 0 : analytics.operational.invokeFailedEvent({
50
- id: experienceId,
51
- extensionKey: extensionKey,
52
58
  actionType: actionType,
53
59
  display: display,
54
60
  reason: reason
55
61
  });
56
- case 19:
62
+ case 22:
57
63
  case "end":
58
64
  return _context.stop();
59
65
  }
60
- }, _callee, null, [[4, 14]]);
66
+ }, _callee, null, [[4, 16]]);
61
67
  }));
62
68
  return function (_x) {
63
69
  return _ref3.apply(this, arguments);
@@ -13,7 +13,7 @@ export var ANALYTICS_CHANNEL = 'media';
13
13
  export var context = {
14
14
  componentName: 'smart-cards',
15
15
  packageName: "@atlaskit/smart-card",
16
- packageVersion: "26.24.0"
16
+ packageVersion: "26.25.0"
17
17
  };
18
18
  export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
19
19
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -32,6 +32,7 @@ var FlexibleErroredView = function FlexibleErroredView(_ref) {
32
32
  return onAuthorize ? [RetryAction(onAuthorize)] : [];
33
33
  }, [onAuthorize]);
34
34
  return /*#__PURE__*/React.createElement(FlexibleCard, {
35
+ appearance: "block",
35
36
  cardState: cardState,
36
37
  onAuthorize: onAuthorize,
37
38
  onClick: onClick,
@@ -5,8 +5,7 @@ import FlexibleCard from '../../../FlexibleCard';
5
5
  import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
6
6
  import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock } from '../../../FlexibleCard/components/blocks';
7
7
  import { metadataBlockCss, footerBlockCss } from './styled';
8
- import { ActionName, CardDisplay, ElementName, MediaPlacement, SmartLinkPosition } from '../../../../constants';
9
- import uuid from 'uuid';
8
+ import { ActionName, ElementName, MediaPlacement, SmartLinkPosition } from '../../../../constants';
10
9
  import { getSimulatedMetadata, getSimulatedBetterMetadata } from './utils';
11
10
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
12
11
  import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
@@ -36,11 +35,6 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
36
35
  useEffect(function () {
37
36
  setIsPreviewBlockErrored(false);
38
37
  }, [url, cardState]);
39
- var _useState3 = useState(function () {
40
- return id ? id : uuid();
41
- }),
42
- _useState4 = _slicedToArray(_useState3, 1),
43
- analyticsId = _useState4[0];
44
38
  var _ref2 = getBooleanFF('platform.linking-platform.smart-card.enable-better-metadata_iojwg') ? getSimulatedBetterMetadata(cardState.details) : getSimulatedMetadata(cardState.details),
45
39
  titleMetadata = _ref2.titleMetadata,
46
40
  topMetadata = _ref2.topMetadata,
@@ -87,49 +81,13 @@ var FlexibleResolvedView = function FlexibleResolvedView(_ref) {
87
81
  }, {
88
82
  actions: [{
89
83
  name: ActionName.PreviewAction,
90
- hideIcon: true,
91
- onClick: function onClick() {
92
- analytics.ui.actionClickedEvent({
93
- id: analyticsId,
94
- actionType: 'PreviewAction',
95
- display: CardDisplay.Block
96
- });
97
- analytics.operational.invokeSucceededEvent({
98
- id: analyticsId,
99
- actionType: 'PreviewAction',
100
- display: CardDisplay.Block
101
- });
102
- }
84
+ hideIcon: true
103
85
  }, {
104
86
  name: ActionName.ViewAction,
105
- hideIcon: true,
106
- onClick: function onClick() {
107
- analytics.ui.actionClickedEvent({
108
- id: analyticsId,
109
- actionType: 'ViewAction',
110
- display: CardDisplay.Block
111
- });
112
- analytics.operational.invokeSucceededEvent({
113
- id: analyticsId,
114
- actionType: 'ViewAction',
115
- display: CardDisplay.Block
116
- });
117
- }
87
+ hideIcon: true
118
88
  }, {
119
89
  name: ActionName.DownloadAction,
120
- hideIcon: true,
121
- onClick: function onClick() {
122
- analytics.ui.actionClickedEvent({
123
- id: analyticsId,
124
- actionType: 'DownloadAction',
125
- display: CardDisplay.Block
126
- });
127
- analytics.operational.invokeSucceededEvent({
128
- id: analyticsId,
129
- actionType: 'DownloadAction',
130
- display: CardDisplay.Block
131
- });
132
- }
90
+ hideIcon: true
133
91
  }]
134
92
  })));
135
93
  };
@@ -1,10 +1,15 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
5
  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; }
4
6
  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; }
5
7
  import React from 'react';
6
8
  import Action from '../index';
7
9
  import { downloadUrl as download } from '../../../../../../utils';
10
+ import { ActionName } from '../../../../../../constants';
11
+ import useInvokeClientAction from '../../../../../../state/hooks/use-invoke-client-action';
12
+ import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
8
13
  var DownloadAction = function DownloadAction(props) {
9
14
  var appearance = props.appearance,
10
15
  asDropDownItem = props.asDropDownItem,
@@ -12,10 +17,37 @@ var DownloadAction = function DownloadAction(props) {
12
17
  _onClick = props.onClick,
13
18
  testId = props.testId,
14
19
  url = props.url;
20
+ var analytics = useFlexibleUiAnalyticsContext();
21
+ var invoke = useInvokeClientAction({
22
+ analytics: analytics
23
+ });
15
24
  if (downloadUrl && url) {
16
25
  var action = _objectSpread(_objectSpread({}, props), {}, {
17
26
  onClick: function onClick() {
18
- download(downloadUrl);
27
+ invoke({
28
+ actionType: ActionName.DownloadAction,
29
+ actionFn: function () {
30
+ var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
31
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
32
+ while (1) switch (_context.prev = _context.next) {
33
+ case 0:
34
+ return _context.abrupt("return", download(downloadUrl));
35
+ case 1:
36
+ case "end":
37
+ return _context.stop();
38
+ }
39
+ }, _callee);
40
+ }));
41
+ function actionFn() {
42
+ return _actionFn.apply(this, arguments);
43
+ }
44
+ return actionFn;
45
+ }(),
46
+ // These values have already been set in analytics context.
47
+ // We only pass these here for ufo experience.
48
+ display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
49
+ extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
50
+ });
19
51
  if (_onClick) {
20
52
  _onClick();
21
53
  }
@@ -1,14 +1,17 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
4
  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; }
4
5
  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
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
5
7
  import React from 'react';
6
8
  import Action from '../index';
7
9
  import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
8
- import { useSmartLinkAnalytics } from '../../../../../../state';
9
10
  import { FormattedMessage } from 'react-intl-next';
10
11
  import { messages } from '../../../../../../messages';
11
12
  import { openEmbedModalWithFlexibleUiIcon } from '../../../utils';
13
+ import useInvokeClientAction from '../../../../../../state/hooks/use-invoke-client-action';
14
+ import { ActionName } from '../../../../../../constants';
12
15
  var PreviewAction = function PreviewAction(props) {
13
16
  var appearance = props.appearance,
14
17
  asDropDownItem = props.asDropDownItem,
@@ -21,23 +24,46 @@ var PreviewAction = function PreviewAction(props) {
21
24
  providerName = props.providerName,
22
25
  downloadUrl = props.downloadUrl,
23
26
  isSupportTheming = props.isSupportTheming;
24
- var defaultAnalytics = useSmartLinkAnalytics(url, function () {});
25
- var analytics = useFlexibleUiAnalyticsContext() || defaultAnalytics;
27
+ var analytics = useFlexibleUiAnalyticsContext();
28
+ var invoke = useInvokeClientAction({
29
+ analytics: analytics
30
+ });
26
31
  if (src && url) {
27
- var embedModal = function embedModal() {
28
- return openEmbedModalWithFlexibleUiIcon({
29
- title: title,
30
- providerName: providerName,
31
- downloadUrl: downloadUrl,
32
- isSupportTheming: isSupportTheming,
33
- analytics: analytics,
34
- linkIcon: linkIcon,
35
- src: src
36
- });
37
- };
32
+ var actionFn = /*#__PURE__*/function () {
33
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
34
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
35
+ while (1) switch (_context.prev = _context.next) {
36
+ case 0:
37
+ return _context.abrupt("return", openEmbedModalWithFlexibleUiIcon({
38
+ download: downloadUrl,
39
+ title: title,
40
+ providerName: providerName,
41
+ isSupportTheming: isSupportTheming,
42
+ analytics: analytics,
43
+ linkIcon: linkIcon,
44
+ src: src,
45
+ url: url
46
+ }));
47
+ case 1:
48
+ case "end":
49
+ return _context.stop();
50
+ }
51
+ }, _callee);
52
+ }));
53
+ return function actionFn() {
54
+ return _ref.apply(this, arguments);
55
+ };
56
+ }();
38
57
  var action = _objectSpread(_objectSpread({}, props), {}, {
39
58
  onClick: function onClick() {
40
- embedModal();
59
+ invoke({
60
+ actionType: ActionName.PreviewAction,
61
+ actionFn: actionFn,
62
+ // These values have already been set in analytics context.
63
+ // We only pass these here for ufo experience.
64
+ display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
65
+ extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
66
+ });
41
67
  if (_onClick) {
42
68
  _onClick();
43
69
  }
@@ -1,10 +1,15 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
5
  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; }
4
6
  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; }
5
7
  import React from 'react';
6
8
  import Action from '../index';
7
9
  import { openUrl } from '../../../../../../utils';
10
+ import { ActionName } from '../../../../../../constants';
11
+ import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
12
+ import useInvokeClientAction from '../../../../../../state/hooks/use-invoke-client-action';
8
13
  var ViewAction = function ViewAction(props) {
9
14
  var appearance = props.appearance,
10
15
  asDropDownItem = props.asDropDownItem,
@@ -12,10 +17,37 @@ var ViewAction = function ViewAction(props) {
12
17
  _onClick = props.onClick,
13
18
  viewUrl = props.viewUrl,
14
19
  url = props.url;
20
+ var analytics = useFlexibleUiAnalyticsContext();
21
+ var invoke = useInvokeClientAction({
22
+ analytics: analytics
23
+ });
15
24
  if (viewUrl && url) {
16
25
  var action = _objectSpread(_objectSpread({}, props), {}, {
17
26
  onClick: function onClick() {
18
- openUrl(viewUrl);
27
+ invoke({
28
+ actionType: ActionName.ViewAction,
29
+ actionFn: function () {
30
+ var _actionFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
31
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
32
+ while (1) switch (_context.prev = _context.next) {
33
+ case 0:
34
+ return _context.abrupt("return", openUrl(viewUrl));
35
+ case 1:
36
+ case "end":
37
+ return _context.stop();
38
+ }
39
+ }, _callee);
40
+ }));
41
+ function actionFn() {
42
+ return _actionFn.apply(this, arguments);
43
+ }
44
+ return actionFn;
45
+ }(),
46
+ // These values have already been set in analytics context.
47
+ // We only pass these here for ufo experience.
48
+ display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
49
+ extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
50
+ });
19
51
  if (_onClick) {
20
52
  _onClick();
21
53
  }
@@ -1,7 +1,11 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
1
2
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
3
  import _extends from "@babel/runtime/helpers/extends";
3
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
+ var _excluded = ["linkIcon"];
4
6
  var _sizeToButtonSpacing, _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
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; }
5
9
  import React from 'react';
6
10
  import { css } from '@emotion/react';
7
11
  import { FormattedMessage } from 'react-intl-next';
@@ -98,34 +102,19 @@ export var hasWhiteSpace = function hasWhiteSpace(str) {
98
102
  return str.search(/\s/) >= 0;
99
103
  };
100
104
  export var openEmbedModalWithFlexibleUiIcon = function openEmbedModalWithFlexibleUiIcon(_ref) {
101
- var analytics = _ref.analytics,
102
- downloadUrl = _ref.downloadUrl,
103
- linkIcon = _ref.linkIcon,
104
- onClose = _ref.onClose,
105
- providerName = _ref.providerName,
106
- src = _ref.src,
107
- title = _ref.title,
108
- url = _ref.url,
109
- isSupportTheming = _ref.isSupportTheming;
105
+ var linkIcon = _ref.linkIcon,
106
+ props = _objectWithoutProperties(_ref, _excluded);
110
107
  var icon = {
111
108
  icon: /*#__PURE__*/React.createElement(Icon, _extends({}, linkIcon, {
112
109
  size: SmartLinkSize.Large
113
110
  })),
114
111
  isFlexibleUi: true
115
112
  };
116
- return openEmbedModal({
117
- analytics: analytics,
118
- download: downloadUrl,
113
+ return openEmbedModal(_objectSpread(_objectSpread({}, props), {}, {
119
114
  icon: icon,
120
115
  // Flex should not send origin as block card. It should be able to support
121
116
  // its internal parent components like hover card, block card and
122
117
  // itself as a standalone. To be investigated and fix in EDM-7520.
123
- origin: 'smartLinkCard',
124
- providerName: providerName,
125
- onClose: onClose,
126
- src: src,
127
- title: title,
128
- url: url,
129
- isSupportTheming: isSupportTheming
130
- });
118
+ origin: 'smartLinkCard'
119
+ }));
131
120
  };
@@ -1,4 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ 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; }
4
+ 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; }
2
5
  import React, { useEffect, useMemo } from 'react';
3
6
  import { SmartLinkStatus } from '../../constants';
4
7
  import Container from './components/container';
@@ -12,7 +15,10 @@ import { getContextByStatus, getRetryOptions } from './utils';
12
15
  * @see Container
13
16
  */
14
17
  var FlexibleCard = function FlexibleCard(_ref) {
18
+ var _details$meta2;
15
19
  var analytics = _ref.analytics,
20
+ _ref$appearance = _ref.appearance,
21
+ appearance = _ref$appearance === void 0 ? 'flexible' : _ref$appearance,
16
22
  cardState = _ref.cardState,
17
23
  children = _ref.children,
18
24
  id = _ref.id,
@@ -43,6 +49,13 @@ var FlexibleCard = function FlexibleCard(_ref) {
43
49
  var retry = getRetryOptions(url, status, details, onAuthorize);
44
50
  var _ref2 = context || {},
45
51
  title = _ref2.title;
52
+ var analyticsContext = useMemo(function () {
53
+ var _details$meta;
54
+ return analytics ? _objectSpread(_objectSpread({}, analytics), {}, {
55
+ display: appearance,
56
+ extensionKey: details === null || details === void 0 ? void 0 : (_details$meta = details.meta) === null || _details$meta === void 0 ? void 0 : _details$meta.key
57
+ }) : undefined;
58
+ }, [analytics, appearance, details === null || details === void 0 ? void 0 : (_details$meta2 = details.meta) === null || _details$meta2 === void 0 ? void 0 : _details$meta2.key]);
46
59
  useEffect(function () {
47
60
  switch (status) {
48
61
  case SmartLinkStatus.Resolved:
@@ -68,7 +81,7 @@ var FlexibleCard = function FlexibleCard(_ref) {
68
81
  }
69
82
  }, [onError, onResolve, status, title, url]);
70
83
  return /*#__PURE__*/React.createElement(FlexibleUiAnalyticsContext.Provider, {
71
- value: analytics
84
+ value: analyticsContext
72
85
  }, /*#__PURE__*/React.createElement(FlexibleUiOptionContext.Provider, {
73
86
  value: ui
74
87
  }, /*#__PURE__*/React.createElement(FlexibleUiContext.Provider, {
@@ -137,6 +137,7 @@ var HoverCardContent = function HoverCardContent(_ref) {
137
137
  subtitle: subtitle
138
138
  };
139
139
  var flexibleCardProps = {
140
+ appearance: CardDisplay.HoverCardPreview,
140
141
  cardState: cardState,
141
142
  onClick: onClick,
142
143
  onResolve: onResolve,
@@ -11,7 +11,7 @@ import LinkWarningModal from './LinkWarningModal';
11
11
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
12
12
  var PACKAGE_DATA = {
13
13
  packageName: "@atlaskit/smart-card",
14
- packageVersion: "26.24.0",
14
+ packageVersion: "26.25.0",
15
15
  componentName: 'linkUrl'
16
16
  };
17
17
  var Link = withLinkClickedEvent('a');
@@ -27,7 +27,6 @@ export declare const TEST_CURRENT_DOCUMENT: JsonLd.Data.Document;
27
27
  export declare const TEST_DOWNLOAD_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
28
28
  export declare const TEST_UNDEFINED_LINK: JsonLd.Data.UndefinedLinkDocument;
29
29
  export declare const TEST_ASSIGN_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
30
- export declare const TEST_NO_ID_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
31
30
  export declare const TEST_VIEW_ACTION: JsonLd.Data.BaseData['schema:potentialAction'];
32
31
  export declare const TEST_FOLLOW_ACTION: JsonLd.Primitives.UpdateAction;
33
32
  export declare const TEST_UNFOLLOW_ACTION: JsonLd.Primitives.UpdateAction;
@@ -2,4 +2,4 @@ import { JsonLd } from 'json-ld-types';
2
2
  import { InvokeHandler } from '../../../model/invoke-handler';
3
3
  import { ActionProps } from '../../../view/BlockCard/components/Action';
4
4
  export declare const getActionsFromJsonLd: (jsonLd: JsonLd.Data.BaseData) => JsonLd.Primitives.Action[];
5
- export declare function extractActions(jsonLd: JsonLd.Data.BaseData, handler: InvokeHandler): ActionProps[];
5
+ export declare function extractClientActions(jsonLd: JsonLd.Data.BaseData, handler: InvokeHandler): ActionProps[];
@@ -90,10 +90,10 @@ export declare const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: A
90
90
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
91
91
  * @param actionType The type of the action that was clicked, e.g. PreviewAction
92
92
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
93
- * @param invokeType Whether the action invoked made a call to a server.
93
+ * @param invokeType @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
94
94
  * @returns
95
95
  */
96
- actionClickedEvent: ({ id: experienceId, actionType, display, invokeType, extensionKey: overrideExtensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiActionClickedEventProps) => void;
96
+ actionClickedEvent: ({ id, actionType, display, invokeType, extensionKey: overrideExtensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiActionClickedEventProps) => void;
97
97
  /**
98
98
  * This fires an event that represents when a user clicks on a hover preview's "navigate to link" button.
99
99
  * https://product-fabric.atlassian.net/wiki/spaces/EM/pages/3206743323/Analytics+Metrics+-+Hover+Previews
@@ -181,7 +181,7 @@ export declare const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: A
181
181
  * @param actionType The type of action invoked, e.g. PreviewAction
182
182
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
183
183
  */
184
- invokeSucceededEvent: ({ id: experienceId, actionType, display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: InvokeSucceededEventProps) => void;
184
+ invokeSucceededEvent: ({ id, actionType, display, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: InvokeSucceededEventProps) => void;
185
185
  /**
186
186
  * This fires an event that represents an action being unsuccessfully invoked.
187
187
  * @param id The unique ID for this Smart Link.
@@ -190,7 +190,7 @@ export declare const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: A
190
190
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
191
191
  * @param reason The reason the invocation failed.
192
192
  */
193
- invokeFailedEvent: ({ id: experienceId, actionType, display, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: InvokeFailedEventProps) => void;
193
+ invokeFailedEvent: ({ id, actionType, display, reason, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: InvokeFailedEventProps) => void;
194
194
  /**
195
195
  * This fires an event that represents an account successfully being connected via a Smart Link.
196
196
  * @param id The unique ID for this Smart Link.