@atlaskit/media-card 77.12.4 → 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 +9 -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 +1 -4
- 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,26 +1,16 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
-
import
|
|
4
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
10
4
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
11
|
-
|
|
12
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
|
-
import React from 'react';
|
|
14
|
-
import { Component } from 'react';
|
|
5
|
+
import React, { useRef, useState, useEffect } from 'react';
|
|
15
6
|
import { globalMediaEventEmitter } from '@atlaskit/media-client';
|
|
16
7
|
import { CustomMediaPlayer, InactivityDetector } from '@atlaskit/media-ui';
|
|
17
8
|
import { defaultImageCardDimensions } from '../utils';
|
|
18
9
|
import { CardLoading } from '../utils/lightCards/cardLoading';
|
|
19
10
|
import { ProgressBar } from './ui/progressBar/progressBar';
|
|
20
|
-
import { calcBreakpointSize } from './ui/styles';
|
|
21
|
-
import { isValidPercentageUnit } from '../utils/isValidPercentageUnit';
|
|
22
|
-
import { getElementDimension } from '../utils/getElementDimension';
|
|
23
11
|
import { InlinePlayerWrapper } from './inlinePlayerWrapper';
|
|
12
|
+
import { useBreakpoint } from './useBreakpoint';
|
|
13
|
+
import { useFileState, useMediaClient } from '@atlaskit/media-client-react';
|
|
24
14
|
export var getPreferredVideoArtifact = function getPreferredVideoArtifact(fileState) {
|
|
25
15
|
if (fileState.status === 'processed' || fileState.status === 'processing') {
|
|
26
16
|
var artifacts = fileState.artifacts;
|
|
@@ -31,265 +21,191 @@ export var getPreferredVideoArtifact = function getPreferredVideoArtifact(fileSt
|
|
|
31
21
|
}
|
|
32
22
|
return undefined;
|
|
33
23
|
};
|
|
34
|
-
export var InlinePlayerBase =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
var width = dimensions.width;
|
|
111
|
-
if (width && isValidPercentageUnit(width) && !!_this.divRef.current) {
|
|
112
|
-
var elementWidth = getElementDimension(_this.divRef.current, 'width');
|
|
113
|
-
_this.setState({
|
|
114
|
-
elementWidth: elementWidth
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
return _this;
|
|
119
|
-
}
|
|
120
|
-
_createClass(InlinePlayerBase, [{
|
|
121
|
-
key: "componentDidMount",
|
|
122
|
-
value: function componentDidMount() {
|
|
123
|
-
var _this2 = this;
|
|
124
|
-
this.saveElementWidth();
|
|
125
|
-
var _this$props3 = this.props,
|
|
126
|
-
mediaClient = _this$props3.mediaClient,
|
|
127
|
-
identifier = _this$props3.identifier;
|
|
128
|
-
var id = identifier.id,
|
|
129
|
-
collectionName = identifier.collectionName;
|
|
130
|
-
this.revoke();
|
|
131
|
-
this.unsubscribe();
|
|
132
|
-
this.subscription = mediaClient.file.getFileState(id, {
|
|
133
|
-
collectionName: collectionName
|
|
134
|
-
}).subscribe({
|
|
135
|
-
next: function () {
|
|
136
|
-
var _next = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(fileState) {
|
|
137
|
-
var existingFileSrc, _yield$fileState$prev, value, fileSrc, artifactName, artifacts, _fileSrc, onError;
|
|
138
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
139
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
140
|
-
case 0:
|
|
141
|
-
if (fileState.status === 'uploading') {
|
|
142
|
-
_this2.setState({
|
|
143
|
-
isUploading: true,
|
|
144
|
-
progress: fileState.progress
|
|
145
|
-
});
|
|
146
|
-
} else {
|
|
147
|
-
_this2.setState({
|
|
148
|
-
isUploading: false
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
existingFileSrc = _this2.state.fileSrc; // we want to reuse the existing fileSrc to prevent re renders
|
|
152
|
-
if (!existingFileSrc) {
|
|
153
|
-
_context2.next = 4;
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
return _context2.abrupt("return");
|
|
157
|
-
case 4:
|
|
158
|
-
if (!(fileState.status !== 'error' && fileState.preview)) {
|
|
159
|
-
_context2.next = 13;
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
_context2.next = 7;
|
|
163
|
-
return fileState.preview;
|
|
164
|
-
case 7:
|
|
165
|
-
_yield$fileState$prev = _context2.sent;
|
|
166
|
-
value = _yield$fileState$prev.value;
|
|
167
|
-
if (!(value instanceof Blob && value.type.indexOf('video/') === 0)) {
|
|
168
|
-
_context2.next = 13;
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
fileSrc = URL.createObjectURL(value);
|
|
172
|
-
_this2.setFileSrc(fileSrc);
|
|
173
|
-
return _context2.abrupt("return");
|
|
174
|
-
case 13:
|
|
175
|
-
if (!(fileState.status === 'processed' || fileState.status === 'processing')) {
|
|
176
|
-
_context2.next = 30;
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
artifactName = getPreferredVideoArtifact(fileState);
|
|
180
|
-
artifacts = fileState.artifacts;
|
|
181
|
-
if (!(!artifactName || !artifacts)) {
|
|
182
|
-
_context2.next = 19;
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
185
|
-
_this2.setBinaryURL();
|
|
186
|
-
return _context2.abrupt("return");
|
|
187
|
-
case 19:
|
|
188
|
-
_context2.prev = 19;
|
|
189
|
-
_context2.next = 22;
|
|
190
|
-
return mediaClient.file.getArtifactURL(artifacts, artifactName, collectionName);
|
|
191
|
-
case 22:
|
|
192
|
-
_fileSrc = _context2.sent;
|
|
193
|
-
_this2.setFileSrc(_fileSrc);
|
|
194
|
-
_context2.next = 30;
|
|
195
|
-
break;
|
|
196
|
-
case 26:
|
|
197
|
-
_context2.prev = 26;
|
|
198
|
-
_context2.t0 = _context2["catch"](19);
|
|
199
|
-
onError = _this2.props.onError;
|
|
200
|
-
if (onError && _context2.t0 instanceof Error) {
|
|
201
|
-
onError(_context2.t0);
|
|
202
|
-
}
|
|
203
|
-
case 30:
|
|
204
|
-
case "end":
|
|
205
|
-
return _context2.stop();
|
|
24
|
+
export var InlinePlayerBase = function InlinePlayerBase(_ref) {
|
|
25
|
+
var identifier = _ref.identifier,
|
|
26
|
+
onError = _ref.onError,
|
|
27
|
+
onClick = _ref.onClick,
|
|
28
|
+
_ref$dimensions = _ref.dimensions,
|
|
29
|
+
dimensions = _ref$dimensions === void 0 ? defaultImageCardDimensions : _ref$dimensions,
|
|
30
|
+
originalDimensions = _ref.originalDimensions,
|
|
31
|
+
selected = _ref.selected,
|
|
32
|
+
testId = _ref.testId,
|
|
33
|
+
forwardRef = _ref.forwardRef,
|
|
34
|
+
autoplay = _ref.autoplay,
|
|
35
|
+
cardPreview = _ref.cardPreview,
|
|
36
|
+
onFullscreenChange = _ref.onFullscreenChange,
|
|
37
|
+
videoControlsWrapperRef = _ref.videoControlsWrapperRef;
|
|
38
|
+
// === States ===
|
|
39
|
+
var _useState = useState(),
|
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
+
fileSrc = _useState2[0],
|
|
42
|
+
setFileSrc = _useState2[1];
|
|
43
|
+
var _useState3 = useState(),
|
|
44
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
45
|
+
isUploading = _useState4[0],
|
|
46
|
+
setIsUploading = _useState4[1];
|
|
47
|
+
var _useState5 = useState(),
|
|
48
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
49
|
+
progress = _useState6[0],
|
|
50
|
+
setProgress = _useState6[1];
|
|
51
|
+
|
|
52
|
+
// === Refs and Local Variables ===
|
|
53
|
+
var divRef = useRef(null);
|
|
54
|
+
var onErrorRef = useRef(onError);
|
|
55
|
+
onErrorRef.current = onError;
|
|
56
|
+
var id = identifier.id,
|
|
57
|
+
collectionName = identifier.collectionName,
|
|
58
|
+
occurrenceKey = identifier.occurrenceKey;
|
|
59
|
+
var breakpoint = useBreakpoint(dimensions === null || dimensions === void 0 ? void 0 : dimensions.width, divRef);
|
|
60
|
+
var mediaClient = useMediaClient();
|
|
61
|
+
var _useFileState = useFileState(id, {
|
|
62
|
+
collectionName: collectionName,
|
|
63
|
+
occurrenceKey: occurrenceKey
|
|
64
|
+
}),
|
|
65
|
+
fileState = _useFileState.fileState;
|
|
66
|
+
useEffect(function () {
|
|
67
|
+
var subscribeFileState = /*#__PURE__*/function () {
|
|
68
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(fileState) {
|
|
69
|
+
var _yield$fileState$prev, value, newFileSrc, artifactName, artifacts, _newFileSrc, _newFileSrc2;
|
|
70
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
71
|
+
while (1) switch (_context.prev = _context.next) {
|
|
72
|
+
case 0:
|
|
73
|
+
if (fileState.status === 'uploading') {
|
|
74
|
+
setIsUploading(true);
|
|
75
|
+
setProgress(fileState.progress);
|
|
76
|
+
} else {
|
|
77
|
+
setIsUploading(false);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// We reuse the existing fileSrc to prevent re renders, therefore we only perform fileSrc updates when there isn't any
|
|
81
|
+
if (!fileSrc) {
|
|
82
|
+
_context.next = 3;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
return _context.abrupt("return");
|
|
86
|
+
case 3:
|
|
87
|
+
if (!(fileState.status !== 'error' && fileState.preview)) {
|
|
88
|
+
_context.next = 12;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
_context.next = 6;
|
|
92
|
+
return fileState.preview;
|
|
93
|
+
case 6:
|
|
94
|
+
_yield$fileState$prev = _context.sent;
|
|
95
|
+
value = _yield$fileState$prev.value;
|
|
96
|
+
if (!(value instanceof Blob && value.type.indexOf('video/') === 0)) {
|
|
97
|
+
_context.next = 12;
|
|
98
|
+
break;
|
|
206
99
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
100
|
+
newFileSrc = URL.createObjectURL(value);
|
|
101
|
+
setFileSrc(newFileSrc);
|
|
102
|
+
return _context.abrupt("return");
|
|
103
|
+
case 12:
|
|
104
|
+
if (!(fileState.status === 'processed' || fileState.status === 'processing')) {
|
|
105
|
+
_context.next = 37;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
artifactName = getPreferredVideoArtifact(fileState);
|
|
109
|
+
artifacts = fileState.artifacts;
|
|
110
|
+
if (!(!artifactName || !artifacts)) {
|
|
111
|
+
_context.next = 27;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
_context.prev = 16;
|
|
115
|
+
_context.next = 19;
|
|
116
|
+
return mediaClient.file.getFileBinaryURL(id, collectionName);
|
|
117
|
+
case 19:
|
|
118
|
+
_newFileSrc = _context.sent;
|
|
119
|
+
setFileSrc(_newFileSrc);
|
|
120
|
+
_context.next = 26;
|
|
121
|
+
break;
|
|
122
|
+
case 23:
|
|
123
|
+
_context.prev = 23;
|
|
124
|
+
_context.t0 = _context["catch"](16);
|
|
125
|
+
if (onErrorRef.current && _context.t0 instanceof Error) {
|
|
126
|
+
onErrorRef.current(_context.t0);
|
|
127
|
+
}
|
|
128
|
+
case 26:
|
|
129
|
+
return _context.abrupt("return");
|
|
130
|
+
case 27:
|
|
131
|
+
_context.prev = 27;
|
|
132
|
+
_context.next = 30;
|
|
133
|
+
return mediaClient.file.getArtifactURL(artifacts, artifactName, collectionName);
|
|
134
|
+
case 30:
|
|
135
|
+
_newFileSrc2 = _context.sent;
|
|
136
|
+
setFileSrc(_newFileSrc2);
|
|
137
|
+
_context.next = 37;
|
|
138
|
+
break;
|
|
139
|
+
case 34:
|
|
140
|
+
_context.prev = 34;
|
|
141
|
+
_context.t1 = _context["catch"](27);
|
|
142
|
+
if (onErrorRef.current && _context.t1 instanceof Error) {
|
|
143
|
+
onErrorRef.current(_context.t1);
|
|
144
|
+
}
|
|
145
|
+
case 37:
|
|
146
|
+
case "end":
|
|
147
|
+
return _context.stop();
|
|
211
148
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
this.revoke();
|
|
221
|
-
}
|
|
222
|
-
}, {
|
|
223
|
-
key: "breakpoint",
|
|
224
|
-
get: function get() {
|
|
225
|
-
var width = this.state.elementWidth || (this.props.dimensions ? this.props.dimensions.width : '') || defaultImageCardDimensions.width;
|
|
226
|
-
return calcBreakpointSize(parseInt("".concat(width), 10));
|
|
149
|
+
}, _callee, null, [[16, 23], [27, 34]]);
|
|
150
|
+
}));
|
|
151
|
+
return function subscribeFileState(_x) {
|
|
152
|
+
return _ref2.apply(this, arguments);
|
|
153
|
+
};
|
|
154
|
+
}();
|
|
155
|
+
if (fileState) {
|
|
156
|
+
subscribeFileState(fileState);
|
|
227
157
|
}
|
|
228
|
-
},
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
158
|
+
}, [fileState, collectionName, fileSrc, id, mediaClient]);
|
|
159
|
+
useEffect(function () {
|
|
160
|
+
return function () {
|
|
161
|
+
fileSrc && URL.revokeObjectURL(fileSrc);
|
|
162
|
+
};
|
|
163
|
+
}, [fileSrc]);
|
|
164
|
+
|
|
165
|
+
// === Render ===
|
|
166
|
+
return fileSrc ? /*#__PURE__*/React.createElement(InlinePlayerWrapper, {
|
|
167
|
+
testId: testId || 'media-card-inline-player',
|
|
168
|
+
selected: {
|
|
169
|
+
selected: selected
|
|
170
|
+
},
|
|
171
|
+
onClick: onClick,
|
|
172
|
+
innerRef: forwardRef || undefined,
|
|
173
|
+
dimensions: dimensions
|
|
174
|
+
}, /*#__PURE__*/React.createElement(InactivityDetector, null, function (checkMouseMovement) {
|
|
175
|
+
return /*#__PURE__*/React.createElement(CustomMediaPlayer, {
|
|
176
|
+
type: "video",
|
|
177
|
+
src: fileSrc,
|
|
178
|
+
onFullscreenChange: onFullscreenChange,
|
|
179
|
+
fileId: id,
|
|
180
|
+
isAutoPlay: autoplay,
|
|
181
|
+
isHDAvailable: false,
|
|
182
|
+
onDownloadClick: function onDownloadClick() {
|
|
183
|
+
mediaClient.file.downloadBinary(id, undefined, collectionName);
|
|
184
|
+
},
|
|
185
|
+
onFirstPlay: function onFirstPlay() {
|
|
186
|
+
globalMediaEventEmitter.emit('media-viewed', {
|
|
187
|
+
fileId: id,
|
|
188
|
+
viewingLevel: 'full'
|
|
252
189
|
});
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
lastWatchTimeConfig: {
|
|
273
|
-
contentId: identifier.id
|
|
274
|
-
},
|
|
275
|
-
originalDimensions: originalDimensions,
|
|
276
|
-
showControls: checkMouseMovement,
|
|
277
|
-
poster: cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.dataURI,
|
|
278
|
-
videoControlsWrapperRef: videoControlsWrapperRef
|
|
279
|
-
});
|
|
280
|
-
}), isUploading ? /*#__PURE__*/React.createElement(ProgressBar, {
|
|
281
|
-
progress: progress,
|
|
282
|
-
breakpoint: this.breakpoint,
|
|
283
|
-
positionBottom: true,
|
|
284
|
-
showOnTop: true
|
|
285
|
-
}) : null);
|
|
286
|
-
}
|
|
287
|
-
}]);
|
|
288
|
-
return InlinePlayerBase;
|
|
289
|
-
}(Component);
|
|
290
|
-
_defineProperty(InlinePlayerBase, "defaultProps", {
|
|
291
|
-
dimensions: defaultImageCardDimensions
|
|
292
|
-
});
|
|
190
|
+
},
|
|
191
|
+
lastWatchTimeConfig: {
|
|
192
|
+
contentId: id
|
|
193
|
+
},
|
|
194
|
+
originalDimensions: originalDimensions,
|
|
195
|
+
showControls: checkMouseMovement,
|
|
196
|
+
poster: cardPreview === null || cardPreview === void 0 ? void 0 : cardPreview.dataURI,
|
|
197
|
+
videoControlsWrapperRef: videoControlsWrapperRef
|
|
198
|
+
});
|
|
199
|
+
}), isUploading && /*#__PURE__*/React.createElement(ProgressBar, {
|
|
200
|
+
progress: progress,
|
|
201
|
+
breakpoint: breakpoint,
|
|
202
|
+
positionBottom: true,
|
|
203
|
+
showOnTop: true
|
|
204
|
+
})) : /*#__PURE__*/React.createElement(CardLoading, {
|
|
205
|
+
testId: testId,
|
|
206
|
+
dimensions: dimensions
|
|
207
|
+
});
|
|
208
|
+
};
|
|
293
209
|
var InlinePlayerForwardRef = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
294
210
|
return /*#__PURE__*/React.createElement(InlinePlayerBase, _extends({}, props, {
|
|
295
211
|
forwardRef: ref
|
|
@@ -83,7 +83,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
83
83
|
}(React.Component);
|
|
84
84
|
_defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
85
85
|
var packageName = "@atlaskit/media-card";
|
|
86
|
-
var packageVersion = "
|
|
86
|
+
var packageVersion = "78.0.0";
|
|
87
87
|
var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
88
88
|
packageVersion: packageVersion,
|
|
89
89
|
packageName: packageName,
|
|
@@ -4,17 +4,17 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
4
4
|
import { jsx } from '@emotion/react';
|
|
5
5
|
import React, { useState, useRef } from 'react';
|
|
6
6
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
7
|
-
import { createAndFireMediaCardEvent } from '
|
|
8
|
-
import { ImageRenderer } from '
|
|
9
|
-
import { ProgressBar } from '
|
|
10
|
-
import { Blanket } from '
|
|
11
|
-
import { Wrapper, ImageContainer } from '
|
|
12
|
-
import { fileCardImageViewSelector } from '
|
|
13
|
-
import { useBreakpoint } from '
|
|
7
|
+
import { createAndFireMediaCardEvent } from '../../utils/analytics';
|
|
8
|
+
import { ImageRenderer } from '../ui/imageRenderer/imageRenderer';
|
|
9
|
+
import { ProgressBar } from '../ui/progressBar/progressBar';
|
|
10
|
+
import { Blanket } from '../ui/blanket/blanket';
|
|
11
|
+
import { Wrapper, ImageContainer } from '../ui/wrapper';
|
|
12
|
+
import { fileCardImageViewSelector } from '../classnames';
|
|
13
|
+
import { useBreakpoint } from '../useBreakpoint';
|
|
14
14
|
import MediaSvg from '@atlaskit/media-svg';
|
|
15
15
|
import { calculateSvgDimensions } from './helpers';
|
|
16
|
-
import OpenMediaViewerButton from '
|
|
17
|
-
import { MediaCardError } from '
|
|
16
|
+
import OpenMediaViewerButton from '../ui/openMediaViewerButton/openMediaViewerButton';
|
|
17
|
+
import { MediaCardError } from '../../errors';
|
|
18
18
|
import { getErrorReason } from './errors';
|
|
19
19
|
export var convertResizeMode = function convertResizeMode(resizeMode) {
|
|
20
20
|
switch (resizeMode) {
|
|
@@ -103,7 +103,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
103
103
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
104
104
|
var analyticsContext = {
|
|
105
105
|
packageVersion: "@atlaskit/media-card",
|
|
106
|
-
packageName: "
|
|
106
|
+
packageName: "78.0.0",
|
|
107
107
|
componentName: 'mediaInlineCard',
|
|
108
108
|
component: 'mediaInlineCard'
|
|
109
109
|
};
|
|
@@ -7,7 +7,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
|
7
7
|
import { MediaCardError } from '../errors';
|
|
8
8
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
9
9
|
var packageName = "@atlaskit/media-card";
|
|
10
|
-
var packageVersion = "
|
|
10
|
+
var packageVersion = "78.0.0";
|
|
11
11
|
var concurrentExperience;
|
|
12
12
|
var getExperience = function getExperience(id) {
|
|
13
13
|
if (!concurrentExperience) {
|
|
@@ -1,68 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { type FileIdentifier, type FileState, type MediaSubscription } from '@atlaskit/media-client';
|
|
1
|
+
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
2
|
+
import React from 'react';
|
|
4
3
|
import { type WrappedComponentProps } from 'react-intl-next';
|
|
5
|
-
import { type
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
dateOverride?: number;
|
|
9
|
-
};
|
|
10
|
-
export declare class CardBase extends Component<CardBaseProps, CardState> {
|
|
11
|
-
private internalOccurrenceKey;
|
|
12
|
-
private hasBeenMounted;
|
|
13
|
-
private mediaViewerButtonRef;
|
|
14
|
-
private fileStateFlags;
|
|
15
|
-
private ssrReliability;
|
|
16
|
-
private timeElapsedTillCommenced;
|
|
17
|
-
subscription?: MediaSubscription;
|
|
18
|
-
private ssrData?;
|
|
19
|
-
private traceContext;
|
|
20
|
-
static defaultProps: Partial<CardProps>;
|
|
21
|
-
constructor(props: CardBaseProps);
|
|
22
|
-
private getSSRPreview;
|
|
23
|
-
componentDidMount(): void;
|
|
24
|
-
componentDidUpdate(prevProps: CardProps, prevState: CardState): void;
|
|
25
|
-
componentWillUnmount(): void;
|
|
26
|
-
updateStateForIdentifier(identifier: FileIdentifier): void;
|
|
27
|
-
private getImageURLParams;
|
|
28
|
-
private getMediaBlobUrlAttrs;
|
|
29
|
-
private getCardPreviewParams;
|
|
30
|
-
private setCacheSSRPreview;
|
|
31
|
-
private refetchSSRPreview;
|
|
32
|
-
private resolveUpfrontPreview;
|
|
33
|
-
private fetchAndCacheRemotePreview;
|
|
34
|
-
private resolvePreview;
|
|
35
|
-
updateFileStateFlag(fileState?: FileState): void;
|
|
36
|
-
subscribeInternalFile(identifier: FileIdentifier): void;
|
|
37
|
-
private get requestedDimensions();
|
|
38
|
-
private get metadata();
|
|
39
|
-
private get fileAttributes();
|
|
40
|
-
private getPerformanceAttributes;
|
|
41
|
-
private logSSRImageError;
|
|
42
|
-
private onImageError;
|
|
43
|
-
private onImageLoad;
|
|
44
|
-
private fireOperationalEvent;
|
|
45
|
-
private fireAbortedEvent;
|
|
46
|
-
private fireCommencedEvent;
|
|
47
|
-
private fireCopiedEvent;
|
|
48
|
-
private fireScreenEvent;
|
|
49
|
-
private fireNonCriticalErrorEvent;
|
|
50
|
-
private safeSetState;
|
|
51
|
-
unsubscribe: () => void;
|
|
52
|
-
get actions(): CardAction[];
|
|
53
|
-
onCardViewClick: (event: React.MouseEvent<HTMLDivElement | HTMLButtonElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
54
|
-
onInlinePlayerError: (e: Error) => void;
|
|
55
|
-
setRef: (cardRef: HTMLDivElement | null) => void;
|
|
56
|
-
setMediaViewerButtonRef: (buttonRef: HTMLButtonElement | null) => void;
|
|
57
|
-
renderInlinePlayer: () => JSX.Element;
|
|
58
|
-
onMediaViewerClose: () => void;
|
|
59
|
-
private onDisplayImage;
|
|
60
|
-
renderMediaViewer: () => React.ReactPortal | undefined;
|
|
61
|
-
renderCard: (withCallbacks?: boolean, cardStatusOverride?: CardStatus, izLazyOverride?: boolean) => JSX.Element;
|
|
62
|
-
private storeSSRData;
|
|
63
|
-
render(): JSX.Element;
|
|
64
|
-
private onCardInViewport;
|
|
65
|
-
onClick: (event: React.MouseEvent<HTMLDivElement | HTMLButtonElement>, analyticsEvent?: UIAnalyticsEvent) => void;
|
|
66
|
-
onMouseEnter: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
67
|
-
}
|
|
4
|
+
import { type CardProps } from '../types';
|
|
5
|
+
export type CardBaseProps = CardProps & WithAnalyticsEventsProps & Partial<WrappedComponentProps>;
|
|
6
|
+
export declare const CardBase: ({ identifier, ...otherProps }: CardBaseProps & WrappedComponentProps) => JSX.Element;
|
|
68
7
|
export declare const Card: React.ComponentType<CardBaseProps>;
|