@atlaskit/media-card 73.1.1 → 73.2.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 (69) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/files/cardImageView/index.js +51 -41
  3. package/dist/cjs/root/card/getCardPreview/index.js +7 -1
  4. package/dist/cjs/root/card/index.js +247 -151
  5. package/dist/cjs/root/cardView.js +127 -115
  6. package/dist/cjs/root/inlinePlayer.js +4 -2
  7. package/dist/cjs/root/ui/imageRenderer/imageRenderer.js +14 -6
  8. package/dist/cjs/root/ui/styled.js +5 -5
  9. package/dist/cjs/types.js +10 -1
  10. package/dist/cjs/utils/analytics.js +23 -7
  11. package/dist/cjs/utils/dimensionComparer.js +7 -13
  12. package/dist/cjs/utils/getMediaCardCursor.js +29 -0
  13. package/dist/cjs/utils/globalScope/getSSRData.js +20 -0
  14. package/dist/cjs/utils/globalScope/globalScope.js +94 -0
  15. package/dist/cjs/utils/globalScope/index.js +39 -0
  16. package/dist/cjs/utils/globalScope/types.js +5 -0
  17. package/dist/cjs/utils/printScript.js +44 -0
  18. package/dist/cjs/version.json +1 -1
  19. package/dist/es2019/files/cardImageView/index.js +19 -5
  20. package/dist/es2019/root/card/getCardPreview/index.js +1 -0
  21. package/dist/es2019/root/card/index.js +107 -35
  22. package/dist/es2019/root/cardView.js +40 -30
  23. package/dist/es2019/root/inlinePlayer.js +4 -2
  24. package/dist/es2019/root/ui/imageRenderer/imageRenderer.js +14 -6
  25. package/dist/es2019/root/ui/styled.js +4 -4
  26. package/dist/es2019/types.js +7 -1
  27. package/dist/es2019/utils/analytics.js +8 -3
  28. package/dist/es2019/utils/dimensionComparer.js +6 -13
  29. package/dist/es2019/utils/getMediaCardCursor.js +19 -0
  30. package/dist/es2019/utils/globalScope/getSSRData.js +10 -0
  31. package/dist/es2019/utils/globalScope/globalScope.js +62 -0
  32. package/dist/es2019/utils/globalScope/index.js +2 -0
  33. package/dist/es2019/utils/globalScope/types.js +1 -0
  34. package/dist/es2019/utils/printScript.js +19 -0
  35. package/dist/es2019/version.json +1 -1
  36. package/dist/esm/files/cardImageView/index.js +53 -41
  37. package/dist/esm/root/card/getCardPreview/index.js +3 -0
  38. package/dist/esm/root/card/index.js +228 -134
  39. package/dist/esm/root/cardView.js +126 -115
  40. package/dist/esm/root/inlinePlayer.js +4 -2
  41. package/dist/esm/root/ui/imageRenderer/imageRenderer.js +14 -6
  42. package/dist/esm/root/ui/styled.js +5 -5
  43. package/dist/esm/types.js +7 -1
  44. package/dist/esm/utils/analytics.js +17 -6
  45. package/dist/esm/utils/dimensionComparer.js +8 -13
  46. package/dist/esm/utils/getMediaCardCursor.js +19 -0
  47. package/dist/esm/utils/globalScope/getSSRData.js +10 -0
  48. package/dist/esm/utils/globalScope/globalScope.js +69 -0
  49. package/dist/esm/utils/globalScope/index.js +2 -0
  50. package/dist/esm/utils/globalScope/types.js +1 -0
  51. package/dist/esm/utils/printScript.js +30 -0
  52. package/dist/esm/version.json +1 -1
  53. package/dist/types/errors.d.ts +1 -1
  54. package/dist/types/files/cardImageView/index.d.ts +6 -2
  55. package/dist/types/root/card/getCardPreview/index.d.ts +1 -0
  56. package/dist/types/root/card/index.d.ts +3 -1
  57. package/dist/types/root/cardView.d.ts +8 -6
  58. package/dist/types/root/inlinePlayer.d.ts +3 -1
  59. package/dist/types/root/ui/imageRenderer/imageRenderer.d.ts +4 -4
  60. package/dist/types/root/ui/styled.d.ts +2 -1
  61. package/dist/types/types.d.ts +6 -1
  62. package/dist/types/utils/analytics.d.ts +6 -0
  63. package/dist/types/utils/getMediaCardCursor.d.ts +2 -0
  64. package/dist/types/utils/globalScope/getSSRData.d.ts +3 -0
  65. package/dist/types/utils/globalScope/globalScope.d.ts +21 -0
  66. package/dist/types/utils/globalScope/index.d.ts +4 -0
  67. package/dist/types/utils/globalScope/types.d.ts +8 -0
  68. package/dist/types/utils/printScript.d.ts +2 -0
  69. package/package.json +5 -5
