@atlaskit/media-card 70.10.0 → 72.1.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 (150) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/dist/cjs/errors.js +76 -5
  3. package/dist/cjs/files/cardImageView/index.js +58 -89
  4. package/dist/cjs/files/index.js +0 -6
  5. package/dist/cjs/index.js +16 -6
  6. package/dist/cjs/root/card/cardAnalytics.js +33 -19
  7. package/dist/cjs/root/card/cardConstants.js +8 -0
  8. package/dist/cjs/root/card/cardLoader.js +66 -124
  9. package/dist/cjs/root/card/cardState.js +50 -0
  10. package/dist/cjs/root/card/getCardPreview/cache.js +5 -0
  11. package/dist/cjs/root/card/getCardPreview/filePreviewStatus.js +50 -0
  12. package/dist/cjs/root/card/getCardPreview/helpers.js +13 -21
  13. package/dist/cjs/root/card/getCardPreview/index.js +171 -100
  14. package/dist/cjs/root/card/getCardStatus.js +7 -1
  15. package/dist/cjs/root/card/index.js +407 -322
  16. package/dist/cjs/root/cardView.js +115 -76
  17. package/dist/cjs/root/index.js +9 -1
  18. package/dist/cjs/root/inline/loader.js +22 -21
  19. package/dist/cjs/root/inline/{inlineMediaCard.js → mediaInlineCard.js} +72 -25
  20. package/dist/cjs/root/inlinePlayer.js +5 -15
  21. package/dist/cjs/root/ui/iconMessage/index.js +17 -9
  22. package/dist/cjs/root/ui/imageRenderer/imageRenderer.js +36 -115
  23. package/dist/cjs/root/ui/styled.js +1 -1
  24. package/dist/cjs/root/ui/titleBox/failedTitleBox.js +7 -3
  25. package/dist/cjs/utils/analytics.js +26 -43
  26. package/dist/cjs/utils/cardActions/cardActionsDropdownMenu.js +16 -9
  27. package/dist/cjs/utils/dimensionComparer.js +1 -1
  28. package/dist/cjs/utils/document.js +12 -0
  29. package/dist/cjs/utils/getDataURIDimension.js +13 -2
  30. package/dist/cjs/utils/metadata.js +11 -3
  31. package/dist/cjs/utils/objectURLCache.js +6 -0
  32. package/dist/cjs/utils/resizeModeToMediaImageProps.js +13 -0
  33. package/dist/cjs/utils/shouldDisplayImageThumbnail.js +1 -1
  34. package/dist/cjs/version.json +1 -1
  35. package/dist/es2019/errors.js +42 -2
  36. package/dist/es2019/files/cardImageView/index.js +12 -46
  37. package/dist/es2019/files/index.js +1 -1
  38. package/dist/es2019/index.js +3 -3
  39. package/dist/es2019/root/card/cardAnalytics.js +23 -17
  40. package/dist/es2019/root/card/cardConstants.js +1 -0
  41. package/dist/es2019/root/card/cardLoader.js +47 -53
  42. package/dist/es2019/root/card/cardState.js +26 -0
  43. package/dist/es2019/root/card/getCardPreview/cache.js +5 -0
  44. package/dist/es2019/root/card/getCardPreview/filePreviewStatus.js +35 -0
  45. package/dist/es2019/root/card/getCardPreview/helpers.js +2 -12
  46. package/dist/es2019/root/card/getCardPreview/index.js +112 -79
  47. package/dist/es2019/root/card/getCardStatus.js +1 -0
  48. package/dist/es2019/root/card/index.js +356 -254
  49. package/dist/es2019/root/cardView.js +98 -58
  50. package/dist/es2019/root/index.js +2 -1
  51. package/dist/es2019/root/inline/loader.js +16 -15
  52. package/dist/es2019/root/inline/mediaInlineCard.js +132 -0
  53. package/dist/es2019/root/inlinePlayer.js +5 -13
  54. package/dist/es2019/root/ui/iconMessage/index.js +10 -6
  55. package/dist/es2019/root/ui/imageRenderer/imageRenderer.js +26 -74
  56. package/dist/es2019/root/ui/styled.js +1 -0
  57. package/dist/es2019/root/ui/titleBox/failedTitleBox.js +5 -3
  58. package/dist/es2019/utils/analytics.js +29 -40
  59. package/dist/es2019/utils/cardActions/cardActionsDropdownMenu.js +8 -4
  60. package/dist/es2019/utils/dimensionComparer.js +1 -1
  61. package/dist/es2019/utils/document.js +1 -0
  62. package/dist/es2019/utils/getDataURIDimension.js +8 -0
  63. package/dist/es2019/utils/metadata.js +12 -4
  64. package/dist/es2019/utils/objectURLCache.js +5 -0
  65. package/dist/es2019/utils/resizeModeToMediaImageProps.js +6 -0
  66. package/dist/es2019/utils/shouldDisplayImageThumbnail.js +1 -1
  67. package/dist/es2019/version.json +1 -1
  68. package/dist/esm/errors.js +60 -1
  69. package/dist/esm/files/cardImageView/index.js +55 -87
  70. package/dist/esm/files/index.js +1 -1
  71. package/dist/esm/index.js +3 -3
  72. package/dist/esm/root/card/cardAnalytics.js +23 -18
  73. package/dist/esm/root/card/cardConstants.js +1 -0
  74. package/dist/esm/root/card/cardLoader.js +66 -126
  75. package/dist/esm/root/card/cardState.js +32 -0
  76. package/dist/esm/root/card/getCardPreview/cache.js +6 -0
  77. package/dist/esm/root/card/getCardPreview/filePreviewStatus.js +35 -0
  78. package/dist/esm/root/card/getCardPreview/helpers.js +13 -21
  79. package/dist/esm/root/card/getCardPreview/index.js +142 -95
  80. package/dist/esm/root/card/getCardStatus.js +3 -0
  81. package/dist/esm/root/card/index.js +416 -325
  82. package/dist/esm/root/cardView.js +114 -73
  83. package/dist/esm/root/index.js +2 -1
  84. package/dist/esm/root/inline/loader.js +23 -22
  85. package/dist/esm/root/inline/mediaInlineCard.js +145 -0
  86. package/dist/esm/root/inlinePlayer.js +5 -13
  87. package/dist/esm/root/ui/iconMessage/index.js +12 -7
  88. package/dist/esm/root/ui/imageRenderer/imageRenderer.js +28 -106
  89. package/dist/esm/root/ui/styled.js +1 -1
  90. package/dist/esm/root/ui/titleBox/failedTitleBox.js +6 -3
  91. package/dist/esm/utils/analytics.js +22 -35
  92. package/dist/esm/utils/cardActions/cardActionsDropdownMenu.js +16 -9
  93. package/dist/esm/utils/dimensionComparer.js +1 -1
  94. package/dist/esm/utils/document.js +3 -0
  95. package/dist/esm/utils/getDataURIDimension.js +8 -0
  96. package/dist/esm/utils/metadata.js +12 -4
  97. package/dist/esm/utils/objectURLCache.js +6 -0
  98. package/dist/esm/utils/resizeModeToMediaImageProps.js +6 -0
  99. package/dist/esm/utils/shouldDisplayImageThumbnail.js +1 -1
  100. package/dist/esm/version.json +1 -1
  101. package/dist/types/errors.d.ts +15 -1
  102. package/dist/types/files/cardImageView/index.d.ts +5 -12
  103. package/dist/types/files/cardImageView/styled.d.ts +1 -1
  104. package/dist/types/files/index.d.ts +1 -1
  105. package/dist/types/index.d.ts +11 -13
  106. package/dist/types/root/card/cardAnalytics.d.ts +5 -7
  107. package/dist/types/root/card/cardConstants.d.ts +1 -0
  108. package/dist/types/root/card/cardLoader.d.ts +4 -18
  109. package/dist/types/root/card/cardState.d.ts +5 -0
  110. package/dist/types/root/card/getCardPreview/cache.d.ts +4 -2
  111. package/dist/types/root/card/getCardPreview/filePreviewStatus.d.ts +5 -0
  112. package/dist/types/root/card/getCardPreview/helpers.d.ts +4 -5
  113. package/dist/types/root/card/getCardPreview/index.d.ts +25 -14
  114. package/dist/types/root/card/getCardStatus.d.ts +1 -0
  115. package/dist/types/root/card/index.d.ts +18 -15
  116. package/dist/types/root/cardView.d.ts +14 -8
  117. package/dist/types/root/index.d.ts +1 -0
  118. package/dist/types/root/inline/loader.d.ts +8 -8
  119. package/dist/types/root/inline/{inlineMediaCard.d.ts → mediaInlineCard.d.ts} +4 -4
  120. package/dist/types/root/inlinePlayer.d.ts +1 -1
  121. package/dist/types/root/ui/iconMessage/index.d.ts +7 -2
  122. package/dist/types/root/ui/imageRenderer/imageRenderer.d.ts +5 -18
  123. package/dist/types/root/ui/titleBox/failedTitleBox.d.ts +2 -0
  124. package/dist/types/types.d.ts +9 -1
  125. package/dist/types/utils/analytics.d.ts +20 -21
  126. package/dist/types/utils/cardDimensions.d.ts +5 -1
  127. package/dist/types/utils/dimensionComparer.d.ts +1 -1
  128. package/dist/types/utils/document.d.ts +2 -0
  129. package/dist/types/utils/getDataURIDimension.d.ts +3 -1
  130. package/dist/types/utils/index.d.ts +1 -0
  131. package/dist/types/utils/lazyContent/styled.d.ts +1 -1
  132. package/dist/types/utils/lightCards/types.d.ts +1 -1
  133. package/dist/types/utils/metadata.d.ts +2 -2
  134. package/dist/types/utils/objectURLCache.d.ts +2 -1
  135. package/dist/types/utils/resizeModeToMediaImageProps.d.ts +5 -0
  136. package/dist/types/utils/shouldDisplayImageThumbnail.d.ts +1 -1
  137. package/example-helpers/developmentUseMessage.tsx +14 -0
  138. package/example-helpers/index.tsx +55 -4
  139. package/example-helpers/selectableCard.tsx +2 -1
  140. package/package.json +18 -14
  141. package/dist/cjs/root/card/getCardPreview/types.js +0 -5
  142. package/dist/cjs/utils/fileAttributesContext.js +0 -40
  143. package/dist/es2019/root/card/getCardPreview/types.js +0 -1
  144. package/dist/es2019/root/inline/inlineMediaCard.js +0 -92
  145. package/dist/es2019/utils/fileAttributesContext.js +0 -19
  146. package/dist/esm/root/card/getCardPreview/types.js +0 -1
  147. package/dist/esm/root/inline/inlineMediaCard.js +0 -100
  148. package/dist/esm/utils/fileAttributesContext.js +0 -18
  149. package/dist/types/root/card/getCardPreview/types.d.ts +0 -5
  150. package/dist/types/utils/fileAttributesContext.d.ts +0 -10
