@atlaskit/media-card 74.1.6 → 74.1.7

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 (157) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/classnames/package.json +8 -1
  3. package/dist/cjs/root/card/getCardPreview/helpers.js +4 -4
  4. package/dist/cjs/root/card/getCardPreview/index.js +1 -1
  5. package/dist/cjs/root/card/index.js +1 -1
  6. package/dist/cjs/root/inlinePlayer.js +2 -2
  7. package/dist/cjs/utils/ufoExperiences.js +1 -1
  8. package/dist/cjs/utils/viewportDetector.js +22 -4
  9. package/dist/cjs/version.json +1 -1
  10. package/dist/es2019/root/card/getCardPreview/helpers.js +4 -4
  11. package/dist/es2019/root/card/getCardPreview/index.js +1 -1
  12. package/dist/es2019/root/card/index.js +1 -1
  13. package/dist/es2019/root/inlinePlayer.js +2 -2
  14. package/dist/es2019/utils/ufoExperiences.js +1 -1
  15. package/dist/es2019/utils/viewportDetector.js +22 -4
  16. package/dist/es2019/version.json +1 -1
  17. package/dist/esm/root/card/getCardPreview/helpers.js +4 -4
  18. package/dist/esm/root/card/getCardPreview/index.js +1 -1
  19. package/dist/esm/root/card/index.js +1 -1
  20. package/dist/esm/root/inlinePlayer.js +2 -2
  21. package/dist/esm/utils/ufoExperiences.js +1 -1
  22. package/dist/esm/utils/viewportDetector.js +22 -4
  23. package/dist/esm/version.json +1 -1
  24. package/dist/types-ts4.0/__tests_external__/index.d.ts +1 -0
  25. package/dist/types-ts4.0/__tests_external__/page-objects/MediaCard.d.ts +8 -0
  26. package/dist/types-ts4.0/actions.d.ts +9 -0
  27. package/dist/types-ts4.0/classnames.d.ts +1 -0
  28. package/dist/types-ts4.0/errors.d.ts +41 -0
  29. package/dist/types-ts4.0/files/cardImageView/cardImageViewWrapper.d.ts +6 -0
  30. package/dist/types-ts4.0/files/cardImageView/cardOverlay/cardOverlayComponents.d.ts +8 -0
  31. package/dist/types-ts4.0/files/cardImageView/cardOverlay/index.d.ts +39 -0
  32. package/dist/types-ts4.0/files/cardImageView/cardOverlay/styles.d.ts +26 -0
  33. package/dist/types-ts4.0/files/cardImageView/classnames.d.ts +2 -0
  34. package/dist/types-ts4.0/files/cardImageView/index.d.ts +50 -0
  35. package/dist/types-ts4.0/files/cardImageView/styles.d.ts +24 -0
  36. package/dist/types-ts4.0/files/index.d.ts +2 -0
  37. package/dist/types-ts4.0/in-product.d.ts +1 -0
  38. package/dist/types-ts4.0/index.d.ts +77 -0
  39. package/dist/types-ts4.0/root/card/cardAnalytics.d.ts +9 -0
  40. package/dist/types-ts4.0/root/card/cardConstants.d.ts +1 -0
  41. package/dist/types-ts4.0/root/card/cardLoader.d.ts +6 -0
  42. package/dist/types-ts4.0/root/card/cardState.d.ts +5 -0
  43. package/dist/types-ts4.0/root/card/getCardPreview/cache.d.ts +19 -0
  44. package/dist/types-ts4.0/root/card/getCardPreview/filePreviewStatus.d.ts +5 -0
  45. package/dist/types-ts4.0/root/card/getCardPreview/helpers.d.ts +9 -0
  46. package/dist/types-ts4.0/root/card/getCardPreview/index.d.ts +57 -0
  47. package/dist/types-ts4.0/root/card/getCardStatus.d.ts +4 -0
  48. package/dist/types-ts4.0/root/card/imageRefetchingAnalytics.d.ts +10 -0
  49. package/dist/types-ts4.0/root/card/index.d.ts +58 -0
  50. package/dist/types-ts4.0/root/cardView.d.ts +80 -0
  51. package/dist/types-ts4.0/root/cardViewWrapper.d.ts +4 -0
  52. package/dist/types-ts4.0/root/index.d.ts +2 -0
  53. package/dist/types-ts4.0/root/inline/loader.d.ts +25 -0
  54. package/dist/types-ts4.0/root/inline/mediaInlineCard.d.ts +14 -0
  55. package/dist/types-ts4.0/root/inlinePlayer.d.ts +51 -0
  56. package/dist/types-ts4.0/root/inlinePlayerLazy.d.ts +2 -0
  57. package/dist/types-ts4.0/root/inlinePlayerWrapper.d.ts +4 -0
  58. package/dist/types-ts4.0/root/media-card-analytics-error-boundary.d.ts +10 -0
  59. package/dist/types-ts4.0/root/styles.d.ts +10 -0
  60. package/dist/types-ts4.0/root/types.d.ts +24 -0
  61. package/dist/types-ts4.0/root/ui/actionsBar/actionsBar.d.ts +5 -0
  62. package/dist/types-ts4.0/root/ui/actionsBar/actionsBarWrapper.d.ts +4 -0
  63. package/dist/types-ts4.0/root/ui/actionsBar/styles.d.ts +6 -0
  64. package/dist/types-ts4.0/root/ui/actionsBar/types.d.ts +10 -0
  65. package/dist/types-ts4.0/root/ui/blanket/blanket.d.ts +6 -0
  66. package/dist/types-ts4.0/root/ui/blanket/styles.d.ts +6 -0
  67. package/dist/types-ts4.0/root/ui/common.d.ts +23 -0
  68. package/dist/types-ts4.0/root/ui/iconMessage/iconMessageWrapper.d.ts +4 -0
  69. package/dist/types-ts4.0/root/ui/iconMessage/index.d.ts +8 -0
  70. package/dist/types-ts4.0/root/ui/iconMessage/styles.d.ts +5 -0
  71. package/dist/types-ts4.0/root/ui/iconMessage/types.d.ts +19 -0
  72. package/dist/types-ts4.0/root/ui/iconWrapper/iconWrapper.d.ts +4 -0
  73. package/dist/types-ts4.0/root/ui/iconWrapper/styles.d.ts +7 -0
  74. package/dist/types-ts4.0/root/ui/iconWrapper/types.d.ts +6 -0
  75. package/dist/types-ts4.0/root/ui/imageRenderer/imageRenderer.d.ts +15 -0
  76. package/dist/types-ts4.0/root/ui/loadingRateLimited/styles.d.ts +13 -0
  77. package/dist/types-ts4.0/root/ui/newFileExperience/newFileExperienceWrapper.d.ts +4 -0
  78. package/dist/types-ts4.0/root/ui/newFileExperience/styles.d.ts +5 -0
  79. package/dist/types-ts4.0/root/ui/newFileExperience/types.d.ts +23 -0
  80. package/dist/types-ts4.0/root/ui/playButton/playButton.d.ts +2 -0
  81. package/dist/types-ts4.0/root/ui/playButton/playButtonBackground.d.ts +3 -0
  82. package/dist/types-ts4.0/root/ui/playButton/playButtonWrapper.d.ts +3 -0
  83. package/dist/types-ts4.0/root/ui/playButton/styles.d.ts +5 -0
  84. package/dist/types-ts4.0/root/ui/progressBar/progressBar.d.ts +10 -0
  85. package/dist/types-ts4.0/root/ui/progressBar/styledBar.d.ts +4 -0
  86. package/dist/types-ts4.0/root/ui/progressBar/styles.d.ts +7 -0
  87. package/dist/types-ts4.0/root/ui/progressBar/types.d.ts +7 -0
  88. package/dist/types-ts4.0/root/ui/styles.d.ts +11 -0
  89. package/dist/types-ts4.0/root/ui/tickBox/styles.d.ts +7 -0
  90. package/dist/types-ts4.0/root/ui/tickBox/tickBox.d.ts +3 -0
  91. package/dist/types-ts4.0/root/ui/tickBox/tickBoxWrapper.d.ts +4 -0
  92. package/dist/types-ts4.0/root/ui/tickBox/types.d.ts +4 -0
  93. package/dist/types-ts4.0/root/ui/titleBox/failedTitleBox.d.ts +3 -0
  94. package/dist/types-ts4.0/root/ui/titleBox/styles.d.ts +15 -0
  95. package/dist/types-ts4.0/root/ui/titleBox/titleBox.d.ts +4 -0
  96. package/dist/types-ts4.0/root/ui/titleBox/titleBoxComponents.d.ts +8 -0
  97. package/dist/types-ts4.0/root/ui/titleBox/types.d.ts +32 -0
  98. package/dist/types-ts4.0/styles/animations.d.ts +1 -0
  99. package/dist/types-ts4.0/styles/config.d.ts +1 -0
  100. package/dist/types-ts4.0/styles/easing.d.ts +2 -0
  101. package/dist/types-ts4.0/styles/getSelectedBorderStyle.d.ts +3 -0
  102. package/dist/types-ts4.0/styles/index.d.ts +9 -0
  103. package/dist/types-ts4.0/styles/mixins.d.ts +21 -0
  104. package/dist/types-ts4.0/types.d.ts +25 -0
  105. package/dist/types-ts4.0/utils/analytics.d.ts +78 -0
  106. package/dist/types-ts4.0/utils/breakpoint.d.ts +11 -0
  107. package/dist/types-ts4.0/utils/cardActions/cardActionButton.d.ts +4 -0
  108. package/dist/types-ts4.0/utils/cardActions/cardActionIconButton.d.ts +12 -0
  109. package/dist/types-ts4.0/utils/cardActions/cardActionsDropdownMenu.d.ts +14 -0
  110. package/dist/types-ts4.0/utils/cardActions/cardActionsView.d.ts +16 -0
  111. package/dist/types-ts4.0/utils/cardActions/index.d.ts +7 -0
  112. package/dist/types-ts4.0/utils/cardActions/styles.d.ts +18 -0
  113. package/dist/types-ts4.0/utils/cardDimensions.d.ts +53 -0
  114. package/dist/types-ts4.0/utils/containsPixelUnit.d.ts +1 -0
  115. package/dist/types-ts4.0/utils/dimensionComparer.d.ts +3 -0
  116. package/dist/types-ts4.0/utils/document.d.ts +2 -0
  117. package/dist/types-ts4.0/utils/errorIcon/index.d.ts +12 -0
  118. package/dist/types-ts4.0/utils/errorIcon/styles.d.ts +1 -0
  119. package/dist/types-ts4.0/utils/fileIcon/index.d.ts +12 -0
  120. package/dist/types-ts4.0/utils/fileIcon/styles.d.ts +1 -0
  121. package/dist/types-ts4.0/utils/generateUniqueId.d.ts +1 -0
  122. package/dist/types-ts4.0/utils/getCSSUnitValue.d.ts +1 -0
  123. package/dist/types-ts4.0/utils/getDataURIDimension.d.ts +9 -0
  124. package/dist/types-ts4.0/utils/getElementDimension.d.ts +2 -0
  125. package/dist/types-ts4.0/utils/getErrorMessage.d.ts +2 -0
  126. package/dist/types-ts4.0/utils/getMediaCardCursor.d.ts +6 -0
  127. package/dist/types-ts4.0/utils/globalScope/getSSRData.d.ts +3 -0
  128. package/dist/types-ts4.0/utils/globalScope/globalScope.d.ts +21 -0
  129. package/dist/types-ts4.0/utils/globalScope/index.d.ts +4 -0
  130. package/dist/types-ts4.0/utils/globalScope/types.d.ts +8 -0
  131. package/dist/types-ts4.0/utils/index.d.ts +15 -0
  132. package/dist/types-ts4.0/utils/isRetina.d.ts +1 -0
  133. package/dist/types-ts4.0/utils/isValidPercentageUnit.d.ts +1 -0
  134. package/dist/types-ts4.0/utils/lightCards/cardError.d.ts +12 -0
  135. package/dist/types-ts4.0/utils/lightCards/cardLoading.d.ts +5 -0
  136. package/dist/types-ts4.0/utils/lightCards/getDimensionsWithDefault.d.ts +2 -0
  137. package/dist/types-ts4.0/utils/lightCards/lightCardWrappers.d.ts +5 -0
  138. package/dist/types-ts4.0/utils/lightCards/styles.d.ts +4 -0
  139. package/dist/types-ts4.0/utils/lightCards/types.d.ts +15 -0
  140. package/dist/types-ts4.0/utils/mediaTypeIcon/iconWrapper.d.ts +4 -0
  141. package/dist/types-ts4.0/utils/mediaTypeIcon/index.d.ts +10 -0
  142. package/dist/types-ts4.0/utils/mediaTypeIcon/styles.d.ts +2 -0
  143. package/dist/types-ts4.0/utils/mediaTypeIcon/types.d.ts +6 -0
  144. package/dist/types-ts4.0/utils/metadata.d.ts +2 -0
  145. package/dist/types-ts4.0/utils/objectURLCache.d.ts +11 -0
  146. package/dist/types-ts4.0/utils/preventClickThrough.d.ts +8 -0
  147. package/dist/types-ts4.0/utils/printScript.d.ts +2 -0
  148. package/dist/types-ts4.0/utils/progressBar/index.d.ts +9 -0
  149. package/dist/types-ts4.0/utils/progressBar/styles.d.ts +1 -0
  150. package/dist/types-ts4.0/utils/resizeModeToMediaImageProps.d.ts +5 -0
  151. package/dist/types-ts4.0/utils/shouldDisplayImageThumbnail.d.ts +3 -0
  152. package/dist/types-ts4.0/utils/ufoExperiences.d.ts +7 -0
  153. package/dist/types-ts4.0/utils/videoSnapshot.d.ts +1 -0
  154. package/dist/types-ts4.0/utils/viewportDetector.d.ts +6 -0
  155. package/in-product/package.json +8 -1
  156. package/package.json +10 -3
  157. package/types/package.json +8 -1
