@atlaskit/smart-card 26.27.1 → 26.28.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 (62) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/state/analytics/useSmartLinkAnalytics.js +6 -2
  3. package/dist/cjs/state/helpers.js +11 -2
  4. package/dist/cjs/utils/analytics/analytics.js +5 -3
  5. package/dist/cjs/utils/mocks.js +53 -71
  6. package/dist/cjs/view/CardWithUrl/component.js +4 -2
  7. package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/index.js +5 -3
  8. package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/resolved/index.js +4 -2
  9. package/dist/cjs/view/FlexibleCard/components/elements/index.js +10 -3
  10. package/dist/cjs/view/FlexibleCard/components/elements/preview/index.js +35 -0
  11. package/dist/cjs/view/FlexibleCard/components/elements/preview/types.js +5 -0
  12. package/dist/cjs/view/HoverCard/components/views/resolved/index.js +5 -2
  13. package/dist/cjs/view/LinkUrl/index.js +1 -1
  14. package/dist/es2019/state/analytics/useSmartLinkAnalytics.js +5 -2
  15. package/dist/es2019/state/helpers.js +5 -0
  16. package/dist/es2019/utils/analytics/analytics.js +5 -3
  17. package/dist/es2019/utils/mocks.js +51 -71
  18. package/dist/es2019/view/CardWithUrl/component.js +5 -3
  19. package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/index.js +4 -2
  20. package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/resolved/index.js +3 -1
  21. package/dist/es2019/view/FlexibleCard/components/elements/index.js +1 -1
  22. package/dist/es2019/view/FlexibleCard/components/elements/preview/index.js +23 -0
  23. package/dist/es2019/view/FlexibleCard/components/elements/preview/types.js +1 -0
  24. package/dist/es2019/view/HoverCard/components/views/resolved/index.js +5 -2
  25. package/dist/es2019/view/LinkUrl/index.js +1 -1
  26. package/dist/esm/state/analytics/useSmartLinkAnalytics.js +6 -2
  27. package/dist/esm/state/helpers.js +7 -0
  28. package/dist/esm/utils/analytics/analytics.js +5 -3
  29. package/dist/esm/utils/mocks.js +53 -71
  30. package/dist/esm/view/CardWithUrl/component.js +5 -3
  31. package/dist/esm/view/FlexibleCard/components/blocks/preview-block/index.js +5 -3
  32. package/dist/esm/view/FlexibleCard/components/blocks/preview-block/resolved/index.js +4 -2
  33. package/dist/esm/view/FlexibleCard/components/elements/index.js +1 -1
  34. package/dist/esm/view/FlexibleCard/components/elements/preview/index.js +24 -0
  35. package/dist/esm/view/FlexibleCard/components/elements/preview/types.js +1 -0
  36. package/dist/esm/view/HoverCard/components/views/resolved/index.js +5 -2
  37. package/dist/esm/view/LinkUrl/index.js +1 -1
  38. package/dist/types/state/analytics/useSmartLinkAnalytics.d.ts +2 -1
  39. package/dist/types/state/helpers.d.ts +3 -0
  40. package/dist/types/state/hooks/useSmartLink.d.ts +1 -1
  41. package/dist/types/utils/analytics/analytics.d.ts +1 -1
  42. package/dist/types/utils/analytics/types.d.ts +1 -0
  43. package/dist/types/utils/mocks.d.ts +42 -1
  44. package/dist/types/view/FlexibleCard/components/blocks/preview-block/index.d.ts +1 -1
  45. package/dist/types/view/FlexibleCard/components/blocks/preview-block/types.d.ts +4 -0
  46. package/dist/types/view/FlexibleCard/components/elements/index.d.ts +1 -2
  47. package/dist/types/view/FlexibleCard/components/elements/preview/index.d.ts +5 -0
  48. package/dist/types/view/FlexibleCard/components/elements/preview/types.d.ts +13 -0
  49. package/dist/types-ts4.5/state/analytics/useSmartLinkAnalytics.d.ts +2 -1
  50. package/dist/types-ts4.5/state/helpers.d.ts +3 -0
  51. package/dist/types-ts4.5/state/hooks/useSmartLink.d.ts +1 -1
  52. package/dist/types-ts4.5/utils/analytics/analytics.d.ts +1 -1
  53. package/dist/types-ts4.5/utils/analytics/types.d.ts +1 -0
  54. package/dist/types-ts4.5/utils/mocks.d.ts +42 -1
  55. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/preview-block/index.d.ts +1 -1
  56. package/dist/types-ts4.5/view/FlexibleCard/components/blocks/preview-block/types.d.ts +4 -0
  57. package/dist/types-ts4.5/view/FlexibleCard/components/elements/index.d.ts +1 -2
  58. package/dist/types-ts4.5/view/FlexibleCard/components/elements/preview/index.d.ts +5 -0
  59. package/dist/types-ts4.5/view/FlexibleCard/components/elements/preview/types.d.ts +13 -0
  60. package/package.json +5 -5
  61. package/report.api.md +3 -0
  62. package/tmp/api-report-tmp.d.ts +3 -1