@@ -1,23 +1,18 @@
1
1
  import { MouseEvent } from 'react';
2
2
  import { FileDetails, MediaClient, Identifier, ImageResizeMode, FileState } from '@atlaskit/media-client';
3
3
  import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
4
- import { MediaFeatureFlags, NumericalCardDimensions } from '@atlaskit/media-common';
4
+ import { MediaFeatureFlags, NumericalCardDimensions, SSR } from '@atlaskit/media-common';
5
5
  import { CardAction } from './actions';
6
6
  import { MediaViewerDataSource } from '@atlaskit/media-viewer';
7
- import { CardPreview } from './root/card/getCardPreview';
8
- import { CardStatus } from './types';
7
+ import { CardPreview, CardStatus, CardAppearance } from './types';
9
8
  import { MediaCardError } from './errors';
9
+ import { CardDimensions } from './utils';
10
+ export type { CardDimensions } from './utils';
10
11
  export type { NumericalCardDimensions } from '@atlaskit/media-common';
11
- export { default as Card } from './root/card/cardLoader';
12
+ export { Card, MediaInlineCard } from './root';
12
13
  export type { CardAction, CardEventHandler } from './actions';
13
- export type { CardStatus } from './types';
14
- export declare type CardAppearance = 'auto' | 'image' | 'square' | 'horizontal';
15
- export declare type CardDimensionValue = number | string;
14
+ export type { CardStatus, CardAppearance, CardDimensionValue, CardPreview, } from './types';
16
15
  export declare type TitleBoxIcon = 'LockFilledIcon';
