@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
@@ -5,7 +5,7 @@ import { extractCommentCount, extractProgrammingLanguage, extractSubscriberCount
5
5
  import { extractLink, extractTitle, extractProvider, extractMembers, extractPersonAssignedTo, extractPersonCreatedBy, extractPersonUpdatedBy, extractImage } from '@atlaskit/link-extractors';
6
6
  import { extractByline } from '../common/byline/extractByline';
7
7
  import { extractTitlePrefix } from '../common/title-prefix/extractTitlePrefix';
8
- import { extractActions } from '../common/actions/extractActions';
8
+ import { extractClientActions } from '../common/actions/extractActions';
9
9
  import { extractPreviewAction } from '../common/actions/extractPreviewAction';
10
10
  import { extractIsTrusted } from '../common/meta/extractIsTrusted';
11
11
  const extractBlockIcon = jsonLd => {
@@ -26,7 +26,7 @@ export const extractBlockActions = (props, jsonLd, opts, platform, meta) => {
26
26
  const {
27
27
  handleInvoke
28
28
  } = opts;
29
- const actions = extractActions(jsonLd, handleInvoke);
29
+ const actions = extractClientActions(jsonLd, handleInvoke);
30
30
  const previewAction = extractPreviewAction({
31
31
  ...opts,
32
32
  viewProps: props,
@@ -30,25 +30,6 @@ const getClientActionProps = (jsonLd, action, handler) => {
30
30
  promise: () => handler(clientActionInvokeOpts)
31
31
  };
32
32
  };
33
- const getServerActionProps = (jsonLd, action, handler) => {
34
- const id = action['@id'] || action['@type'];
35
- const data = {
36
- type: 'server',
37
- key: action.identifier,
38
- action: {
39
- type: action['@type'],
40
- payload: {
41
- id,
42
- context: jsonLd.context
43
- }
44
- }
45
- };
46
- return {
47
- id,
48
- text: action.name,
49
- promise: () => handler(data)
50
- };
51
- };
52
33
  export const getActionsFromJsonLd = jsonLd => {
53
34
  let actions = jsonLd && jsonLd['schema:potentialAction'];
54
35
  if (!actions) {
@@ -59,11 +40,9 @@ export const getActionsFromJsonLd = jsonLd => {
59
40
  }
60
41
  return actions;
61
42
  };
62
- export function extractActions(jsonLd, handler) {
43
+ export function extractClientActions(jsonLd, handler) {
63
44
  const actions = getActionsFromJsonLd(jsonLd);
64
45
  const clientActions = actions.filter(isClientAction);
65
- const serverActions = actions.filter(action => !isClientAction(action));
66
46
  const clientActionImpls = clientActions.map(action => getClientActionProps(jsonLd, action, handler));
67
- const serverActionImpls = serverActions.map(action => getServerActionProps(jsonLd, action, handler));
68
- return [...clientActionImpls, ...serverActionImpls];
47
+ return clientActionImpls;
69
48
  }
@@ -235,11 +235,11 @@ export const useSmartLinkAnalytics = (url, _dispatchAnalytics, id, defaultLocati
235
235
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
236
236
  * @param actionType The type of the action that was clicked, e.g. PreviewAction
237
237
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
238
- * @param invokeType Whether the action invoked made a call to a server.
238
+ * @param invokeType @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
239
239
  * @returns
240
240
  */
241
241
  actionClickedEvent: ({
242
- id: experienceId,
242
+ id,
243
243
  actionType,
244
244
  display,
245
245
  invokeType,
@@ -251,14 +251,8 @@ export const useSmartLinkAnalytics = (url, _dispatchAnalytics, id, defaultLocati
251
251
  location
252
252
  }) => {
253
253
  const extensionKey = overrideExtensionKey !== null && overrideExtensionKey !== void 0 ? overrideExtensionKey : extractedExtensionKey;
254
- startUfoExperience('smart-link-action-invocation', experienceId, {
255
- actionType,
256
- display,
257
- extensionKey,
258
- invokeType
259
- });
260
254
  dispatchAnalytics(applyCommonAttributes(uiActionClickedEvent({
261
- id: defaultId,
255
+ id: id !== null && id !== void 0 ? id : defaultId,
262
256
  actionType,
263
257
  display,
264
258
  extensionKey,
@@ -507,7 +501,7 @@ export const useSmartLinkAnalytics = (url, _dispatchAnalytics, id, defaultLocati
507
501
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
508
502
  */
509
503
  invokeSucceededEvent: ({
510
- id: experienceId,
504
+ id,
511
505
  actionType,
512
506
  display,
513
507
  extensionKey,
@@ -517,9 +511,8 @@ export const useSmartLinkAnalytics = (url, _dispatchAnalytics, id, defaultLocati
517
511
  destinationSubproduct,
518
512
  location
519
513
  }) => {
520
- succeedUfoExperience('smart-link-action-invocation', experienceId);
521
514
  dispatchAnalytics(applyCommonAttributes(invokeSucceededEvent({
522
- id: defaultId,
515
+ id: id !== null && id !== void 0 ? id : defaultId,
523
516
  actionType,
524
517
  display,
525
518
  extensionKey,
@@ -539,7 +532,7 @@ export const useSmartLinkAnalytics = (url, _dispatchAnalytics, id, defaultLocati
539
532
  * @param reason The reason the invocation failed.
540
533
  */
541
534
  invokeFailedEvent: ({
542
- id: experienceId,
535
+ id,
543
536
  actionType,
544
537
  display,
545
538
  reason,
@@ -550,9 +543,8 @@ export const useSmartLinkAnalytics = (url, _dispatchAnalytics, id, defaultLocati
550
543
  destinationSubproduct,
551
544
  location
552
545
  }) => {
553
- failUfoExperience('smart-link-action-invocation', experienceId);
554
546
  dispatchAnalytics(applyCommonAttributes(invokeFailedEvent({
555
- id: defaultId,
547
+ id: id !== null && id !== void 0 ? id : defaultId,
556
548
  actionType,
557
549
  display,
558
550
  reason,
@@ -1,6 +1,9 @@
1
1
  import { useCallback } from 'react';
2
2
  import uuid from 'uuid';
3
3
  import * as measure from '../../../utils/performance';
4
+ import { failUfoExperience, startUfoExperience, succeedUfoExperience } from '../../analytics';
5
+ const ACTION_EXPERIENCE_NAME = 'smart-link-action-invocation';
6
+
4
7
  /**
5
8
  * Invoke client action such as preview, download and open link
6
9
  */
@@ -18,31 +21,34 @@ const useInvokeClientAction = ({
18
21
  const markName = `${experienceId}-${actionType}`;
19
22
  measure.mark(markName, 'pending');
20
23
  try {
21
- // Begin analytics instrumentation.
22
- analytics === null || analytics === void 0 ? void 0 : analytics.ui.actionClickedEvent({
23
- id: experienceId,
24
- extensionKey,
24
+ // Begin UFO experience
25
+ startUfoExperience(ACTION_EXPERIENCE_NAME, experienceId, {
25
26
  actionType,
26
27
  display,
28
+ extensionKey,
27
29
  invokeType: 'client'
28
30
  });
29
31
 
32
+ // Begin analytics instrumentation.
33
+ analytics === null || analytics === void 0 ? void 0 : analytics.ui.actionClickedEvent({
34
+ actionType,
35
+ display
36
+ });
37
+
30
38
  // Invoke action
31
39
  const result = await actionFn();
32
40
  measure.mark(markName, 'resolved');
41
+ succeedUfoExperience(ACTION_EXPERIENCE_NAME, experienceId);
33
42
  analytics === null || analytics === void 0 ? void 0 : analytics.operational.invokeSucceededEvent({
34
- id: experienceId,
35
- extensionKey,
36
43
  actionType,
37
44
  display
38
45
  });
39
46
  return result;
40
47
  } catch (err) {
41
48
  measure.mark(markName, 'errored');
49
+ failUfoExperience(ACTION_EXPERIENCE_NAME, experienceId);
42
50
  const reason = typeof err === 'string' ? err : err === null || err === void 0 ? void 0 : err.message;
43
51
  analytics === null || analytics === void 0 ? void 0 : analytics.operational.invokeFailedEvent({
44
- id: experienceId,
45
- extensionKey,
46
52
  actionType,
47
53
  display,
48
54
  reason
@@ -3,7 +3,7 @@ export const ANALYTICS_CHANNEL = 'media';
3
3
  export const context = {
4
4
  componentName: 'smart-cards',
5
5
  packageName: "@atlaskit/smart-card",
6
- packageVersion: "26.24.0"
6
+ packageVersion: "26.25.0"
7
7
  };
8
8
  export let TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
9
9
  TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
@@ -30,6 +30,7 @@ const FlexibleErroredView = ({
30
30
  const status = cardState.status;
31
31
  const actions = useMemo(() => onAuthorize ? [RetryAction(onAuthorize)] : [], [onAuthorize]);
32
32
  return /*#__PURE__*/React.createElement(FlexibleCard, {
33
+ appearance: "block",
33
34
  cardState: cardState,
34
35
  onAuthorize: onAuthorize,
35
36
  onClick: onClick,
@@ -4,8 +4,7 @@ import FlexibleCard from '../../../FlexibleCard';
4
4
  import TitleBlock from '../../../FlexibleCard/components/blocks/title-block';
5
5
  import { FooterBlock, MetadataBlock, PreviewBlock, SnippetBlock } from '../../../FlexibleCard/components/blocks';
6
6
  import { metadataBlockCss, footerBlockCss } from './styled';
7
- import { ActionName, CardDisplay, ElementName, MediaPlacement, SmartLinkPosition } from '../../../../constants';
8
- import uuid from 'uuid';
7
+ import { ActionName, ElementName, MediaPlacement, SmartLinkPosition } from '../../../../constants';
9
8
  import { getSimulatedMetadata, getSimulatedBetterMetadata } from './utils';
10
9
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
11
10
  import { withFlexibleUIBlockCardStyle } from './utils/withFlexibleUIBlockCardStyle';
@@ -32,7 +31,6 @@ const FlexibleResolvedView = ({
32
31
  useEffect(() => {
33
32
  setIsPreviewBlockErrored(false);
34
33
  }, [url, cardState]);
35
- const [analyticsId] = useState(() => id ? id : uuid());
36
34
  const {
37
35
  titleMetadata,
38
36
  topMetadata,
@@ -80,49 +78,13 @@ const FlexibleResolvedView = ({
80
78
  }, {
81
79
  actions: [{
82
80
  name: ActionName.PreviewAction,
83
- hideIcon: true,
84
- onClick: () => {
85
- analytics.ui.actionClickedEvent({
86
- id: analyticsId,
87
- actionType: 'PreviewAction',
88
- display: CardDisplay.Block
89
- });
90
- analytics.operational.invokeSucceededEvent({
91
- id: analyticsId,
92
- actionType: 'PreviewAction',
93
- display: CardDisplay.Block
94
- });
95
- }
81
+ hideIcon: true
96
82
  }, {
97
83
  name: ActionName.ViewAction,
98
- hideIcon: true,
99
- onClick: () => {
100
- analytics.ui.actionClickedEvent({
101
- id: analyticsId,
102
- actionType: 'ViewAction',
103
- display: CardDisplay.Block
104
- });
105
- analytics.operational.invokeSucceededEvent({
106
- id: analyticsId,
107
- actionType: 'ViewAction',
108
- display: CardDisplay.Block
109
- });
110
- }
84
+ hideIcon: true
111
85
  }, {
112
86
  name: ActionName.DownloadAction,
113
- hideIcon: true,
114
- onClick: () => {
115
- analytics.ui.actionClickedEvent({
116
- id: analyticsId,
117
- actionType: 'DownloadAction',
118
- display: CardDisplay.Block
119
- });
120
- analytics.operational.invokeSucceededEvent({
121
- id: analyticsId,
122
- actionType: 'DownloadAction',
123
- display: CardDisplay.Block
124
- });
125
- }
87
+ hideIcon: true
126
88
  }]
127
89
  })));
128
90
  };
@@ -2,6 +2,9 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import Action from '../index';
4
4
  import { downloadUrl as download } from '../../../../../../utils';
5
+ import { ActionName } from '../../../../../../constants';
6
+ import useInvokeClientAction from '../../../../../../state/hooks/use-invoke-client-action';
7
+ import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
5
8
  const DownloadAction = props => {
6
9
  const {
7
10
  appearance,
@@ -11,11 +14,22 @@ const DownloadAction = props => {
11
14
  testId,
12
15
  url
13
16
  } = props;
17
+ const analytics = useFlexibleUiAnalyticsContext();
18
+ const invoke = useInvokeClientAction({
19
+ analytics
20
+ });
14
21
  if (downloadUrl && url) {
15
22
  const action = {
16
23
  ...props,
17
24
  onClick: () => {
18
- download(downloadUrl);
25
+ invoke({
26
+ actionType: ActionName.DownloadAction,
27
+ actionFn: async () => download(downloadUrl),
28
+ // These values have already been set in analytics context.
29
+ // We only pass these here for ufo experience.
30
+ display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
31
+ extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
32
+ });
19
33
  if (onClick) {
20
34
  onClick();
21
35
  }
@@ -2,10 +2,11 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import Action from '../index';
4
4
  import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
5
- import { useSmartLinkAnalytics } from '../../../../../../state';
6
5
  import { FormattedMessage } from 'react-intl-next';
7
6
  import { messages } from '../../../../../../messages';
8
7
  import { openEmbedModalWithFlexibleUiIcon } from '../../../utils';
8
+ import useInvokeClientAction from '../../../../../../state/hooks/use-invoke-client-action';
9
+ import { ActionName } from '../../../../../../constants';
9
10
  const PreviewAction = props => {
10
11
  const {
11
12
  appearance,
@@ -20,22 +21,32 @@ const PreviewAction = props => {
20
21
  downloadUrl,
21
22
  isSupportTheming
22
23
  } = props;
23
- const defaultAnalytics = useSmartLinkAnalytics(url, () => {});
24
- const analytics = useFlexibleUiAnalyticsContext() || defaultAnalytics;
24
+ const analytics = useFlexibleUiAnalyticsContext();
25
+ const invoke = useInvokeClientAction({
26
+ analytics
27
+ });
25
28
  if (src && url) {
26
- const embedModal = () => openEmbedModalWithFlexibleUiIcon({
29
+ const actionFn = async () => openEmbedModalWithFlexibleUiIcon({
30
+ download: downloadUrl,
27
31
  title,
28
32
  providerName,
29
- downloadUrl,
30
33
  isSupportTheming,
31
34
  analytics,
32
35
  linkIcon,
33
- src
36
+ src,
37
+ url
34
38
  });
35
39
  const action = {
36
40
  ...props,
37
41
  onClick: () => {
38
- embedModal();
42
+ invoke({
43
+ actionType: ActionName.PreviewAction,
44
+ actionFn,
45
+ // These values have already been set in analytics context.
46
+ // We only pass these here for ufo experience.
47
+ display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
48
+ extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
49
+ });
39
50
  if (onClick) {
40
51
  onClick();
41
52
  }
@@ -2,6 +2,9 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
3
  import Action from '../index';
4
4
  import { openUrl } from '../../../../../../utils';
5
+ import { ActionName } from '../../../../../../constants';
6
+ import { useFlexibleUiAnalyticsContext } from '../../../../../../state/flexible-ui-context';
7
+ import useInvokeClientAction from '../../../../../../state/hooks/use-invoke-client-action';
5
8
  const ViewAction = props => {
6
9
  const {
7
10
  appearance,
@@ -11,11 +14,22 @@ const ViewAction = props => {
11
14
  viewUrl,
12
15
  url
13
16
  } = props;
17
+ const analytics = useFlexibleUiAnalyticsContext();
18
+ const invoke = useInvokeClientAction({
19
+ analytics
20
+ });
14
21
  if (viewUrl && url) {
15
22
  const action = {
16
23
  ...props,
17
24
  onClick: () => {
18
- openUrl(viewUrl);
25
+ invoke({
26
+ actionType: ActionName.ViewAction,
27
+ actionFn: async () => openUrl(viewUrl),
28
+ // These values have already been set in analytics context.
29
+ // We only pass these here for ufo experience.
30
+ display: analytics === null || analytics === void 0 ? void 0 : analytics.display,
31
+ extensionKey: analytics === null || analytics === void 0 ? void 0 : analytics.extensionKey
32
+ });
19
33
  if (onClick) {
20
34
  onClick();
21
35
  }
@@ -142,15 +142,8 @@ export const hasWhiteSpace = str => {
142
142
  return str.search(/\s/) >= 0;
143
143
  };
144
144
  export const openEmbedModalWithFlexibleUiIcon = ({
145
- analytics,
146
- downloadUrl,
147
145
  linkIcon,
148
- onClose,
149
- providerName,
150
- src,
151
- title,
152
- url,
153
- isSupportTheming
146
+ ...props
154
147
  }) => {
155
148
  const icon = {
156
149
  icon: /*#__PURE__*/React.createElement(Icon, _extends({}, linkIcon, {
@@ -159,18 +152,11 @@ export const openEmbedModalWithFlexibleUiIcon = ({
159
152
  isFlexibleUi: true
160
153
  };
161
154
  return openEmbedModal({
162
- analytics,
163
- download: downloadUrl,
155
+ ...props,
164
156
  icon,
165
157
  // Flex should not send origin as block card. It should be able to support
166
158
  // its internal parent components like hover card, block card and
167
159
  // itself as a standalone. To be investigated and fix in EDM-7520.
168
- origin: 'smartLinkCard',
169
- providerName,
170
- onClose,
171
- src,
172
- title,
173
- url,
174
- isSupportTheming
160
+ origin: 'smartLinkCard'
175
161
  });
176
162
  };
@@ -13,6 +13,7 @@ import { getContextByStatus, getRetryOptions } from './utils';
13
13
  */
14
14
  const FlexibleCard = ({
15
15
  analytics,
16
+ appearance = 'flexible',
16
17
  cardState,
17
18
  children,
18
19
  id,
@@ -28,6 +29,7 @@ const FlexibleCard = ({
28
29
  ui,
29
30
  url
30
31
  }) => {
32
+ var _details$meta2;
31
33
  const {
32
34
  status: cardType,
33
35
  details
@@ -45,6 +47,14 @@ const FlexibleCard = ({
45
47
  const {
46
48
  title
47
49
  } = context || {};
50
+ const analyticsContext = useMemo(() => {
51
+ var _details$meta;
52
+ return analytics ? {
53
+ ...analytics,
54
+ display: appearance,
55
+ extensionKey: details === null || details === void 0 ? void 0 : (_details$meta = details.meta) === null || _details$meta === void 0 ? void 0 : _details$meta.key
56
+ } : undefined;
57
+ }, [analytics, appearance, details === null || details === void 0 ? void 0 : (_details$meta2 = details.meta) === null || _details$meta2 === void 0 ? void 0 : _details$meta2.key]);
48
58
  useEffect(() => {
49
59
  switch (status) {
50
60
  case SmartLinkStatus.Resolved:
@@ -70,7 +80,7 @@ const FlexibleCard = ({
70
80
  }
71
81
  }, [onError, onResolve, status, title, url]);
72
82
  return /*#__PURE__*/React.createElement(FlexibleUiAnalyticsContext.Provider, {
73
- value: analytics
83
+ value: analyticsContext
74
84
  }, /*#__PURE__*/React.createElement(FlexibleUiOptionContext.Provider, {
75
85
  value: ui
76
86
  }, /*#__PURE__*/React.createElement(FlexibleUiContext.Provider, {
@@ -111,6 +111,7 @@ const HoverCardContent = ({
111
111
  subtitle: subtitle
112
112
  };
113
113
  const flexibleCardProps = {
114
+ appearance: CardDisplay.HoverCardPreview,
114
115
  cardState: cardState,
115
116
  onClick: onClick,
116
117
  onResolve: onResolve,
@@ -8,7 +8,7 @@ import LinkWarningModal from './LinkWarningModal';
8
8
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
9
  const PACKAGE_DATA = {
10
10
  packageName: "@atlaskit/smart-card",
11
- packageVersion: "26.24.0",
11
+ packageVersion: "26.25.0",
12
12
  componentName: 'linkUrl'
13
13
  };
14
14
  const Link = withLinkClickedEvent('a');
@@ -8,7 +8,7 @@ import { extractCommentCount, extractProgrammingLanguage, extractSubscriberCount
8
8
  import { extractLink, extractTitle, extractProvider, extractMembers, extractPersonAssignedTo, extractPersonCreatedBy, extractPersonUpdatedBy, extractImage } from '@atlaskit/link-extractors';
9
9
  import { extractByline } from '../common/byline/extractByline';
10
10
  import { extractTitlePrefix } from '../common/title-prefix/extractTitlePrefix';
11
- import { extractActions } from '../common/actions/extractActions';
11
+ import { extractClientActions } from '../common/actions/extractActions';
12
12
  import { extractPreviewAction } from '../common/actions/extractPreviewAction';
13
13
  import { extractIsTrusted } from '../common/meta/extractIsTrusted';
14
14
  var extractBlockIcon = function extractBlockIcon(jsonLd) {
@@ -31,7 +31,7 @@ var extractBlockDetails = function extractBlockDetails(jsonLd) {
31
31
  export var extractBlockActions = function extractBlockActions(props, jsonLd, opts, platform, meta) {
32
32
  if (opts) {
33
33
  var handleInvoke = opts.handleInvoke;
34
- var actions = extractActions(jsonLd, handleInvoke);
34
+ var actions = extractClientActions(jsonLd, handleInvoke);
35
35
  var previewAction = extractPreviewAction(_objectSpread(_objectSpread({}, opts), {}, {
36
36
  viewProps: props,
37
37
  jsonLd: jsonLd,
@@ -1,4 +1,3 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
2
  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
3
  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; }
@@ -37,27 +36,6 @@ var getClientActionProps = function getClientActionProps(jsonLd, action, handler
37
36
  }
38
37
  });
39
38
  };
40
- var getServerActionProps = function getServerActionProps(jsonLd, action, handler) {
41
- var id = action['@id'] || action['@type'];
42
- var data = {
43
- type: 'server',
44
- key: action.identifier,
45
- action: {
46
- type: action['@type'],
47
- payload: {
48
- id: id,
49
- context: jsonLd.context
50
- }
51
- }
52
- };
53
- return {
54
- id: id,
55
- text: action.name,
56
- promise: function promise() {
57
- return handler(data);
58
- }
59
- };
60
- };
61
39
  export var getActionsFromJsonLd = function getActionsFromJsonLd(jsonLd) {
62
40
  var actions = jsonLd && jsonLd['schema:potentialAction'];
63
41
  if (!actions) {
@@ -68,17 +46,11 @@ export var getActionsFromJsonLd = function getActionsFromJsonLd(jsonLd) {
68
46
  }
69
47
  return actions;
70
48
  };
71
- export function extractActions(jsonLd, handler) {
49
+ export function extractClientActions(jsonLd, handler) {
72
50
  var actions = getActionsFromJsonLd(jsonLd);
73
51
  var clientActions = actions.filter(isClientAction);
74
- var serverActions = actions.filter(function (action) {
75
- return !isClientAction(action);
76
- });
77
52
  var clientActionImpls = clientActions.map(function (action) {
78
53
  return getClientActionProps(jsonLd, action, handler);
79
54
  });
80
- var serverActionImpls = serverActions.map(function (action) {
81
- return getServerActionProps(jsonLd, action, handler);
82
- });
83
- return [].concat(_toConsumableArray(clientActionImpls), _toConsumableArray(serverActionImpls));
55
+ return clientActionImpls;
84
56
  }
@@ -247,11 +247,11 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
247
247
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
248
248
  * @param actionType The type of the action that was clicked, e.g. PreviewAction
249
249
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
250
- * @param invokeType Whether the action invoked made a call to a server.
250
+ * @param invokeType @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-2681 Internal documentation for deprecation (no external access)}
251
251
  * @returns
252
252
  */
253
253
  actionClickedEvent: function actionClickedEvent(_ref6) {
254
- var experienceId = _ref6.id,
254
+ var id = _ref6.id,
255
255
  actionType = _ref6.actionType,
256
256
  display = _ref6.display,
257
257
  invokeType = _ref6.invokeType,
@@ -262,14 +262,8 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
262
262
  destinationSubproduct = _ref6.destinationSubproduct,
263
263
  location = _ref6.location;
264
264
  var extensionKey = overrideExtensionKey !== null && overrideExtensionKey !== void 0 ? overrideExtensionKey : extractedExtensionKey;
265
- startUfoExperience('smart-link-action-invocation', experienceId, {
266
- actionType: actionType,
267
- display: display,
268
- extensionKey: extensionKey,
269
- invokeType: invokeType
270
- });
271
265
  dispatchAnalytics(applyCommonAttributes(uiActionClickedEvent({
272
- id: defaultId,
266
+ id: id !== null && id !== void 0 ? id : defaultId,
273
267
  actionType: actionType,
274
268
  display: display,
275
269
  extensionKey: extensionKey,
@@ -527,7 +521,7 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
527
521
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
528
522
  */
529
523
  invokeSucceededEvent: function invokeSucceededEvent(_ref13) {
530
- var experienceId = _ref13.id,
524
+ var id = _ref13.id,
531
525
  actionType = _ref13.actionType,
532
526
  display = _ref13.display,
533
527
  extensionKey = _ref13.extensionKey,
@@ -536,9 +530,8 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
536
530
  destinationProduct = _ref13.destinationProduct,
537
531
  destinationSubproduct = _ref13.destinationSubproduct,
538
532
  location = _ref13.location;
539
- succeedUfoExperience('smart-link-action-invocation', experienceId);
540
533
  dispatchAnalytics(applyCommonAttributes(_invokeSucceededEvent({
541
- id: defaultId,
534
+ id: id !== null && id !== void 0 ? id : defaultId,
542
535
  actionType: actionType,
543
536
  display: display,
544
537
  extensionKey: extensionKey,
@@ -558,7 +551,7 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
558
551
  * @param reason The reason the invocation failed.
559
552
  */
560
553
  invokeFailedEvent: function invokeFailedEvent(_ref14) {
561
- var experienceId = _ref14.id,
554
+ var id = _ref14.id,
562
555
  actionType = _ref14.actionType,
563
556
  display = _ref14.display,
564
557
  reason = _ref14.reason,
@@ -568,9 +561,8 @@ export var useSmartLinkAnalytics = function useSmartLinkAnalytics(url, _dispatch
568
561
  destinationProduct = _ref14.destinationProduct,
569
562
  destinationSubproduct = _ref14.destinationSubproduct,
570
563
  location = _ref14.location;
571
- failUfoExperience('smart-link-action-invocation', experienceId);
572
564
  dispatchAnalytics(applyCommonAttributes(_invokeFailedEvent({
573
- id: defaultId,
565
+ id: id !== null && id !== void 0 ? id : defaultId,
574
566
  actionType: actionType,
575
567
  display: display,
576
568
  reason: reason,