@@ -0,0 +1,69 @@
1
+ import React from 'react';
2
+ import { printFunctionCall, printScript } from '../printScript';
3
+ // ----- WARNING -----
4
+ // This is a very sensitive fraction of code.
5
+ // Any changes to this file must be tested directly in product before merging.
6
+ // The scripts printed here might differ from what we observe in our internal tests
7
+ // due to minimification, for example.
8
+ export var GLOBAL_MEDIA_CARD_SSR = 'mediaCardSsr';
9
+ export var GLOBAL_MEDIA_NAMESPACE = '__MEDIA_INTERNAL';
10
+ export function getMediaGlobalScope() {
11
+ var globalScope = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
12
+ // Must match GLOBAL_MEDIA_NAMESPACE. Can't reference the constant from here.
13
+ var namespace = '__MEDIA_INTERNAL';
14
+
15
+ if (!globalScope[namespace]) {
16
+ globalScope[namespace] = {};
17
+ }
18
+
19
+ return globalScope[namespace];
20
+ }
21
+ export function getMediaCardSSR() {
22
+ var globalScope = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
23
+ var globalMedia = getMediaGlobalScope(globalScope); // Must match GLOBAL_MEDIA_CARD_SSR. Can't reference the constant from here.
24
+
25
+ var key = 'mediaCardSsr';
26
+
27
+ if (!globalMedia[key]) {
28
+ globalMedia[key] = {};
29
+ }
30
+
31
+ return globalMedia[key];
32
+ }
33
+
34
+ var dashed = function dashed(param) {
35
+ return param ? "-".concat(param) : '';
36
+ };
37
+
38
+ export var getKey = function getKey(_ref) {
39
+ var id = _ref.id,
40
+ collectionName = _ref.collectionName,
41
+ occurrenceKey = _ref.occurrenceKey;
42
+ return "".concat(id).concat(dashed(collectionName)).concat(dashed(occurrenceKey));
43
+ };
44
+ export var storeDataURI = function storeDataURI(key, dataURI, dimensions, error) {
45
+ var globalScope = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : window;
46
+ var mediaCardSsr = getMediaCardSSR(globalScope);
47
+ mediaCardSsr[key] = {
48
+ dataURI: dataURI,
49
+ dimensions: dimensions,
50
+ error: error
51
+ };
52
+ };
53
+
54
+ var generateScript = function generateScript(identifier, dataURI, dimensions, error) {
55
+ var functionCall = printFunctionCall(storeDataURI, getKey(identifier), dataURI, dimensions, error);
56
+ return printScript([getMediaCardSSR.toString(), getMediaGlobalScope.toString(), functionCall]);
57
+ };
58
+
59
+ export var StoreSSRDataScript = function StoreSSRDataScript(_ref2) {
60
+ var dataURI = _ref2.dataURI,
61
+ identifier = _ref2.identifier,
62
+ dimensions = _ref2.dimensions,
63
+ error = _ref2.error;
64
+ return /*#__PURE__*/React.createElement("script", {
65
+ dangerouslySetInnerHTML: {
66
+ __html: generateScript(identifier, dataURI, dimensions, error)
67
+ }
68
+ });
69
+ };
@@ -0,0 +1,2 @@
1
+ export { StoreSSRDataScript, GLOBAL_MEDIA_NAMESPACE, GLOBAL_MEDIA_CARD_SSR, getKey } from './globalScope';
2
+ export { getSSRData } from './getSSRData';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,30 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
2
+
3
+ var printParam = function printParam(param) {
4
+ if (typeof param === 'string') {
5
+ return "'".concat(param, "'");
6
+ } else if (_typeof(param) === 'object') {
7
+ return JSON.stringify(param);
8
+ } else if (param === undefined) {
9
+ return 'undefined';
10
+ }
11
+
12
+ return param;
13
+ };
14
+
15
+ var printParams = function printParams(args) {
16
+ return args.map(function (arg) {
17
+ return printParam(arg);
18
+ }).join(',');
19
+ };
20
+
21
+ export var printFunctionCall = function printFunctionCall(fn) {
22
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
23
+ args[_key - 1] = arguments[_key];
24
+ }
25
+
26
+ return "(".concat(fn.toString(), ")(").concat(printParams(args), ");");
27
+ };
28
+ export var printScript = function printScript(statements) {
29
+ return "(function(){\n ".concat(statements.join(';'), "\n})();\n");
30
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "73.1.1",
3
+ "version": "73.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -24,7 +24,7 @@ export declare class SsrPreviewError extends MediaCardError {
24
24
  readonly secondaryError?: Error | undefined;
25
25
  constructor(primaryReason: SsrPreviewPrimaryReason, secondaryError?: Error | undefined);
26
26
  }