@@ -92,7 +92,7 @@ export var OwnedByGroup = createElement(ElementName.OwnedByGroup);
92
92
  * Creates a Preview element using the data from Preview in the Flexible UI Context.
93
93
  * @see Preview
94
94
  */
95
- export var Preview = createElement(ElementName.Preview);
95
+ export { default as Preview } from './preview';
96
96
  /**
97
97
  * Creates a Priority Badge element using the data from Priority in the Flexible UI Context.
98
98
  * @see Badge
@@ -0,0 +1,24 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["overrideUrl"];
4
+ /** @jsx jsx */
5
+ import React, { useContext } from 'react';
6
+ import { jsx } from '@emotion/react';
7
+ import { FlexibleUiContext } from '../../../../../state/flexible-ui-context';
8
+ import { MediaType } from '../../../../../constants';
9
+ import Media from '../media';
10
+ var Preview = function Preview(props) {
11
+ var _ref = props !== null && props !== void 0 ? props : {},
12
+ overrideUrl = _ref.overrideUrl,
13
+ rest = _objectWithoutProperties(_ref, _excluded);
14
+ var context = useContext(FlexibleUiContext);
15
+ var data = overrideUrl ? {
16
+ url: overrideUrl,
17
+ type: MediaType.Image
18
+ } : context === null || context === void 0 ? void 0 : context.preview;
19
+ if (!data) {
20
+ return null;
21
+ }
22
+ return jsx(Media, _extends({}, rest, data));
23
+ };
24
+ export default Preview;
@@ -11,6 +11,7 @@ import { extractMetadata, elementNamesToItems } from '../../../../../extractors/
11
11
  import { messages } from '../../../../../messages';
12
12
  import { FormattedMessage } from 'react-intl-next';
13
13
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
14
+ import { getCanBeDatasource } from '../../../../../state/helpers';
14
15
  export var toFooterActions = function toFooterActions(cardActions, onActionClick) {
15
16
  var followAction = {
16
17
  hideIcon: true,
@@ -58,14 +59,16 @@ var HoverCardResolvedView = function HoverCardResolvedView(_ref) {
58
59
  cardActions = _ref$cardActions === void 0 ? [] : _ref$cardActions,
59
60
  onActionClick = _ref.onActionClick,
60
61
  extensionKey = _ref.extensionKey;
62
+ var canBeDatasource = getCanBeDatasource(cardState.details);
61
63
  useEffect(function () {
62
64
  // Since this hover view is only rendered on resolved status,
63
65
  // there is no need to check for statuses.
64
66
  analytics.ui.renderSuccessEvent({
65
67
  display: CardDisplay.HoverCardPreview,
66
- status: cardState.status
68
+ status: cardState.status,
69
+ canBeDatasource: canBeDatasource
67
70
  });
68
- }, [analytics.ui, cardState.status]);
71
+ }, [analytics.ui, cardState.status, canBeDatasource]);
69
72
  var footerActions = useMemo(function () {
70
73
  return toFooterActions(cardActions, onActionClick);
71
74
  }, [cardActions, onActionClick]);
@@ -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.27.1",
14
+ packageVersion: "26.28.0",
15
15
  componentName: 'linkUrl'
16
16
  };