@@ -0,0 +1,24 @@
1
+ /// <reference types="react" />
2
+ import { GlobalThemeTokens } from '@atlaskit/theme/components';
3
+ import { CardStatus } from '../../index';
4
+ export interface WrapperProps {
5
+ disableOverlay?: boolean;
6
+ selectable?: boolean;
7
+ selected?: boolean;
8
+ hasOnClick?: boolean;
9
+ mediaType?: string;
10
+ mediaName?: string;
11
+ progress?: number;
12
+ status?: CardStatus;
13
+ theme?: GlobalThemeTokens;
14
+ children?: JSX.Element | JSX.Element[];
15
+ }
16
+ export declare const wrapperStyles: (props: WrapperProps) => import("@emotion/react").SerializedStyles;
17
+ export declare const playIconWrapperStyles: import("@emotion/react").SerializedStyles;
18
+ export declare const playIconBackgroundStyles: import("@emotion/react").SerializedStyles;
19
+ export declare const progressBarWrapperStyles: import("@emotion/react").SerializedStyles;
20
+ export declare const overlayStyles: import("@emotion/react").SerializedStyles;
21
+ export declare const titleStyles: import("@emotion/react").SerializedStyles;
22
+ export declare const bodyStyles: import("@emotion/react").SerializedStyles;
23
+ export declare const progressWrapperStyles: import("@emotion/react").SerializedStyles;
24
+ export declare const cardActionsWrapperStyles: import("@emotion/react").SerializedStyles;
@@ -0,0 +1,2 @@
1
+ export { FileCardImageView } from './cardImageView';
2
+ export type { FileCardImageViewProps } from './cardImageView';
@@ -0,0 +1 @@
1
+ export { MediaCardPageObject } from './__tests_external__';
@@ -0,0 +1,77 @@
1
+ import { MouseEvent } from 'react';
2
+ import { FileDetails, MediaClient, Identifier, ImageResizeMode, FileState } from '@atlaskit/media-client';
3
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
4
+ import { MediaFeatureFlags, NumericalCardDimensions, SSR } from '@atlaskit/media-common';
5
+ import { CardAction } from './actions';
6
+ import { MediaViewerDataSource } from '@atlaskit/media-viewer';
7
+ import { CardPreview, CardStatus, CardAppearance } from './types';
8
+ import { MediaCardError } from './errors';
9
+ import { CardDimensions } from './utils';
10
+ export type { CardDimensions } from './utils';
11
+ export type { NumericalCardDimensions } from '@atlaskit/media-common';
12
+ export { Card, MediaInlineCard } from './root';
13
+ export type { CardAction, CardEventHandler } from './actions';
14
+ export type { CardStatus, CardAppearance, CardDimensionValue, CardPreview, } from './types';
15
+ export declare type TitleBoxIcon = 'LockFilledIcon';
16
+ export interface CardEvent {
17
+ event: MouseEvent<HTMLElement>;
18
+ mediaItemDetails?: FileDetails;
19
+ }
20
+ export interface SharedCardProps {
21
+ readonly disableOverlay?: boolean;
22
+ readonly resizeMode?: ImageResizeMode;
23
+ readonly featureFlags?: MediaFeatureFlags;
24
+ readonly appearance?: CardAppearance;
25
+ readonly dimensions?: CardDimensions;
26
+ readonly originalDimensions?: NumericalCardDimensions;
27
+ readonly actions?: Array<CardAction>;
28
+ readonly selectable?: boolean;
29
+ readonly selected?: boolean;
30
+ readonly alt?: string;
31
+ readonly testId?: string;
32
+ readonly titleBoxBgColor?: string;
33
+ readonly titleBoxIcon?: TitleBoxIcon;
34
+ }
35
+ export interface CardOnClickCallback {
36
+ (result: CardEvent, analyticsEvent?: UIAnalyticsEvent): void;
37
+ }
38
+ export interface CardEventProps {
39
+ readonly onClick?: CardOnClickCallback;
40
+ readonly onMouseEnter?: (result: CardEvent) => void;
41
+ /** Callback function to be called when video enters and exit fullscreen.
42
+ * `fullscreen = true` indicates video enters fullscreen
43
+ * `fullscreen = false` indicates video exits fullscreen
44
+ */
45
+ readonly onFullscreenChange?: (fullscreen: boolean) => void;
46
+ }
47
+ export interface CardProps extends SharedCardProps, CardEventProps {
48
+ readonly mediaClient: MediaClient;
49
+ readonly identifier: Identifier;
50
+ readonly isLazy?: boolean;
51
+ readonly useInlinePlayer?: boolean;
52
+ readonly shouldOpenMediaViewer?: boolean;
53
+ readonly mediaViewerDataSource?: MediaViewerDataSource;
54
+ readonly contextId?: string;
55
+ readonly shouldEnableDownloadButton?: boolean;
56
+ readonly ssr?: SSR;
57
+ }
58
+ export interface CardState {
59
+ status: CardStatus;
60
+ isCardVisible: boolean;
61
+ shouldAutoplay?: boolean;
62
+ isPlayingFile: boolean;
63
+ mediaViewerSelectedItem?: Identifier;
64
+ fileState?: FileState;
65
+ progress?: number;
66
+ cardPreview?: CardPreview;
67
+ error?: MediaCardError;
68
+ cardRef: HTMLDivElement | null;
69
+ isBannedLocalPreview: boolean;
70
+ previewDidRender: boolean;
71
+ }
72
+ export { CardLoading } from './utils/lightCards/cardLoading';
73
+ export { CardError } from './utils/lightCards/cardError';
74
+ export { defaultImageCardDimensions } from './utils/cardDimensions';
75
+ export { fileCardImageViewSelector, fileCardImageViewSelectedSelector, } from './files/cardImageView/classnames';
76
+ export { inlinePlayerClassName } from './root/styles';
77
+ export { newFileExperienceClassName } from './root/card/cardConstants';
@@ -0,0 +1,9 @@
1
+ import { FileAttributes, PerformanceAttributes } from '@atlaskit/media-common';
2
+ import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
3
+ import { SSRStatus } from '../../utils/analytics';
4
+ import { CardStatus } from '../..';
5
+ import { MediaCardError } from './../../errors';
6
+ export declare const fireOperationalEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, status: CardStatus, fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, ssrReliability: SSRStatus, error?: MediaCardError) => 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";
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { WithMediaClientConfigProps } from '@atlaskit/media-client';
3
+ import type { CardBaseProps } from '.';
4
+ export declare type CardWithMediaClientConfigProps = WithMediaClientConfigProps<CardBaseProps>;
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>;
@@ -0,0 +1,19 @@
1
+ import { ImageResizeMode } from '@atlaskit/media-client';
2
+ import { ObjectURLCache } from '../../../utils/objectURLCache';
3
+ import { CardPreview } from '../../../types';
4
+ declare type Mode = ImageResizeMode | undefined;
5
+ export declare const getCacheKey: (id: string, mode: Mode) => string;
6
+ export interface CardPreviewCache {
7
+ get(id: string, mode: Mode): CardPreview | undefined;
8
+ set(id: string, mode: Mode, cardPreview: CardPreview): void;
9
+ remove(id: string, mode: Mode): void;
10
+ }
11
+ export declare class CardPreviewCacheImpl implements CardPreviewCache {
12
+ private previewCache;
13
+ constructor(previewCache: ObjectURLCache);
14
+ get: (id: string, mode: Mode) => CardPreview | undefined;
15
+ set: (id: string, mode: Mode, cardPreview: CardPreview) => void;
16
+ remove: (id: string, mode: Mode) => void;
17
+ }
18
+ declare const _default: CardPreviewCacheImpl;
19
+ 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;
@@ -0,0 +1,9 @@
1
+ import { MediaClient, FilePreview, MediaStoreGetFileImageParams, MediaType } from '@atlaskit/media-client';
2
+ import { CardPreview } from '../../../types';
3
+ /**
4
+ * This method tells the support for the media
5
+ * types covered in getCardPreviewFromFilePreview
6
+ */
7
+ export declare const isSupportedLocalPreview: (mediaType?: MediaType | undefined) => boolean;
8
+ export declare const getCardPreviewFromFilePreview: (filePreview: FilePreview | Promise<FilePreview>) => Promise<CardPreview>;
9
+ export declare const getCardPreviewFromBackend: (mediaClient: MediaClient, id: string, params: MediaStoreGetFileImageParams) => Promise<CardPreview>;
@@ -0,0 +1,57 @@
1
+ import { MediaClient, FilePreview, FileState, MediaStoreGetFileImageParams, MediaBlobUrlAttrs, FileIdentifier } from '@atlaskit/media-client';
2
+ import { MediaFeatureFlags, SSR } from '@atlaskit/media-common';
3
+ import { ImageResizeMode } from '@atlaskit/media-client';
4
+ import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
5
+ import { CardDimensions } from '../../../utils/cardDimensions';
6
+ import { MediaCardError } from '../../../errors';
7
+ import { CardStatus, CardPreview } from '../../../types';
8
+ export { getCardPreviewFromFilePreview, getCardPreviewFromBackend, isSupportedLocalPreview, } from './helpers';
9
+ export { extractFilePreviewStatus } from './filePreviewStatus';
10
+ export declare const getCardPreviewFromCache: (id: string, mode: ImageResizeMode | undefined) => CardPreview | undefined;
11
+ export declare const removeCardPreviewFromCache: (id: string, mode: ImageResizeMode | undefined) => void;
12
+ /**
13
+ * Will return the preview if available and supported by the browser
14
+ * See extractFilePreviewStatus "hasLocalPreview" logic
15
+ */
16
+ export declare const getFilePreviewFromFileState: (fileState: FileState) => FilePreview | Promise<FilePreview> | undefined;
17
+ export declare type CardPreviewParams = {
18
+ mediaClient: MediaClient;
19
+ id: string;
20
+ dimensions?: CardDimensions;
21
+ filePreview?: FilePreview | Promise<FilePreview>;
22
+ onLocalPreviewError?: (error: MediaCardError) => void;
23
+ isRemotePreviewReady: boolean;
24
+ imageUrlParams: MediaStoreGetFileImageParams;
25
+ mediaBlobUrlAttrs?: MediaBlobUrlAttrs;
26
+ createAnalyticsEvent?: CreateUIAnalyticsEvent;
27
+ featureFlags?: MediaFeatureFlags;
28
+ };
29
+ /**
30
+ * This function will try to return a Card preview, either from cache, local preview or remote preview.
31
+ * It should only be called if there is a chance to get either a remote or a local preview, or both.
32
+ * This, in order to ensure there is always going to be a valid return value OR throw an error if the process fails.
33
+ * It is worth noting that local preview failures break the process if there is no remote preview available.
34
+ * In that case we throw an error immediately.
35
+ * Otherwise, if the local preview fails but there is a remote preview available, the failure does not break the process.
36
+ * In that case, we still want to report the local preview error to the caller, for feature realiability track.
37
+ * hence the use of the optional callback onLocalPreviewError
38
+ */
39
+ export declare const getCardPreview: ({ mediaClient, id, dimensions, filePreview, onLocalPreviewError, isRemotePreviewReady, imageUrlParams, mediaBlobUrlAttrs, createAnalyticsEvent, featureFlags, }: CardPreviewParams) => Promise<CardPreview>;
40
+ export declare const shouldResolvePreview: ({ status, fileState, prevDimensions, dimensions, identifier, fileImageMode, hasCardPreview, isBannedLocalPreview, featureFlags, }: {
41
+ status: CardStatus;
42
+ fileState: FileState;
43
+ prevDimensions?: CardDimensions | undefined;
44
+ dimensions?: CardDimensions | undefined;
45
+ identifier: FileIdentifier;
46
+ fileImageMode?: ImageResizeMode | undefined;
47
+ hasCardPreview: boolean;
48
+ isBannedLocalPreview: boolean;
49
+ featureFlags?: MediaFeatureFlags | undefined;
50
+ }) => boolean;
51
+ export declare const getSSRCardPreview: (ssr: SSR, mediaClient: MediaClient, id: string, params: MediaStoreGetFileImageParams, mediaBlobUrlAttrs?: MediaBlobUrlAttrs | undefined) => CardPreview;
52
+ export declare const isLocalPreview: (preview: CardPreview) => boolean;
53
+ export declare const isSSRPreview: (preview: CardPreview) => boolean;
54
+ export declare const isSSRServerPreview: (preview: CardPreview) => boolean;
55
+ export declare const isSSRClientPreview: (preview: CardPreview) => boolean;
56
+ export declare const isSSRDataPreview: (preview: CardPreview) => boolean;
57
+ export declare const fetchAndCacheRemotePreview: (mediaClient: MediaClient, id: string, dimensions: CardDimensions, params: MediaStoreGetFileImageParams, mediaBlobUrlAttrs?: MediaBlobUrlAttrs | undefined) => Promise<CardPreview>;
@@ -0,0 +1,4 @@
1
+ import { FileStatus } from '@atlaskit/media-client';
2
+ import { CardStatus, FilePreviewStatus } from '../../types';
3
+ export declare const isFinalCardStatus: (status: CardStatus) => boolean;
4
+ export declare const getCardStatus: (fileStatus: FileStatus, { hasFilesize, isPreviewable, hasPreview }: FilePreviewStatus) => CardStatus;
@@ -0,0 +1,10 @@
1
+ import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
+ import { CardDimensions } from '../../utils';
3
+ import { CardPreviewAttributes } from '../../utils/analytics';
4
+ declare type cardAction = 'cache-hit' | 'remote-success';
5
+ export declare const fireImageFetchingOperationalEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, action: cardAction, cardPreviewAttributes: CardPreviewAttributes) => void;
6
+ export declare const calculatePercentageDifference: (prevDimensions: CardDimensions | undefined, currentDimensions: CardDimensions | undefined) => {
7
+ width: string;
8
+ height: string;
9
+ } | undefined;
10
+ export {};
@@ -0,0 +1,58 @@
1
+ import React, { Component } from 'react';
2
+ import { UIAnalyticsEvent, WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
3
+ import { FileIdentifier, FileState, MediaSubscription } from '@atlaskit/media-client';
4
+ import { WrappedComponentProps } from 'react-intl-next';
5
+ import { CardAction, CardProps, CardState, CardStatus } from '../..';
6
+ export declare type CardBaseProps = CardProps & WithAnalyticsEventsProps & Partial<WrappedComponentProps>;
7
+ export declare class CardBase extends Component<CardBaseProps, CardState> {
8
+ private internalOccurrenceKey;
9
+ private hasBeenMounted;
10
+ private fileStateFlags;
11
+ private ssrReliability;
12
+ private timeElapsedTillCommenced;
13
+ subscription?: MediaSubscription;
14
+ private ssrData?;
15
+ static defaultProps: Partial<CardProps>;
16
+ constructor(props: CardBaseProps);
17
+ componentDidMount(): void;
18
+ componentDidUpdate(prevProps: CardProps, prevState: CardState): void;
19
+ componentWillUnmount(): void;
20
+ updateStateForIdentifier(identifier: FileIdentifier): void;
21
+ private getImageURLParams;
22
+ private getMediaBlobUrlAttrs;
23
+ private getCardPreviewParams;
24
+ private setCacheSSRPreview;
25
+ private refetchSSRPreview;
26
+ private resolvePreview;
27
+ updateFileStateFlag(fileState?: FileState): void;
28
+ subscribeInternalFile(identifier: FileIdentifier): void;
29
+ private get requestedDimensions();
30
+ private get metadata();
31
+ private get fileAttributes();
32
+ private getPerformanceAttributes;
33
+ private logSSRImageError;
34
+ private onImageError;
35
+ private onImageLoad;
36
+ private fireOperationalEvent;
37
+ private fireCommencedEvent;
38
+ private fireCopiedEvent;
39
+ private fireScreenEvent;
40
+ private fireLocalPreviewErrorEvent;
41
+ private safeSetState;
42
+ unsubscribe: () => void;
43
+ get actions(): CardAction[];
44
+ onCardViewClick: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent | undefined) => void;
45
+ onInlinePlayerError: () => void;
46
+ setRef: (cardRef: HTMLDivElement | null) => void;
47
+ renderInlinePlayer: () => JSX.Element;
48
+ onMediaViewerClose: () => void;
49
+ private onDisplayImage;
50
+ renderMediaViewer: () => React.ReactPortal | undefined;
51
+ renderCard: (withCallbacks?: boolean, cardStatusOverride?: CardStatus | undefined, izLazyOverride?: boolean | undefined) => JSX.Element;
52
+ private storeSSRData;
53
+ render(): JSX.Element;
54
+ private onCardInViewport;
55
+ onClick: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent | undefined) => void;
56
+ onMouseEnter: (event: React.MouseEvent<HTMLDivElement>) => void;
57
+ }
58
+ export declare const Card: React.ComponentType<CardBaseProps>;
@@ -0,0 +1,80 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import React, { MouseEvent } from 'react';
4
+ import { MessageDescriptor } from 'react-intl-next';
5
+ import { MediaItemType, FileDetails } from '@atlaskit/media-client';
6
+ import { WithAnalyticsEventsProps, UIAnalyticsEvent } from '@atlaskit/analytics-next';
7
+ import { SharedCardProps, CardStatus } from '../index';
8
+ import { MediaCardError } from '../errors';
9
+ import { CardPreview } from '..';
10
+ import { MediaCardCursor } from '../types';
11
+ export interface CardViewOwnProps extends SharedCardProps {
12
+ readonly status: CardStatus;
13
+ readonly mediaItemType: MediaItemType;
14
+ readonly mediaCardCursor?: MediaCardCursor;
15
+ readonly metadata?: FileDetails;
16
+ readonly error?: MediaCardError;
17
+ readonly onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
18
+ readonly onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
19
+ readonly onDisplayImage?: () => void;
20
+ readonly cardPreview?: CardPreview;
21
+ readonly progress?: number;
22
+ readonly innerRef?: (instance: HTMLDivElement | null) => void;
23
+ readonly onImageLoad: (cardPreview: CardPreview) => void;
24
+ readonly onImageError: (cardPreview: CardPreview) => void;
25
+ readonly nativeLazyLoad?: boolean;
26
+ readonly forceSyncDisplay?: boolean;
27
+ disableAnimation?: boolean;
28
+ }
29
+ export interface CardViewState {
30
+ elementWidth?: number;
31
+ didImageRender: boolean;
32
+ }
33
+ export declare type CardViewProps = CardViewOwnProps & WithAnalyticsEventsProps;
34
+ export interface RenderConfigByStatus {
35
+ renderTypeIcon?: boolean;
36
+ iconMessage?: JSX.Element;
37
+ renderImageRenderer?: boolean;
38
+ renderPlayButton?: boolean;
39
+ renderTitleBox?: boolean;
40
+ renderBlanket?: boolean;
41
+ isFixedBlanket?: boolean;
42
+ renderProgressBar?: boolean;
43
+ renderSpinner?: boolean;
44
+ renderFailedTitleBox?: boolean;
45
+ renderTickBox?: boolean;
46
+ customTitleMessage?: MessageDescriptor;
47
+ }
48
+ /**
49
+ * This is classic vanilla CardView class. To create an instance of class one would need to supply
50
+ * `createAnalyticsEvent` prop to satisfy it's Analytics Events needs.
51
+ */
52
+ export declare class CardViewBase extends React.Component<CardViewProps, CardViewState> {
53
+ state: CardViewState;
54
+ divRef: React.RefObject<HTMLDivElement>;
55
+ static defaultProps: Partial<CardViewOwnProps>;
56
+ componentDidMount(): void;
57
+ componentDidUpdate({ cardPreview: prevCardPreview }: CardViewProps): void;
58
+ private onImageLoad;
59
+ private onImageError;
60
+ private get width();
61
+ private get breakpoint();
62
+ saveElementWidth: () => void;
63
+ render(): jsx.JSX.Element;
64
+ private renderSpinner;
65
+ private shouldRenderPlayButton;
66
+ private renderPlayButton;
67
+ private renderBlanket;
68
+ private renderTitleBox;
69
+ private renderFailedTitleBox;
70
+ private renderProgressBar;
71
+ private renderImageRenderer;
72
+ private renderTickBox;
73
+ private renderMediaTypeIcon;
74
+ private renderActionsBar;
75
+ private renderFileNewExperience;
76
+ private renderFile;
77
+ private getRenderConfigByStatus;
78
+ private renderNewExperienceCard;
79
+ }
80
+ export declare const CardView: React.ForwardRefExoticComponent<Pick<Omit<CardViewProps, keyof WithAnalyticsEventsProps>, never> & Partial<Pick<Omit<CardViewProps, keyof WithAnalyticsEventsProps>, keyof CardViewOwnProps>> & Partial<Pick<Partial<CardViewOwnProps>, never>> & React.RefAttributes<any>>;
@@ -0,0 +1,4 @@
1
+ /**@jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { WrapperProps } from './types';
4
+ export declare const Wrapper: (props: WrapperProps) => jsx.JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { default as Card } from './card/cardLoader';
2
+ export { default as MediaInlineCard } from './inline/loader';
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { WithMediaClientConfigProps } from '@atlaskit/media-client';
3
+ import { MediaInlineCardProps } from './mediaInlineCard';
4
+ export declare type MediaInlineCardWithMediaClientConfigProps = WithMediaClientConfigProps<MediaInlineCardProps>;
5
+ declare type MediaInlineCardWithMediaClientConfigComponent = React.ComponentType<MediaInlineCardWithMediaClientConfigProps>;
6
+ declare type ErrorBoundaryComponent = React.ComponentType<{
7
+ data?: {
8
+ [k: string]: any;
9
+ };
10
+ }>;
11
+ export interface MediaInlineCardLoaderState {
12
+ MediaInlineCard?: MediaInlineCardWithMediaClientConfigComponent;
13
+ ErrorBoundary?: ErrorBoundaryComponent;
14
+ }
15
+ export default class MediaInlineCardLoader extends React.PureComponent<MediaInlineCardWithMediaClientConfigProps & MediaInlineCardLoaderState, MediaInlineCardLoaderState> {
16
+ static displayName: string;
17
+ static MediaInlineCard?: MediaInlineCardWithMediaClientConfigComponent;
18
+ static ErrorBoundary?: ErrorBoundaryComponent;
19
+ isMounted: boolean;
20
+ state: MediaInlineCardLoaderState;
21
+ componentDidMount(): Promise<void>;
22
+ componentWillUnmount(): Promise<void>;
23
+ render(): JSX.Element;
24
+ }
25
+ export {};
@@ -0,0 +1,14 @@
1
+ import React, { FC } from 'react';
2
+ import { FileIdentifier, MediaClient } from '@atlaskit/media-client';
3
+ import { WrappedComponentProps } from 'react-intl-next';
4
+ import { MediaViewerDataSource } from '@atlaskit/media-viewer';
5
+ export interface MediaInlineCardProps {
6
+ identifier: FileIdentifier;
7
+ mediaClient: MediaClient;
8
+ shouldOpenMediaViewer?: boolean;
9
+ isSelected?: boolean;
10
+ onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
11
+ mediaViewerDataSource?: MediaViewerDataSource;
12
+ }
13
+ export declare const MediaInlineCardInternal: FC<MediaInlineCardProps & WrappedComponentProps>;
14
+ export declare const MediaInlineCard: React.FC<MediaInlineCardProps>;
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import { Component } from 'react';
3
+ import { MediaClient, FileIdentifier, FileState, MediaFileArtifacts, MediaSubscription } from '@atlaskit/media-client';
4
+ import { CardDimensions, NumericalCardDimensions } from '..';
5
+ import { WithAnalyticsEventsProps, UIAnalyticsEvent } from '@atlaskit/analytics-next';
6
+ import type { CardPreview } from '..';
7
+ export interface InlinePlayerOwnProps {
8
+ identifier: FileIdentifier;
9
+ mediaClient: MediaClient;
10
+ dimensions?: CardDimensions;
11
+ originalDimensions?: NumericalCardDimensions;
12
+ autoplay: boolean;
13
+ selected?: boolean;
14
+ onFullscreenChange?: (fullscreen: boolean) => void;
15
+ onError?: (error: Error) => void;
16
+ readonly onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
17
+ testId?: string;
18
+ readonly cardPreview?: CardPreview;
19
+ readonly forwardRef?: React.Ref<HTMLDivElement>;
20
+ }
21
+ export declare type InlinePlayerProps = InlinePlayerOwnProps & WithAnalyticsEventsProps;
22
+ export interface InlinePlayerState {
23
+ fileSrc?: string;
24
+ isUploading?: boolean;
25
+ progress?: number;
26
+ elementWidth?: number;
27
+ }
28
+ export declare const getPreferredVideoArtifact: (fileState: FileState) => keyof MediaFileArtifacts | undefined;
29
+ export declare class InlinePlayerBase extends Component<InlinePlayerProps, InlinePlayerState> {
30
+ subscription?: MediaSubscription;
31
+ state: InlinePlayerState;
32
+ divRef: React.RefObject<HTMLDivElement>;
33
+ static defaultProps: {
34
+ dimensions: {
35
+ width: number;
36
+ height: number;
37
+ };
38
+ };
39
+ componentDidMount(): void;
40
+ setFileSrc: (fileSrc: string) => void;
41
+ setBinaryURL: () => Promise<void>;
42
+ unsubscribe: () => void;
43
+ revoke: () => void;
44
+ componentWillUnmount(): void;
45
+ onDownloadClick: () => void;
46
+ onFirstPlay: () => void;
47
+ private get breakpoint();
48
+ saveElementWidth: () => void;
49
+ render(): JSX.Element;
50
+ }
51
+ export declare const InlinePlayer: React.ForwardRefExoticComponent<Pick<InlinePlayerProps, "createAnalyticsEvent" | keyof InlinePlayerOwnProps> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const InlinePlayerLazy: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<Pick<import("./inlinePlayer").InlinePlayerProps, "createAnalyticsEvent" | keyof import("./inlinePlayer").InlinePlayerOwnProps> & import("react").RefAttributes<HTMLDivElement>>>;
@@ -0,0 +1,4 @@
1
+ /**@jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { InlinePlayerWrapperProps } from './types';
4
+ export declare const InlinePlayerWrapper: (props: InlinePlayerWrapperProps) => jsx.JSX.Element;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export declare type MediaCardAnalyticsErrorBoundaryProps = {
3
+ data?: {
4
+ [k: string]: any;
5
+ };
6
+ };
7
+ export default class MediaCardAnalyticsErrorBoundary extends React.Component<MediaCardAnalyticsErrorBoundaryProps> {
8
+ static displayName: string;
9
+ render(): JSX.Element;
10
+ }
@@ -0,0 +1,10 @@
1
+ import { InlinePlayerWrapperProps, WrapperProps } from './types';
2
+ export declare const inlinePlayerClassName = "media-card-inline-player";
3
+ export declare const wrapperStyles: {
4
+ ({ dimensions, breakpointSize, shouldUsePointerCursor, }: WrapperProps): import("@emotion/react").SerializedStyles;
5
+ displayName: string;
6
+ };
7
+ export declare const inlinePlayerWrapperStyles: {
8
+ ({ dimensions, selected, }: InlinePlayerWrapperProps): import("@emotion/react").SerializedStyles;
9
+ displayName: string;
10
+ };
@@ -0,0 +1,24 @@
1
+ import React, { MouseEvent, ReactElement, RefObject } from 'react';
2
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
+ import { CardDimensions } from '../';
4
+ import { BreakpointSizeValue } from '../utils/breakpoint';
5
+ export interface WrapperProps {
6
+ testId?: string;
7
+ shouldUsePointerCursor?: boolean;
8
+ dimensions?: CardDimensions;
9
+ breakpointSize?: BreakpointSizeValue;
10
+ onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
11
+ onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
12
+ innerRef?: RefObject<HTMLDivElement>;
13
+ children?: JSX.Element;
14
+ }
15
+ export declare type InlinePlayerWrapperProps = {
16
+ testId?: string;
17
+ dimensions?: CardDimensions;
18
+ selected: {
19
+ selected?: boolean | undefined;
20
+ };
21
+ onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
22
+ innerRef?: RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | undefined;
23
+ children?: JSX.Element[] | ReactElement<any, any> | null | any;
24
+ };
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { ActionsBarProps } from './types';
3
+ export declare class ActionsBar extends React.Component<ActionsBarProps> {
4
+ render(): JSX.Element | null;
5
+ }
@@ -0,0 +1,4 @@
1
+ /**@jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { ActionBarWrapperProps } from './types';
4
+ export declare const ActionsBarWrapper: (props: ActionBarWrapperProps) => jsx.JSX.Element;
@@ -0,0 +1,6 @@
1
+ export declare const actionsBarClassName = "media-card-actions-bar";
2
+ export declare const fixedActionBarStyles = "opacity: 1;";
3
+ export declare const wrapperStyles: {
4
+ (isFixed?: boolean | undefined): import("@emotion/react").SerializedStyles;
5
+ displayName: string;
6
+ };
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ import { CardAction } from '../../../actions';
3
+ export interface ActionsBarProps {
4
+ actions: Array<CardAction>;
5
+ isFixed?: boolean;
6
+ }
7
+ export declare type ActionBarWrapperProps = {
8
+ isFixed?: boolean;
9
+ children?: ReactNode;
10
+ };
@@ -0,0 +1,6 @@
1
+ /**@jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ export interface BlanketProps {
4
+ isFixed?: boolean;
5
+ }
6
+ export declare const Blanket: (props: BlanketProps) => jsx.JSX.Element;
@@ -0,0 +1,6 @@
1
+ export declare const blanketClassName = "media-card-blanket";
2
+ export declare const fixedBlanketStyles: string;
3
+ export declare const blanketStyles: {
4
+ (isFixed?: boolean | undefined): import("@emotion/react").SerializedStyles;
5
+ displayName: string;
6
+ };
@@ -0,0 +1,23 @@
1
+ export declare enum Breakpoint {
2
+ SMALL = "small",
3
+ LARGE = "large"
4
+ }
5
+ export declare const responsiveSettings: {
6
+ small: {
7
+ fontSize: number;
8
+ lineHeight: number;
9
+ titleBox: {
10
+ verticalPadding: number;
11
+ horizontalPadding: number;
12
+ };
13
+ };
14
+ large: {
15
+ fontSize: number;
16
+ lineHeight: number;
17
+ titleBox: {
18
+ verticalPadding: number;
19
+ horizontalPadding: number;
20
+ };
21
+ };
22
+ };
23
+ export declare const getTitleBoxHeight: (breakpoint: Breakpoint) => number;
@@ -0,0 +1,4 @@
1
+ /**@jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { IconMessageWrapperProps } from './types';
4
+ export declare const IconMessageWrapper: (props: IconMessageWrapperProps) => jsx.JSX.Element;