@atlaskit/media-card 71.0.0 → 72.0.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.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/errors.js +56 -5
- package/dist/cjs/files/cardImageView/index.js +53 -104
- package/dist/cjs/files/index.js +0 -6
- package/dist/cjs/root/card/cardAnalytics.js +3 -15
- package/dist/cjs/root/card/cardSSRView.js +4 -2
- package/dist/cjs/root/card/cardState.js +50 -0
- package/dist/cjs/root/card/getCardPreview/cache.js +5 -0
- package/dist/cjs/root/card/getCardPreview/filePreviewStatus.js +50 -0
- package/dist/cjs/root/card/getCardPreview/helpers.js +13 -21
- package/dist/cjs/root/card/getCardPreview/index.js +91 -94
- package/dist/cjs/root/card/getCardStatus.js +7 -1
- package/dist/cjs/root/card/index.js +271 -266
- package/dist/cjs/root/cardView.js +96 -60
- package/dist/cjs/root/inline/loader.js +2 -1
- package/dist/cjs/root/inline/mediaInlineCard.js +4 -3
- package/dist/cjs/root/ui/iconMessage/index.js +12 -5
- package/dist/cjs/root/ui/imageRenderer/imageRenderer.js +30 -124
- package/dist/cjs/root/ui/titleBox/failedTitleBox.js +7 -3
- package/dist/cjs/utils/analytics.js +6 -44
- package/dist/cjs/utils/dimensionComparer.js +1 -1
- package/dist/cjs/utils/metadata.js +11 -3
- package/dist/cjs/utils/objectURLCache.js +6 -0
- package/dist/cjs/utils/shouldDisplayImageThumbnail.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/errors.js +34 -2
- package/dist/es2019/files/cardImageView/index.js +8 -61
- package/dist/es2019/files/index.js +1 -1
- package/dist/es2019/root/card/cardAnalytics.js +3 -14
- package/dist/es2019/root/card/cardSSRView.js +3 -2
- package/dist/es2019/root/card/cardState.js +26 -0
- package/dist/es2019/root/card/getCardPreview/cache.js +5 -0
- package/dist/es2019/root/card/getCardPreview/filePreviewStatus.js +35 -0
- package/dist/es2019/root/card/getCardPreview/helpers.js +2 -12
- package/dist/es2019/root/card/getCardPreview/index.js +71 -74
- package/dist/es2019/root/card/getCardStatus.js +1 -0
- package/dist/es2019/root/card/index.js +193 -171
- package/dist/es2019/root/cardView.js +100 -61
- package/dist/es2019/root/inline/loader.js +2 -1
- package/dist/es2019/root/inline/mediaInlineCard.js +4 -3
- package/dist/es2019/root/ui/iconMessage/index.js +5 -3
- package/dist/es2019/root/ui/imageRenderer/imageRenderer.js +21 -88
- package/dist/es2019/root/ui/titleBox/failedTitleBox.js +5 -3
- package/dist/es2019/utils/analytics.js +5 -34
- package/dist/es2019/utils/dimensionComparer.js +1 -1
- package/dist/es2019/utils/metadata.js +12 -4
- package/dist/es2019/utils/objectURLCache.js +5 -0
- package/dist/es2019/utils/shouldDisplayImageThumbnail.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/errors.js +42 -1
- package/dist/esm/files/cardImageView/index.js +51 -102
- package/dist/esm/files/index.js +1 -1
- package/dist/esm/root/card/cardAnalytics.js +3 -15
- package/dist/esm/root/card/cardSSRView.js +3 -2
- package/dist/esm/root/card/cardState.js +32 -0
- package/dist/esm/root/card/getCardPreview/cache.js +6 -0
- package/dist/esm/root/card/getCardPreview/filePreviewStatus.js +35 -0
- package/dist/esm/root/card/getCardPreview/helpers.js +13 -21
- package/dist/esm/root/card/getCardPreview/index.js +79 -88
- package/dist/esm/root/card/getCardStatus.js +3 -0
- package/dist/esm/root/card/index.js +278 -268
- package/dist/esm/root/cardView.js +98 -61
- package/dist/esm/root/inline/loader.js +2 -1
- package/dist/esm/root/inline/mediaInlineCard.js +4 -3
- package/dist/esm/root/ui/iconMessage/index.js +7 -3
- package/dist/esm/root/ui/imageRenderer/imageRenderer.js +23 -118
- package/dist/esm/root/ui/titleBox/failedTitleBox.js +6 -3
- package/dist/esm/utils/analytics.js +5 -36
- package/dist/esm/utils/dimensionComparer.js +1 -1
- package/dist/esm/utils/metadata.js +12 -4
- package/dist/esm/utils/objectURLCache.js +6 -0
- package/dist/esm/utils/shouldDisplayImageThumbnail.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/errors.d.ts +9 -1
- package/dist/types/files/cardImageView/index.d.ts +4 -13
- package/dist/types/files/cardImageView/styled.d.ts +1 -1
- package/dist/types/files/index.d.ts +1 -1
- package/dist/types/index.d.ts +4 -3
- package/dist/types/root/card/cardAnalytics.d.ts +1 -6
- package/dist/types/root/card/cardSSRView.d.ts +1 -1
- package/dist/types/root/card/cardState.d.ts +5 -0
- package/dist/types/root/card/getCardPreview/cache.d.ts +3 -1
- package/dist/types/root/card/getCardPreview/filePreviewStatus.d.ts +5 -0
- package/dist/types/root/card/getCardPreview/helpers.d.ts +3 -4
- package/dist/types/root/card/getCardPreview/index.d.ts +17 -13
- package/dist/types/root/card/getCardStatus.d.ts +1 -0
- package/dist/types/root/card/index.d.ts +11 -10
- package/dist/types/root/cardView.d.ts +11 -8
- package/dist/types/root/inlinePlayer.d.ts +1 -1
- package/dist/types/root/ui/iconMessage/index.d.ts +2 -1
- package/dist/types/root/ui/imageRenderer/imageRenderer.d.ts +2 -13
- package/dist/types/root/ui/styledSSR.d.ts +1 -1
- package/dist/types/root/ui/titleBox/failedTitleBox.d.ts +2 -0
- package/dist/types/styles/mixins.d.ts +1 -1
- package/dist/types/types.d.ts +7 -1
- package/dist/types/utils/analytics.d.ts +6 -15
- package/dist/types/utils/cardDimensions.d.ts +4 -4
- package/dist/types/utils/dimensionComparer.d.ts +1 -1
- package/dist/types/utils/metadata.d.ts +2 -2
- package/dist/types/utils/objectURLCache.d.ts +2 -1
- package/example-helpers/index.tsx +21 -0
- package/package.json +6 -5
- package/dist/cjs/root/card/getCardPreview/types.js +0 -5
- package/dist/cjs/utils/fileAttributesContext.js +0 -40
- package/dist/es2019/root/card/getCardPreview/types.js +0 -1
- package/dist/es2019/utils/fileAttributesContext.js +0 -19
- package/dist/esm/root/card/getCardPreview/types.js +0 -1
- package/dist/esm/utils/fileAttributesContext.js +0 -18
- package/dist/types/root/card/getCardPreview/types.d.ts +0 -5
- package/dist/types/utils/fileAttributesContext.d.ts +0 -10
package/dist/esm/version.json
CHANGED
package/dist/types/errors.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { CardPreview } from '.';
|
|
2
|
+
export declare type MediaCardErrorPrimaryReason = 'upload' | 'metadata-fetch' | 'error-file-state' | RemotePreviewPrimaryReason | LocalPreviewPrimaryReason | ImageLoadPrimaryReason | 'preview-fetch';
|
|
3
|
+
export declare type ImageLoadPrimaryReason = 'cache-remote-uri' | 'cache-local-uri' | 'local-uri' | 'remote-uri' | 'external-uri' | 'unknown-uri';
|
|
2
4
|
export declare type RemotePreviewPrimaryReason = 'remote-preview-fetch' | 'remote-preview-not-ready';
|
|
3
5
|
export declare type LocalPreviewPrimaryReason = 'local-preview-get' | 'local-preview-unsupported' | 'local-preview-rejected' | 'local-preview-image' | 'local-preview-video';
|
|
4
6
|
export declare class MediaCardError extends Error {
|
|
@@ -16,8 +18,14 @@ export declare class RemotePreviewError extends MediaCardError {
|
|
|
16
18
|
readonly secondaryError?: Error | undefined;
|
|
17
19
|
constructor(primaryReason: RemotePreviewPrimaryReason, secondaryError?: Error | undefined);
|
|
18
20
|
}
|
|
21
|
+
export declare const getImageLoadPrimaryReason: (source?: "local" | "remote" | "cache-local" | "cache-remote" | "external" | undefined) => ImageLoadPrimaryReason;
|
|
22
|
+
export declare class ImageLoadError extends MediaCardError {
|
|
23
|
+
constructor(source?: CardPreview['source']);
|
|
24
|
+
}
|
|
19
25
|
export declare function isMediaCardError(err: Error): err is MediaCardError;
|
|
20
26
|
export declare const isLocalPreviewError: (err: Error) => err is LocalPreviewError;
|
|
21
27
|
export declare const isRemotePreviewError: (err: Error) => err is LocalPreviewError;
|
|
22
28
|
export declare const isUnsupportedLocalPreviewError: (err: Error) => boolean;
|
|
29
|
+
export declare function isImageLoadError(err: Error): err is ImageLoadError;
|
|
23
30
|
export declare const ensureMediaCardError: (primaryReason: MediaCardErrorPrimaryReason, error: Error) => MediaCardError;
|
|
31
|
+
export declare const isUploadError: (error: MediaCardError) => boolean;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { Component, ReactNode } from 'react';
|
|
3
2
|
import { MediaItemType, MediaType, ImageResizeMode } from '@atlaskit/media-client';
|
|
4
3
|
import { CardDimensions, CardStatus } from '../../index';
|
|
5
4
|
import { CardAction } from '../../actions';
|
|
6
|
-
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
7
|
-
import { RenderEventAction } from '../../utils/analytics';
|
|
8
|
-
import { WithFileAttributesProps } from '../../utils/fileAttributesContext';
|
|
9
5
|
export interface FileCardImageViewProps {
|
|
10
6
|
readonly mediaName?: string;
|
|
11
7
|
readonly mediaType?: MediaType;
|
|
@@ -25,15 +21,14 @@ export interface FileCardImageViewProps {
|
|
|
25
21
|
readonly actions?: CardAction[];
|
|
26
22
|
readonly onDisplayImage?: () => void;
|
|
27
23
|
readonly previewOrientation?: number;
|
|
28
|
-
readonly
|
|
24
|
+
readonly onImageError?: () => void;
|
|
25
|
+
readonly onImageLoad?: () => void;
|
|
29
26
|
}
|
|
30
27
|
export declare const fileCardImageViewSelector = "media-file-card-view";
|
|
31
28
|
export declare const fileCardImageViewSelectedSelector = "media-file-card-view-selected";
|
|
32
|
-
export declare
|
|
33
|
-
export declare class FileCardImageViewBase extends Component<FileCardImageViewBaseProps> {
|
|
29
|
+
export declare class FileCardImageView extends Component<FileCardImageViewProps> {
|
|
34
30
|
private wasThumbnailDisplayed;
|
|
35
|
-
|
|
36
|
-
static defaultProps: Partial<FileCardImageViewBaseProps>;
|
|
31
|
+
static defaultProps: Partial<FileCardImageViewProps>;
|
|
37
32
|
render(): JSX.Element;
|
|
38
33
|
private renderCardContents;
|
|
39
34
|
private renderLoadingContents;
|
|
@@ -41,10 +36,7 @@ export declare class FileCardImageViewBase extends Component<FileCardImageViewBa
|
|
|
41
36
|
private renderFailedContents;
|
|
42
37
|
private renderUploadingCardOverlay;
|
|
43
38
|
private renderPlayButton;
|
|
44
|
-
onImageLoad: () => void;
|
|
45
|
-
onImageError: () => void;
|
|
46
39
|
private renderMediaImage;
|
|
47
|
-
shouldFireEvent: (action: RenderEventAction) => boolean;
|
|
48
40
|
private renderProgressBar;
|
|
49
41
|
private renderSuccessCardContents;
|
|
50
42
|
private renderSuccessCardOverlay;
|
|
@@ -52,4 +44,3 @@ export declare class FileCardImageViewBase extends Component<FileCardImageViewBa
|
|
|
52
44
|
private get isCropped();
|
|
53
45
|
private get isStretched();
|
|
54
46
|
}
|
|
55
|
-
export declare const FileCardImageView: React.ForwardRefExoticComponent<Pick<React.PropsWithChildren<FileCardImageViewProps & WithAnalyticsEventsProps>, "progress" | "error" | "alt" | "dimensions" | "resizeMode" | "mediaType" | "mimeType" | "children" | "actions" | "mediaName" | "selectable" | "selected" | "disableOverlay" | "fileSize" | "dataURI" | "status" | "mediaItemType" | "onDisplayImage" | "previewOrientation" | "timeElapsedTillCommenced"> & React.RefAttributes<any>>;
|
|
@@ -6,7 +6,7 @@ export interface WrapperProps {
|
|
|
6
6
|
hasOnClick?: boolean;
|
|
7
7
|
mediaType?: string;
|
|
8
8
|
}
|
|
9
|
-
export declare const Wrapper: import("styled-components").StyledComponentClass<import("react").HTMLAttributes<{}> & WrapperProps, any, Pick<import("react").HTMLAttributes<{}>, "
|
|
9
|
+
export declare const Wrapper: import("styled-components").StyledComponentClass<import("react").HTMLAttributes<{}> & WrapperProps, any, Pick<import("react").HTMLAttributes<{}>, "style" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "inputMode" | "is" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css"> & {
|
|
10
10
|
theme?: any;
|
|
11
11
|
} & WrapperProps>;
|
|
12
12
|
export declare const PlayIconWrapper: import("styled-components").StyledComponentClass<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, any, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { FileCardImageView
|
|
1
|
+
export { FileCardImageView } from './cardImageView';
|
|
2
2
|
export type { FileCardImageViewProps } from './cardImageView';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,15 +4,14 @@ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
|
4
4
|
import { MediaFeatureFlags, NumericalCardDimensions } from '@atlaskit/media-common';
|
|
5
5
|
import { CardAction } from './actions';
|
|
6
6
|
import { MediaViewerDataSource } from '@atlaskit/media-viewer';
|
|
7
|
-
import { CardPreview } from './
|
|
8
|
-
import { CardStatus, CardAppearance } from './types';
|
|
7
|
+
import { CardPreview, CardStatus, CardAppearance } from './types';
|
|
9
8
|
import { MediaCardError } from './errors';
|
|
10
9
|
import { CardDimensions } from './utils';
|
|
11
10
|
export type { CardDimensions } from './utils';
|
|
12
11
|
export type { NumericalCardDimensions } from '@atlaskit/media-common';
|
|
13
12
|
export { Card, MediaInlineCard } from './root';
|
|
14
13
|
export type { CardAction, CardEventHandler } from './actions';
|
|
15
|
-
export type { CardStatus, CardAppearance, CardDimensionValue } from './types';
|
|
14
|
+
export type { CardStatus, CardAppearance, CardDimensionValue, CardPreview, } from './types';
|
|
16
15
|
export declare type TitleBoxIcon = 'LockFilledIcon';
|
|
17
16
|
export interface CardEvent {
|
|
18
17
|
event: MouseEvent<HTMLElement>;
|
|
@@ -60,6 +59,8 @@ export interface CardState {
|
|
|
60
59
|
cardPreview?: CardPreview;
|
|
61
60
|
error?: MediaCardError;
|
|
62
61
|
cardRef: HTMLDivElement | null;
|
|
62
|
+
isBannedLocalPreview: boolean;
|
|
63
|
+
previewDidRender: boolean;
|
|
63
64
|
}
|
|
64
65
|
export { CardLoading } from './utils/lightCards/cardLoading';
|
|
65
66
|
export { CardError } from './utils/lightCards/cardError';
|
|
@@ -1,14 +1,9 @@
|
|
|
1
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
|
|
8
|
-
cardPreview?: CardPreview;
|
|
9
|
-
error?: MediaCardError;
|
|
10
|
-
};
|
|
11
|
-
export declare const fireOperationalEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, status: CardStatus, fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, { cardPreview, error }?: FireOperationalEventParams) => void;
|
|
6
|
+
export declare const fireOperationalEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, status: CardStatus, fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes, error?: MediaCardError | undefined) => void;
|
|
12
7
|
export declare const fireCommencedEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes) => void;
|
|
13
8
|
export declare const fireCopiedEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, fileId: string, cardRef: HTMLDivElement) => void;
|
|
14
9
|
export declare const fireScreenEvent: (createAnalyticsEvent: CreateUIAnalyticsEvent, fileAttributes: FileAttributes) => void;
|
|
@@ -5,7 +5,7 @@ export interface CardSSRViewProps {
|
|
|
5
5
|
readonly identifier: FileIdentifier;
|
|
6
6
|
readonly dimensions?: CardDimensions;
|
|
7
7
|
readonly mediaClient: MediaClient;
|
|
8
|
-
readonly resizeMode
|
|
8
|
+
readonly resizeMode?: ImageResizeMode;
|
|
9
9
|
readonly alt?: string;
|
|
10
10
|
readonly disableOverlay: boolean;
|
|
11
11
|
readonly isLazy?: boolean;
|
|
@@ -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
2
|
import { CardDimensions } from '../../../utils/cardDimensions';
|
|
3
|
-
import { CardPreview } from '
|
|
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 {
|
|
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
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,
|
|
9
|
+
export declare const getCardPreviewFromBackend: (mediaClient: MediaClient, id: string, params: MediaStoreGetFileImageParams) => Promise<CardPreview>;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { MediaClient, FilePreview,
|
|
1
|
+
import { MediaClient, FilePreview, FileState, MediaStoreGetFileImageParams, MediaBlobUrlAttrs } from '@atlaskit/media-client';
|
|
2
2
|
import { MediaFeatureFlags } from '@atlaskit/media-common';
|
|
3
|
-
import { NumericalCardDimensions } from '../../..';
|
|
4
3
|
import { CardDimensions } from '../../../utils/cardDimensions';
|
|
5
|
-
import { CardPreview } from './types';
|
|
6
4
|
import { MediaCardError } from '../../../errors';
|
|
7
|
-
import { CardStatus,
|
|
8
|
-
export type { CardPreview } from './types';
|
|
5
|
+
import { CardStatus, CardPreview } from '../../../types';
|
|
9
6
|
export { getCardPreviewFromFilePreview, getCardPreviewFromBackend, isSupportedLocalPreview, } from './helpers';
|
|
10
|
-
export
|
|
11
|
-
export declare const shouldGetCardPreview: (cardStatus: CardStatus, { isPreviewable, hasPreview, isSupportedByBrowser }: FilePreviewStatus) => boolean;
|
|
7
|
+
export { extractFilePreviewStatus } from './filePreviewStatus';
|
|
12
8
|
export declare const getCardPreviewFromCache: (id: string, dimensions: CardDimensions) => CardPreview | undefined;
|
|
9
|
+
export declare const removeCardPreviewFromCache: (id: string, dimensions: CardDimensions) => void;
|
|
13
10
|
/**
|
|
14
11
|
* Will return the preview if available and supported by the browser
|
|
15
12
|
* See extractFilePreviewStatus "hasLocalPreview" logic
|
|
@@ -18,14 +15,12 @@ export declare const getFilePreviewFromFileState: (fileState: FileState) => File
|
|
|
18
15
|
export declare type CardPreviewParams = {
|
|
19
16
|
mediaClient: MediaClient;
|
|
20
17
|
id: string;
|
|
21
|
-
collectionName?: string;
|
|
22
18
|
dimensions?: CardDimensions;
|
|
23
|
-
requestedDimensions: NumericalCardDimensions;
|
|
24
|
-
resizeMode?: ImageResizeMode;
|
|
25
|
-
isRemotePreviewReady: boolean;
|
|
26
19
|
filePreview?: FilePreview | Promise<FilePreview>;
|
|
27
|
-
addContextToDataURI: (dataURI: string) => string;
|
|
28
20
|
onLocalPreviewError?: (error: MediaCardError) => void;
|
|
21
|
+
isRemotePreviewReady: boolean;
|
|
22
|
+
imageUrlParams: MediaStoreGetFileImageParams;
|
|
23
|
+
mediaBlobUrlAttrs?: MediaBlobUrlAttrs;
|
|
29
24
|
};
|
|
30
25
|
/**
|
|
31
26
|
* This function will try to return a Card preview, either from cache, local preview or remote preview.
|
|
@@ -37,4 +32,13 @@ export declare type CardPreviewParams = {
|
|
|
37
32
|
* In that case, we still want to report the local preview error to the caller, for feature realiability track.
|
|
38
33
|
* hence the use of the optional callback onLocalPreviewError
|
|
39
34
|
*/
|
|
40
|
-
export declare const getCardPreview: ({ mediaClient, id,
|
|
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;
|
|
@@ -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,15 +1,12 @@
|
|
|
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
|
|
4
|
+
import { FileIdentifier } from '@atlaskit/media-client';
|
|
5
5
|
import { Subscription } from 'rxjs/Subscription';
|
|
6
|
-
import { CardAction,
|
|
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?;
|
|
13
10
|
private timeElapsedTillCommenced;
|
|
14
11
|
subscription?: Subscription;
|
|
15
12
|
static defaultProps: Partial<CardProps>;
|
|
@@ -19,20 +16,24 @@ export declare class CardBase extends Component<CardWithAnalyticsEventsProps, Ca
|
|
|
19
16
|
constructor(props: CardWithAnalyticsEventsProps);
|
|
20
17
|
componentDidMount(): void;
|
|
21
18
|
componentDidUpdate(prevProps: CardProps, prevState: CardState): void;
|
|
22
|
-
shouldRefetchImage: (current?: CardDimensions | undefined, next?: CardDimensions | undefined) => boolean;
|
|
23
19
|
componentWillUnmount(): void;
|
|
24
20
|
updateStateForIdentifier(identifier: FileIdentifier): void;
|
|
25
|
-
private
|
|
26
|
-
private
|
|
27
|
-
private
|
|
28
|
-
|
|
21
|
+
private getImageURLParams;
|
|
22
|
+
private getMediaBlobUrlAttrs;
|
|
23
|
+
private getCardPreviewParams;
|
|
24
|
+
private resolvePreview;
|
|
29
25
|
subscribeInternalFile(identifier: FileIdentifier): void;
|
|
26
|
+
private get requestedDimensions();
|
|
30
27
|
private get metadata();
|
|
31
28
|
private get fileAttributes();
|
|
29
|
+
private getPerformanceAttributes;
|
|
30
|
+
private onImageError;
|
|
31
|
+
private onImageLoad;
|
|
32
32
|
private fireOperationalEvent;
|
|
33
33
|
private fireCommencedEvent;
|
|
34
34
|
private fireCopiedEvent;
|
|
35
35
|
private fireScreenEvent;
|
|
36
|
+
private fireLocalPreviewErrorEvent;
|
|
36
37
|
private safeSetState;
|
|
37
38
|
unsubscribe: () => void;
|
|
38
39
|
get actions(): CardAction[];
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
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
|
+
import { MediaCardError } from '../errors';
|
|
6
7
|
export interface CardViewOwnProps extends SharedCardProps {
|
|
7
8
|
readonly status: CardStatus;
|
|
8
9
|
readonly mediaItemType: MediaItemType;
|
|
9
10
|
readonly metadata?: FileDetails;
|
|
10
|
-
readonly error?:
|
|
11
|
+
readonly error?: MediaCardError;
|
|
11
12
|
readonly onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
12
13
|
readonly onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
13
14
|
readonly onDisplayImage?: () => void;
|
|
@@ -15,12 +16,13 @@ export interface CardViewOwnProps extends SharedCardProps {
|
|
|
15
16
|
readonly progress?: number;
|
|
16
17
|
readonly previewOrientation?: number;
|
|
17
18
|
readonly innerRef?: (instance: HTMLDivElement | null) => void;
|
|
19
|
+
readonly onImageLoad: () => void;
|
|
20
|
+
readonly onImageError: () => void;
|
|
18
21
|
disableAnimation?: boolean;
|
|
19
|
-
timeElapsedTillCommenced?: number;
|
|
20
22
|
}
|
|
21
23
|
export interface CardViewState {
|
|
22
24
|
elementWidth?: number;
|
|
23
|
-
|
|
25
|
+
didImageRender: boolean;
|
|
24
26
|
}
|
|
25
27
|
export declare type CardViewProps = CardViewOwnProps & WithAnalyticsEventsProps;
|
|
26
28
|
export interface RenderConfigByStatus {
|
|
@@ -34,8 +36,8 @@ export interface RenderConfigByStatus {
|
|
|
34
36
|
renderProgressBar?: boolean;
|
|
35
37
|
renderSpinner?: boolean;
|
|
36
38
|
renderFailedTitleBox?: boolean;
|
|
37
|
-
renderLoadingRateLimited?: boolean;
|
|
38
39
|
renderTickBox?: boolean;
|
|
40
|
+
customTitleMessage?: FormattedMessage.MessageDescriptor;
|
|
39
41
|
}
|
|
40
42
|
/**
|
|
41
43
|
* This is classic vanilla CardView class. To create an instance of class one would need to supply
|
|
@@ -47,7 +49,8 @@ export declare class CardViewBase extends React.Component<CardViewProps, CardVie
|
|
|
47
49
|
static defaultProps: Partial<CardViewOwnProps>;
|
|
48
50
|
componentDidMount(): void;
|
|
49
51
|
componentDidUpdate({ dataURI: prevDataURI }: CardViewProps): void;
|
|
50
|
-
private
|
|
52
|
+
private onImageLoad;
|
|
53
|
+
private onImageError;
|
|
51
54
|
private get width();
|
|
52
55
|
private get breakpoint();
|
|
53
56
|
saveElementWidth: () => void;
|
|
@@ -68,4 +71,4 @@ export declare class CardViewBase extends React.Component<CardViewProps, CardVie
|
|
|
68
71
|
private getRenderConfigByStatus;
|
|
69
72
|
private renderNewExperienceCard;
|
|
70
73
|
}
|
|
71
|
-
export declare const CardView: React.ForwardRefExoticComponent<Pick<Pick<CardViewProps, "progress" | "
|
|
74
|
+
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" | "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" | "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" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">> & Partial<Pick<Partial<CardViewOwnProps>, never>> & React.RefAttributes<any>>;
|
|
@@ -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<InlinePlayerProps, "
|
|
43
|
+
export declare const InlinePlayer: React.ForwardRefExoticComponent<Pick<InlinePlayerProps, "onError" | "onClick" | "createAnalyticsEvent" | "testId" | "selected" | "dimensions" | "originalDimensions" | "mediaClient" | "identifier" | "forwardRef"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -11,6 +11,7 @@ declare type CreatingPreviewProps = {
|
|
|
11
11
|
export declare const IconMessage: React.FC<InternalIconMessageProps>;
|
|
12
12
|
export declare const CreatingPreview: React.FC<CreatingPreviewProps>;
|
|
13
13
|
export declare const PreviewUnavailable: React.FC;
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const FailedToLoad: React.FC;
|
|
15
|
+
export declare const FailedToUpload: React.FC;
|
|
15
16
|
export declare const PreviewCurrentlyUnavailable: React.FC;
|
|
16
17
|
export {};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
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';
|
|
6
3
|
export declare type ImageRendererProps = {
|
|
7
4
|
readonly dataURI: string;
|
|
8
5
|
readonly mediaType: MediaType;
|
|
@@ -12,14 +9,6 @@ export declare type ImageRendererProps = {
|
|
|
12
9
|
readonly resizeMode?: ImageResizeMode;
|
|
13
10
|
readonly onDisplayImage?: () => void;
|
|
14
11
|
readonly onImageError?: () => void;
|
|
15
|
-
readonly
|
|
12
|
+
readonly onImageLoad?: () => void;
|
|
16
13
|
};
|
|
17
|
-
export declare
|
|
18
|
-
private lastAnalyticsAction?;
|
|
19
|
-
componentDidMount(): void;
|
|
20
|
-
onImageLoad: () => void;
|
|
21
|
-
onImageError: () => void;
|
|
22
|
-
shouldFireEvent: (action: RenderEventAction) => boolean;
|
|
23
|
-
render(): JSX.Element;
|
|
24
|
-
}
|
|
25
|
-
export declare const ImageRenderer: React.ForwardRefExoticComponent<Pick<React.PropsWithChildren<ImageRendererProps & WithAnalyticsEventsProps>, "alt" | "resizeMode" | "mediaType" | "children" | "dataURI" | "mediaItemType" | "onDisplayImage" | "previewOrientation" | "timeElapsedTillCommenced" | "onImageError"> & React.RefAttributes<any>>;
|
|
14
|
+
export declare const ImageRenderer: React.FC<ImageRendererProps>;
|
|
@@ -11,6 +11,6 @@ export interface BaseNewFileExperienceWrapperProps {
|
|
|
11
11
|
selected: boolean;
|
|
12
12
|
}
|
|
13
13
|
export declare const SSRFileExperienceWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & BaseNewFileExperienceWrapperProps, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & BaseNewFileExperienceWrapperProps>;
|
|
14
|
-
export declare const getWrapperDimensions: (dimensions?: CardDimensions | undefined, appearance?: "
|
|
14
|
+
export declare const getWrapperDimensions: (dimensions?: CardDimensions | undefined, appearance?: "image" | "auto" | "square" | "horizontal" | undefined) => string;
|
|
15
15
|
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>>;
|
|
16
16
|
export declare const calcBreakpointSize: (wrapperWidth?: number) => Breakpoint;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Breakpoint } from '../Breakpoint';
|
|
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>;
|
|
@@ -14,8 +14,8 @@ export interface WithAppearanceProps {
|
|
|
14
14
|
appearance?: CardAppearance;
|
|
15
15
|
}
|
|
16
16
|
export declare const withAppearance: (styleMap: {
|
|
17
|
-
auto?: string | undefined;
|
|
18
17
|
image?: string | undefined;
|
|
18
|
+
auto?: string | undefined;
|
|
19
19
|
square?: string | undefined;
|
|
20
20
|
horizontal?: string | undefined;
|
|
21
21
|
}) => ({ appearance }: WithAppearanceProps) => string;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare type CardStatus = 'uploading' | 'loading' | 'processing' | 'loading-preview' | 'complete' | 'error' | 'failed-processing'
|
|
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;
|
|
@@ -7,3 +7,9 @@ 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' | 'cache-local' | 'cache-remote' | 'external';
|
|
11
|
+
export interface CardPreview {
|
|
12
|
+
dataURI: string;
|
|
13
|
+
orientation?: number;
|
|
14
|
+
source: CardPreviewSource;
|
|
15
|
+
}
|
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
import { FileDetails, MediaClientErrorReason, RequestMetadata } from '@atlaskit/media-client';
|
|
2
|
-
import { FileAttributes, PerformanceAttributes, OperationalEventPayload, UIEventPayload, WithFileAttributes, WithPerformanceAttributes, 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
|
-
import { ScreenEventPayload, ScreenAttributes } from '@atlaskit/media-common';
|
|
6
|
-
export declare enum RenderEventAction {
|
|
7
|
-
COMMENCED = "commenced",
|
|
8
|
-
SUCCEEDED = "succeeded",
|
|
9
|
-
FAILED = "failed"
|
|
10
|
-
}
|
|
11
5
|
export declare type FileUriFailReason = 'local-uri' | 'remote-uri' | `unknown-uri`;
|
|
12
6
|
export declare type FailedErrorFailReason = MediaCardErrorPrimaryReason | 'nativeError';
|
|
13
|
-
export declare type RenderEventFailReason = FailedErrorFailReason | 'failed-processing' | FileUriFailReason | 'external-uri';
|
|
14
7
|
export declare type RenderFailedEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes & FailureAttributes & {
|
|
15
|
-
failReason:
|
|
8
|
+
failReason: FailedErrorFailReason | 'failed-processing';
|
|
16
9
|
error?: MediaClientErrorReason | 'nativeError';
|
|
17
10
|
request?: RequestMetadata;
|
|
18
|
-
},
|
|
19
|
-
export declare type RenderSucceededEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes & SuccessAttributes,
|
|
20
|
-
export declare type RenderCommencedEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes,
|
|
11
|
+
}, 'failed', 'mediaCardRender'>;
|
|
12
|
+
export declare type RenderSucceededEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes & SuccessAttributes, 'succeeded', 'mediaCardRender'>;
|
|
13
|
+
export declare type RenderCommencedEventPayload = OperationalEventPayload<WithFileAttributes & WithPerformanceAttributes, 'commenced', 'mediaCardRender'>;
|
|
21
14
|
export declare type CopiedFileEventPayload = UIEventPayload<{}, 'copied', string>;
|
|
22
15
|
export declare type ClickedEventPayload = UIEventPayload<{
|
|
23
16
|
label?: string;
|
|
@@ -29,12 +22,10 @@ export declare type RenderScreenEventPayload = Omit<ScreenEventPayload<ScreenAtt
|
|
|
29
22
|
};
|
|
30
23
|
};
|
|
31
24
|
export declare type MediaCardAnalyticsEventPayload = RenderCommencedEventPayload | RenderSucceededEventPayload | RenderFailedEventPayload | CopiedFileEventPayload | ClickedEventPayload | RenderScreenEventPayload;
|
|
32
|
-
export declare const getFileAttributes: (metadata: FileDetails, fileStatus?: "
|
|
25
|
+
export declare const getFileAttributes: (metadata: FileDetails, fileStatus?: "failed-processing" | "uploading" | "processing" | "processed" | "error" | undefined) => FileAttributes;
|
|
33
26
|
export declare const getRenderPreviewableCardPayload: (fileAttributes: FileAttributes) => RenderScreenEventPayload;
|
|
34
27
|
export declare const getRenderCommencedEventPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes) => RenderCommencedEventPayload;
|
|
35
28
|
export declare const getRenderSucceededEventPayload: (fileAttributes: FileAttributes, performanceAttributes?: PerformanceAttributes | undefined) => RenderSucceededEventPayload;
|
|
36
|
-
export declare const getFailedFileUriFailReason: (fileStatus?: "error" | "uploading" | "processing" | "failed-processing" | "processed" | undefined) => FileUriFailReason;
|
|
37
|
-
export declare const getRenderFailedFileUriPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes) => RenderFailedEventPayload;
|
|
38
29
|
export declare const getRenderFailedExternalUriPayload: (fileAttributes: FileAttributes, performanceAttributes: PerformanceAttributes) => RenderFailedEventPayload;
|
|
39
30
|
export declare const getRenderErrorFailReason: (error: MediaCardError) => FailedErrorFailReason;
|
|
40
31
|
export declare const getRenderErrorErrorReason: (error: MediaCardError) => MediaClientErrorReason | 'nativeError';
|
|
@@ -47,7 +47,7 @@ export declare const maxSquareCardDimensions: {
|
|
|
47
47
|
width: number;
|
|
48
48
|
height: number;
|
|
49
49
|
};
|
|
50
|
-
export declare const getCardMaxHeight: (appearance?: "
|
|
51
|
-
export declare const getCardMinWidth: (appearance?: "
|
|
52
|
-
export declare const getCardMaxWidth: (appearance?: "
|
|
53
|
-
export declare const getDefaultCardDimensions: (appearance?: "
|
|
50
|
+
export declare const getCardMaxHeight: (appearance?: "image" | "auto" | "square" | "horizontal" | undefined) => number;
|
|
51
|
+
export declare const getCardMinWidth: (appearance?: "image" | "auto" | "square" | "horizontal" | undefined) => number;
|
|
52
|
+
export declare const getCardMaxWidth: (appearance?: "image" | "auto" | "square" | "horizontal" | undefined) => number;
|
|
53
|
+
export declare const getDefaultCardDimensions: (appearance?: "image" | "auto" | "square" | "horizontal" | undefined) => Required<CardDimensions>;
|
|
@@ -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
|
|
3
|
+
export declare const isBigger: (current?: CardDimensions | undefined, next?: CardDimensions | undefined) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const getFileDetails: (
|
|
1
|
+
import { FileDetails, Identifier, ErrorFileState } from '@atlaskit/media-client';
|
|
2
|
+
export declare const getFileDetails: (identifier: Identifier, fileState?: import("@atlaskit/media-client").UploadingFileState | import("@atlaskit/media-client").ProcessingFileState | import("@atlaskit/media-client").ProcessedFileState | ErrorFileState | import("@atlaskit/media-client").ProcessingFailedState | undefined) => FileDetails;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CardPreview } from '../
|
|
1
|
+
import { CardPreview } from '../';
|
|
2
2
|
export declare const PREVIEW_CACHE_LRU_SIZE = 50;
|
|
3
3
|
export declare class ObjectURLCache {
|
|
4
4
|
private readonly cache;
|
|
@@ -6,5 +6,6 @@ export declare class ObjectURLCache {
|
|
|
6
6
|
has(key: string): boolean;
|
|
7
7
|
get(key: string): CardPreview | undefined;
|
|
8
8
|
set(key: string, value: CardPreview): void;
|
|
9
|
+
remove(key: string): void;
|
|
9
10
|
}
|
|
10
11
|
export declare const createObjectURLCache: () => ObjectURLCache;
|