17
17
  var Link = withLinkClickedEvent('a');
@@ -125,8 +125,9 @@ export declare const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: A
125
125
  * @param id The unique ID for this Smart Link.
126
126
  * @param definitionId The definitionId of the Smart Link resolver invoked.
127
127
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
128
+ * @param canBeDatasource An indicator that shows that a smart link can be converted to a datasource
128
129
  */
129
- renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiRenderSuccessEventProps) => void;
130
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, canBeDatasource, }: UiRenderSuccessEventProps) => void;
130
131
  /**
131
132
  * This fires an event that represents when a Smart Link renders unsuccessfuly.
132
133
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
@@ -1,6 +1,7 @@
1
1
  import { JsonLd } from 'json-ld-types';
2
2
  import { CardType, CardStore } from '@atlaskit/linking-common';
3
3
  import { DestinationProduct, DestinationSubproduct } from '../utils/analytics/types';
4
+ import { DatasourceResolveResponse, JsonLdDatasourceResponse } from '@atlaskit/link-client-extension';
4
5
  export declare const getByDefinitionId: (definitionId: string | undefined, store: CardStore) => string[];
5
6
  export declare const getClickUrl: (url: string, jsonLd?: JsonLd.Response) => string;
6
7
  export declare const getDefinitionId: (details?: JsonLd.Response) => string | undefined;
@@ -14,3 +15,5 @@ export declare const isAccessible: ({ meta: { access } }: JsonLd.Response) => bo
14
15
  export declare const isVisible: ({ meta: { visibility } }: JsonLd.Response) => boolean;
15
16
  export declare const getStatusDetails: (details?: JsonLd.Response) => string | undefined;
16
17
  export declare const isFinalState: (status: CardType) => boolean;
18
+ export declare const getDatasources: (details?: JsonLdDatasourceResponse) => DatasourceResolveResponse[] | undefined;
19
+ export declare const getCanBeDatasource: (details?: JsonLdDatasourceResponse) => boolean;
@@ -30,7 +30,7 @@ dispatchAnalytics?: AnalyticsHandler): {
30
30
  modalClosedEvent: (data: Partial<import("../../utils/types").AnalyticsPayload> & {
31
31
  actionSubjectId: string;
32
32
  }) => void;
33
- renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiRenderSuccessEventProps) => void;
33
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, canBeDatasource, }: import("../../utils/analytics/types").UiRenderSuccessEventProps) => void;
34
34
  renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiRenderFailedEventProps) => void;
35
35
  hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("../../utils/analytics/types").UiHoverCardViewedEventProps) => void;
36
36
  hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("../../utils/analytics/types").UiHoverCardDismissedEventProps) => void;
@@ -49,7 +49,7 @@ export declare const uiIframeFocusedEvent: ({ id, display, status, definitionId,
49
49
  export declare const uiActionClickedEvent: ({ id, actionType, extensionKey, display, definitionId, destinationProduct, destinationSubproduct, location, }: UiActionClickedEventProps) => AnalyticsPayload;
50
50
  export declare const uiClosedAuthEvent: ({ display, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: UiClosedAuthEventProps) => AnalyticsPayload;
51
51
  export declare const screenAuthPopupEvent: ({ extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: ScreenAuthPopupEventProps) => AnalyticsPayload;
52
- export declare const uiRenderSuccessEvent: ({ display, status, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: UiRenderSuccessEventProps) => AnalyticsPayload;
52
+ export declare const uiRenderSuccessEvent: ({ display, status, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, canBeDatasource, }: UiRenderSuccessEventProps) => AnalyticsPayload;
53
53
  export declare const uiRenderFailedEvent: ({ display, error, errorInfo, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: UiRenderFailedEventProps) => AnalyticsPayload;
54
54
  export declare const uiHoverCardViewedEvent: ({ id, previewDisplay, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, previewInvokeMethod, status, }: UiHoverCardViewedEventProps) => AnalyticsPayload;
55
55
  export declare const uiHoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, previewInvokeMethod, status, }: UiHoverCardDismissedEventProps) => AnalyticsPayload;
@@ -85,6 +85,7 @@ export type UiClosedAuthEventProps = CommonEventProps & {
85
85
  export type UiRenderSuccessEventProps = CommonEventProps & {
86
86
  display: CardInnerAppearance;
87
87
  status: CardType;
88
+ canBeDatasource?: boolean;
88
89
  };
89
90
  export type UiRenderFailedEventProps = CommonEventProps & {
90
91
  display: CardInnerAppearance;
@@ -35,6 +35,47 @@ export declare const mocks: {
35
35
  };
36
36
  };
37
37
  };
38
+ withDatasource: {
39
+ meta: {
40
+ visibility: string;
41
+ access: string;
42
+ auth: never[];
43
+ definitionId: string;
44
+ key: string;
45
+ };
46
+ data: {
47
+ summary: string;
48
+ 'schema:potentialAction': {
49
+ '@id': string;
50
+ '@type': string;
51
+ identifier: string;
52
+ name: string;
53
+ };
54
+ 'atlassian:downloadUrl': string;
55
+ preview: {
56
+ href: string;
57
+ };
58
+ '@context': {
59
+ '@vocab': string;
60
+ atlassian: string;
61
+ schema: string;
62
+ };
63
+ '@type': string;
64
+ name: string;
65
+ url: string;
66
+ };
67
+ datasources: {
68
+ key: string;
69
+ parameters: {
70
+ jql: string;
71
+ cloudId: string;
72
+ };
73
+ id: string;
74
+ ari: string;
75
+ description: string;
76
+ name: string;
77
+ }[];
78
+ };
38
79
  };
39
80
  export declare const fakeResponse: () => Promise<JsonLd.Response<JsonLd.Data.BaseData>>;
40
81
  export declare const fakeFactory: any;
@@ -55,7 +96,7 @@ export declare const mockAnalytics: {
55
96
  modalClosedEvent: (data: Partial<import("./types").AnalyticsPayload> & {
56
97
  actionSubjectId: string;
57
98
  }) => void;
58
- renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").UiRenderSuccessEventProps) => void;
99
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, canBeDatasource, }: import("./analytics/types").UiRenderSuccessEventProps) => void;
59
100
  renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").UiRenderFailedEventProps) => void;
60
101
  hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("./analytics/types").UiHoverCardViewedEventProps) => void;
61
102
  hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("./analytics/types").UiHoverCardDismissedEventProps) => void;
@@ -4,7 +4,7 @@ import { PreviewBlockProps } from './types';
4
4
  /**
5
5
  * Represents a PreviewBlock, which typically contains media or other large format content.
6
6
  * @public
7
- * @param {PreviewBlock} PreviewBlock
7
+ * @param {PreviewBlockProps} PreviewBlock
8
8
  * @see Block
9
9
  */
