@atlaskit/media-card 77.12.3 → 78.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 +15 -0
- package/dist/cjs/card/card.js +20 -1039
- package/dist/cjs/card/cardLoader.js +2 -2
- package/dist/cjs/card/cardView.js +255 -417
- package/dist/cjs/card/cardWithMediaClient.js +5 -9
- package/dist/cjs/card/{v2/cardviews → cardviews}/cardViewWrapper.js +8 -8
- package/dist/cjs/card/{v2/cardviews → cardviews}/errorCardView.js +6 -6
- package/dist/cjs/card/{v2/cardviews → cardviews}/iconCardView.js +5 -5
- package/dist/cjs/card/{v2/cardviews → cardviews}/imageCardView.js +5 -5
- package/dist/cjs/card/{v2/cardviews → cardviews}/index.js +2 -2
- package/dist/cjs/card/{v2/cardviews → cardviews}/loadingCardView.js +3 -3
- package/dist/cjs/card/{v2/cardviews → cardviews}/processingCardView.js +4 -4
- package/dist/cjs/card/{v2/cardviews → cardviews}/videoCardView.js +7 -7
- package/dist/cjs/card/{v2/externalImageCard.js → externalImageCard.js} +11 -11
- package/dist/cjs/card/{v2/fileCard.js → fileCard.js} +18 -18
- package/dist/cjs/card/index.js +2 -2
- package/dist/cjs/card/inlinePlayer.js +184 -267
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/{v2/svgView → svgView}/svgView.js +9 -9
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/card.js +20 -1023
- package/dist/es2019/card/cardLoader.js +2 -2
- package/dist/es2019/card/cardView.js +252 -403
- package/dist/es2019/card/cardWithMediaClient.js +6 -10
- package/dist/es2019/card/{v2/cardviews → cardviews}/cardViewWrapper.js +8 -8
- package/dist/es2019/card/{v2/cardviews → cardviews}/errorCardView.js +6 -6
- package/dist/es2019/card/{v2/cardviews → cardviews}/iconCardView.js +5 -5
- package/dist/es2019/card/{v2/cardviews → cardviews}/imageCardView.js +5 -5
- package/dist/es2019/card/{v2/cardviews → cardviews}/index.js +2 -2
- package/dist/es2019/card/{v2/cardviews → cardviews}/loadingCardView.js +3 -3
- package/dist/es2019/card/{v2/cardviews → cardviews}/processingCardView.js +4 -4
- package/dist/es2019/card/{v2/cardviews → cardviews}/videoCardView.js +7 -7
- package/dist/es2019/card/{v2/externalImageCard.js → externalImageCard.js} +11 -11
- package/dist/es2019/card/{v2/fileCard.js → fileCard.js} +18 -18
- package/dist/es2019/card/index.js +1 -1
- package/dist/es2019/card/inlinePlayer.js +127 -208
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/{v2/svgView → svgView}/svgView.js +9 -9
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/card.js +21 -1040
- package/dist/esm/card/cardLoader.js +2 -2
- package/dist/esm/card/cardView.js +251 -416
- package/dist/esm/card/cardWithMediaClient.js +6 -10
- package/dist/esm/card/{v2/cardviews → cardviews}/cardViewWrapper.js +8 -8
- package/dist/esm/card/{v2/cardviews → cardviews}/errorCardView.js +6 -6
- package/dist/esm/card/{v2/cardviews → cardviews}/iconCardView.js +5 -5
- package/dist/esm/card/{v2/cardviews → cardviews}/imageCardView.js +5 -5
- package/dist/esm/card/{v2/cardviews → cardviews}/index.js +2 -2
- package/dist/esm/card/{v2/cardviews → cardviews}/loadingCardView.js +3 -3
- package/dist/esm/card/{v2/cardviews → cardviews}/processingCardView.js +4 -4
- package/dist/esm/card/{v2/cardviews → cardviews}/videoCardView.js +7 -7
- package/dist/esm/card/{v2/externalImageCard.js → externalImageCard.js} +11 -11
- package/dist/esm/card/{v2/fileCard.js → fileCard.js} +18 -18
- package/dist/esm/card/index.js +1 -1
- package/dist/esm/card/inlinePlayer.js +185 -269
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/{v2/svgView → svgView}/svgView.js +9 -9
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/card.d.ts +5 -66
- package/dist/types/card/cardLoader.d.ts +1 -1
- package/dist/types/card/cardView.d.ts +23 -45
- package/dist/types/card/cardWithMediaClient.d.ts +1 -1
- package/dist/types/card/{v2/cardviews → cardviews}/cardViewWrapper.d.ts +3 -3
- package/dist/types/card/{v2/cardviews → cardviews}/errorCardView.d.ts +1 -1
- package/dist/{types-ts4.5/card/v2 → types/card}/cardviews/iconCardView.d.ts +1 -1
- package/dist/{types-ts4.5/card/v2 → types/card}/cardviews/imageCardView.d.ts +1 -1
- package/dist/{types-ts4.5/card/v2 → types/card}/cardviews/index.d.ts +5 -5
- package/dist/types/card/{v2/cardviews → cardviews}/videoCardView.d.ts +1 -1
- package/dist/types/card/{v2/externalImageCard.d.ts → externalImageCard.d.ts} +1 -1
- package/dist/types/card/{v2/fileCard.d.ts → fileCard.d.ts} +2 -2
- package/dist/types/card/index.d.ts +1 -1
- package/dist/types/card/inlinePlayer.d.ts +2 -31
- package/dist/types/card/{v2/svgView → svgView}/errors.d.ts +1 -1
- package/dist/{types-ts4.5/card/v2 → types/card}/svgView/svgView.d.ts +2 -2
- package/dist/types-ts4.5/card/card.d.ts +5 -66
- package/dist/types-ts4.5/card/cardLoader.d.ts +1 -1
- package/dist/types-ts4.5/card/cardView.d.ts +23 -45
- package/dist/types-ts4.5/card/cardWithMediaClient.d.ts +1 -1
- package/dist/types-ts4.5/card/{v2/cardviews → cardviews}/cardViewWrapper.d.ts +3 -3
- package/dist/types-ts4.5/card/{v2/cardviews → cardviews}/errorCardView.d.ts +1 -1
- package/dist/{types/card/v2 → types-ts4.5/card}/cardviews/iconCardView.d.ts +1 -1
- package/dist/{types/card/v2 → types-ts4.5/card}/cardviews/imageCardView.d.ts +1 -1
- package/dist/{types/card/v2 → types-ts4.5/card}/cardviews/index.d.ts +5 -5
- package/dist/types-ts4.5/card/{v2/cardviews → cardviews}/videoCardView.d.ts +1 -1
- package/dist/types-ts4.5/card/{v2/externalImageCard.d.ts → externalImageCard.d.ts} +1 -1
- package/dist/types-ts4.5/card/{v2/fileCard.d.ts → fileCard.d.ts} +2 -2
- package/dist/types-ts4.5/card/index.d.ts +1 -1
- package/dist/types-ts4.5/card/inlinePlayer.d.ts +2 -31
- package/dist/types-ts4.5/card/{v2/svgView → svgView}/errors.d.ts +1 -1
- package/dist/{types/card/v2 → types-ts4.5/card}/svgView/svgView.d.ts +2 -2
- package/package.json +3 -6
- package/dist/cjs/card/cardSwitcher.js +0 -15
- package/dist/cjs/card/v2/cardV2.js +0 -41
- package/dist/cjs/card/v2/cardV2Loader.js +0 -36
- package/dist/cjs/card/v2/cardViewV2.js +0 -298
- package/dist/cjs/card/v2/cardWithMediaClientV2.js +0 -34
- package/dist/cjs/card/v2/inlinePlayerLazyV2.js +0 -35
- package/dist/cjs/card/v2/inlinePlayerV2.js +0 -224
- package/dist/es2019/card/cardSwitcher.js +0 -8
- package/dist/es2019/card/v2/cardV2.js +0 -33
- package/dist/es2019/card/v2/cardV2Loader.js +0 -18
- package/dist/es2019/card/v2/cardViewV2.js +0 -294
- package/dist/es2019/card/v2/cardWithMediaClientV2.js +0 -25
- package/dist/es2019/card/v2/inlinePlayerLazyV2.js +0 -10
- package/dist/es2019/card/v2/inlinePlayerV2.js +0 -166
- package/dist/esm/card/cardSwitcher.js +0 -8
- package/dist/esm/card/v2/cardV2.js +0 -34
- package/dist/esm/card/v2/cardV2Loader.js +0 -24
- package/dist/esm/card/v2/cardViewV2.js +0 -290
- package/dist/esm/card/v2/cardWithMediaClientV2.js +0 -27
- package/dist/esm/card/v2/inlinePlayerLazyV2.js +0 -23
- package/dist/esm/card/v2/inlinePlayerV2.js +0 -214
- package/dist/types/card/cardSwitcher.d.ts +0 -4
- package/dist/types/card/v2/cardV2.d.ts +0 -7
- package/dist/types/card/v2/cardV2Loader.d.ts +0 -4
- package/dist/types/card/v2/cardViewV2.d.ts +0 -59
- package/dist/types/card/v2/cardWithMediaClientV2.d.ts +0 -3
- package/dist/types/card/v2/inlinePlayerLazyV2.d.ts +0 -2
- package/dist/types/card/v2/inlinePlayerV2.d.ts +0 -24
- package/dist/types-ts4.5/card/cardSwitcher.d.ts +0 -4
- package/dist/types-ts4.5/card/v2/cardV2.d.ts +0 -7
- package/dist/types-ts4.5/card/v2/cardV2Loader.d.ts +0 -4
- package/dist/types-ts4.5/card/v2/cardViewV2.d.ts +0 -59
- package/dist/types-ts4.5/card/v2/cardWithMediaClientV2.d.ts +0 -3
- package/dist/types-ts4.5/card/v2/inlinePlayerLazyV2.d.ts +0 -2
- package/dist/types-ts4.5/card/v2/inlinePlayerV2.d.ts +0 -24
- /package/dist/cjs/card/{v2/performance.js → performance.js} +0 -0
- /package/dist/cjs/card/{v2/svgView → svgView}/errors.js +0 -0
- /package/dist/cjs/card/{v2/svgView → svgView}/helpers.js +0 -0
- /package/dist/cjs/card/{v2/svgView → svgView}/index.js +0 -0
- /package/dist/es2019/card/{v2/performance.js → performance.js} +0 -0
- /package/dist/es2019/card/{v2/svgView → svgView}/errors.js +0 -0
- /package/dist/es2019/card/{v2/svgView → svgView}/helpers.js +0 -0
- /package/dist/es2019/card/{v2/svgView → svgView}/index.js +0 -0
- /package/dist/esm/card/{v2/performance.js → performance.js} +0 -0
- /package/dist/esm/card/{v2/svgView → svgView}/errors.js +0 -0
- /package/dist/esm/card/{v2/svgView → svgView}/helpers.js +0 -0
- /package/dist/esm/card/{v2/svgView → svgView}/index.js +0 -0
- /package/dist/types/card/{v2/cardviews → cardviews}/loadingCardView.d.ts +0 -0
- /package/dist/types/card/{v2/cardviews → cardviews}/processingCardView.d.ts +0 -0
- /package/dist/types/card/{v2/performance.d.ts → performance.d.ts} +0 -0
- /package/dist/types/card/{v2/svgView → svgView}/helpers.d.ts +0 -0
- /package/dist/types/card/{v2/svgView → svgView}/index.d.ts +0 -0
- /package/dist/types-ts4.5/card/{v2/cardviews → cardviews}/loadingCardView.d.ts +0 -0
- /package/dist/types-ts4.5/card/{v2/cardviews → cardviews}/processingCardView.d.ts +0 -0
- /package/dist/types-ts4.5/card/{v2/performance.d.ts → performance.d.ts} +0 -0
- /package/dist/types-ts4.5/card/{v2/svgView → svgView}/helpers.d.ts +0 -0
- /package/dist/types-ts4.5/card/{v2/svgView → svgView}/index.d.ts +0 -0
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { withMediaClient } from '@atlaskit/media-client-react';
|
|
3
|
-
import { Card as MediaCard } from './card';
|
|
4
3
|
import MediaCardAnalyticsErrorBoundary from './media-card-analytics-error-boundary';
|
|
4
|
+
import { Card as InternalCard } from './card';
|
|
5
5
|
export const CardWithMediaClient = props => {
|
|
6
6
|
const {
|
|
7
7
|
dimensions,
|
|
8
8
|
onClick
|
|
9
9
|
} = props;
|
|
10
10
|
const Card = React.useMemo(() => {
|
|
11
|
-
return withMediaClient(
|
|
11
|
+
return withMediaClient(InternalCard);
|
|
12
12
|
}, []);
|
|
13
|
-
return (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
dimensions: dimensions,
|
|
18
|
-
onClick: onClick
|
|
19
|
-
}, /*#__PURE__*/React.createElement(Card, props))
|
|
20
|
-
);
|
|
13
|
+
return /*#__PURE__*/React.createElement(MediaCardAnalyticsErrorBoundary, {
|
|
14
|
+
dimensions: dimensions,
|
|
15
|
+
onClick: onClick
|
|
16
|
+
}, /*#__PURE__*/React.createElement(Card, props));
|
|
21
17
|
};
|
|
@@ -4,14 +4,14 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
import { jsx } from '@emotion/react';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
7
|
-
import { ImageContainer, Wrapper } from '
|
|
8
|
-
import { attachDetailsToActions } from '
|
|
9
|
-
import { TitleBox } from '
|
|
10
|
-
import { TickBox } from '
|
|
11
|
-
import { Blanket } from '
|
|
12
|
-
import { ActionsBar } from '
|
|
13
|
-
import { fileCardImageViewSelector } from '
|
|
14
|
-
import OpenMediaViewerButton from '
|
|
7
|
+
import { ImageContainer, Wrapper } from '../ui/wrapper';
|
|
8
|
+
import { attachDetailsToActions } from '../actions';
|
|
9
|
+
import { TitleBox } from '../ui/titleBox/titleBox';
|
|
10
|
+
import { TickBox } from '../ui/tickBox/tickBox';
|
|
11
|
+
import { Blanket } from '../ui/blanket/blanket';
|
|
12
|
+
import { ActionsBar } from '../ui/actionsBar/actionsBar';
|
|
13
|
+
import { fileCardImageViewSelector } from '../classnames';
|
|
14
|
+
import OpenMediaViewerButton from '../ui/openMediaViewerButton/openMediaViewerButton';
|
|
15
15
|
export const CardViewWrapper = /*#__PURE__*/React.forwardRef(({
|
|
16
16
|
cardPreview,
|
|
17
17
|
testId,
|
|
@@ -4,14 +4,14 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
import { jsx } from '@emotion/react';
|
|
5
5
|
import { useRef } from 'react';
|
|
6
6
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
7
|
-
import { createAndFireMediaCardEvent } from '
|
|
8
|
-
import { useBreakpoint } from '
|
|
7
|
+
import { createAndFireMediaCardEvent } from '../../utils/analytics';
|
|
8
|
+
import { useBreakpoint } from '../useBreakpoint';
|
|
9
9
|
import { CardViewWrapper } from './cardViewWrapper';
|
|
10
10
|
import { MimeTypeIcon } from '@atlaskit/media-ui/mime-type-icon';
|
|
11
|
-
import { IconWrapper } from '
|
|
12
|
-
import { FailedTitleBox } from '
|
|
13
|
-
import { PreviewUnavailable, FailedToUpload, PreviewCurrentlyUnavailable, FailedToLoad } from '
|
|
14
|
-
import { isUploadError, isRateLimitedError, isPollingError } from '
|
|
11
|
+
import { IconWrapper } from '../ui/iconWrapper/iconWrapper';
|
|
12
|
+
import { FailedTitleBox } from '../ui/titleBox/failedTitleBox';
|
|
13
|
+
import { PreviewUnavailable, FailedToUpload, PreviewCurrentlyUnavailable, FailedToLoad } from '../ui/iconMessage';
|
|
14
|
+
import { isUploadError, isRateLimitedError, isPollingError } from '../../errors';
|
|
15
15
|
import { messages } from '@atlaskit/media-ui';
|
|
16
16
|
const IconMessage = ({
|
|
17
17
|
error,
|
|
@@ -5,12 +5,12 @@ import { jsx } from '@emotion/react';
|
|
|
5
5
|
import { useEffect, useRef } from 'react';
|
|
6
6
|
import { MimeTypeIcon } from '@atlaskit/media-ui/mime-type-icon';
|
|
7
7
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
8
|
-
import { createAndFireMediaCardEvent } from '
|
|
9
|
-
import { IconWrapper } from '
|
|
10
|
-
import { useBreakpoint } from '
|
|
8
|
+
import { createAndFireMediaCardEvent } from '../../utils/analytics';
|
|
9
|
+
import { IconWrapper } from '../ui/iconWrapper/iconWrapper';
|
|
10
|
+
import { useBreakpoint } from '../useBreakpoint';
|
|
11
11
|
import { CardViewWrapper } from './cardViewWrapper';
|
|
12
|
-
import { ProgressBar } from '
|
|
13
|
-
import { Blanket } from '
|
|
12
|
+
import { ProgressBar } from '../ui/progressBar/progressBar';
|
|
13
|
+
import { Blanket } from '../ui/blanket/blanket';
|
|
14
14
|
// NOTE: should we call this Icon or UploadingCardView since we now have ProgressBar?
|
|
15
15
|
|
|
16
16
|
const IconCardViewBase = props => {
|
|
@@ -4,12 +4,12 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
import { jsx } from '@emotion/react';
|
|
5
5
|
import { useEffect, useRef } from 'react';
|
|
6
6
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
7
|
-
import { createAndFireMediaCardEvent } from '
|
|
8
|
-
import { ImageRenderer } from '
|
|
9
|
-
import { useBreakpoint } from '
|
|
7
|
+
import { createAndFireMediaCardEvent } from '../../utils/analytics';
|
|
8
|
+
import { ImageRenderer } from '../ui/imageRenderer/imageRenderer';
|
|
9
|
+
import { useBreakpoint } from '../useBreakpoint';
|
|
10
10
|
import { CardViewWrapper } from './cardViewWrapper';
|
|
11
|
-
import { ProgressBar } from '
|
|
12
|
-
import { Blanket } from '
|
|
11
|
+
import { ProgressBar } from '../ui/progressBar/progressBar';
|
|
12
|
+
import { Blanket } from '../ui/blanket/blanket';
|
|
13
13
|
const ImageCardViewBase = props => {
|
|
14
14
|
const {
|
|
15
15
|
status,
|
|
@@ -4,8 +4,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
import { jsx } from '@emotion/react';
|
|
5
5
|
import React, { useEffect, useState, useRef } from 'react';
|
|
6
6
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
7
|
-
import { createAndFireMediaCardEvent } from '
|
|
8
|
-
import { useBreakpoint } from '
|
|
7
|
+
import { createAndFireMediaCardEvent } from '../../utils/analytics';
|
|
8
|
+
import { useBreakpoint } from '../useBreakpoint';
|
|
9
9
|
import { ProcessingCardView } from './processingCardView';
|
|
10
10
|
import { ErrorCardView } from './errorCardView';
|
|
11
11
|
import { VideoCardView } from './videoCardView';
|
|
@@ -5,9 +5,9 @@ import { jsx } from '@emotion/react';
|
|
|
5
5
|
import { useEffect, useRef } from 'react';
|
|
6
6
|
import SpinnerIcon from '@atlaskit/spinner';
|
|
7
7
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
8
|
-
import { createAndFireMediaCardEvent } from '
|
|
9
|
-
import { IconWrapper } from '
|
|
10
|
-
import { useBreakpoint } from '
|
|
8
|
+
import { createAndFireMediaCardEvent } from '../../utils/analytics';
|
|
9
|
+
import { IconWrapper } from '../ui/iconWrapper/iconWrapper';
|
|
10
|
+
import { useBreakpoint } from '../useBreakpoint';
|
|
11
11
|
import { CardViewWrapper } from './cardViewWrapper';
|
|
12
12
|
const LoadingCardViewBase = props => {
|
|
13
13
|
const {
|
|
@@ -5,10 +5,10 @@ import { jsx } from '@emotion/react';
|
|
|
5
5
|
import { useEffect, useRef } from 'react';
|
|
6
6
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
7
7
|
import { MimeTypeIcon } from '@atlaskit/media-ui/mime-type-icon';
|
|
8
|
-
import { createAndFireMediaCardEvent } from '
|
|
9
|
-
import { IconWrapper } from '
|
|
10
|
-
import { CreatingPreview } from '
|
|
11
|
-
import { useBreakpoint } from '
|
|
8
|
+
import { createAndFireMediaCardEvent } from '../../utils/analytics';
|
|
9
|
+
import { IconWrapper } from '../ui/iconWrapper/iconWrapper';
|
|
10
|
+
import { CreatingPreview } from '../ui/iconMessage';
|
|
11
|
+
import { useBreakpoint } from '../useBreakpoint';
|
|
12
12
|
import { CardViewWrapper } from './cardViewWrapper';
|
|
13
13
|
const ProcessingCardViewBase = props => {
|
|
14
14
|
const {
|
|
@@ -4,14 +4,14 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
4
4
|
import { jsx } from '@emotion/react';
|
|
5
5
|
import { useEffect, useRef } from 'react';
|
|
6
6
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
7
|
-
import { createAndFireMediaCardEvent } from '
|
|
8
|
-
import { IconWrapper } from '
|
|
9
|
-
import { PlayButton } from '
|
|
10
|
-
import { ImageRenderer } from '
|
|
11
|
-
import { useBreakpoint } from '
|
|
7
|
+
import { createAndFireMediaCardEvent } from '../../utils/analytics';
|
|
8
|
+
import { IconWrapper } from '../ui/iconWrapper/iconWrapper';
|
|
9
|
+
import { PlayButton } from '../ui/playButton/playButton';
|
|
10
|
+
import { ImageRenderer } from '../ui/imageRenderer/imageRenderer';
|
|
11
|
+
import { useBreakpoint } from '../useBreakpoint';
|
|
12
12
|
import { CardViewWrapper } from './cardViewWrapper';
|
|
13
|
-
import { ProgressBar } from '
|
|
14
|
-
import { Blanket } from '
|
|
13
|
+
import { ProgressBar } from '../ui/progressBar/progressBar';
|
|
14
|
+
import { Blanket } from '../ui/blanket/blanket';
|
|
15
15
|
const VideoCardViewBase = props => {
|
|
16
16
|
const {
|
|
17
17
|
status,
|
|
@@ -3,16 +3,16 @@ import { getRandomHex } from '@atlaskit/media-common';
|
|
|
3
3
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
4
4
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import ReactDOM from 'react-dom';
|
|
6
|
-
import { ImageLoadError } from '
|
|
7
|
-
import getDocument from '
|
|
8
|
-
import { generateUniqueId } from '
|
|
9
|
-
import { getMediaCardCursor } from '
|
|
10
|
-
import { abortUfoExperience, completeUfoExperience, startUfoExperience } from '
|
|
11
|
-
import { useCurrentValueRef } from '
|
|
12
|
-
import { getDefaultCardDimensions } from '
|
|
13
|
-
import { usePrevious } from '
|
|
14
|
-
import { fireCommencedEvent, fireCopiedEvent, fireOperationalEvent, fireScreenEvent } from '
|
|
15
|
-
import {
|
|
6
|
+
import { ImageLoadError } from '../errors';
|
|
7
|
+
import getDocument from '../utils/document';
|
|
8
|
+
import { generateUniqueId } from '../utils/generateUniqueId';
|
|
9
|
+
import { getMediaCardCursor } from '../utils/getMediaCardCursor';
|
|
10
|
+
import { abortUfoExperience, completeUfoExperience, startUfoExperience } from '../utils/ufoExperiences';
|
|
11
|
+
import { useCurrentValueRef } from '../utils/useCurrentValueRef';
|
|
12
|
+
import { getDefaultCardDimensions } from '../utils/cardDimensions';
|
|
13
|
+
import { usePrevious } from '../utils/usePrevious';
|
|
14
|
+
import { fireCommencedEvent, fireCopiedEvent, fireOperationalEvent, fireScreenEvent } from './cardAnalytics';
|
|
15
|
+
import { CardView } from './cardView';
|
|
16
16
|
import { performanceNow } from './performance';
|
|
17
17
|
export const ExternalImageCard = ({
|
|
18
18
|
mediaClient,
|
|
@@ -190,7 +190,7 @@ export const ExternalImageCard = ({
|
|
|
190
190
|
//----------------------------------------------------------------//
|
|
191
191
|
|
|
192
192
|
const mediaCardCursor = getMediaCardCursor(false, !!shouldOpenMediaViewer, status === 'error', !!cardPreview, metadata.mediaType);
|
|
193
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
193
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CardView, {
|
|
194
194
|
status: status,
|
|
195
195
|
error: error,
|
|
196
196
|
mediaItemType: identifier.mediaItemType,
|
|
@@ -6,28 +6,28 @@ import { getRandomHex, isMimeTypeSupportedByBrowser, isVideoMimeTypeSupportedByB
|
|
|
6
6
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
7
7
|
import React, { Suspense, useEffect, useMemo, useRef, useState } from 'react';
|
|
8
8
|
import ReactDOM from 'react-dom';
|
|
9
|
-
import { MediaCardError } from '
|
|
10
|
-
import getDocument from '
|
|
11
|
-
import { generateUniqueId } from '
|
|
12
|
-
import { resolveCardPreviewDimensions } from '
|
|
13
|
-
import { getMediaCardCursor } from '
|
|
14
|
-
import { getFileDetails } from '
|
|
15
|
-
import { abortUfoExperience, completeUfoExperience, startUfoExperience } from '
|
|
16
|
-
import { useCurrentValueRef } from '
|
|
17
|
-
import { usePrevious } from '
|
|
18
|
-
import { ViewportDetector } from '
|
|
19
|
-
import { getDefaultCardDimensions } from '
|
|
20
|
-
import { fireCommencedEvent, fireCopiedEvent, fireNonCriticalErrorEvent, fireOperationalEvent, fireScreenEvent } from '
|
|
21
|
-
import { isSSRPreview } from '
|
|
22
|
-
import {
|
|
9
|
+
import { MediaCardError } from '../errors';
|
|
10
|
+
import getDocument from '../utils/document';
|
|
11
|
+
import { generateUniqueId } from '../utils/generateUniqueId';
|
|
12
|
+
import { resolveCardPreviewDimensions } from '../utils/getDataURIDimension';
|
|
13
|
+
import { getMediaCardCursor } from '../utils/getMediaCardCursor';
|
|
14
|
+
import { getFileDetails } from '../utils/metadata';
|
|
15
|
+
import { abortUfoExperience, completeUfoExperience, startUfoExperience } from '../utils/ufoExperiences';
|
|
16
|
+
import { useCurrentValueRef } from '../utils/useCurrentValueRef';
|
|
17
|
+
import { usePrevious } from '../utils/usePrevious';
|
|
18
|
+
import { ViewportDetector } from '../utils/viewportDetector';
|
|
19
|
+
import { getDefaultCardDimensions } from '../utils/cardDimensions';
|
|
20
|
+
import { fireCommencedEvent, fireCopiedEvent, fireNonCriticalErrorEvent, fireOperationalEvent, fireScreenEvent } from './cardAnalytics';
|
|
21
|
+
import { isSSRPreview } from './getCardPreview';
|
|
22
|
+
import { CardView } from './cardView';
|
|
23
23
|
import { CardViews } from './cardviews';
|
|
24
|
-
import {
|
|
24
|
+
import { InlinePlayerLazy } from './inlinePlayerLazy';
|
|
25
25
|
import { useFilePreview } from '@atlaskit/media-file-preview';
|
|
26
26
|
import { performanceNow } from './performance';
|
|
27
27
|
import { useContext } from 'react';
|
|
28
|
-
import { DateOverrideContext } from '
|
|
28
|
+
import { DateOverrideContext } from '../dateOverrideContext';
|
|
29
29
|
import { SvgView } from './svgView';
|
|
30
|
-
const LoadedCardView = getBooleanFF('platform.media-experience.card-views-refactor_b91lr') ? CardViews :
|
|
30
|
+
const LoadedCardView = getBooleanFF('platform.media-experience.card-views-refactor_b91lr') ? CardViews : CardView;
|
|
31
31
|
export const FileCard = ({
|
|
32
32
|
appearance = 'auto',
|
|
33
33
|
resizeMode = 'crop',
|
|
@@ -579,7 +579,7 @@ export const FileCard = ({
|
|
|
579
579
|
const collectionName = identifier.collectionName || '';
|
|
580
580
|
return /*#__PURE__*/React.createElement(React.Fragment, null, isPlayingFile ? /*#__PURE__*/React.createElement(Suspense, {
|
|
581
581
|
fallback: inlinePlayerFallback
|
|
582
|
-
}, /*#__PURE__*/React.createElement(
|
|
582
|
+
}, /*#__PURE__*/React.createElement(InlinePlayerLazy, {
|
|
583
583
|
dimensions: cardDimensions,
|
|
584
584
|
originalDimensions: originalDimensions,
|
|
585
585
|
identifier: identifier,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Card } from './
|
|
1
|
+
export { default as Card } from './cardLoader';
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { Component } from 'react';
|
|
2
|
+
import React, { useRef, useState, useEffect } from 'react';
|
|
5
3
|
import { globalMediaEventEmitter } from '@atlaskit/media-client';
|
|
6
4
|
import { CustomMediaPlayer, InactivityDetector } from '@atlaskit/media-ui';
|
|
7
5
|
import { defaultImageCardDimensions } from '../utils';
|
|
8
6
|
import { CardLoading } from '../utils/lightCards/cardLoading';
|
|
9
7
|
import { ProgressBar } from './ui/progressBar/progressBar';
|
|
10
|
-
import { calcBreakpointSize } from './ui/styles';
|
|
11
|
-
import { isValidPercentageUnit } from '../utils/isValidPercentageUnit';
|
|
12
|
-
import { getElementDimension } from '../utils/getElementDimension';
|
|
13
8
|
import { InlinePlayerWrapper } from './inlinePlayerWrapper';
|
|
9
|
+
import { useBreakpoint } from './useBreakpoint';
|
|
10
|
+
import { useFileState, useMediaClient } from '@atlaskit/media-client-react';
|
|
14
11
|
export const getPreferredVideoArtifact = fileState => {
|
|
15
12
|
if (fileState.status === 'processed' || fileState.status === 'processing') {
|
|
16
13
|
const {
|
|
@@ -23,222 +20,144 @@ export const getPreferredVideoArtifact = fileState => {
|
|
|
23
20
|
}
|
|
24
21
|
return undefined;
|
|
25
22
|
};
|
|
26
|
-
export
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
23
|
+
export const InlinePlayerBase = ({
|
|
24
|
+
identifier,
|
|
25
|
+
onError,
|
|
26
|
+
onClick,
|
|
27
|
+
dimensions = defaultImageCardDimensions,
|
|
28
|
+
originalDimensions,
|
|
29
|
+
selected,
|
|
30
|
+
testId,
|
|
31
|
+
forwardRef,
|
|
32
|
+
autoplay,
|
|
33
|
+
cardPreview,
|
|
34
|
+
onFullscreenChange,
|
|
35
|
+
videoControlsWrapperRef
|
|
36
|
+
}) => {
|
|
37
|
+
// === States ===
|
|
38
|
+
const [fileSrc, setFileSrc] = useState();
|
|
39
|
+
const [isUploading, setIsUploading] = useState();
|
|
40
|
+
const [progress, setProgress] = useState();
|
|
41
|
+
|
|
42
|
+
// === Refs and Local Variables ===
|
|
43
|
+
const divRef = useRef(null);
|
|
44
|
+
const onErrorRef = useRef(onError);
|
|
45
|
+
onErrorRef.current = onError;
|
|
46
|
+
const {
|
|
47
|
+
id,
|
|
48
|
+
collectionName,
|
|
49
|
+
occurrenceKey
|
|
50
|
+
} = identifier;
|
|
51
|
+
const breakpoint = useBreakpoint(dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, divRef);
|
|
52
|
+
const mediaClient = useMediaClient();
|
|
53
|
+
const {
|
|
54
|
+
fileState
|
|
55
|
+
} = useFileState(id, {
|
|
56
|
+
collectionName,
|
|
57
|
+
occurrenceKey
|
|
58
|
+
});
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
const subscribeFileState = async fileState => {
|
|
61
|
+
if (fileState.status === 'uploading') {
|
|
62
|
+
setIsUploading(true);
|
|
63
|
+
setProgress(fileState.progress);
|
|
64
|
+
} else {
|
|
65
|
+
setIsUploading(false);
|
|
59
66
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const {
|
|
63
|
-
fileSrc
|
|
64
|
-
} = this.state;
|
|
67
|
+
|
|
68
|
+
// We reuse the existing fileSrc to prevent re renders, therefore we only perform fileSrc updates when there isn't any
|
|
65
69
|
if (fileSrc) {
|
|
66
|
-
URL.revokeObjectURL(fileSrc);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
_defineProperty(this, "onDownloadClick", () => {
|
|
70
|
-
const {
|
|
71
|
-
mediaClient,
|
|
72
|
-
identifier
|
|
73
|
-
} = this.props;
|
|
74
|
-
const {
|
|
75
|
-
id,
|
|
76
|
-
collectionName
|
|
77
|
-
} = identifier;
|
|
78
|
-
mediaClient.file.downloadBinary(id, undefined, collectionName);
|
|
79
|
-
});
|
|
80
|
-
_defineProperty(this, "onFirstPlay", () => {
|
|
81
|
-
const {
|
|
82
|
-
identifier
|
|
83
|
-
} = this.props;
|
|
84
|
-
globalMediaEventEmitter.emit('media-viewed', {
|
|
85
|
-
fileId: identifier.id,
|
|
86
|
-
viewingLevel: 'full'
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
_defineProperty(this, "saveElementWidth", () => {
|
|
90
|
-
const {
|
|
91
|
-
dimensions
|
|
92
|
-
} = this.props;
|
|
93
|
-
if (!dimensions) {
|
|
94
70
|
return;
|
|
95
71
|
}
|
|
96
|
-
|
|
97
|
-
width
|
|
98
|
-
} = dimensions;
|
|
99
|
-
if (width && isValidPercentageUnit(width) && !!this.divRef.current) {
|
|
100
|
-
const elementWidth = getElementDimension(this.divRef.current, 'width');
|
|
101
|
-
this.setState({
|
|
102
|
-
elementWidth
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
componentDidMount() {
|
|
108
|
-
this.saveElementWidth();
|
|
109
|
-
const {
|
|
110
|
-
mediaClient,
|
|
111
|
-
identifier
|
|
112
|
-
} = this.props;
|
|
113
|
-
const {
|
|
114
|
-
id,
|
|
115
|
-
collectionName
|
|
116
|
-
} = identifier;
|
|
117
|
-
this.revoke();
|
|
118
|
-
this.unsubscribe();
|
|
119
|
-
this.subscription = mediaClient.file.getFileState(id, {
|
|
120
|
-
collectionName
|
|
121
|
-
}).subscribe({
|
|
122
|
-
next: async fileState => {
|
|
123
|
-
if (fileState.status === 'uploading') {
|
|
124
|
-
this.setState({
|
|
125
|
-
isUploading: true,
|
|
126
|
-
progress: fileState.progress
|
|
127
|
-
});
|
|
128
|
-
} else {
|
|
129
|
-
this.setState({
|
|
130
|
-
isUploading: false
|
|
131
|
-
});
|
|
132
|
-
}
|
|
72
|
+
if (fileState.status !== 'error' && fileState.preview) {
|
|
133
73
|
const {
|
|
134
|
-
|
|
135
|
-
} =
|
|
136
|
-
|
|
137
|
-
|
|
74
|
+
value
|
|
75
|
+
} = await fileState.preview;
|
|
76
|
+
if (value instanceof Blob && value.type.indexOf('video/') === 0) {
|
|
77
|
+
const newFileSrc = URL.createObjectURL(value);
|
|
78
|
+
setFileSrc(newFileSrc);
|
|
138
79
|
return;
|
|
139
80
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
if (fileState.status === 'processed' || fileState.status === 'processing') {
|
|
151
|
-
const artifactName = getPreferredVideoArtifact(fileState);
|
|
152
|
-
const {
|
|
153
|
-
artifacts
|
|
154
|
-
} = fileState;
|
|
155
|
-
if (!artifactName || !artifacts) {
|
|
156
|
-
this.setBinaryURL();
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
81
|
+
}
|
|
82
|
+
if (fileState.status === 'processed' || fileState.status === 'processing') {
|
|
83
|
+
const artifactName = getPreferredVideoArtifact(fileState);
|
|
84
|
+
const {
|
|
85
|
+
artifacts
|
|
86
|
+
} = fileState;
|
|
87
|
+
if (!artifactName || !artifacts) {
|
|
88
|
+
// Tries to use the binary artifact to provide something to play while the video is still processing
|
|
159
89
|
try {
|
|
160
|
-
const
|
|
161
|
-
|
|
90
|
+
const newFileSrc = await mediaClient.file.getFileBinaryURL(id, collectionName);
|
|
91
|
+
setFileSrc(newFileSrc);
|
|
162
92
|
} catch (error) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
} = this.props;
|
|
166
|
-
if (onError && error instanceof Error) {
|
|
167
|
-
onError(error);
|
|
93
|
+
if (onErrorRef.current && error instanceof Error) {
|
|
94
|
+
onErrorRef.current(error);
|
|
168
95
|
}
|
|
169
96
|
}
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
const newFileSrc = await mediaClient.file.getArtifactURL(artifacts, artifactName, collectionName);
|
|
101
|
+
setFileSrc(newFileSrc);
|
|
102
|
+
} catch (error) {
|
|
103
|
+
if (onErrorRef.current && error instanceof Error) {
|
|
104
|
+
onErrorRef.current(error);
|
|
105
|
+
}
|
|
170
106
|
}
|
|
171
107
|
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
this.unsubscribe();
|
|
176
|
-
this.revoke();
|
|
177
|
-
}
|
|
178
|
-
get breakpoint() {
|
|
179
|
-
const width = this.state.elementWidth || (this.props.dimensions ? this.props.dimensions.width : '') || defaultImageCardDimensions.width;
|
|
180
|
-
return calcBreakpointSize(parseInt(`${width}`, 10));
|
|
181
|
-
}
|
|
182
|
-
render() {
|
|
183
|
-
const {
|
|
184
|
-
onClick,
|
|
185
|
-
dimensions,
|
|
186
|
-
originalDimensions,
|
|
187
|
-
selected,
|
|
188
|
-
testId,
|
|
189
|
-
identifier,
|
|
190
|
-
forwardRef,
|
|
191
|
-
autoplay,
|
|
192
|
-
cardPreview,
|
|
193
|
-
onFullscreenChange,
|
|
194
|
-
videoControlsWrapperRef
|
|
195
|
-
} = this.props;
|
|
196
|
-
const {
|
|
197
|
-
fileSrc,
|
|
198
|
-
isUploading,
|
|
199
|
-
progress
|
|
200
|
-
} = this.state;
|
|
201
|
-
if (!fileSrc) {
|
|
202
|
-
return /*#__PURE__*/React.createElement(CardLoading, {
|
|
203
|
-
testId: testId,
|
|
204
|
-
dimensions: dimensions
|
|
205
|
-
});
|
|
108
|
+
};
|
|
109
|
+
if (fileState) {
|
|
110
|
+
subscribeFileState(fileState);
|
|
206
111
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
112
|
+
}, [fileState, collectionName, fileSrc, id, mediaClient]);
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
return () => {
|
|
115
|
+
fileSrc && URL.revokeObjectURL(fileSrc);
|
|
116
|
+
};
|
|
117
|
+
}, [fileSrc]);
|
|
118
|
+
|
|
119
|
+
// === Render ===
|
|
120
|
+
return fileSrc ? /*#__PURE__*/React.createElement(InlinePlayerWrapper, {
|
|
121
|
+
testId: testId || 'media-card-inline-player',
|
|
122
|
+
selected: {
|
|
123
|
+
selected
|
|
124
|
+
},
|
|
125
|
+
onClick: onClick,
|
|
126
|
+
innerRef: forwardRef || undefined,
|
|
127
|
+
dimensions: dimensions
|
|
128
|
+
}, /*#__PURE__*/React.createElement(InactivityDetector, null, checkMouseMovement => /*#__PURE__*/React.createElement(CustomMediaPlayer, {
|
|
129
|
+
type: "video",
|
|
130
|
+
src: fileSrc,
|
|
131
|
+
onFullscreenChange: onFullscreenChange,
|
|
132
|
+
fileId: id,
|
|
133
|
+
isAutoPlay: autoplay,
|
|
134
|
+
isHDAvailable: false,
|
|
135
|
+
onDownloadClick: () => {
|
|
136
|
+
mediaClient.file.downloadBinary(id, undefined, collectionName);
|
|
137
|
+
},
|
|
138
|
+
onFirstPlay: () => {
|
|
139
|
+
globalMediaEventEmitter.emit('media-viewed', {
|
|
140
|
+
fileId: id,
|
|
141
|
+
viewingLevel: 'full'
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
lastWatchTimeConfig: {
|
|
145
|
+
contentId: id
|
|
146
|
+
},
|
|
147
|
+
originalDimensions: originalDimensions,
|
|
148
|
+
showControls: checkMouseMovement,
|
|
149
|
+
poster: cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.dataURI,
|
|
150
|
+
videoControlsWrapperRef: videoControlsWrapperRef
|
|
151
|
+
})), isUploading && /*#__PURE__*/React.createElement(ProgressBar, {
|
|
152
|
+
progress: progress,
|
|
153
|
+
breakpoint: breakpoint,
|
|
154
|
+
positionBottom: true,
|
|
155
|
+
showOnTop: true
|
|
156
|
+
})) : /*#__PURE__*/React.createElement(CardLoading, {
|
|
157
|
+
testId: testId,
|
|
158
|
+
dimensions: dimensions
|
|
159
|
+
});
|
|
160
|
+
};
|
|
242
161
|
const InlinePlayerForwardRef = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
243
162
|
return /*#__PURE__*/React.createElement(InlinePlayerBase, _extends({}, props, {
|
|
244
163
|
forwardRef: ref
|