17
- export interface CardDimensions {
18
- width?: CardDimensionValue;
19
- height?: CardDimensionValue;
20
- }
21
16
  export interface CardEvent {
22
17
  event: MouseEvent<HTMLElement>;
23
18
  mediaItemDetails?: FileDetails;
@@ -53,6 +48,7 @@ export interface CardProps extends SharedCardProps, CardEventProps {
53
48
  readonly mediaViewerDataSource?: MediaViewerDataSource;
54
49
  readonly contextId?: string;
55
50
  readonly shouldEnableDownloadButton?: boolean;
51
+ readonly ssr?: SSR;
56
52
  }
57
53
  export interface CardState {
58
54
  status: CardStatus;
@@ -64,10 +60,12 @@ export interface CardState {
64
60
  cardPreview?: CardPreview;
65
61
  error?: MediaCardError;
66
62
  cardRef: HTMLDivElement | null;
63
+ isBannedLocalPreview: boolean;
64
+ previewDidRender: boolean;
67
65
  }
68
66
  export { CardLoading } from './utils/lightCards/cardLoading';
69
67
  export { CardError } from './utils/lightCards/cardError';
70
68
  export { defaultImageCardDimensions } from './utils/cardDimensions';
71
- export { fileCardImageViewSelector } from './files/cardImageView';
69
+ export { fileCardImageViewSelector, fileCardImageViewSelectedSelector, } from './files/cardImageView';
72
70
  export { inlinePlayerClassName } from './root/inlinePlayer';
73
- export { newFileExperienceClassName } from './root/cardView';
71
+ export { newFileExperienceClassName } from './root/card/cardConstants';
@@ -1,11 +1,9 @@
1
- import { FileAttributes, MediaFeatureFlags } from '@atlaskit/media-common';
1
+ import { FileAttributes, MediaFeatureFlags, PerformanceAttributes } from '@atlaskit/media-common';
2
2
  import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  import { CardStatus } from '../..';
4
- import { CardPreview } from './getCardPreview';
5
4
  import { MediaCardError } from './../../errors';
6
5
  export declare const relevantFeatureFlagNames: Array<keyof MediaFeatureFlags>;
7
- export declare type FireOperationalEventParams = {
8
- cardPreview?: CardPreview;
9
- error?: MediaCardError;
10
- };
11
- export declare const fireOperationalEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, status: CardStatus, fileAttributes: FileAttributes, { cardPreview, error }?: FireOperationalEventParams) => void;
6
+ export declare const fireOperationalEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, status: CardStatus, fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, error?: MediaCardError | undefined) => void;
7
+ export declare const fireCommencedEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes) => void;
8
+ export declare const fireCopiedEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, fileId: string, cardRef: HTMLDivElement) => void;
9
+ export declare const fireScreenEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, fileAttributes: FileAttributes) => void;
@@ -0,0 +1 @@
1
+ export declare const newFileExperienceClassName = "new-file-experience-wrapper";
@@ -1,20 +1,6 @@
1
1
  import React from 'react';
2
- import { WithMediaClientConfigProps } from '@atlaskit/media-client';
3
- import { MediaCardAnalyticsErrorBoundaryProps } from '../media-card-analytics-error-boundary';
4
- import { CardWithAnalyticsEventsProps } from '.';
2
+ import type { WithMediaClientConfigProps } from '@atlaskit/media-client';
3
+ import type { CardWithAnalyticsEventsProps } from '.';
5
4
  export declare type CardWithMediaClientConfigProps = WithMediaClientConfigProps<CardWithAnalyticsEventsProps>;
6
- declare type CardWithMediaClientConfigComponent = React.ComponentType<CardWithMediaClientConfigProps>;
7
- declare type MediaCardErrorBoundaryComponent = React.ComponentType<MediaCardAnalyticsErrorBoundaryProps>;
8
- export interface AsyncCardState {
9
- Card?: CardWithMediaClientConfigComponent;
10
- MediaCardErrorBoundary?: MediaCardErrorBoundaryComponent;
11
- }
12
- export default class CardLoader extends React.PureComponent<CardWithMediaClientConfigProps & AsyncCardState, AsyncCardState> {
13
- static displayName: string;
14
- static Card?: CardWithMediaClientConfigComponent;
15
- static MediaCardErrorBoundary?: MediaCardErrorBoundaryComponent;
16
- state: AsyncCardState;
17
- componentDidMount(): Promise<void>;
18
- render(): JSX.Element;
19
- }
20
- export {};
5
+ declare const CardLoader: React.FC<CardWithMediaClientConfigProps>;
6
+ export default CardLoader;
@@ -0,0 +1,5 @@
1
+ import { FileState } from '@atlaskit/media-client';
2
+ import { MediaFeatureFlags } from '@atlaskit/media-common';
3
+ import { CardState } from '../..';
4
+ export declare const createStateUpdater: (newState: Partial<CardState>) => (prevState: CardState) => Pick<CardState, keyof CardState>;
5
+ export declare const getCardStateFromFileState: (fileState: FileState, isBannedLocalPreview: boolean, featureFlags?: MediaFeatureFlags | undefined) => Partial<CardState>;
@@ -1,16 +1,18 @@
1
1
  import { ObjectURLCache } from '../../../utils/objectURLCache';
2
- import { CardDimensions } from '../../..';
3
- import { CardPreview } from './types';
2
+ import { CardDimensions } from '../../../utils/cardDimensions';
3
+ import { CardPreview } from '../../../types';
4
4
  export declare const getCacheKey: (id: string, dimensions: CardDimensions) => string;
5
5
  export interface CardPreviewCache {
6
6
  get(id: string, dimensions: CardDimensions): CardPreview | undefined;
7
7
  set(id: string, dimensions: CardDimensions, cardPreview: CardPreview): void;
8
+ remove(id: string, dimensions: CardDimensions): void;
8
9
  }
9
10
  export declare class CardPreviewCacheImpl implements CardPreviewCache {
10
11
  private previewCache;
11
12
  constructor(previewCache: ObjectURLCache);
12
13
  get: (id: string, dimensions: CardDimensions) => CardPreview | undefined;
13
14
  set: (id: string, dimensions: CardDimensions, cardPreview: CardPreview) => void;
15
+ remove: (id: string, dimensions: CardDimensions) => void;
14
16
  }
15
17
  declare const _default: CardPreviewCacheImpl;
16
18
  export default _default;
@@ -0,0 +1,5 @@
1
+ import { MediaFeatureFlags } from '@atlaskit/media-common';
2
+ import { CardStatus, FilePreviewStatus } from '../../../types';
3
+ import { FileState } from '@atlaskit/media-client';
4
+ export declare const extractFilePreviewStatus: (fileState: FileState, isBannedLocalPreview: boolean, featureFlags?: MediaFeatureFlags | undefined) => FilePreviewStatus;
5
+ export declare const isPreviewableStatus: (cardStatus: CardStatus, { isPreviewable, hasPreview, isSupportedByBrowser }: FilePreviewStatus) => boolean;
@@ -1,10 +1,9 @@
1
- import { MediaClient, FilePreview } from '@atlaskit/media-client';
2
- import { NumericalCardDimensions } from '../../..';
3
- import { CardPreview } from './types';
1
+ import { MediaClient, FilePreview, MediaStoreGetFileImageParams } from '@atlaskit/media-client';
2
+ import { CardPreview } from '../../../types';
4
3
  /**
5
4
  * This method tells the support for the media
6
5
  * types covered in getCardPreviewFromFilePreview
7
6
  */