10
10
  declare const PreviewBlock: React.FC<PreviewBlockProps>;
@@ -20,4 +20,8 @@ export type PreviewBlockProps = {
20
20
  * to the left/right of the container.
21
21
  */
22
22
  placement?: MediaPlacement;
23
+ /**
24
+ * An image URL to render. This will replace the default image from smart link data.
25
+ */
26
+ overrideUrl?: string;
23
27
  } & BlockProps;
@@ -6,7 +6,6 @@ import { LozengeProps } from './lozenge/types';
6
6
  import { AvatarGroupProps } from './avatar-group/types';
7
7
  import { TextProps } from './text/types';
8
8
  import { DateTimeProps } from './date-time/types';
9
- import { MediaProps } from './media/types';
10
9
  import { AtlaskitBadgeProps } from './atlaskit-badge/types';
11
10
  /**
12
11
  * Creates a AssignedTo text element using the data from AssignedTo in the Flexible UI Context.
@@ -97,7 +96,7 @@ export declare const OwnedByGroup: import("react").FC<AvatarGroupProps>;
97
96
  * Creates a Preview element using the data from Preview in the Flexible UI Context.
98
97
  * @see Preview
99
98
  */
100
- export declare const Preview: import("react").FC<MediaProps>;
99
+ export { default as Preview } from './preview';
101
100
  /**
102
101
  * Creates a Priority Badge element using the data from Priority in the Flexible UI Context.
103
102
  * @see Badge
@@ -0,0 +1,5 @@
1
+ /** @jsx jsx */
2
+ import React from 'react';
3
+ import { PreviewProps } from './types';
4
+ declare const Preview: React.FC<PreviewProps>;
5
+ export default Preview;
@@ -0,0 +1,13 @@
1
+ import { ElementProps } from '../types';
2
+ export type PreviewProps = ElementProps & {
3
+ /**
4
+ * An image URL to render. This will replace the default image from smart link data.
5
+ */
6
+ overrideUrl?: string;
7
+ /**
8
+ * Function to be called on error loading media.
9
+ * @internal
10
+ */
11
+ onError?: () => void;
12
+ onLoad?: () => void;
13
+ };
@@ -125,8 +125,9 @@ export declare const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: A
125
125
  * @param id The unique ID for this Smart Link.