27
- export declare const getImageLoadPrimaryReason: (source?: "local" | "remote" | "ssr-server" | "ssr-client" | "cache-local" | "cache-remote" | "cache-ssr-client" | "cache-ssr-server" | "external" | undefined) => ImageLoadPrimaryReason;
27
+ export declare const getImageLoadPrimaryReason: (source?: "local" | "remote" | "ssr-server" | "ssr-client" | "ssr-data" | "cache-local" | "cache-remote" | "cache-ssr-client" | "cache-ssr-server" | "external" | undefined) => ImageLoadPrimaryReason;
28
28
  export declare class ImageLoadError extends MediaCardError {
29
29
  constructor(source?: CardPreview['source']);
30
30
  }
@@ -2,6 +2,7 @@ import { Component, ReactNode } from 'react';
2
2
  import { MediaItemType, MediaType, ImageResizeMode } from '@atlaskit/media-client';
3
3
  import { CardDimensions, CardStatus } from '../../index';
4
4
  import { CardAction } from '../../actions';
5
+ import { CardPreview } from '../..';
5
6
  export interface FileCardImageViewProps {
6
7
  readonly mediaName?: string;
7
8
  readonly mediaType?: MediaType;
@@ -21,8 +22,9 @@ export interface FileCardImageViewProps {
21
22
  readonly actions?: CardAction[];
22
23
  readonly onDisplayImage?: () => void;
23
24
  readonly previewOrientation?: number;
24
- readonly onImageError?: () => void;
25
- readonly onImageLoad?: () => void;
25
+ readonly onImageError?: (cardPreview: CardPreview) => void;
26
+ readonly onImageLoad?: (cardPreview: CardPreview) => void;
27
+ readonly cardPreview: CardPreview;
26
28
  }
27
29
  export declare const fileCardImageViewSelector = "media-file-card-view";
28
30
  export declare const fileCardImageViewSelectedSelector = "media-file-card-view-selected";
@@ -36,6 +38,8 @@ export declare class FileCardImageView extends Component<FileCardImageViewProps>
36
38
  private renderFailedContents;
37
39
  private renderUploadingCardOverlay;
38
40
  private renderPlayButton;
41
+ onImageLoad: () => void;
42
+ onImageError: () => void;
39
43
  private renderMediaImage;
40
44
  private renderProgressBar;
41
45
  private renderSuccessCardContents;
@@ -47,4 +47,5 @@ export declare const isLocalPreview: (preview: CardPreview) => boolean;
47
47
  export declare const isSSRPreview: (preview: CardPreview) => boolean;
48
48
  export declare const isSSRServerPreview: (preview: CardPreview) => boolean;
49
49
  export declare const isSSRClientPreview: (preview: CardPreview) => boolean;
50
+ export declare const isSSRDataPreview: (preview: CardPreview) => boolean;
50
51
  export declare const fetchAndCacheRemotePreview: (mediaClient: MediaClient, id: string, dimensions: CardDimensions, params: MediaStoreGetFileImageParams, mediaBlobUrlAttrs?: MediaBlobUrlAttrs | undefined) => Promise<CardPreview>;
@@ -11,6 +11,7 @@ export declare class CardBase extends Component<CardBaseProps, CardState> {
11
11
  private viewportPostAnchorRef;
12
12
  private timeElapsedTillCommenced;
13
13
  subscription?: Subscription;
14
+ private ssrData?;
14
15
  static defaultProps: Partial<CardProps>;
15
16
  constructor(props: CardBaseProps);
16
17
  componentDidMount(): void;
@@ -21,7 +22,7 @@ export declare class CardBase extends Component<CardBaseProps, CardState> {
21
22
  private getMediaBlobUrlAttrs;
22
23
  private getCardPreviewParams;
23
24
  private setCacheSSRPreview;
24
- private resolveSSRPreview;
25
+ private refetchSSRPreview;
25
26
  private resolvePreview;
26
27
  subscribeInternalFile(identifier: FileIdentifier): void;
27
28
  private get requestedDimensions();
@@ -46,6 +47,7 @@ export declare class CardBase extends Component<CardBaseProps, CardState> {
46
47
  private onDisplayImage;
47
48
  renderMediaViewer: () => React.ReactPortal | undefined;
48
49
  renderCard: () => JSX.Element;
50
+ private storeSSRData;
49
51
  render(): JSX.Element;
50
52
  private onCardInViewport;
51
53
  onClick: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent | undefined) => void;
@@ -3,21 +3,23 @@ import { MediaItemType, FileDetails } from '@atlaskit/media-client';
3
3
  import { WithAnalyticsEventsProps, UIAnalyticsEvent } from '@atlaskit/analytics-next';
4
4
  import { SharedCardProps, CardStatus } from '../index';
5
5
  import { MediaCardError } from '../errors';
6
+ import { CardPreview } from '..';
6
7
  import { MessageDescriptor } from 'react-intl-next';
8
+ import { MediaCardCursor } from '../types';
7
9
  export interface CardViewOwnProps extends SharedCardProps {
8
10
  readonly status: CardStatus;
9
11
  readonly mediaItemType: MediaItemType;
12
+ readonly mediaCardCursor: MediaCardCursor;
10
13
  readonly metadata?: FileDetails;
11
14
  readonly error?: MediaCardError;
12
15
  readonly onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
13
16
  readonly onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
14
17
  readonly onDisplayImage?: () => void;
15
- readonly dataURI?: string;
18
+ readonly cardPreview?: CardPreview;
16
19
  readonly progress?: number;
17
- readonly previewOrientation?: number;
18
20
  readonly innerRef?: (instance: HTMLDivElement | null) => void;
19
- readonly onImageLoad: () => void;
20
- readonly onImageError: () => void;
21
+ readonly onImageLoad: (cardPreview: CardPreview) => void;
22
+ readonly onImageError: (cardPreview: CardPreview) => void;
21
23
  readonly nativeLazyLoad?: boolean;
22
24
  readonly forceSyncDisplay?: boolean;
23
25
  disableAnimation?: boolean;
@@ -50,7 +52,7 @@ export declare class CardViewBase extends React.Component<CardViewProps, CardVie
50
52
  divRef: React.RefObject<HTMLDivElement>;
51
53
  static defaultProps: Partial<CardViewOwnProps>;
52
54
  componentDidMount(): void;
53
- componentDidUpdate({ dataURI: prevDataURI }: CardViewProps): void;
55
+ componentDidUpdate({ cardPreview: prevCardPreview }: CardViewProps): void;
54
56
  private onImageLoad;
55
57
  private onImageError;
56
58
  private get width();
@@ -73,4 +75,4 @@ export declare class CardViewBase extends React.Component<CardViewProps, CardVie
73
75
  private getRenderConfigByStatus;
74
76
  private renderNewExperienceCard;
75
77
  }
76
- export declare const CardView: React.ForwardRefExoticComponent<Pick<Pick<CardViewProps, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "testId" | "appearance" | "error" | "actions" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "forceSyncDisplay" | "nativeLazyLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">, never> & Partial<Pick<Pick<CardViewProps, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "testId" | "appearance" | "error" | "actions" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "forceSyncDisplay" | "nativeLazyLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "testId" | "appearance" | "error" | "actions" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "forceSyncDisplay" | "nativeLazyLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">> & Partial<Pick<Partial<CardViewOwnProps>, never>> & React.RefAttributes<any>>;
78
+ export declare const CardView: React.ForwardRefExoticComponent<Pick<Pick<CardViewProps, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "testId" | "appearance" | "error" | "actions" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "onImageError" | "onImageLoad" | "cardPreview" | "forceSyncDisplay" | "mediaCardCursor" | "nativeLazyLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">, never> & Partial<Pick<Pick<CardViewProps, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "testId" | "appearance" | "error" | "actions" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "onImageError" | "onImageLoad" | "cardPreview" | "forceSyncDisplay" | "mediaCardCursor" | "nativeLazyLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "testId" | "appearance" | "error" | "actions" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "onImageError" | "onImageLoad" | "cardPreview" | "forceSyncDisplay" | "mediaCardCursor" | "nativeLazyLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">> & Partial<Pick<Partial<CardViewOwnProps>, never>> & React.RefAttributes<any>>;
@@ -4,6 +4,7 @@ import { MediaClient, FileIdentifier, FileState, MediaFileArtifacts } from '@atl
4
4
  import { Subscription } from 'rxjs/Subscription';
5
5
  import { CardDimensions, NumericalCardDimensions } from '..';
6
6
  import { WithAnalyticsEventsProps, UIAnalyticsEvent } from '@atlaskit/analytics-next';
7
+ import type { CardPreview } from '..';
7
8
  export declare const inlinePlayerClassName = "media-card-inline-player";
8
9
  export interface InlinePlayerOwnProps {
9
10
  identifier: FileIdentifier;
@@ -15,6 +16,7 @@ export interface InlinePlayerOwnProps {
15
16
  onError?: (error: Error) => void;
16
17
  readonly onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
17
18
  testId?: string;
19
+ readonly cardPreview?: CardPreview;
18
20
  readonly forwardRef?: React.Ref<HTMLDivElement>;
19
21
  }
20
22
  export declare type InlinePlayerProps = InlinePlayerOwnProps & WithAnalyticsEventsProps;
@@ -47,4 +49,4 @@ export declare class InlinePlayerBase extends Component<InlinePlayerProps, Inlin
47
49
  saveElementWidth: () => void;
48
50
  render(): JSX.Element;
49
51
  }
50
- export declare const InlinePlayer: React.ForwardRefExoticComponent<Pick<InlinePlayerProps, "onError" | "onClick" | "testId" | "createAnalyticsEvent" | "selected" | "dimensions" | "originalDimensions" | "mediaClient" | "identifier" | "autoplay" | "forwardRef"> & React.RefAttributes<HTMLDivElement>>;
52
+ export declare const InlinePlayer: React.ForwardRefExoticComponent<Pick<InlinePlayerProps, "onError" | "onClick" | "testId" | "createAnalyticsEvent" | "selected" | "dimensions" | "cardPreview" | "originalDimensions" | "mediaClient" | "identifier" | "autoplay" | "forwardRef"> & React.RefAttributes<HTMLDivElement>>;
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
2
  import { MediaType, ImageResizeMode } from '@atlaskit/media-client';
3
+ import { CardPreview } from '../../..';
3
4
  export declare type ImageRendererProps = {
4
- readonly dataURI: string;
5
+ readonly cardPreview: CardPreview;
5
6
  readonly mediaType: MediaType;
6
- readonly previewOrientation?: number;
7
7
  readonly alt?: string;
8
8
  readonly resizeMode?: ImageResizeMode;
9
9
  readonly onDisplayImage?: () => void;
10
- readonly onImageError?: () => void;
11
- readonly onImageLoad?: () => void;
10
+ readonly onImageError?: (cardPreview: CardPreview) => void;
11
+ readonly onImageLoad?: (cardPreview: CardPreview) => void;
12
12
  readonly nativeLazyLoad?: boolean;
13
13
  readonly forceSyncDisplay?: boolean;
14
14
  };
@@ -1,19 +1,20 @@
1
1
  /// <reference types="react" />
2
2
  import { CardDimensions, CardAppearance } from '../..';
3
3
  import { Breakpoint } from './common';
4
+ import { MediaCardCursor } from '../../types';
4
5
  export declare const calcBreakpointSize: (wrapperWidth?: number) => Breakpoint;
5
6
  export interface NewFileExperienceWrapperProps {
6
7
  breakpoint: Breakpoint;
7
8
  dimensions?: CardDimensions;
8
9
  appearance?: CardAppearance;
9
10
  mediaType?: string;
10
- shouldUsePointerCursor: boolean;
11
11
  disableOverlay: boolean;
12
12
  displayBackground: boolean;
13
13
  selected: boolean;
14
14
  isPlayButtonClickable: boolean;
15
15
  isTickBoxSelectable: boolean;
16
16
  shouldDisplayTooltip: boolean;
17
+ mediaCardCursor: MediaCardCursor;
17
18
  }
18
19
  export declare const NewFileExperienceWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & NewFileExperienceWrapperProps, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & NewFileExperienceWrapperProps>;
19
20
  export declare const CardImageContainer: import("styled-components").StyledComponentClass<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, any, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
@@ -7,9 +7,14 @@ export declare type FilePreviewStatus = {
7
7
  };
8
8
  export declare type CardAppearance = 'auto' | 'image' | 'square' | 'horizontal';
9
9
  export declare type CardDimensionValue = number | string;
10
- export declare type CardPreviewSource = 'local' | 'remote' | 'ssr-server' | 'ssr-client' | 'cache-local' | 'cache-remote' | 'cache-ssr-client' | 'cache-ssr-server' | 'external';
10
+ export declare type CardPreviewSource = 'local' | 'remote' | 'ssr-server' | 'ssr-client' | 'ssr-data' | 'cache-local' | 'cache-remote' | 'cache-ssr-client' | 'cache-ssr-server' | 'external';
11
11
  export interface CardPreview {
12
12
  dataURI: string;
13
13
  orientation?: number;
14
14
  source: CardPreviewSource;
15
15
  }
16
+ export declare enum MediaCardCursor {
17
+ Action = "pointer",
18
+ NoAction = "default",
19
+ NotReady = "wait"
20
+ }
@@ -4,6 +4,11 @@ import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
4
4
  import { MediaCardError, MediaCardErrorPrimaryReason } from '../errors';
5
5
  export declare type FileUriFailReason = 'local-uri' | 'remote-uri' | `unknown-uri`;
6
6
  export declare type FailedErrorFailReason = MediaCardErrorPrimaryReason | 'nativeError';
7
+ export declare type MediaCardErrorInfo = {
8
+ failReason: FailedErrorFailReason;
9
+ error: MediaClientErrorReason | 'nativeError';
10
+ errorDetail: string;
11
+ };
7
12
  export declare type RenderFailedEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes & FailureAttributes & {
8
13
  failReason: FailedErrorFailReason | 'failed-processing';
9
14
  error?: MediaClientErrorReason | 'nativeError';
@@ -31,6 +36,7 @@ export declare const getRenderErrorFailReason: (error: MediaCardError) => Failed
31
36
  export declare const getRenderErrorErrorReason: (error: MediaCardError) => MediaClientErrorReason | 'nativeError';
32
37
  export declare const getRenderErrorErrorDetail: (error: MediaCardError) => string;
33
38
  export declare const getRenderErrorRequestMetadata: (error: MediaCardError) => RequestMetadata | undefined;
39
+ export declare const extractErrorInfo: (error: MediaCardError) => MediaCardErrorInfo;
34
40
  export declare const getRenderErrorEventPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, error: MediaCardError) => RenderFailedEventPayload;
35
41
  export declare const getRenderFailedFileStatusPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes) => RenderFailedEventPayload;
36
42
  export declare const getCopiedFilePayload: (fileId: string) => CopiedFileEventPayload;
@@ -0,0 +1,2 @@
1
+ import { MediaCardCursor } from '../types';
2
+ export declare const getMediaCardCursor: (useInlinePlayer: boolean, useMediaViewer: boolean, isErrorStatus: boolean, hasCardPreview: boolean, mediaType?: "audio" | "video" | "image" | "doc" | "archive" | "unknown" | undefined) => MediaCardCursor;
@@ -0,0 +1,3 @@
1
+ import type { MediaCardSsrData } from './types';
2
+ import { FileIdentifier } from '@atlaskit/media-client';
3
+ export declare const getSSRData: (identifier: FileIdentifier) => MediaCardSsrData | undefined;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { FileIdentifier } from '@atlaskit/media-client';
3
+ import { NumericalCardDimensions } from '@atlaskit/media-common';
4
+ import { MediaCardErrorInfo } from '../../utils/analytics';
5
+ import { MediaCardSsr } from './types';
6
+ export declare const GLOBAL_MEDIA_CARD_SSR = "mediaCardSsr";
7
+ export declare const GLOBAL_MEDIA_NAMESPACE = "__MEDIA_INTERNAL";
8
+ export declare type MediaGlobalScope = {
9
+ [GLOBAL_MEDIA_CARD_SSR]?: MediaCardSsr;
10
+ };
11
+ export declare function getMediaGlobalScope(globalScope?: any): MediaGlobalScope;
12
+ export declare function getMediaCardSSR(globalScope?: any): MediaCardSsr;
13
+ export declare const getKey: ({ id, collectionName, occurrenceKey }: FileIdentifier) => string;
14
+ export declare const storeDataURI: (key: string, dataURI?: string | undefined, dimensions?: NumericalCardDimensions | undefined, error?: MediaCardErrorInfo | undefined, globalScope?: any) => void;
15
+ export declare type StoreSSRDataScriptProps = {
16
+ identifier: FileIdentifier;
17
+ dataURI?: string;
18
+ dimensions?: NumericalCardDimensions;
19
+ error?: MediaCardErrorInfo;
20
+ };
21
+ export declare const StoreSSRDataScript: React.FC<StoreSSRDataScriptProps>;
@@ -0,0 +1,4 @@
1
+ export { StoreSSRDataScript, GLOBAL_MEDIA_NAMESPACE, GLOBAL_MEDIA_CARD_SSR, getKey, } from './globalScope';
2
+ export { getSSRData } from './getSSRData';
3
+ export type { MediaCardSsrData, MediaCardSsr } from './types';
4
+ export type { MediaGlobalScope } from './globalScope';
@@ -0,0 +1,8 @@
1
+ import { NumericalCardDimensions } from '@atlaskit/media-common';
2
+ import { MediaCardErrorInfo } from '../../utils/analytics';
3
+ export declare type MediaCardSsrData = {
4
+ dataURI?: string;
5
+ dimensions?: NumericalCardDimensions;
6
+ error?: MediaCardErrorInfo;
7
+ };
8
+ export declare type MediaCardSsr = Record<string, MediaCardSsrData>;
@@ -0,0 +1,2 @@
1
+ export declare const printFunctionCall: <T extends any[]>(fn: (...args: T) => void, ...args: T) => string;
2
+ export declare const printScript: (statements: string[]) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-card",
3
- "version": "73.1.1",
3
+ "version": "73.2.0",
4
4
  "description": "Includes all media card related components, CardView, CardViewSmall, Card...",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,13 +29,13 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@atlaskit/analytics-next": "^8.2.0",
32
- "@atlaskit/dropdown-menu": "^11.0.0",
32
+ "@atlaskit/dropdown-menu": "^11.1.0",
33
33
  "@atlaskit/editor-shared-styles": "^1.6.0",
34
34
  "@atlaskit/icon": "^21.10.0",
35
35
  "@atlaskit/in-product-testing": "^0.1.0",
36
36
  "@atlaskit/media-client": "^14.3.0",
37
37
  "@atlaskit/media-common": "^2.10.0",
38
- "@atlaskit/media-ui": "^18.1.0",
38
+ "@atlaskit/media-ui": "^19.0.0",
39
39
  "@atlaskit/media-viewer": "^46.0.0",
40
40
  "@atlaskit/spinner": "^15.1.0",
41
41
  "@atlaskit/theme": "^12.1.0",
@@ -63,9 +63,9 @@
63
63
  "@atlaskit/inline-message": "^11.2.0",
64
64
  "@atlaskit/item": "^12.0.0",
65
65
  "@atlaskit/media-core": "^32.2.0",
66
- "@atlaskit/media-test-helpers": "^29.0.0",
66
+ "@atlaskit/media-test-helpers": "^29.1.0",
67
67
  "@atlaskit/radio": "^5.3.2",
68
- "@atlaskit/range": "^5.1.0",
68
+ "@atlaskit/range": "^6.0.0",
69
69
  "@atlaskit/select": "^15.2.1",
70
70
  "@atlaskit/ssr": "*",
71
71
  "@atlaskit/textfield": "^5.1.0",