8
- export declare const isSupportedLocalPreview: (mediaType?: "audio" | "video" | "doc" | "image" | "archive" | "unknown" | undefined) => boolean;
7
+ export declare const isSupportedLocalPreview: (mediaType?: "audio" | "video" | "image" | "doc" | "archive" | "unknown" | undefined) => boolean;
9
8
  export declare const getCardPreviewFromFilePreview: (filePreview: FilePreview | Promise<FilePreview>) => Promise<CardPreview>;
10
- export declare const getCardPreviewFromBackend: (mediaClient: MediaClient, id: string, { width, height }: NumericalCardDimensions, collectionName?: string | undefined, resizeMode?: "crop" | "fit" | "full-fit" | "stretchy-fit" | undefined) => Promise<CardPreview>;
9
+ export declare const getCardPreviewFromBackend: (mediaClient: MediaClient, id: string, params: MediaStoreGetFileImageParams) => Promise<CardPreview>;
@@ -1,14 +1,12 @@
1
- import { MediaClient, FilePreview, ImageResizeMode, FileState } from '@atlaskit/media-client';
2
- import { MediaFeatureFlags } from '@atlaskit/media-common';
3
- import { CardDimensions, NumericalCardDimensions } from '../../..';
4
- import { CardPreview } from './types';
1
+ import { MediaClient, FilePreview, FileState, MediaStoreGetFileImageParams, MediaBlobUrlAttrs } from '@atlaskit/media-client';
2
+ import { MediaFeatureFlags, SSR } from '@atlaskit/media-common';
3
+ import { CardDimensions } from '../../../utils/cardDimensions';
5
4
  import { MediaCardError } from '../../../errors';
6
- import { CardStatus, FilePreviewStatus } from '../../../types';
7
- export type { CardPreview } from './types';
5
+ import { CardStatus, CardPreview } from '../../../types';
8
6
  export { getCardPreviewFromFilePreview, getCardPreviewFromBackend, isSupportedLocalPreview, } from './helpers';
9
- export declare const extractFilePreviewStatus: (fileState: FileState, featureFlags?: MediaFeatureFlags | undefined) => FilePreviewStatus;
10
- export declare const shouldGetCardPreview: (cardStatus: CardStatus, { isPreviewable, hasPreview, isSupportedByBrowser }: FilePreviewStatus) => boolean;
7
+ export { extractFilePreviewStatus } from './filePreviewStatus';
11
8
  export declare const getCardPreviewFromCache: (id: string, dimensions: CardDimensions) => CardPreview | undefined;
9
+ export declare const removeCardPreviewFromCache: (id: string, dimensions: CardDimensions) => void;
12
10
  /**
13
11
  * Will return the preview if available and supported by the browser
14
12
  * See extractFilePreviewStatus "hasLocalPreview" logic
@@ -17,14 +15,12 @@ export declare const getFilePreviewFromFileState: (fileState: FileState) => File
17
15
  export declare type CardPreviewParams = {
18
16
  mediaClient: MediaClient;
19
17
  id: string;
20
- collectionName?: string;
21
18
  dimensions?: CardDimensions;
22
- requestedDimensions: NumericalCardDimensions;
23
- resizeMode?: ImageResizeMode;
24
- isRemotePreviewReady: boolean;
25
19
  filePreview?: FilePreview | Promise<FilePreview>;
26
- addContextToDataURI: (dataURI: string) => string;
27
20
  onLocalPreviewError?: (error: MediaCardError) => void;
21
+ isRemotePreviewReady: boolean;
22
+ imageUrlParams: MediaStoreGetFileImageParams;
23
+ mediaBlobUrlAttrs?: MediaBlobUrlAttrs;
28
24
  };
29
25
  /**
30
26
  * This function will try to return a Card preview, either from cache, local preview or remote preview.
@@ -36,4 +32,19 @@ export declare type CardPreviewParams = {
36
32
  * In that case, we still want to report the local preview error to the caller, for feature realiability track.
37
33
  * hence the use of the optional callback onLocalPreviewError
38
34
  */
39
- export declare const getCardPreview: ({ mediaClient, id, collectionName, requestedDimensions, isRemotePreviewReady, addContextToDataURI, filePreview, dimensions, resizeMode, onLocalPreviewError, }: CardPreviewParams) => Promise<CardPreview>;
35
+ export declare const getCardPreview: ({ mediaClient, id, dimensions, filePreview, onLocalPreviewError, isRemotePreviewReady, imageUrlParams, mediaBlobUrlAttrs, }: CardPreviewParams) => Promise<CardPreview>;
36
+ export declare const shouldResolvePreview: ({ status, fileState, dimensions, prevDimensions, hasCardPreview, isBannedLocalPreview, featureFlags, }: {
37
+ status: CardStatus;
38
+ fileState: FileState;
39
+ dimensions?: CardDimensions | undefined;
40
+ prevDimensions?: CardDimensions | undefined;
41
+ hasCardPreview: boolean;
42
+ isBannedLocalPreview: boolean;
43
+ featureFlags?: MediaFeatureFlags | undefined;
44
+ }) => boolean;
45
+ export declare const getSSRCardPreview: (ssr: SSR, mediaClient: MediaClient, id: string, params: MediaStoreGetFileImageParams, mediaBlobUrlAttrs?: MediaBlobUrlAttrs | undefined) => CardPreview;
46
+ export declare const isLocalPreview: (preview: CardPreview) => boolean;
47
+ export declare const isSSRPreview: (preview: CardPreview) => boolean;
48
+ export declare const isSSRServerPreview: (preview: CardPreview) => boolean;
49
+ export declare const isSSRClientPreview: (preview: CardPreview) => boolean;
50
+ export declare const fetchAndCacheRemotePreview: (mediaClient: MediaClient, id: string, dimensions: CardDimensions, params: MediaStoreGetFileImageParams, mediaBlobUrlAttrs?: MediaBlobUrlAttrs | undefined) => Promise<CardPreview>;
@@ -1,3 +1,4 @@
1
1
  import { FileStatus } from '@atlaskit/media-client';
2
2
  import { CardStatus, FilePreviewStatus } from '../../types';