126
126
  * @param definitionId The definitionId of the Smart Link resolver invoked.
127
127
  * @param extensionKey The extensionKey of the Smart Link resovler invoked.
128
+ * @param canBeDatasource An indicator that shows that a smart link can be converted to a datasource
128
129
  */
129
- renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiRenderSuccessEventProps) => void;
130
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, canBeDatasource, }: UiRenderSuccessEventProps) => void;
130
131
  /**
131
132
  * This fires an event that represents when a Smart Link renders unsuccessfuly.
132
133
  * @param display Whether the card was an Inline, Block, Embed or Flexible UI.
@@ -1,6 +1,7 @@
1
1
  import { JsonLd } from 'json-ld-types';
2
2
  import { CardType, CardStore } from '@atlaskit/linking-common';
3
3
  import { DestinationProduct, DestinationSubproduct } from '../utils/analytics/types';
4
+ import { DatasourceResolveResponse, JsonLdDatasourceResponse } from '@atlaskit/link-client-extension';
4
5
  export declare const getByDefinitionId: (definitionId: string | undefined, store: CardStore) => string[];
5
6
  export declare const getClickUrl: (url: string, jsonLd?: JsonLd.Response) => string;
6
7
  export declare const getDefinitionId: (details?: JsonLd.Response) => string | undefined;
@@ -14,3 +15,5 @@ export declare const isAccessible: ({ meta: { access } }: JsonLd.Response) => bo
14
15
  export declare const isVisible: ({ meta: { visibility } }: JsonLd.Response) => boolean;
15
16
  export declare const getStatusDetails: (details?: JsonLd.Response) => string | undefined;
16
17
  export declare const isFinalState: (status: CardType) => boolean;
18
+ export declare const getDatasources: (details?: JsonLdDatasourceResponse) => DatasourceResolveResponse[] | undefined;
19
+ export declare const getCanBeDatasource: (details?: JsonLdDatasourceResponse) => boolean;
@@ -30,7 +30,7 @@ dispatchAnalytics?: AnalyticsHandler): {
30
30
  modalClosedEvent: (data: Partial<import("../../utils/types").AnalyticsPayload> & {
31
31
  actionSubjectId: string;
32
32
  }) => void;
33
- renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiRenderSuccessEventProps) => void;
33
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, canBeDatasource, }: import("../../utils/analytics/types").UiRenderSuccessEventProps) => void;
34
34
  renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("../../utils/analytics/types").UiRenderFailedEventProps) => void;
35
35
  hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("../../utils/analytics/types").UiHoverCardViewedEventProps) => void;
36
36
  hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("../../utils/analytics/types").UiHoverCardDismissedEventProps) => void;
@@ -49,7 +49,7 @@ export declare const uiIframeFocusedEvent: ({ id, display, status, definitionId,
49
49
  export declare const uiActionClickedEvent: ({ id, actionType, extensionKey, display, definitionId, destinationProduct, destinationSubproduct, location, }: UiActionClickedEventProps) => AnalyticsPayload;
50
50
  export declare const uiClosedAuthEvent: ({ display, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: UiClosedAuthEventProps) => AnalyticsPayload;
51
51
  export declare const screenAuthPopupEvent: ({ extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: ScreenAuthPopupEventProps) => AnalyticsPayload;
52
- export declare const uiRenderSuccessEvent: ({ display, status, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: UiRenderSuccessEventProps) => AnalyticsPayload;
52
+ export declare const uiRenderSuccessEvent: ({ display, status, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, canBeDatasource, }: UiRenderSuccessEventProps) => AnalyticsPayload;
53
53
  export declare const uiRenderFailedEvent: ({ display, error, errorInfo, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, }: UiRenderFailedEventProps) => AnalyticsPayload;
54
54
  export declare const uiHoverCardViewedEvent: ({ id, previewDisplay, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, previewInvokeMethod, status, }: UiHoverCardViewedEventProps) => AnalyticsPayload;
55
55
  export declare const uiHoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, extensionKey, definitionId, destinationProduct, destinationSubproduct, location, previewInvokeMethod, status, }: UiHoverCardDismissedEventProps) => AnalyticsPayload;
@@ -85,6 +85,7 @@ export type UiClosedAuthEventProps = CommonEventProps & {
85
85
  export type UiRenderSuccessEventProps = CommonEventProps & {
86
86
  display: CardInnerAppearance;
87
87
  status: CardType;
88
+ canBeDatasource?: boolean;
88
89
  };
89
90
  export type UiRenderFailedEventProps = CommonEventProps & {
90
91
  display: CardInnerAppearance;
@@ -35,6 +35,47 @@ export declare const mocks: {
35
35
  };
36
36
  };
37
37
  };
38
+ withDatasource: {
39
+ meta: {
40
+ visibility: string;
41
+ access: string;
42
+ auth: never[];
43
+ definitionId: string;
44
+ key: string;
45
+ };
46
+ data: {
47
+ summary: string;
48
+ 'schema:potentialAction': {
49
+ '@id': string;
50
+ '@type': string;
51
+ identifier: string;
52
+ name: string;
53
+ };
54
+ 'atlassian:downloadUrl': string;
55
+ preview: {
56
+ href: string;
57
+ };
58
+ '@context': {
59
+ '@vocab': string;
60
+ atlassian: string;
61
+ schema: string;
62
+ };
63
+ '@type': string;
64
+ name: string;
65
+ url: string;
66
+ };
67
+ datasources: {
68
+ key: string;
69
+ parameters: {
70
+ jql: string;
71
+ cloudId: string;
72
+ };
73
+ id: string;
74
+ ari: string;
75
+ description: string;
76
+ name: string;
77
+ }[];
78
+ };
38
79
  };
39
80
  export declare const fakeResponse: () => Promise<JsonLd.Response<JsonLd.Data.BaseData>>;
40
81
  export declare const fakeFactory: any;
@@ -55,7 +96,7 @@ export declare const mockAnalytics: {
55
96
  modalClosedEvent: (data: Partial<import("./types").AnalyticsPayload> & {
56
97
  actionSubjectId: string;
57
98
  }) => void;
58
- renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").UiRenderSuccessEventProps) => void;
99
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, canBeDatasource, }: import("./analytics/types").UiRenderSuccessEventProps) => void;
59
100
  renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: import("./analytics/types").UiRenderFailedEventProps) => void;
60
101
  hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("./analytics/types").UiHoverCardViewedEventProps) => void;
61
102
  hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: import("./analytics/types").UiHoverCardDismissedEventProps) => void;
@@ -4,7 +4,7 @@ import { PreviewBlockProps } from './types';
4
4
  /**
5
5
  * Represents a PreviewBlock, which typically contains media or other large format content.
6
6
  * @public
7
- * @param {PreviewBlock} PreviewBlock
7
+ * @param {PreviewBlockProps} PreviewBlock
8
8
  * @see Block
9
9
  */
