@atlaskit/media-card 71.0.0 → 73.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.
- package/CHANGELOG.md +104 -0
- package/dist/cjs/actions.js +2 -2
- package/dist/cjs/errors.js +83 -8
- package/dist/cjs/files/cardImageView/cardOverlay/styled.js +1 -1
- package/dist/cjs/files/cardImageView/index.js +53 -104
- package/dist/cjs/files/cardImageView/styled.js +1 -1
- package/dist/cjs/files/index.js +0 -6
- package/dist/cjs/index.js +8 -8
- package/dist/cjs/root/card/cardAnalytics.js +4 -16
- package/dist/cjs/root/card/cardLoader.js +66 -124
- package/dist/cjs/root/card/cardState.js +50 -0
- package/dist/cjs/root/card/getCardPreview/cache.js +10 -5
- package/dist/cjs/root/card/getCardPreview/filePreviewStatus.js +53 -0
- package/dist/cjs/root/card/getCardPreview/helpers.js +14 -22
- package/dist/cjs/root/card/getCardPreview/index.js +177 -97
- package/dist/cjs/root/card/getCardStatus.js +7 -1
- package/dist/cjs/root/card/index.js +384 -285
- package/dist/cjs/root/cardView.js +113 -88
- package/dist/cjs/root/inline/loader.js +47 -15
- package/dist/cjs/root/inline/mediaInlineCard.js +33 -12
- package/dist/cjs/root/inlinePlayer.js +77 -24
- package/dist/cjs/root/styled.js +7 -3
- package/dist/cjs/root/ui/actionsBar/styled.js +1 -1
- package/dist/cjs/root/ui/blanket/styled.js +1 -1
- package/dist/cjs/root/ui/common.js +11 -5
- package/dist/cjs/root/ui/iconMessage/index.js +16 -7
- package/dist/cjs/root/ui/iconWrapper/styled.js +1 -1
- package/dist/cjs/root/ui/imageRenderer/imageRenderer.js +47 -123
- package/dist/cjs/root/ui/loadingRateLimited/loadingRateLimited.js +6 -4
- package/dist/cjs/root/ui/loadingRateLimited/styled.js +2 -2
- package/dist/cjs/root/ui/playButton/styled.js +1 -1
- package/dist/cjs/root/ui/progressBar/progressBar.js +7 -4
- package/dist/cjs/root/ui/progressBar/styled.js +8 -9
- package/dist/cjs/root/ui/styled.js +80 -17
- package/dist/cjs/root/ui/tickBox/styled.js +1 -1
- package/dist/cjs/root/ui/titleBox/failedTitleBox.js +9 -3
- package/dist/cjs/root/ui/titleBox/styled.js +2 -4
- package/dist/cjs/root/ui/titleBox/titleBox.js +2 -2
- package/dist/cjs/styles/index.js +25 -23
- package/dist/cjs/styles/mixins.js +1 -1
- package/dist/cjs/utils/analytics.js +7 -44
- package/dist/cjs/utils/breakpoint.js +1 -1
- package/dist/cjs/utils/cardActions/cardActionsDropdownMenu.js +18 -9
- package/dist/cjs/utils/cardActions/index.js +10 -10
- package/dist/cjs/utils/cardActions/styled.js +1 -1
- package/dist/cjs/utils/cardDimensions.js +1 -1
- package/dist/cjs/utils/dimensionComparer.js +1 -1
- package/dist/cjs/utils/getErrorMessage.js +2 -2
- package/dist/cjs/utils/index.js +46 -46
- package/dist/cjs/utils/lightCards/styled.js +1 -1
- package/dist/cjs/utils/metadata.js +11 -3
- package/dist/cjs/utils/objectURLCache.js +7 -1
- package/dist/cjs/utils/shouldDisplayImageThumbnail.js +1 -1
- package/dist/cjs/utils/viewportDetector.js +49 -22
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/errors.js +42 -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/cardLoader.js +47 -53
- 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 +38 -0
- package/dist/es2019/root/card/getCardPreview/helpers.js +2 -12
- package/dist/es2019/root/card/getCardPreview/index.js +112 -73
- package/dist/es2019/root/card/getCardStatus.js +1 -0
- package/dist/es2019/root/card/index.js +308 -190
- package/dist/es2019/root/cardView.js +97 -68
- package/dist/es2019/root/inline/loader.js +17 -5
- package/dist/es2019/root/inline/mediaInlineCard.js +32 -11
- package/dist/es2019/root/inlinePlayer.js +56 -4
- package/dist/es2019/root/styled.js +2 -1
- package/dist/es2019/root/ui/common.js +7 -1
- package/dist/es2019/root/ui/iconMessage/index.js +8 -5
- package/dist/es2019/root/ui/imageRenderer/imageRenderer.js +35 -88
- package/dist/es2019/root/ui/loadingRateLimited/loadingRateLimited.js +4 -3
- package/dist/es2019/root/ui/loadingRateLimited/styled.js +1 -1
- package/dist/es2019/root/ui/progressBar/progressBar.js +5 -3
- package/dist/es2019/root/ui/progressBar/styled.js +7 -6
- package/dist/es2019/root/ui/styled.js +65 -4
- package/dist/es2019/root/ui/titleBox/failedTitleBox.js +6 -3
- package/dist/es2019/root/ui/titleBox/styled.js +1 -2
- package/dist/es2019/root/ui/titleBox/titleBox.js +1 -1
- package/dist/es2019/utils/analytics.js +5 -34
- package/dist/es2019/utils/cardActions/cardActionsDropdownMenu.js +8 -4
- package/dist/es2019/utils/dimensionComparer.js +1 -1
- package/dist/es2019/utils/getErrorMessage.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/utils/viewportDetector.js +48 -18
- package/dist/es2019/version.json +1 -1
- package/dist/esm/actions.js +2 -2
- package/dist/esm/errors.js +64 -4
- 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/cardLoader.js +66 -126
- package/dist/esm/root/card/cardState.js +32 -0
- package/dist/esm/root/card/getCardPreview/cache.js +9 -2
- package/dist/esm/root/card/getCardPreview/filePreviewStatus.js +38 -0
- package/dist/esm/root/card/getCardPreview/helpers.js +13 -21
- package/dist/esm/root/card/getCardPreview/index.js +144 -91
- package/dist/esm/root/card/getCardStatus.js +3 -0
- package/dist/esm/root/card/index.js +396 -288
- package/dist/esm/root/cardView.js +113 -86
- package/dist/esm/root/inline/loader.js +48 -15
- package/dist/esm/root/inline/mediaInlineCard.js +32 -11
- package/dist/esm/root/inlinePlayer.js +74 -23
- package/dist/esm/root/styled.js +3 -2
- package/dist/esm/root/ui/common.js +7 -1
- package/dist/esm/root/ui/iconMessage/index.js +10 -5
- package/dist/esm/root/ui/imageRenderer/imageRenderer.js +37 -116
- package/dist/esm/root/ui/loadingRateLimited/loadingRateLimited.js +4 -3
- package/dist/esm/root/ui/loadingRateLimited/styled.js +1 -1
- package/dist/esm/root/ui/progressBar/progressBar.js +6 -3
- package/dist/esm/root/ui/progressBar/styled.js +7 -7
- package/dist/esm/root/ui/styled.js +61 -13
- package/dist/esm/root/ui/titleBox/failedTitleBox.js +7 -3
- package/dist/esm/root/ui/titleBox/styled.js +1 -2
- package/dist/esm/root/ui/titleBox/titleBox.js +1 -1
- package/dist/esm/utils/analytics.js +5 -36
- package/dist/esm/utils/cardActions/cardActionsDropdownMenu.js +17 -9
- package/dist/esm/utils/dimensionComparer.js +1 -1
- package/dist/esm/utils/getErrorMessage.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/utils/viewportDetector.js +48 -21
- package/dist/esm/version.json +1 -1
- package/dist/types/errors.d.ts +15 -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 +7 -4
- package/dist/types/root/card/cardAnalytics.d.ts +1 -6
- package/dist/types/root/card/cardLoader.d.ts +5 -19
- 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 +24 -14
- package/dist/types/root/card/getCardStatus.d.ts +1 -0
- package/dist/types/root/card/index.d.ts +20 -18
- package/dist/types/root/cardView.d.ts +13 -8
- package/dist/types/root/inline/loader.d.ts +2 -0
- package/dist/types/root/inline/mediaInlineCard.d.ts +3 -5
- package/dist/types/root/inlinePlayer.d.ts +8 -1
- package/dist/types/root/styled.d.ts +1 -0
- package/dist/types/root/ui/common.d.ts +4 -1
- package/dist/types/root/ui/iconMessage/index.d.ts +4 -3
- package/dist/types/root/ui/iconWrapper/styled.d.ts +1 -1
- package/dist/types/root/ui/imageRenderer/imageRenderer.d.ts +14 -15
- package/dist/types/root/ui/loadingRateLimited/loadingRateLimited.d.ts +2 -1
- package/dist/types/root/ui/loadingRateLimited/styled.d.ts +1 -1
- package/dist/types/root/ui/playButton/playButton.d.ts +1 -0
- package/dist/types/root/ui/progressBar/progressBar.d.ts +4 -2
- package/dist/types/root/ui/progressBar/styled.d.ts +3 -2
- package/dist/types/root/ui/styled.d.ts +10 -3
- package/dist/types/root/ui/tickBox/tickBox.d.ts +1 -0
- package/dist/types/root/ui/titleBox/failedTitleBox.d.ts +3 -1
- package/dist/types/root/ui/titleBox/styled.d.ts +1 -1
- package/dist/types/root/ui/titleBox/titleBox.d.ts +2 -10
- 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/getErrorMessage.d.ts +1 -0
- package/dist/types/utils/metadata.d.ts +2 -2
- package/dist/types/utils/objectURLCache.d.ts +2 -1
- package/dist/types/utils/viewportDetector.d.ts +13 -5
- package/example-helpers/developmentUseMessage.tsx +14 -0
- package/example-helpers/index.tsx +55 -4
- package/example-helpers/selectableCard.tsx +2 -1
- package/package.json +18 -16
- package/dist/cjs/root/card/cardSSRView.js +0 -112
- package/dist/cjs/root/card/getCardPreview/types.js +0 -5
- package/dist/cjs/root/ui/Breakpoint.js +0 -13
- package/dist/cjs/root/ui/styledSSR.js +0 -108
- package/dist/cjs/utils/fileAttributesContext.js +0 -40
- package/dist/cjs/utils/lazyContent/index.js +0 -56
- package/dist/cjs/utils/lazyContent/styled.js +0 -23
- package/dist/es2019/root/card/cardSSRView.js +0 -92
- package/dist/es2019/root/card/getCardPreview/types.js +0 -1
- package/dist/es2019/root/ui/Breakpoint.js +0 -6
- package/dist/es2019/root/ui/styledSSR.js +0 -93
- package/dist/es2019/utils/fileAttributesContext.js +0 -19
- package/dist/es2019/utils/lazyContent/index.js +0 -18
- package/dist/es2019/utils/lazyContent/styled.js +0 -12
- package/dist/esm/root/card/cardSSRView.js +0 -91
- package/dist/esm/root/card/getCardPreview/types.js +0 -1
- package/dist/esm/root/ui/Breakpoint.js +0 -6
- package/dist/esm/root/ui/styledSSR.js +0 -76
- package/dist/esm/utils/fileAttributesContext.js +0 -18
- package/dist/esm/utils/lazyContent/index.js +0 -41
- package/dist/esm/utils/lazyContent/styled.js +0 -14
- package/dist/types/root/card/cardSSRView.d.ts +0 -13
- package/dist/types/root/card/getCardPreview/types.d.ts +0 -5
- package/dist/types/root/ui/Breakpoint.d.ts +0 -4
- package/dist/types/root/ui/styledSSR.d.ts +0 -16
- package/dist/types/utils/fileAttributesContext.d.ts +0 -10
- package/dist/types/utils/lazyContent/index.d.ts +0 -11
- package/dist/types/utils/lazyContent/styled.d.ts +0 -5
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { MediaClient, FilePreview,
|
|
2
|
-
import { MediaFeatureFlags } from '@atlaskit/media-common';
|
|
3
|
-
import { NumericalCardDimensions } from '../../..';
|
|
1
|
+
import { MediaClient, FilePreview, FileState, MediaStoreGetFileImageParams, MediaBlobUrlAttrs } from '@atlaskit/media-client';
|
|
2
|
+
import { MediaFeatureFlags, SSR } from '@atlaskit/media-common';
|
|
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,19 @@ 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;
|
|
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,40 @@
|
|
|
1
|
-
/// <reference types="react-intl" />
|
|
2
1
|
import React, { Component } from 'react';
|
|
3
2
|
import { UIAnalyticsEvent, WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
4
|
-
import { FileIdentifier
|
|
3
|
+
import { FileIdentifier } from '@atlaskit/media-client';
|
|
5
4
|
import { Subscription } from 'rxjs/Subscription';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
export declare type
|
|
9
|
-
export declare class CardBase extends Component<
|
|
5
|
+
import { WrappedComponentProps } from 'react-intl-next';
|
|
6
|
+
import { CardAction, CardProps, CardState } from '../..';
|
|
7
|
+
export declare type CardBaseProps = CardProps & WithAnalyticsEventsProps & Partial<WrappedComponentProps>;
|
|
8
|
+
export declare class CardBase extends Component<CardBaseProps, CardState> {
|
|
10
9
|
private hasBeenMounted;
|
|
11
|
-
private
|
|
12
|
-
private
|
|
10
|
+
private viewportPreAnchorRef;
|
|
11
|
+
private viewportPostAnchorRef;
|
|
13
12
|
private timeElapsedTillCommenced;
|
|
14
13
|
subscription?: Subscription;
|
|
15
14
|
static defaultProps: Partial<CardProps>;
|
|
16
|
-
|
|
17
|
-
intl: ReactIntl.IntlShape;
|
|
18
|
-
};
|
|
19
|
-
constructor(props: CardWithAnalyticsEventsProps);
|
|
15
|
+
constructor(props: CardBaseProps);
|
|
20
16
|
componentDidMount(): void;
|
|
21
17
|
componentDidUpdate(prevProps: CardProps, prevState: CardState): void;
|
|
22
|
-
shouldRefetchImage: (current?: CardDimensions | undefined, next?: CardDimensions | undefined) => boolean;
|
|
23
18
|
componentWillUnmount(): void;
|
|
24
19
|
updateStateForIdentifier(identifier: FileIdentifier): void;
|
|
25
|
-
private
|
|
26
|
-
private
|
|
27
|
-
private
|
|
28
|
-
|
|
20
|
+
private getImageURLParams;
|
|
21
|
+
private getMediaBlobUrlAttrs;
|
|
22
|
+
private getCardPreviewParams;
|
|
23
|
+
private setCacheSSRPreview;
|
|
24
|
+
private resolveSSRPreview;
|
|
25
|
+
private resolvePreview;
|
|
29
26
|
subscribeInternalFile(identifier: FileIdentifier): void;
|
|
27
|
+
private get requestedDimensions();
|
|
30
28
|
private get metadata();
|
|
31
29
|
private get fileAttributes();
|
|
30
|
+
private getPerformanceAttributes;
|
|
31
|
+
private onImageError;
|
|
32
|
+
private onImageLoad;
|
|
32
33
|
private fireOperationalEvent;
|
|
33
34
|
private fireCommencedEvent;
|
|
34
35
|
private fireCopiedEvent;
|
|
35
36
|
private fireScreenEvent;
|
|
37
|
+
private fireLocalPreviewErrorEvent;
|
|
36
38
|
private safeSetState;
|
|
37
39
|
unsubscribe: () => void;
|
|
38
40
|
get actions(): CardAction[];
|
|
@@ -49,4 +51,4 @@ export declare class CardBase extends Component<CardWithAnalyticsEventsProps, Ca
|
|
|
49
51
|
onClick: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent | undefined) => void;
|
|
50
52
|
onMouseEnter: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
51
53
|
}
|
|
52
|
-
export declare const Card: React.ComponentType<
|
|
54
|
+
export declare const Card: React.ComponentType<CardBaseProps>;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { MouseEvent } from 'react';
|
|
1
|
+
import React, { MouseEvent } from 'react';
|
|
3
2
|
import { MediaItemType, FileDetails } from '@atlaskit/media-client';
|
|
4
3
|
import { WithAnalyticsEventsProps, UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
5
4
|
import { SharedCardProps, CardStatus } from '../index';
|
|
5
|
+
import { MediaCardError } from '../errors';
|
|
6
|
+
import { MessageDescriptor } from 'react-intl-next';
|
|
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,15 @@ 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;
|
|
21
|
+
readonly nativeLazyLoad?: boolean;
|
|
22
|
+
readonly forceSyncDisplay?: boolean;
|
|
18
23
|
disableAnimation?: boolean;
|
|
19
|
-
timeElapsedTillCommenced?: number;
|
|
20
24
|
}
|
|
21
25
|
export interface CardViewState {
|
|
22
26
|
elementWidth?: number;
|
|
23
|
-
|
|
27
|
+
didImageRender: boolean;
|
|
24
28
|
}
|
|
25
29
|
export declare type CardViewProps = CardViewOwnProps & WithAnalyticsEventsProps;
|
|
26
30
|
export interface RenderConfigByStatus {
|
|
@@ -34,8 +38,8 @@ export interface RenderConfigByStatus {
|
|
|
34
38
|
renderProgressBar?: boolean;
|
|
35
39
|
renderSpinner?: boolean;
|
|
36
40
|
renderFailedTitleBox?: boolean;
|
|
37
|
-
renderLoadingRateLimited?: boolean;
|
|
38
41
|
renderTickBox?: boolean;
|
|
42
|
+
customTitleMessage?: MessageDescriptor;
|
|
39
43
|
}
|
|
40
44
|
/**
|
|
41
45
|
* This is classic vanilla CardView class. To create an instance of class one would need to supply
|
|
@@ -47,7 +51,8 @@ export declare class CardViewBase extends React.Component<CardViewProps, CardVie
|
|
|
47
51
|
static defaultProps: Partial<CardViewOwnProps>;
|
|
48
52
|
componentDidMount(): void;
|
|
49
53
|
componentDidUpdate({ dataURI: prevDataURI }: CardViewProps): void;
|
|
50
|
-
private
|
|
54
|
+
private onImageLoad;
|
|
55
|
+
private onImageError;
|
|
51
56
|
private get width();
|
|
52
57
|
private get breakpoint();
|
|
53
58
|
saveElementWidth: () => void;
|
|
@@ -68,4 +73,4 @@ export declare class CardViewBase extends React.Component<CardViewProps, CardVie
|
|
|
68
73
|
private getRenderConfigByStatus;
|
|
69
74
|
private renderNewExperienceCard;
|
|
70
75
|
}
|
|
71
|
-
export declare const CardView: React.ForwardRefExoticComponent<Pick<Pick<CardViewProps, "progress" | "
|
|
76
|
+
export declare const CardView: React.ForwardRefExoticComponent<Pick<Pick<CardViewProps, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "testId" | "appearance" | "error" | "actions" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "forceSyncDisplay" | "nativeLazyLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">, never> & Partial<Pick<Pick<CardViewProps, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "testId" | "appearance" | "error" | "actions" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "forceSyncDisplay" | "nativeLazyLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">, "progress" | "metadata" | "onClick" | "onMouseEnter" | "innerRef" | "testId" | "appearance" | "error" | "actions" | "selectable" | "selected" | "alt" | "disableOverlay" | "dimensions" | "featureFlags" | "dataURI" | "status" | "mediaItemType" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "forceSyncDisplay" | "nativeLazyLoad" | "titleBoxBgColor" | "titleBoxIcon" | "disableAnimation" | "originalDimensions">> & Partial<Pick<Partial<CardViewOwnProps>, never>> & React.RefAttributes<any>>;
|
|
@@ -16,8 +16,10 @@ export default class MediaInlineCardLoader extends React.PureComponent<MediaInli
|
|
|
16
16
|
static displayName: string;
|
|
17
17
|
static MediaInlineCard?: MediaInlineCardWithMediaClientConfigComponent;
|
|
18
18
|
static ErrorBoundary?: ErrorBoundaryComponent;
|
|
19
|
+
isMounted: boolean;
|
|
19
20
|
state: MediaInlineCardLoaderState;
|
|
20
21
|
componentDidMount(): Promise<void>;
|
|
22
|
+
componentWillUnmount(): Promise<void>;
|
|
21
23
|
render(): JSX.Element;
|
|
22
24
|
}
|
|
23
25
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
2
|
import { FileIdentifier, MediaClient } from '@atlaskit/media-client';
|
|
3
|
-
import {
|
|
3
|
+
import { WrappedComponentProps } from 'react-intl-next';
|
|
4
4
|
import { MediaViewerDataSource } from '@atlaskit/media-viewer';
|
|
5
5
|
export interface MediaInlineCardProps {
|
|
6
6
|
identifier: FileIdentifier;
|
|
@@ -10,7 +10,5 @@ export interface MediaInlineCardProps {
|
|
|
10
10
|
onClick?: React.EventHandler<React.MouseEvent | React.KeyboardEvent>;
|
|
11
11
|
mediaViewerDataSource?: MediaViewerDataSource;
|
|
12
12
|
}
|
|
13
|
-
export declare const MediaInlineCardInternal: FC<MediaInlineCardProps &
|
|
14
|
-
export declare const MediaInlineCard: React.
|
|
15
|
-
WrappedComponent: ReactIntl.ComponentConstructor<MediaInlineCardProps & InjectedIntlProps>;
|
|
16
|
-
};
|
|
13
|
+
export declare const MediaInlineCardInternal: FC<MediaInlineCardProps & WrappedComponentProps>;
|
|
14
|
+
export declare const MediaInlineCard: React.FC<MediaInlineCardProps>;
|
|
@@ -10,6 +10,7 @@ export interface InlinePlayerOwnProps {
|
|
|
10
10
|
mediaClient: MediaClient;
|
|
11
11
|
dimensions?: CardDimensions;
|
|
12
12
|
originalDimensions?: NumericalCardDimensions;
|
|
13
|
+
autoplay: boolean;
|
|
13
14
|
selected?: boolean;
|
|
14
15
|
onError?: (error: Error) => void;
|
|
15
16
|
readonly onClick?: (event: React.MouseEvent<HTMLDivElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
@@ -19,11 +20,15 @@ export interface InlinePlayerOwnProps {
|
|
|
19
20
|
export declare type InlinePlayerProps = InlinePlayerOwnProps & WithAnalyticsEventsProps;
|
|
20
21
|
export interface InlinePlayerState {
|
|
21
22
|
fileSrc?: string;
|
|
23
|
+
isUploading?: boolean;
|
|
24
|
+
progress?: number;
|
|
25
|
+
elementWidth?: number;
|
|
22
26
|
}
|
|
23
27
|
export declare const getPreferredVideoArtifact: (fileState: FileState) => keyof MediaFileArtifacts | undefined;
|
|
24
28
|
export declare class InlinePlayerBase extends Component<InlinePlayerProps, InlinePlayerState> {
|
|
25
29
|
subscription?: Subscription;
|
|
26
30
|
state: InlinePlayerState;
|
|
31
|
+
divRef: React.RefObject<HTMLDivElement>;
|
|
27
32
|
static defaultProps: {
|
|
28
33
|
dimensions: {
|
|
29
34
|
width: number;
|
|
@@ -38,6 +43,8 @@ export declare class InlinePlayerBase extends Component<InlinePlayerProps, Inlin
|
|
|
38
43
|
componentWillUnmount(): void;
|
|
39
44
|
onDownloadClick: () => void;
|
|
40
45
|
onFirstPlay: () => void;
|
|
46
|
+
private get breakpoint();
|
|
47
|
+
saveElementWidth: () => void;
|
|
41
48
|
render(): JSX.Element;
|
|
42
49
|
}
|
|
43
|
-
export declare const InlinePlayer: React.ForwardRefExoticComponent<Pick<InlinePlayerProps, "
|
|
50
|
+
export declare const InlinePlayer: React.ForwardRefExoticComponent<Pick<InlinePlayerProps, "onError" | "onClick" | "testId" | "createAnalyticsEvent" | "selected" | "dimensions" | "originalDimensions" | "mediaClient" | "identifier" | "autoplay" | "forwardRef"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -12,4 +12,5 @@ declare type InlinePlayerWrapper = {
|
|
|
12
12
|
selected?: boolean;
|
|
13
13
|
};
|
|
14
14
|
export declare const InlinePlayerWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & InlinePlayerWrapper, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & InlinePlayerWrapper>;
|
|
15
|
+
export declare const FormattedMessageWrapper: import("styled-components").StyledComponentClass<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, any, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>>;
|
|
15
16
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { MessageDescriptor } from 'react-intl-next';
|
|
3
3
|
export declare type InternalIconMessageProps = {
|
|
4
|
-
messageDescriptor:
|
|
4
|
+
messageDescriptor: MessageDescriptor;
|
|
5
5
|
animated?: boolean;
|
|
6
6
|
reducedFont?: boolean;
|
|
7
7
|
};
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Breakpoint } from '../
|
|
2
|
+
import { Breakpoint } from '../common';
|
|
3
3
|
export declare function titleBoxHeight(hasTitleBox: boolean, breakpoint: Breakpoint): string;
|
|
4
4
|
export declare type IconWrapperProps = {
|
|
5
5
|
hasTitleBox: boolean;
|
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { MediaType, ImageResizeMode
|
|
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;
|
|
15
|
-
readonly
|
|
11
|
+
readonly onImageLoad?: () => void;
|
|
12
|
+
readonly nativeLazyLoad?: boolean;
|
|
13
|
+
readonly forceSyncDisplay?: boolean;
|
|
14
|
+
readonly isImageVisible?: boolean;
|
|
15
|
+
readonly className?: string;
|
|
16
16
|
};
|
|
17
|
-
export declare
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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>>;
|
|
17
|
+
export declare const ImageRendererBase: React.FC<ImageRendererProps>;
|
|
18
|
+
export declare const ImageRenderer: import("styled-components").StyledComponentClass<ImageRendererProps & {
|
|
19
|
+
isImageVisible?: boolean | undefined;
|
|
20
|
+
}, any, Pick<ImageRendererProps, "className" | "mediaType" | "alt" | "dataURI" | "resizeMode" | "onDisplayImage" | "previewOrientation" | "onImageError" | "onImageLoad" | "forceSyncDisplay" | "nativeLazyLoad" | "isImageVisible"> & {
|
|
21
|
+
theme?: any;
|
|
22
|
+
} & {
|
|
23
|
+
isImageVisible?: boolean | undefined;
|
|
24
|
+
}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Breakpoint } from '../common';
|
|
2
3
|
export declare const LoadingRateLimited: ({ breakpoint, positionBottom, }: {
|
|
3
4
|
breakpoint?: Breakpoint | undefined;
|
|
4
5
|
positionBottom?: boolean | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTMLAttributes, ComponentClass } from 'react';
|
|
2
|
-
import { Breakpoint } from '../
|
|
2
|
+
import { Breakpoint } from '../common';
|
|
3
3
|
export declare const LoadingRateLimitedContainer: import("styled-components").StyledComponentClass<import("react").DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, any, import("react").DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
4
4
|
export declare const WarningIconWrapper: ComponentClass<HTMLAttributes<{}>>;
|
|
5
5
|
export declare type StyledTextProps = {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Breakpoint } from '../common';
|
|
2
3
|
export declare type ProgressBarProps = {
|
|
3
4
|
progress?: number;
|
|
4
5
|
breakpoint?: Breakpoint;
|
|
5
6
|
positionBottom?: boolean;
|
|
7
|
+
showOnTop?: boolean;
|
|
6
8
|
};
|
|
7
|
-
export declare const ProgressBar: ({ progress, breakpoint, positionBottom, }: ProgressBarProps) => JSX.Element;
|
|
9
|
+
export declare const ProgressBar: ({ progress, breakpoint, positionBottom, showOnTop, }: ProgressBarProps) => JSX.Element;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Breakpoint } from '../
|
|
3
|
-
export declare function generateResponsiveStyles(breakpoint: Breakpoint, positionBottom: boolean, multiplier?: number): string;
|
|
2
|
+
import { Breakpoint } from '../common';
|
|
3
|
+
export declare function generateResponsiveStyles(breakpoint: Breakpoint, positionBottom: boolean, showOnTop: boolean, multiplier?: number): string;
|
|
4
4
|
export declare type StyledBarProps = {
|
|
5
5
|
progress: number;
|
|
6
6
|
breakpoint: Breakpoint;
|
|
7
7
|
positionBottom: boolean;
|
|
8
|
+
showOnTop: boolean;
|
|
8
9
|
};
|
|
9
10
|
export declare const StyledBar: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyledBarProps, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & StyledBarProps>;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { CardDimensions, CardAppearance } from '../..';
|
|
3
|
+
import { Breakpoint } from './common';
|
|
4
|
+
export declare const calcBreakpointSize: (wrapperWidth?: number) => Breakpoint;
|
|
5
|
+
export interface NewFileExperienceWrapperProps {
|
|
6
|
+
breakpoint: Breakpoint;
|
|
7
|
+
dimensions?: CardDimensions;
|
|
8
|
+
appearance?: CardAppearance;
|
|
9
|
+
mediaType?: string;
|
|
4
10
|
shouldUsePointerCursor: boolean;
|
|
5
11
|
disableOverlay: boolean;
|
|
6
12
|
displayBackground: boolean;
|
|
@@ -9,4 +15,5 @@ export interface NewFileExperienceWrapperProps extends BaseNewFileExperienceWrap
|
|
|
9
15
|
isTickBoxSelectable: boolean;
|
|
10
16
|
shouldDisplayTooltip: boolean;
|
|
11
17
|
}
|
|
12
|
-
export declare const NewFileExperienceWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> &
|
|
18
|
+
export declare const NewFileExperienceWrapper: import("styled-components").StyledComponentClass<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & NewFileExperienceWrapperProps, any, import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & NewFileExperienceWrapperProps>;
|
|
19
|
+
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>>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Breakpoint } from '../
|
|
2
|
+
import { Breakpoint } from '../common';
|
|
3
|
+
import { MessageDescriptor } from 'react-intl-next';
|
|
3
4
|
export declare type OnRetryFunction = () => void;
|
|
4
5
|
export declare type FailedTitleBoxProps = {
|
|
5
6
|
breakpoint: Breakpoint;
|
|
7
|
+
customMessage?: MessageDescriptor;
|
|
6
8
|
};
|
|
7
9
|
export declare const FailedTitleBox: React.FC<FailedTitleBoxProps>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="react-intl" />
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { TitleBoxIcon as TitleBoxIconType } from '../../../index';
|
|
4
|
-
import { Breakpoint } from '../
|
|
3
|
+
import { Breakpoint } from '../common';
|
|
5
4
|
export declare type TitleBoxProps = {
|
|
6
5
|
name: string;
|
|
7
6
|
breakpoint: Breakpoint;
|
|
@@ -12,13 +11,6 @@ export declare type TitleBoxProps = {
|
|
|
12
11
|
declare type FormattedDateProps = {
|
|
13
12
|
timestamp: number;
|
|
14
13
|
};
|
|
15
|
-
declare
|
|
16
|
-
intl?: {
|
|
17
|
-
locale?: string;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export declare const FormattedDate: React.ComponentClass<FormattedDateProps & WithIntlProps, any> & {
|
|
21
|
-
WrappedComponent: ReactIntl.ComponentConstructor<FormattedDateProps & WithIntlProps & ReactIntl.InjectedIntlProps>;
|
|
22
|
-
};
|
|
14
|
+
export declare const FormattedDate: React.ComponentType<FormattedDateProps>;
|
|
23
15
|
export declare const TitleBox: ({ name, createdAt, breakpoint, titleBoxBgColor, titleBoxIcon, }: TitleBoxProps) => JSX.Element;
|
|
24
16
|
export {};
|
|
@@ -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' | '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,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;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import React
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* As IntersectionObserver::rootMargin doesn't work within IFrames, we use an empty div + dynamic offsetTop to eagerly detect cards entering viewport.
|
|
4
|
+
* Using this approach, we can lazy load cards ABS_VIEWPORT_ANCHOR_OFFSET_TOP px before they enter viewport.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ABS_VIEWPORT_ANCHOR_OFFSET_TOP = 900;
|
|
7
|
+
export declare const ViewportAnchor: React.ForwardRefExoticComponent<{
|
|
8
|
+
offsetTop: number;
|
|
9
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export declare type ViewportDetectorProps = {
|
|
11
|
+
cardEl: HTMLElement | null;
|
|
12
|
+
preAnchorRef: React.RefObject<HTMLDivElement>;
|
|
13
|
+
postAnchorRef: React.RefObject<HTMLDivElement>;
|
|
4
14
|
onVisible: () => void;
|
|
5
15
|
};
|
|
6
|
-
export declare const createViewportDetector: (isIntersectionObserverSupported: boolean) => React.FC<ViewportDetectorProps>;
|
|
7
16
|
export declare const ViewportDetector: React.FC<ViewportDetectorProps>;
|
|
8
|
-
export {};
|