3
+ export declare const isFinalCardStatus: (status: CardStatus) => boolean;
3
4
  export declare const getCardStatus: (fileStatus: FileStatus, { hasFilesize, isPreviewable, hasPreview }: FilePreviewStatus) => CardStatus;
@@ -1,38 +1,41 @@
1
1
  /// <reference types="react-intl" />
2
2
  import React, { Component } from 'react';
3
3
  import { UIAnalyticsEvent, WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
4
- import { FileIdentifier, FileState, MediaClient } from '@atlaskit/media-client';
4
+ import { FileIdentifier } from '@atlaskit/media-client';
5
5
  import { Subscription } from 'rxjs/Subscription';
6
- import { CardAction, CardDimensions, CardProps, CardState } from '../..';
7
- import { CardPreviewParams } from './getCardPreview';
6
+ import { CardAction, CardProps, CardState } from '../..';
8
7
  export declare type CardWithAnalyticsEventsProps = CardProps & WithAnalyticsEventsProps;
9
8
  export declare class CardBase extends Component<CardWithAnalyticsEventsProps, CardState> {
10
9
  private hasBeenMounted;
11
- private lastFileState?;
12
- private lastCardStatusUpdateTimestamp?;
10
+ private timeElapsedTillCommenced;
13
11
  subscription?: Subscription;
14
12
  static defaultProps: Partial<CardProps>;
15
13
  static contextTypes: {
16
14
  intl: ReactIntl.IntlShape;
17
15
  };
18
16
  constructor(props: CardWithAnalyticsEventsProps);
19
- onCopyListener: () => void;
20
17
  componentDidMount(): void;
21
18
  componentDidUpdate(prevProps: CardProps, prevState: CardState): void;
22
- static getDerivedStateFromProps: (props: CardProps) => Partial<CardState> | null;
23
- shouldRefetchImage: (current?: CardDimensions | undefined, next?: CardDimensions | undefined) => boolean;
24
19
  componentWillUnmount(): void;
25
- updateStateForIdentifier(): void;
26
- private isLatestCardStatusUpdate;
27
- private onLocalPreviewError;
20
+ updateStateForIdentifier(identifier: FileIdentifier): void;
21
+ private getImageURLParams;
22
+ private getMediaBlobUrlAttrs;
23
+ private getCardPreviewParams;
24
+ private setCacheSSRPreview;
25
+ private resolveSSRPreview;
26
+ private resolvePreview;
27
+ subscribeInternalFile(identifier: FileIdentifier): void;
28
28
  private get requestedDimensions();
29
- private createAddContextToDataURI;
30
- getCardPreviewParams: (id: string, collectionName: string | undefined, fileState: FileState) => CardPreviewParams;
31
- subscribeInternalFile(identifier: FileIdentifier, mediaClient: MediaClient): void;
32
29
  private get metadata();
33
30
  private get fileAttributes();
31
+ private getPerformanceAttributes;
32
+ private onImageError;
33
+ private onImageLoad;
34
+ private fireOperationalEvent;
34
35
  private fireCommencedEvent;
35
- private fireFileCopiedEvent;
36
+ private fireCopiedEvent;
37
+ private fireScreenEvent;
38
+ private fireLocalPreviewErrorEvent;
36
39
  private safeSetState;
37
40
  unsubscribe: () => void;
38
41
  get actions(): CardAction[];
@@ -1,14 +1,14 @@
1
- import React from 'react';
2
- import { MouseEvent } from 'react';
1
+ import React, { MouseEvent } from 'react';
2
+ import { FormattedMessage } from 'react-intl';
3
3
  import { MediaItemType, FileDetails } from '@atlaskit/media-client';
4
4
  import { WithAnalyticsEventsProps, UIAnalyticsEvent } from '@atlaskit/analytics-next';
5
5
  import { SharedCardProps, CardStatus } from '../index';
6
- export declare const newFileExperienceClassName = "new-file-experience-wrapper";
6
+ import { MediaCardError } from '../errors';
7
7
  export interface CardViewOwnProps extends SharedCardProps {
8
8
  readonly status: CardStatus;
9
9
  readonly mediaItemType: MediaItemType;
10
10
  readonly metadata?: FileDetails;
11
- readonly error?: Error;
11
+ readonly error?: MediaCardError;
12
12
  readonly onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
13
13
  readonly onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
14
14
  readonly onDisplayImage?: () => void;
@@ -16,10 +16,15 @@ export interface CardViewOwnProps extends SharedCardProps {
16
16
  readonly progress?: number;
17
17
  readonly previewOrientation?: number;
18
18
  readonly innerRef?: (instance: HTMLDivElement | null) => void;
19
+ readonly onImageLoad: () => void;
20
+ readonly onImageError: () => void;
21
+ readonly nativeLazyLoad?: boolean;
22
+ readonly forceSyncDisplay?: boolean;
23
+ disableAnimation?: boolean;
19
24
  }
20
25
  export interface CardViewState {
21
26
  elementWidth?: number;
22
- isImageFailedToLoad: boolean;
27
+ didImageRender: boolean;
23
28
  }
24
29
  export declare type CardViewProps = CardViewOwnProps & WithAnalyticsEventsProps;
25
30
  export interface RenderConfigByStatus {
@@ -33,8 +38,8 @@ export interface RenderConfigByStatus {
33
38
  renderProgressBar?: boolean;
34
39
  renderSpinner?: boolean;
35
40
  renderFailedTitleBox?: boolean;
36
- renderLoadingRateLimited?: boolean;
37
41
  renderTickBox?: boolean;
42
+ customTitleMessage?: FormattedMessage.MessageDescriptor;
38
43
  }
39
44
  /**
40
45
  * This is classic vanilla CardView class. To create an instance of class one would need to supply
@@ -46,7 +51,8 @@ export declare class CardViewBase extends React.Component<CardViewProps, CardVie
46
51
  static defaultProps: Partial<CardViewOwnProps>;
47
52
  componentDidMount(): void;
48
53
  componentDidUpdate({ dataURI: prevDataURI }: CardViewProps): void;
49
- private onImageLoadError;
54
+ private onImageLoad;
55
+ private onImageError;
50
56
  private get width();
51
57
  private get breakpoint();
52
58
  saveElementWidth: () => void;
@@ -67,4 +73,4 @@ export declare class CardViewBase extends React.Component<CardViewProps, CardVie
67
73
  private getRenderConfigByStatus;
68
74
  private renderNewExperienceCard;
69
75
  }
70
- export declare const CardView: React.ForwardRefExoticComponent<Pick<Pick<CardViewProps, "progress" | "error" | "alt" | "dimensions" | "resizeMode" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "appearance" | "actions" | "testId" | "selectable" | "selected" | "disableOverlay" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "onDisplayImage" | "previewOrientation" | "titleBoxBgColor" | "titleBoxIcon" | "originalDimensions">, never> & Partial<Pick<Pick<CardViewProps, "progress" | "error" | "alt" | "dimensions" | "resizeMode" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "appearance" | "actions" | "testId" | "selectable" | "selected" | "disableOverlay" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "onDisplayImage" | "previewOrientation" | "titleBoxBgColor" | "titleBoxIcon" | "originalDimensions">, "progress" | "error" | "alt" | "dimensions" | "resizeMode" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "appearance" | "actions" | "testId" | "selectable" | "selected" | "disableOverlay" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "onDisplayImage" | "previewOrientation" | "titleBoxBgColor" | "titleBoxIcon" | "originalDimensions">> & Partial<Pick<Partial<CardViewOwnProps>, never>> & React.RefAttributes<any>>;
76
+ export declare const CardView: React.ForwardRefExoticComponent<Pick<Pick<CardViewProps, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "appearance" | "error" | "actions" | "testId" | "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" | "appearance" | "error" | "actions" | "testId" | "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" | "appearance" | "error" | "actions" | "testId" | "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>>;
@@ -1 +1,2 @@
1
1
  export { default as Card } from './card/cardLoader';
2
+ export { default as MediaInlineCard } from './inline/loader';
@@ -1,22 +1,22 @@
1
1
  import React from 'react';
2
2
  import { WithMediaClientConfigProps } from '@atlaskit/media-client';
3
- import { InlineMediaCardProps } from './inlineMediaCard';
4
- export declare type InlineMediaCardWithMediaClientConfigProps = WithMediaClientConfigProps<InlineMediaCardProps>;
5
- declare type InlineMediaCardWithMediaClientConfigComponent = React.ComponentType<InlineMediaCardWithMediaClientConfigProps>;
3
+ import { MediaInlineCardProps } from './mediaInlineCard';
4
+ export declare type MediaInlineCardWithMediaClientConfigProps = WithMediaClientConfigProps<MediaInlineCardProps>;
5
+ declare type MediaInlineCardWithMediaClientConfigComponent = React.ComponentType<MediaInlineCardWithMediaClientConfigProps>;
6
6
  declare type ErrorBoundaryComponent = React.ComponentType<{
7
7
  data?: {
8
8
  [k: string]: any;
9
9
  };
10
10
  }>;
11
- export interface InlineMediaCardLoaderState {
12
- InlineMediaCard?: InlineMediaCardWithMediaClientConfigComponent;
11
+ export interface MediaInlineCardLoaderState {
12
+ MediaInlineCard?: MediaInlineCardWithMediaClientConfigComponent;
13
13
  ErrorBoundary?: ErrorBoundaryComponent;
14
14
  }
15
- export default class InlineMediaCardLoader extends React.PureComponent<InlineMediaCardWithMediaClientConfigProps & InlineMediaCardLoaderState, InlineMediaCardLoaderState> {
15
+ export default class MediaInlineCardLoader extends React.PureComponent<MediaInlineCardWithMediaClientConfigProps & MediaInlineCardLoaderState, MediaInlineCardLoaderState> {
16
16
  static displayName: string;
17
- static InlineMediaCard?: InlineMediaCardWithMediaClientConfigComponent;
17
+ static MediaInlineCard?: MediaInlineCardWithMediaClientConfigComponent;
18
18
  static ErrorBoundary?: ErrorBoundaryComponent;
19
- state: InlineMediaCardLoaderState;
19
+ state: MediaInlineCardLoaderState;
20
20
  componentDidMount(): Promise<void>;
21
21
  render(): JSX.Element;
22
22
  }
@@ -2,7 +2,7 @@ import React, { FC } from 'react';
2
2
  import { FileIdentifier, MediaClient } from '@atlaskit/media-client';
3
3
  import { InjectedIntlProps } from 'react-intl';
4
4
  import { MediaViewerDataSource } from '@atlaskit/media-viewer';
5
- export interface InlineMediaCardProps {
5
+ export interface MediaInlineCardProps {
6
6
  identifier: FileIdentifier;
7
7
  mediaClient: MediaClient;
8
8
  shouldOpenMediaViewer?: boolean;
@@ -10,7 +10,7 @@ export interface InlineMediaCardProps {
10
10
  onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
11
11
  mediaViewerDataSource?: MediaViewerDataSource;
12
12
  }
13
- export declare const InlineMediaCardInternal: FC<InlineMediaCardProps & InjectedIntlProps>;
14
- export declare const InlineMediaCard: React.ComponentClass<InlineMediaCardProps, any> & {
15
- WrappedComponent: ReactIntl.ComponentConstructor<InlineMediaCardProps & InjectedIntlProps>;
13
+ export declare const MediaInlineCardInternal: FC<MediaInlineCardProps & InjectedIntlProps>;
14
+ export declare const MediaInlineCard: React.ComponentClass<MediaInlineCardProps, any> & {
15
+ WrappedComponent: ReactIntl.ComponentConstructor<MediaInlineCardProps & InjectedIntlProps>;
16
16
  };
@@ -40,4 +40,4 @@ export declare class InlinePlayerBase extends Component<InlinePlayerProps, Inlin
40
40
  onFirstPlay: () => void;
41
41
  render(): JSX.Element;
42
42
  }
43
- export declare const InlinePlayer: React.ForwardRefExoticComponent<Pick<Pick<InlinePlayerProps, "mediaClient" | "dimensions" | "onError" | "onClick" | "createAnalyticsEvent" | "testId" | "selected" | "originalDimensions" | "identifier" | "forwardRef"> & React.RefAttributes<HTMLDivElement>, "mediaClient" | "dimensions" | "onError" | "key" | "onClick" | "testId" | "selected" | "originalDimensions" | "identifier" | "forwardRef"> & React.RefAttributes<any>>;
43
+ export declare const InlinePlayer: React.ForwardRefExoticComponent<Pick<InlinePlayerProps, "onError" | "onClick" | "createAnalyticsEvent" | "testId" | "selected" | "dimensions" | "originalDimensions" | "mediaClient" | "identifier" | "forwardRef"> & React.RefAttributes<HTMLDivElement>>;
@@ -5,8 +5,13 @@ export declare type InternalIconMessageProps = {
5
5
  animated?: boolean;
6
6
  reducedFont?: boolean;
7
7
  };
8
+ declare type CreatingPreviewProps = {
9
+ disableAnimation?: boolean;
10
+ };
8
11
  export declare const IconMessage: React.FC<InternalIconMessageProps>;
9
- export declare const CreatingPreview: React.FC;
12
+ export declare const CreatingPreview: React.FC<CreatingPreviewProps>;
10
13
  export declare const PreviewUnavailable: React.FC;
11
- export declare const RateLimited: React.FC;
14
+ export declare const FailedToLoad: React.FC;
15
+ export declare const FailedToUpload: React.FC;
12
16
  export declare const PreviewCurrentlyUnavailable: React.FC;
17
+ export {};
@@ -1,28 +1,15 @@
1
1
  import React from 'react';
2
- import { MediaType, ImageResizeMode, MediaItemType } from '@atlaskit/media-client';
3
- import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
4
- import { RenderEventAction } from '../../../utils/analytics';
5
- import { WithFileAttributesProps } from '../../../utils/fileAttributesContext';
2
+ import { MediaType, ImageResizeMode } from '@atlaskit/media-client';
6
3
  export declare type ImageRendererProps = {
7
4
  readonly dataURI: string;
8
5
  readonly mediaType: MediaType;
9
- readonly mediaItemType: MediaItemType;
10
6
  readonly previewOrientation?: number;
11
7
  readonly alt?: string;
12
8
  readonly resizeMode?: ImageResizeMode;
13
9
  readonly onDisplayImage?: () => void;
14
10
  readonly onImageError?: () => void;
11
+ readonly onImageLoad?: () => void;
12
+ readonly nativeLazyLoad?: boolean;
13
+ readonly forceSyncDisplay?: boolean;
15
14
  };
16
- export declare const resizeModeToMediaImageProps: (resizeMode?: "crop" | "fit" | "full-fit" | "stretchy-fit" | undefined) => {
17
- crop: boolean;
18
- stretch: boolean;
19
- };
20
- export declare class ImageRendererBase extends React.Component<ImageRendererProps & WithAnalyticsEventsProps & WithFileAttributesProps> {
21
- private lastAnalyticsAction?;
22
- componentDidMount(): void;
23
- onImageLoad: () => void;
24
- onImageError: () => void;
25
- shouldFireEvent: (action: RenderEventAction) => boolean;
26
- render(): JSX.Element;
27
- }
28
- export declare const ImageRenderer: React.ForwardRefExoticComponent<Pick<React.PropsWithChildren<ImageRendererProps & WithAnalyticsEventsProps>, "alt" | "resizeMode" | "mediaType" | "children" | "dataURI" | "mediaItemType" | "onDisplayImage" | "previewOrientation" | "onImageError"> & React.RefAttributes<any>>;
15
+ export declare const ImageRenderer: React.FC<ImageRendererProps>;
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import { Breakpoint } from '../common';
3
+ import { FormattedMessage } from 'react-intl';
3
4
  export declare type OnRetryFunction = () => void;
4
5
  export declare type FailedTitleBoxProps = {
5
6
  breakpoint: Breakpoint;
7
+ customMessage?: FormattedMessage.MessageDescriptor;
6
8
  };
7
9
  export declare const FailedTitleBox: React.FC<FailedTitleBoxProps>;
@@ -1,7 +1,15 @@
1
- export declare type CardStatus = 'uploading' | 'loading' | 'processing' | 'complete' | 'error' | 'failed-processing' | 'loading-preview';
1
+ export declare type CardStatus = 'uploading' | 'loading' | 'processing' | 'loading-preview' | 'complete' | 'error' | 'failed-processing';
2
2
  export declare type FilePreviewStatus = {
3
3
  hasFilesize: boolean;
4
4
  isPreviewable: boolean;
5
5
  hasPreview: boolean;
6
6
  isSupportedByBrowser: boolean;
7
7
  };
8
+ export declare type CardAppearance = 'auto' | 'image' | 'square' | 'horizontal';
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';
11
+ export interface CardPreview {
12
+ dataURI: string;
13
+ orientation?: number;
14
+ source: CardPreviewSource;
15
+ }
@@ -1,39 +1,38 @@
1
1
  import { FileDetails, MediaClientErrorReason, RequestMetadata } from '@atlaskit/media-client';
2
- import { FileAttributes, OperationalEventPayload, UIEventPayload, WithFileAttributes, SuccessAttributes, FailureAttributes } from '@atlaskit/media-common';
2
+ import { FileAttributes, PerformanceAttributes, OperationalEventPayload, UIEventPayload, WithFileAttributes, WithPerformanceAttributes, SuccessAttributes, FailureAttributes, ScreenEventPayload, ScreenAttributes } from '@atlaskit/media-common';
3
3
  import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
4
4
  import { MediaCardError, MediaCardErrorPrimaryReason } from '../errors';
5
- export declare enum RenderEventAction {
6
- COMMENCED = "commenced",
7
- SUCCEEDED = "succeeded",
8
- FAILED = "failed"
9
- }
10
5
  export declare type FileUriFailReason = 'local-uri' | 'remote-uri' | `unknown-uri`;
11
6
  export declare type FailedErrorFailReason = MediaCardErrorPrimaryReason | 'nativeError';
12
- export declare type RenderEventFailReason = FailedErrorFailReason | 'failed-processing' | FileUriFailReason | 'external-uri';
13
- export declare type RenderFailedEventPayload = OperationalEventPayload<WithFileAttributes & FailureAttributes & {
14
- failReason: RenderEventFailReason;
7
+ export declare type RenderFailedEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes & FailureAttributes & {
8
+ failReason: FailedErrorFailReason | 'failed-processing';
15
9
  error?: MediaClientErrorReason | 'nativeError';
16
10
  request?: RequestMetadata;
17
- }, RenderEventAction.FAILED, 'mediaCardRender'>;
18
- export declare type RenderSucceededEventPayload = OperationalEventPayload<WithFileAttributes & SuccessAttributes, RenderEventAction.SUCCEEDED, 'mediaCardRender'>;
19
- export declare type RenderCommencedEventPayload = OperationalEventPayload<WithFileAttributes, RenderEventAction.COMMENCED, 'mediaCardRender'>;
11
+ }, 'failed', 'mediaCardRender'>;
12
+ export declare type RenderSucceededEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes & SuccessAttributes, 'succeeded', 'mediaCardRender'>;
13
+ export declare type RenderCommencedEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes, 'commenced', 'mediaCardRender'>;
20
14
  export declare type CopiedFileEventPayload = UIEventPayload<{}, 'copied', string>;
21
15
  export declare type ClickedEventPayload = UIEventPayload<{
22
16
  label?: string;
23
17
  }, 'clicked', string>;
24
- export declare type MediaCardAnalyticsEventPayload = RenderCommencedEventPayload | RenderSucceededEventPayload | RenderFailedEventPayload | CopiedFileEventPayload | ClickedEventPayload;
25
- export declare const getFileAttributes: (metadata: FileDetails, fileStatus?: "error" | "uploading" | "processing" | "failed-processing" | "processed" | undefined) => FileAttributes;
26
- export declare const getRenderCommencedEventPayload: (fileAttributes: FileAttributes) => RenderCommencedEventPayload;
27
- export declare const getRenderSucceededEventPayload: (fileAttributes: FileAttributes) => RenderSucceededEventPayload;
28
- export declare const getFailedFileUriFailReason: (fileStatus?: "error" | "uploading" | "processing" | "failed-processing" | "processed" | undefined) => FileUriFailReason;
29
- export declare const getRenderFailedFileUriPayload: (fileAttributes: FileAttributes) => RenderFailedEventPayload;
30
- export declare const getRenderFailedExternalUriPayload: (fileAttributes: FileAttributes) => RenderFailedEventPayload;
18
+ export declare type RenderScreenEventPayload = Omit<ScreenEventPayload<ScreenAttributes, 'mediaCardRenderScreen'>, 'attributes'> & {
19
+ attributes: {
20
+ type: string | undefined;
21
+ fileAttributes: FileAttributes;
22
+ };
23
+ };
24
+ export declare type MediaCardAnalyticsEventPayload = RenderCommencedEventPayload | RenderSucceededEventPayload | RenderFailedEventPayload | CopiedFileEventPayload | ClickedEventPayload | RenderScreenEventPayload;
25
+ export declare const getFileAttributes: (metadata: FileDetails, fileStatus?: "failed-processing" | "uploading" | "processing" | "processed" | "error" | undefined) => FileAttributes;
26
+ export declare const getRenderPreviewableCardPayload: (fileAttributes: FileAttributes) => RenderScreenEventPayload;
27
+ export declare const getRenderCommencedEventPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes) => RenderCommencedEventPayload;
28
+ export declare const getRenderSucceededEventPayload: (fileAttributes: FileAttributes, performanceAttributes?: PerformanceAttributes | undefined) => RenderSucceededEventPayload;
29
+ export declare const getRenderFailedExternalUriPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes) => RenderFailedEventPayload;
31
30
  export declare const getRenderErrorFailReason: (error: MediaCardError) => FailedErrorFailReason;
32
31
  export declare const getRenderErrorErrorReason: (error: MediaCardError) => MediaClientErrorReason | 'nativeError';
33
32
  export declare const getRenderErrorErrorDetail: (error: MediaCardError) => string;
34
33
  export declare const getRenderErrorRequestMetadata: (error: MediaCardError) => RequestMetadata | undefined;
35
- export declare const getRenderErrorEventPayload: (fileAttributes: FileAttributes, error: MediaCardError) => RenderFailedEventPayload;
36
- export declare const getRenderFailedFileStatusPayload: (fileAttributes: FileAttributes) => RenderFailedEventPayload;
34
+ export declare const getRenderErrorEventPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, error: MediaCardError) => RenderFailedEventPayload;
35
+ export declare const getRenderFailedFileStatusPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes) => RenderFailedEventPayload;
37
36
  export declare const getCopiedFilePayload: (fileId: string) => CopiedFileEventPayload;
38
37
  export declare function fireMediaCardEvent(payload: MediaCardAnalyticsEventPayload, createAnalyticsEvent?: CreateUIAnalyticsEvent): void;
39
38
  export declare const createAndFireMediaCardEvent: (payload: MediaCardAnalyticsEventPayload) => (createAnalyticsEvent: CreateUIAnalyticsEvent) => import("@atlaskit/analytics-next").UIAnalyticsEvent;
@@ -1,4 +1,8 @@
1
- import { CardDimensions } from '..';
1
+ import { CardDimensionValue } from '../types';
2
+ export interface CardDimensions {
3
+ width?: CardDimensionValue;
4
+ height?: CardDimensionValue;
5
+ }
2
6
  export declare const defaultSmallCardDimensions: {
3
7
  width: string;
4
8
  height: number;
@@ -1,3 +1,3 @@
1
1
  import { CardDimensions } from '../';
2
2
  export declare const canCompareDimension: (current?: string | number | undefined, next?: string | number | undefined) => boolean;
3
- export declare const isBigger: (current: CardDimensions, next: CardDimensions) => boolean;
3
+ export declare const isBigger: (current?: CardDimensions | undefined, next?: CardDimensions | undefined) => boolean;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Document;
2
+ export default _default;
@@ -1,7 +1,9 @@
1
- import { CardDimensions } from '..';
1
+ import { CardDimensions } from './cardDimensions';
2
2
  import { ElementDimension } from './getElementDimension';
3
+ import { NumericalCardDimensions } from '@atlaskit/media-common';
3
4
  export declare type getDataURIDimensionOptions = {
4
5
  element?: Element | null;
5
6
  dimensions?: CardDimensions;
6
7
  };
7
8
  export declare const getDataURIDimension: (dimension: ElementDimension, options: getDataURIDimensionOptions) => number;
9
+ export declare const getRequestedDimensions: (options: getDataURIDimensionOptions) => NumericalCardDimensions;
@@ -12,3 +12,4 @@ export { isValidPercentageUnit } from './isValidPercentageUnit';
12
12
  export { getElementDimension } from './getElementDimension';
13
13
  export type { ElementDimension } from './getElementDimension';
14
14
  export { containsPixelUnit } from './containsPixelUnit';
15
+ export type { CardDimensions } from './cardDimensions';
@@ -1,5 +1,5 @@
1
1
  import { LazilyRenderProps } from 'react-lazily-render';
2
2
  import { StyledComponentClass } from 'styled-components';
3
- export declare const Wrapper: StyledComponentClass<LazilyRenderProps, any, Pick<LazilyRenderProps, "children" | "className" | "placeholder" | "content" | "offset" | "component" | "onRender" | "scrollContainer"> & {
3
+ export declare const Wrapper: StyledComponentClass<LazilyRenderProps, any, Pick<LazilyRenderProps, "className" | "placeholder" | "children" | "content" | "offset" | "component" | "onRender" | "scrollContainer"> & {
4
4
  theme?: any;
5
5
  }>;
@@ -1,4 +1,4 @@
1
- import { CardDimensions } from '../..';
1
+ import { CardDimensions } from '../../utils/cardDimensions';
2
2
  import { MediaFeatureFlags } from '@atlaskit/media-common';
3
3
  export interface StaticCardProps {
4
4
  dimensions?: CardDimensions;