10
10
  declare const PreviewBlock: React.FC<PreviewBlockProps>;
@@ -20,4 +20,8 @@ export type PreviewBlockProps = {
20
20
  * to the left/right of the container.
21
21
  */
22
22
  placement?: MediaPlacement;
23
+ /**
24
+ * An image URL to render. This will replace the default image from smart link data.
25
+ */
26
+ overrideUrl?: string;
23
27
  } & BlockProps;
@@ -6,7 +6,6 @@ import { LozengeProps } from './lozenge/types';
6
6
  import { AvatarGroupProps } from './avatar-group/types';
7
7
  import { TextProps } from './text/types';
8
8
  import { DateTimeProps } from './date-time/types';
9
- import { MediaProps } from './media/types';
10
9
  import { AtlaskitBadgeProps } from './atlaskit-badge/types';
11
10
  /**
12
11
  * Creates a AssignedTo text element using the data from AssignedTo in the Flexible UI Context.
@@ -97,7 +96,7 @@ export declare const OwnedByGroup: import("react").FC<AvatarGroupProps>;
97
96
  * Creates a Preview element using the data from Preview in the Flexible UI Context.
98
97
  * @see Preview
99
98
  */
100
- export declare const Preview: import("react").FC<MediaProps>;
99
+ export { default as Preview } from './preview';
101
100
  /**
102
101
  * Creates a Priority Badge element using the data from Priority in the Flexible UI Context.
103
102
  * @see Badge
@@ -0,0 +1,5 @@
1
+ /** @jsx jsx */
2
+ import React from 'react';
3
+ import { PreviewProps } from './types';
4
+ declare const Preview: React.FC<PreviewProps>;
5
+ export default Preview;
@@ -0,0 +1,13 @@
1
+ import { ElementProps } from '../types';
2
+ export type PreviewProps = ElementProps & {
3
+ /**
4
+ * An image URL to render. This will replace the default image from smart link data.
5
+ */
6
+ overrideUrl?: string;
7
+ /**
8
+ * Function to be called on error loading media.
9
+ * @internal
10
+ */
11
+ onError?: () => void;
12
+ onLoad?: () => void;
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/smart-card",
3
- "version": "26.27.1",
3
+ "version": "26.28.0",
4
4
  "description": "Smart card component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -28,7 +28,7 @@
28
28
  "@atlaskit/avatar-group": "^9.4.0",
29
29
  "@atlaskit/badge": "^15.1.0",
30
30
  "@atlaskit/button": "^16.10.0",
31
- "@atlaskit/dropdown-menu": "^11.13.0",
31
+ "@atlaskit/dropdown-menu": "^11.14.0",
32
32
  "@atlaskit/frontend-utilities": "^2.7.0",
33
33
  "@atlaskit/icon": "^21.12.0",
34
34
  "@atlaskit/icon-file-type": "^6.4.0",
@@ -42,13 +42,13 @@
42
42
  "@atlaskit/linking-types": "^8.3.0",
43
43
  "@atlaskit/logo": "^13.14.0",
44
44
  "@atlaskit/lozenge": "^11.4.0",
45
- "@atlaskit/modal-dialog": "^12.6.0",
45
+ "@atlaskit/modal-dialog": "^12.7.0",
46
46
  "@atlaskit/outbound-auth-flow-client": "^3.4.0",
47
47
  "@atlaskit/platform-feature-flags": "^0.2.1",
48
- "@atlaskit/popup": "^1.9.0",
48
+ "@atlaskit/popup": "^1.10.0",
49
49
  "@atlaskit/spinner": "^15.5.0",
50
50
  "@atlaskit/theme": "^12.6.0",
51
- "@atlaskit/tokens": "^1.24.0",
51
+ "@atlaskit/tokens": "^1.25.0",
52
52
  "@atlaskit/tooltip": "^17.8.0",
53
53
  "@atlaskit/ufo": "^0.2.0",
54
54
  "@babel/runtime": "^7.0.0",
package/report.api.md CHANGED
@@ -760,6 +760,7 @@ type PreviewBlockProps = {
760
760
  ignoreContainerPadding?: boolean;
761
761
  onError?: () => void;
762
762
  placement?: MediaPlacement;
763
+ overrideUrl?: string;
763
764
  } & BlockProps;
764
765
 
765
766
  // @public (undocumented)
@@ -1064,6 +1065,7 @@ type UiRenderFailedEventProps = CommonEventProps & {
1064
1065
  type UiRenderSuccessEventProps = CommonEventProps & {
1065
1066
  display: CardInnerAppearance;
1066
1067
  status: CardType;
1068
+ canBeDatasource?: boolean;
1067
1069
  };
1068
1070
 
1069
1071
  // @public (undocumented)
@@ -1181,6 +1183,7 @@ export const useSmartLinkAnalytics: (
1181
1183
  destinationProduct,
1182
1184
  destinationSubproduct,
1183
1185
  location,
1186
+ canBeDatasource,
1184
1187
  }: UiRenderSuccessEventProps) => void;
1185
1188
  renderFailedEvent: ({
1186
1189
  display,
@@ -611,6 +611,7 @@ type PreviewBlockProps = {
611
611
  ignoreContainerPadding?: boolean;
612
612
  onError?: () => void;
613
613
  placement?: MediaPlacement;
614
+ overrideUrl?: string;
614
615
  } & BlockProps;
615
616
 
616
617
  // @public (undocumented)
@@ -912,6 +913,7 @@ type UiRenderFailedEventProps = CommonEventProps & {
912
913
  type UiRenderSuccessEventProps = CommonEventProps & {
913
914
  display: CardInnerAppearance;
914
915
  status: CardType;
916
+ canBeDatasource?: boolean;
915
917
  };
916
918
 
917
919
  // @public (undocumented)
@@ -936,7 +938,7 @@ export const useSmartLinkAnalytics: (url: string, _dispatchAnalytics?: Analytics
936
938
  modalClosedEvent: (data: Partial<AnalyticsPayload> & {
937
939
  actionSubjectId: Required<string>;
938
940
  }) => void;
939
- renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiRenderSuccessEventProps) => void;
941
+ renderSuccessEvent: ({ display, status, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, canBeDatasource, }: UiRenderSuccessEventProps) => void;
940
942
  renderFailedEvent: ({ display, id, error, errorInfo, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, }: UiRenderFailedEventProps) => void;
941
943
  hoverCardViewedEvent: ({ previewDisplay, previewInvokeMethod, id, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: UiHoverCardViewedEventProps) => void;
942
944
  hoverCardDismissedEvent: ({ id, previewDisplay, hoverTime, previewInvokeMethod, extensionKey, definitionId, resourceType, destinationProduct, destinationSubproduct, location, status, }: UiHoverCardDismissedEventProps) => void;