@atlaskit/media-card 79.5.16 → 79.6.1
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 +13 -0
- package/compass.yml +3 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/fileCard.js +24 -1
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/inline/loader.js +1 -1
- package/dist/cjs/utils/ufoExperiences.js +1 -1
- package/dist/es2019/card/card.js +1 -1
- package/dist/es2019/card/fileCard.js +24 -1
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/inline/loader.js +1 -1
- package/dist/es2019/utils/ufoExperiences.js +1 -1
- package/dist/esm/card/card.js +1 -1
- package/dist/esm/card/fileCard.js +24 -1
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/card/fileCard.d.ts +8 -1
- package/dist/types/types.d.ts +5 -1
- package/dist/types-ts4.5/card/fileCard.d.ts +8 -1
- package/dist/types-ts4.5/types.d.ts +5 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 79.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 79.6.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`e5f402044b1c6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e5f402044b1c6) -
|
|
14
|
+
Add media render error analytics
|
|
15
|
+
|
|
3
16
|
## 79.5.16
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/compass.yml
CHANGED
|
@@ -14,6 +14,9 @@ fields:
|
|
|
14
14
|
labels:
|
|
15
15
|
- atlassian-platform
|
|
16
16
|
links:
|
|
17
|
+
- name: Root Repository
|
|
18
|
+
type: REPOSITORY
|
|
19
|
+
url: https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master
|
|
17
20
|
- name: ''
|
|
18
21
|
type: REPOSITORY
|
|
19
22
|
url: 'https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master/platform/packages/media/media-card/'
|
package/dist/cjs/card/card.js
CHANGED
|
@@ -20,7 +20,7 @@ var _label = _interopRequireDefault(require("@atlaskit/react-ufo/label"));
|
|
|
20
20
|
var _excluded = ["identifier"];
|
|
21
21
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
22
22
|
var packageName = "@atlaskit/media-card";
|
|
23
|
-
var packageVersion = "
|
|
23
|
+
var packageVersion = "0.0.0-development";
|
|
24
24
|
var CardBase = exports.CardBase = function CardBase(_ref) {
|
|
25
25
|
var identifier = _ref.identifier,
|
|
26
26
|
otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -44,6 +44,7 @@ var _usePressTracing = _interopRequireDefault(require("@atlaskit/react-ufo/use-p
|
|
|
44
44
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
45
45
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
46
46
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
47
|
+
var IMAGE_LOAD_ERROR = 'image-load-error';
|
|
47
48
|
var traceContextRetriever = function traceContextRetriever() {
|
|
48
49
|
var trace = (0, _experienceTraceIdContext.getActiveTrace)();
|
|
49
50
|
if (trace && (0, _platformFeatureFlags.fg)('platform-filecard-ufo-trace')) {
|
|
@@ -90,7 +91,8 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
90
91
|
onMouseEnter = _ref.onMouseEnter,
|
|
91
92
|
videoControlsWrapperRef = _ref.videoControlsWrapperRef,
|
|
92
93
|
viewerOptions = _ref.viewerOptions,
|
|
93
|
-
includeHashForDuplicateFiles = _ref.includeHashForDuplicateFiles
|
|
94
|
+
includeHashForDuplicateFiles = _ref.includeHashForDuplicateFiles,
|
|
95
|
+
onError = _ref.onError;
|
|
94
96
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
95
97
|
formatMessage = _useIntl.formatMessage;
|
|
96
98
|
var _useState = (0, _react.useState)(false),
|
|
@@ -109,6 +111,9 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
109
111
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
110
112
|
cardElement = _useState4[0],
|
|
111
113
|
setCardElement = _useState4[1];
|
|
114
|
+
|
|
115
|
+
// use reference here to avoid excessive calls.
|
|
116
|
+
var onErrorRef = (0, _useCurrentValueRef.useCurrentValueRef)(onError);
|
|
112
117
|
var cardDimensions = dimensions || (0, _cardDimensions.getDefaultCardDimensions)(appearance);
|
|
113
118
|
|
|
114
119
|
// Calculate the preview dimensions if card dimensions are "percentage" based
|
|
@@ -197,6 +202,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
197
202
|
}) : undefined;
|
|
198
203
|
}, [alt, previewDimensions, contextId, fileStateValue, identifier, originalDimensions]);
|
|
199
204
|
var _useFilePreview = (0, _mediaFilePreview.useFilePreview)({
|
|
205
|
+
useSrcSet: true,
|
|
200
206
|
mediaBlobUrlAttrs: mediaBlobUrlAttrs,
|
|
201
207
|
resizeMode: (0, _mediaClient.imageResizeModeToFileImageMode)(resizeMode),
|
|
202
208
|
identifier: identifier,
|
|
@@ -365,6 +371,17 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
365
371
|
}
|
|
366
372
|
});
|
|
367
373
|
|
|
374
|
+
//----------------------------------------------------------------//
|
|
375
|
+
//--------------------- Handling Errors---------------------------//
|
|
376
|
+
//----------------------------------------------------------------//
|
|
377
|
+
|
|
378
|
+
(0, _react.useEffect)(function () {
|
|
379
|
+
if (onErrorRef.current && finalError) {
|
|
380
|
+
var errorReason = finalError.primaryReason;
|
|
381
|
+
onErrorRef.current(errorReason);
|
|
382
|
+
}
|
|
383
|
+
}, [finalError, onErrorRef]);
|
|
384
|
+
|
|
368
385
|
//----------------------------------------------------------------//
|
|
369
386
|
//--------------------- Focus on Close Viewer -------------------//
|
|
370
387
|
//----------------------------------------------------------------//
|
|
@@ -386,10 +403,16 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
386
403
|
setStatus('error');
|
|
387
404
|
};
|
|
388
405
|
var onImageError = function onImageError(newCardPreview) {
|
|
406
|
+
var _onErrorRef$current;
|
|
389
407
|
if (metadata.mimeType === 'image/svg+xml') {
|
|
390
408
|
return;
|
|
391
409
|
}
|
|
392
410
|
onImageErrorBase(newCardPreview);
|
|
411
|
+
|
|
412
|
+
// The image error is not reflected in the status,
|
|
413
|
+
// as the preview might fail to load if the file itself is broken.
|
|
414
|
+
// In that case we want call onError callback.
|
|
415
|
+
(_onErrorRef$current = onErrorRef.current) === null || _onErrorRef$current === void 0 || _onErrorRef$current.call(onErrorRef, IMAGE_LOAD_ERROR);
|
|
393
416
|
};
|
|
394
417
|
var onSvgLoad = function onSvgLoad() {
|
|
395
418
|
setPreviewDidRender(true);
|
|
@@ -87,7 +87,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
87
87
|
}(_react.default.Component);
|
|
88
88
|
(0, _defineProperty2.default)(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
89
89
|
var packageName = "@atlaskit/media-card";
|
|
90
|
-
var packageVersion = "
|
|
90
|
+
var packageVersion = "0.0.0-development";
|
|
91
91
|
|
|
92
92
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
93
93
|
var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
|
|
@@ -116,7 +116,7 @@ var MediaInlineCardLoader = exports.default = /*#__PURE__*/function (_React$Pure
|
|
|
116
116
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
117
117
|
var analyticsContext = {
|
|
118
118
|
packageVersion: "@atlaskit/media-card",
|
|
119
|
-
packageName: "
|
|
119
|
+
packageName: "0.0.0-development",
|
|
120
120
|
componentName: 'mediaInlineCard',
|
|
121
121
|
component: 'mediaInlineCard'
|
|
122
122
|
};
|
|
@@ -15,7 +15,7 @@ var _mediaClient = require("@atlaskit/media-client");
|
|
|
15
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
17
|
var packageName = "@atlaskit/media-card";
|
|
18
|
-
var packageVersion = "
|
|
18
|
+
var packageVersion = "0.0.0-development";
|
|
19
19
|
var SAMPLE_RATE = 0.05;
|
|
20
20
|
var concurrentExperience;
|
|
21
21
|
var getExperience = function getExperience(id) {
|
package/dist/es2019/card/card.js
CHANGED
|
@@ -9,7 +9,7 @@ import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerfor
|
|
|
9
9
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
10
10
|
import UFOLabel from '@atlaskit/react-ufo/label';
|
|
11
11
|
const packageName = "@atlaskit/media-card";
|
|
12
|
-
const packageVersion = "
|
|
12
|
+
const packageVersion = "0.0.0-development";
|
|
13
13
|
export const CardBase = ({
|
|
14
14
|
identifier,
|
|
15
15
|
...otherProps
|
|
@@ -29,6 +29,7 @@ import { AbuseModal } from '@atlaskit/media-ui/abuseModal';
|
|
|
29
29
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
30
30
|
import { getActiveTrace } from '@atlaskit/react-ufo/experience-trace-id-context';
|
|
31
31
|
import usePressTracing from '@atlaskit/react-ufo/use-press-tracing';
|
|
32
|
+
const IMAGE_LOAD_ERROR = 'image-load-error';
|
|
32
33
|
const traceContextRetriever = () => {
|
|
33
34
|
const trace = getActiveTrace();
|
|
34
35
|
if (trace && fg('platform-filecard-ufo-trace')) {
|
|
@@ -71,7 +72,8 @@ export const FileCard = ({
|
|
|
71
72
|
onMouseEnter,
|
|
72
73
|
videoControlsWrapperRef,
|
|
73
74
|
viewerOptions,
|
|
74
|
-
includeHashForDuplicateFiles
|
|
75
|
+
includeHashForDuplicateFiles,
|
|
76
|
+
onError
|
|
75
77
|
}) => {
|
|
76
78
|
const {
|
|
77
79
|
formatMessage
|
|
@@ -87,6 +89,9 @@ export const FileCard = ({
|
|
|
87
89
|
const pressTracing = usePressTracing('click-file-card');
|
|
88
90
|
const mediaClient = useMediaClient();
|
|
89
91
|
const [cardElement, setCardElement] = useState(null);
|
|
92
|
+
|
|
93
|
+
// use reference here to avoid excessive calls.
|
|
94
|
+
const onErrorRef = useCurrentValueRef(onError);
|
|
90
95
|
const cardDimensions = dimensions || getDefaultCardDimensions(appearance);
|
|
91
96
|
|
|
92
97
|
// Calculate the preview dimensions if card dimensions are "percentage" based
|
|
@@ -167,6 +172,7 @@ export const FileCard = ({
|
|
|
167
172
|
getSsrScriptProps,
|
|
168
173
|
copyNodeRef
|
|
169
174
|
} = useFilePreview({
|
|
175
|
+
useSrcSet: true,
|
|
170
176
|
mediaBlobUrlAttrs,
|
|
171
177
|
resizeMode: imageResizeModeToFileImageMode(resizeMode),
|
|
172
178
|
identifier,
|
|
@@ -288,6 +294,17 @@ export const FileCard = ({
|
|
|
288
294
|
}
|
|
289
295
|
});
|
|
290
296
|
|
|
297
|
+
//----------------------------------------------------------------//
|
|
298
|
+
//--------------------- Handling Errors---------------------------//
|
|
299
|
+
//----------------------------------------------------------------//
|
|
300
|
+
|
|
301
|
+
useEffect(() => {
|
|
302
|
+
if (onErrorRef.current && finalError) {
|
|
303
|
+
const errorReason = finalError.primaryReason;
|
|
304
|
+
onErrorRef.current(errorReason);
|
|
305
|
+
}
|
|
306
|
+
}, [finalError, onErrorRef]);
|
|
307
|
+
|
|
291
308
|
//----------------------------------------------------------------//
|
|
292
309
|
//--------------------- Focus on Close Viewer -------------------//
|
|
293
310
|
//----------------------------------------------------------------//
|
|
@@ -309,10 +326,16 @@ export const FileCard = ({
|
|
|
309
326
|
setStatus('error');
|
|
310
327
|
};
|
|
311
328
|
const onImageError = newCardPreview => {
|
|
329
|
+
var _onErrorRef$current;
|
|
312
330
|
if (metadata.mimeType === 'image/svg+xml') {
|
|
313
331
|
return;
|
|
314
332
|
}
|
|
315
333
|
onImageErrorBase(newCardPreview);
|
|
334
|
+
|
|
335
|
+
// The image error is not reflected in the status,
|
|
336
|
+
// as the preview might fail to load if the file itself is broken.
|
|
337
|
+
// In that case we want call onError callback.
|
|
338
|
+
(_onErrorRef$current = onErrorRef.current) === null || _onErrorRef$current === void 0 ? void 0 : _onErrorRef$current.call(onErrorRef, IMAGE_LOAD_ERROR);
|
|
316
339
|
};
|
|
317
340
|
const onSvgLoad = () => {
|
|
318
341
|
setPreviewDidRender(true);
|
|
@@ -66,7 +66,7 @@ class WrappedMediaCardAnalyticsErrorBoundary extends React.Component {
|
|
|
66
66
|
}
|
|
67
67
|
_defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
68
68
|
const packageName = "@atlaskit/media-card";
|
|
69
|
-
const packageVersion = "
|
|
69
|
+
const packageVersion = "0.0.0-development";
|
|
70
70
|
|
|
71
71
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
72
72
|
const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
@@ -37,7 +37,7 @@ export default class MediaInlineCardLoader extends React.PureComponent {
|
|
|
37
37
|
} = this.state;
|
|
38
38
|
const analyticsContext = {
|
|
39
39
|
packageVersion: "@atlaskit/media-card",
|
|
40
|
-
packageName: "
|
|
40
|
+
packageName: "0.0.0-development",
|
|
41
41
|
componentName: 'mediaInlineCard',
|
|
42
42
|
component: 'mediaInlineCard'
|
|
43
43
|
};
|
|
@@ -5,7 +5,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
|
5
5
|
import { MediaCardError } from '../errors';
|
|
6
6
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
7
7
|
const packageName = "@atlaskit/media-card";
|
|
8
|
-
const packageVersion = "
|
|
8
|
+
const packageVersion = "0.0.0-development";
|
|
9
9
|
const SAMPLE_RATE = 0.05;
|
|
10
10
|
let concurrentExperience;
|
|
11
11
|
const getExperience = id => {
|
package/dist/esm/card/card.js
CHANGED
|
@@ -11,7 +11,7 @@ import { startResourceObserver, setAnalyticsContext } from '../utils/mediaPerfor
|
|
|
11
11
|
import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
12
12
|
import UFOLabel from '@atlaskit/react-ufo/label';
|
|
13
13
|
var packageName = "@atlaskit/media-card";
|
|
14
|
-
var packageVersion = "
|
|
14
|
+
var packageVersion = "0.0.0-development";
|
|
15
15
|
export var CardBase = function CardBase(_ref) {
|
|
16
16
|
var identifier = _ref.identifier,
|
|
17
17
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -36,6 +36,7 @@ import { AbuseModal } from '@atlaskit/media-ui/abuseModal';
|
|
|
36
36
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
37
37
|
import { getActiveTrace } from '@atlaskit/react-ufo/experience-trace-id-context';
|
|
38
38
|
import usePressTracing from '@atlaskit/react-ufo/use-press-tracing';
|
|
39
|
+
var IMAGE_LOAD_ERROR = 'image-load-error';
|
|
39
40
|
var traceContextRetriever = function traceContextRetriever() {
|
|
40
41
|
var trace = getActiveTrace();
|
|
41
42
|
if (trace && fg('platform-filecard-ufo-trace')) {
|
|
@@ -82,7 +83,8 @@ export var FileCard = function FileCard(_ref) {
|
|
|
82
83
|
onMouseEnter = _ref.onMouseEnter,
|
|
83
84
|
videoControlsWrapperRef = _ref.videoControlsWrapperRef,
|
|
84
85
|
viewerOptions = _ref.viewerOptions,
|
|
85
|
-
includeHashForDuplicateFiles = _ref.includeHashForDuplicateFiles
|
|
86
|
+
includeHashForDuplicateFiles = _ref.includeHashForDuplicateFiles,
|
|
87
|
+
onError = _ref.onError;
|
|
86
88
|
var _useIntl = useIntl(),
|
|
87
89
|
formatMessage = _useIntl.formatMessage;
|
|
88
90
|
var _useState = useState(false),
|
|
@@ -101,6 +103,9 @@ export var FileCard = function FileCard(_ref) {
|
|
|
101
103
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
102
104
|
cardElement = _useState4[0],
|
|
103
105
|
setCardElement = _useState4[1];
|
|
106
|
+
|
|
107
|
+
// use reference here to avoid excessive calls.
|
|
108
|
+
var onErrorRef = useCurrentValueRef(onError);
|
|
104
109
|
var cardDimensions = dimensions || getDefaultCardDimensions(appearance);
|
|
105
110
|
|
|
106
111
|
// Calculate the preview dimensions if card dimensions are "percentage" based
|
|
@@ -189,6 +194,7 @@ export var FileCard = function FileCard(_ref) {
|
|
|
189
194
|
}) : undefined;
|
|
190
195
|
}, [alt, previewDimensions, contextId, fileStateValue, identifier, originalDimensions]);
|
|
191
196
|
var _useFilePreview = useFilePreview({
|
|
197
|
+
useSrcSet: true,
|
|
192
198
|
mediaBlobUrlAttrs: mediaBlobUrlAttrs,
|
|
193
199
|
resizeMode: imageResizeModeToFileImageMode(resizeMode),
|
|
194
200
|
identifier: identifier,
|
|
@@ -357,6 +363,17 @@ export var FileCard = function FileCard(_ref) {
|
|
|
357
363
|
}
|
|
358
364
|
});
|
|
359
365
|
|
|
366
|
+
//----------------------------------------------------------------//
|
|
367
|
+
//--------------------- Handling Errors---------------------------//
|
|
368
|
+
//----------------------------------------------------------------//
|
|
369
|
+
|
|
370
|
+
useEffect(function () {
|
|
371
|
+
if (onErrorRef.current && finalError) {
|
|
372
|
+
var errorReason = finalError.primaryReason;
|
|
373
|
+
onErrorRef.current(errorReason);
|
|
374
|
+
}
|
|
375
|
+
}, [finalError, onErrorRef]);
|
|
376
|
+
|
|
360
377
|
//----------------------------------------------------------------//
|
|
361
378
|
//--------------------- Focus on Close Viewer -------------------//
|
|
362
379
|
//----------------------------------------------------------------//
|
|
@@ -378,10 +395,16 @@ export var FileCard = function FileCard(_ref) {
|
|
|
378
395
|
setStatus('error');
|
|
379
396
|
};
|
|
380
397
|
var onImageError = function onImageError(newCardPreview) {
|
|
398
|
+
var _onErrorRef$current;
|
|
381
399
|
if (metadata.mimeType === 'image/svg+xml') {
|
|
382
400
|
return;
|
|
383
401
|
}
|
|
384
402
|
onImageErrorBase(newCardPreview);
|
|
403
|
+
|
|
404
|
+
// The image error is not reflected in the status,
|
|
405
|
+
// as the preview might fail to load if the file itself is broken.
|
|
406
|
+
// In that case we want call onError callback.
|
|
407
|
+
(_onErrorRef$current = onErrorRef.current) === null || _onErrorRef$current === void 0 || _onErrorRef$current.call(onErrorRef, IMAGE_LOAD_ERROR);
|
|
385
408
|
};
|
|
386
409
|
var onSvgLoad = function onSvgLoad() {
|
|
387
410
|
setPreviewDidRender(true);
|
|
@@ -80,7 +80,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
80
80
|
}(React.Component);
|
|
81
81
|
_defineProperty(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
82
82
|
var packageName = "@atlaskit/media-card";
|
|
83
|
-
var packageVersion = "
|
|
83
|
+
var packageVersion = "0.0.0-development";
|
|
84
84
|
|
|
85
85
|
// @ts-ignore: [PIT-1685] Fails in post-office due to backwards incompatibility issue with React 18
|
|
86
86
|
var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
@@ -101,7 +101,7 @@ var MediaInlineCardLoader = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
101
101
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
102
102
|
var analyticsContext = {
|
|
103
103
|
packageVersion: "@atlaskit/media-card",
|
|
104
|
-
packageName: "
|
|
104
|
+
packageName: "0.0.0-development",
|
|
105
105
|
componentName: 'mediaInlineCard',
|
|
106
106
|
component: 'mediaInlineCard'
|
|
107
107
|
};
|
|
@@ -8,7 +8,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
|
8
8
|
import { MediaCardError } from '../errors';
|
|
9
9
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
10
10
|
var packageName = "@atlaskit/media-card";
|
|
11
|
-
var packageVersion = "
|
|
11
|
+
var packageVersion = "0.0.0-development";
|
|
12
12
|
var SAMPLE_RATE = 0.05;
|
|
13
13
|
var concurrentExperience;
|
|
14
14
|
var getExperience = function getExperience(id) {
|
|
@@ -2,8 +2,12 @@ import { type FileIdentifier, type Identifier, type ImageResizeMode } from '@atl
|
|
|
2
2
|
import { type MediaFeatureFlags, type NumericalCardDimensions, type SSR } from '@atlaskit/media-common';
|
|
3
3
|
import { type ViewerOptionsProps } from '@atlaskit/media-viewer';
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import { type MediaCardErrorPrimaryReason } from '../errors';
|
|
5
6
|
import { type CardAppearance, type CardDimensions, type CardEventProps, type TitleBoxIcon } from '../types';
|
|
7
|
+
import { type MediaFilePreviewErrorPrimaryReason } from '@atlaskit/media-file-preview';
|
|
6
8
|
import { type CardAction } from './actions';
|
|
9
|
+
declare const IMAGE_LOAD_ERROR = "image-load-error";
|
|
10
|
+
export type ImageLoadErrorType = typeof IMAGE_LOAD_ERROR;
|
|
7
11
|
export interface FileCardProps extends CardEventProps {
|
|
8
12
|
/** Overlay the media file. */
|
|
9
13
|
readonly disableOverlay?: boolean;
|
|
@@ -52,5 +56,8 @@ export interface FileCardProps extends CardEventProps {
|
|
|
52
56
|
readonly viewerOptions?: ViewerOptionsProps;
|
|
53
57
|
/** Sets options for viewer **/
|
|
54
58
|
readonly includeHashForDuplicateFiles?: boolean;
|
|
59
|
+
/** General Error handling include status errors and display errors*/
|
|
60
|
+
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason | ImageLoadErrorType) => void;
|
|
55
61
|
}
|
|
56
|
-
export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, }: FileCardProps) => React.JSX.Element;
|
|
62
|
+
export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, onError, }: FileCardProps) => React.JSX.Element;
|
|
63
|
+
export {};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -8,8 +8,10 @@ import { type MediaSettings } from '@atlaskit/media-client-react';
|
|
|
8
8
|
import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
9
9
|
import { type MediaFeatureFlags, type NumericalCardDimensions, type SSR } from '@atlaskit/media-common';
|
|
10
10
|
import { type CardAction } from './card/actions';
|
|
11
|
-
import { type MediaCardError } from './errors';
|
|
11
|
+
import { type MediaCardError, type MediaCardErrorPrimaryReason } from './errors';
|
|
12
12
|
import { type ViewerOptionsProps } from '@atlaskit/media-viewer';
|
|
13
|
+
import type { MediaFilePreviewErrorPrimaryReason } from '@atlaskit/media-file-preview';
|
|
14
|
+
import type { ImageLoadErrorType } from './card/fileCard';
|
|
13
15
|
export type CardStatus = 'uploading' | 'loading' | 'processing' | 'loading-preview' | 'complete' | 'error' | 'failed-processing';
|
|
14
16
|
export type FilePreviewStatus = {
|
|
15
17
|
hasFilesize: boolean;
|
|
@@ -109,6 +111,8 @@ export interface CardProps extends SharedCardProps, CardEventProps {
|
|
|
109
111
|
readonly shouldHideTooltip?: boolean;
|
|
110
112
|
/** General Media Settings */
|
|
111
113
|
readonly mediaSettings?: MediaSettings;
|
|
114
|
+
/** General Error handling include status errors and display errors*/
|
|
115
|
+
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason | ImageLoadErrorType) => void;
|
|
112
116
|
}
|
|
113
117
|
export interface CardState {
|
|
114
118
|
status: CardStatus;
|
|
@@ -2,8 +2,12 @@ import { type FileIdentifier, type Identifier, type ImageResizeMode } from '@atl
|
|
|
2
2
|
import { type MediaFeatureFlags, type NumericalCardDimensions, type SSR } from '@atlaskit/media-common';
|
|
3
3
|
import { type ViewerOptionsProps } from '@atlaskit/media-viewer';
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import { type MediaCardErrorPrimaryReason } from '../errors';
|
|
5
6
|
import { type CardAppearance, type CardDimensions, type CardEventProps, type TitleBoxIcon } from '../types';
|
|
7
|
+
import { type MediaFilePreviewErrorPrimaryReason } from '@atlaskit/media-file-preview';
|
|
6
8
|
import { type CardAction } from './actions';
|
|
9
|
+
declare const IMAGE_LOAD_ERROR = "image-load-error";
|
|
10
|
+
export type ImageLoadErrorType = typeof IMAGE_LOAD_ERROR;
|
|
7
11
|
export interface FileCardProps extends CardEventProps {
|
|
8
12
|
/** Overlay the media file. */
|
|
9
13
|
readonly disableOverlay?: boolean;
|
|
@@ -52,5 +56,8 @@ export interface FileCardProps extends CardEventProps {
|
|
|
52
56
|
readonly viewerOptions?: ViewerOptionsProps;
|
|
53
57
|
/** Sets options for viewer **/
|
|
54
58
|
readonly includeHashForDuplicateFiles?: boolean;
|
|
59
|
+
/** General Error handling include status errors and display errors*/
|
|
60
|
+
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason | ImageLoadErrorType) => void;
|
|
55
61
|
}
|
|
56
|
-
export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, }: FileCardProps) => React.JSX.Element;
|
|
62
|
+
export declare const FileCard: ({ appearance, resizeMode, isLazy, disableOverlay, featureFlags, identifier, ssr, dimensions, originalDimensions, contextId, alt, actions, shouldEnableDownloadButton, useInlinePlayer, shouldOpenMediaViewer, onFullscreenChange, selectable, selected, testId, titleBoxBgColor, titleBoxIcon, shouldHideTooltip, mediaViewerItems, onClick, onMouseEnter, videoControlsWrapperRef, viewerOptions, includeHashForDuplicateFiles, onError, }: FileCardProps) => React.JSX.Element;
|
|
63
|
+
export {};
|
|
@@ -8,8 +8,10 @@ import { type MediaSettings } from '@atlaskit/media-client-react';
|
|
|
8
8
|
import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
9
9
|
import { type MediaFeatureFlags, type NumericalCardDimensions, type SSR } from '@atlaskit/media-common';
|
|
10
10
|
import { type CardAction } from './card/actions';
|
|
11
|
-
import { type MediaCardError } from './errors';
|
|
11
|
+
import { type MediaCardError, type MediaCardErrorPrimaryReason } from './errors';
|
|
12
12
|
import { type ViewerOptionsProps } from '@atlaskit/media-viewer';
|
|
13
|
+
import type { MediaFilePreviewErrorPrimaryReason } from '@atlaskit/media-file-preview';
|
|
14
|
+
import type { ImageLoadErrorType } from './card/fileCard';
|
|
13
15
|
export type CardStatus = 'uploading' | 'loading' | 'processing' | 'loading-preview' | 'complete' | 'error' | 'failed-processing';
|
|
14
16
|
export type FilePreviewStatus = {
|
|
15
17
|
hasFilesize: boolean;
|
|
@@ -109,6 +111,8 @@ export interface CardProps extends SharedCardProps, CardEventProps {
|
|
|
109
111
|
readonly shouldHideTooltip?: boolean;
|
|
110
112
|
/** General Media Settings */
|
|
111
113
|
readonly mediaSettings?: MediaSettings;
|
|
114
|
+
/** General Error handling include status errors and display errors*/
|
|
115
|
+
readonly onError?: (reason: MediaFilePreviewErrorPrimaryReason | MediaCardErrorPrimaryReason | ImageLoadErrorType) => void;
|
|
112
116
|
}
|
|
113
117
|
export interface CardState {
|
|
114
118
|
status: CardStatus;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "79.
|
|
3
|
+
"version": "79.6.1",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
35
35
|
"@atlaskit/dropdown-menu": "^16.3.0",
|
|
36
|
-
"@atlaskit/editor-shared-styles": "^3.
|
|
36
|
+
"@atlaskit/editor-shared-styles": "^3.8.0",
|
|
37
37
|
"@atlaskit/icon": "^28.5.0",
|
|
38
38
|
"@atlaskit/link": "^3.2.0",
|
|
39
39
|
"@atlaskit/media-client": "^35.5.0",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"@atlaskit/media-ui": "^28.7.0",
|
|
45
45
|
"@atlaskit/media-viewer": "^52.4.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
|
-
"@atlaskit/primitives": "^16.
|
|
48
|
-
"@atlaskit/react-ufo": "^4.
|
|
47
|
+
"@atlaskit/primitives": "^16.1.0",
|
|
48
|
+
"@atlaskit/react-ufo": "^4.14.0",
|
|
49
49
|
"@atlaskit/spinner": "^19.0.0",
|
|
50
50
|
"@atlaskit/theme": "^21.0.0",
|
|
51
|
-
"@atlaskit/tokens": "^
|
|
52
|
-
"@atlaskit/tooltip": "^20.
|
|
51
|
+
"@atlaskit/tokens": "^8.0.0",
|
|
52
|
+
"@atlaskit/tooltip": "^20.8.0",
|
|
53
53
|
"@atlaskit/ufo": "^0.4.0",
|
|
54
54
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
55
55
|
"@babel/runtime": "^7.0.0",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@atlaskit/analytics-listeners": "^9.1.0",
|
|
73
73
|
"@atlaskit/analytics-namespaced-context": "^7.1.0",
|
|
74
74
|
"@atlaskit/form": "^14.2.0",
|
|
75
|
-
"@atlaskit/inline-message": "^15.
|
|
75
|
+
"@atlaskit/inline-message": "^15.4.0",
|
|
76
76
|
"@atlaskit/media-core": "^37.0.0",
|
|
77
77
|
"@atlaskit/media-picker": "^70.0.0",
|
|
78
78
|
"@atlaskit/media-state": "^1.8.0",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"@atlaskit/range": "^9.2.0",
|
|
83
83
|
"@atlaskit/ssr": "workspace:^",
|
|
84
84
|
"@atlaskit/toggle": "^15.1.0",
|
|
85
|
-
"@atlassian/feature-flags-test-utils": "^0.
|
|
85
|
+
"@atlassian/feature-flags-test-utils": "^1.0.0",
|
|
86
86
|
"@atlassian/ufo": "^0.7.0",
|
|
87
87
|
"@testing-library/dom": "^10.1.0",
|
|
88
88
|
"@testing-library/react": "^13.4.0",
|