@atlaskit/media-card 79.5.16 → 79.6.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 +7 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/fileCard.js +23 -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 +23 -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 +23 -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 +4 -4
package/CHANGELOG.md
CHANGED
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
|
|
@@ -365,6 +370,17 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
365
370
|
}
|
|
366
371
|
});
|
|
367
372
|
|
|
373
|
+
//----------------------------------------------------------------//
|
|
374
|
+
//--------------------- Handling Errors---------------------------//
|
|
375
|
+
//----------------------------------------------------------------//
|
|
376
|
+
|
|
377
|
+
(0, _react.useEffect)(function () {
|
|
378
|
+
if (onErrorRef.current && finalError) {
|
|
379
|
+
var errorReason = finalError.primaryReason;
|
|
380
|
+
onErrorRef.current(errorReason);
|
|
381
|
+
}
|
|
382
|
+
}, [finalError, onErrorRef]);
|
|
383
|
+
|
|
368
384
|
//----------------------------------------------------------------//
|
|
369
385
|
//--------------------- Focus on Close Viewer -------------------//
|
|
370
386
|
//----------------------------------------------------------------//
|
|
@@ -386,10 +402,16 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
386
402
|
setStatus('error');
|
|
387
403
|
};
|
|
388
404
|
var onImageError = function onImageError(newCardPreview) {
|
|
405
|
+
var _onErrorRef$current;
|
|
389
406
|
if (metadata.mimeType === 'image/svg+xml') {
|
|
390
407
|
return;
|
|
391
408
|
}
|
|
392
409
|
onImageErrorBase(newCardPreview);
|
|
410
|
+
|
|
411
|
+
// The image error is not reflected in the status,
|
|
412
|
+
// as the preview might fail to load if the file itself is broken.
|
|
413
|
+
// In that case we want call onError callback.
|
|
414
|
+
(_onErrorRef$current = onErrorRef.current) === null || _onErrorRef$current === void 0 || _onErrorRef$current.call(onErrorRef, IMAGE_LOAD_ERROR);
|
|
393
415
|
};
|
|
394
416
|
var onSvgLoad = function onSvgLoad() {
|
|
395
417
|
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
|
|
@@ -288,6 +293,17 @@ export const FileCard = ({
|
|
|
288
293
|
}
|
|
289
294
|
});
|
|
290
295
|
|
|
296
|
+
//----------------------------------------------------------------//
|
|
297
|
+
//--------------------- Handling Errors---------------------------//
|
|
298
|
+
//----------------------------------------------------------------//
|
|
299
|
+
|
|
300
|
+
useEffect(() => {
|
|
301
|
+
if (onErrorRef.current && finalError) {
|
|
302
|
+
const errorReason = finalError.primaryReason;
|
|
303
|
+
onErrorRef.current(errorReason);
|
|
304
|
+
}
|
|
305
|
+
}, [finalError, onErrorRef]);
|
|
306
|
+
|
|
291
307
|
//----------------------------------------------------------------//
|
|
292
308
|
//--------------------- Focus on Close Viewer -------------------//
|
|
293
309
|
//----------------------------------------------------------------//
|
|
@@ -309,10 +325,16 @@ export const FileCard = ({
|
|
|
309
325
|
setStatus('error');
|
|
310
326
|
};
|
|
311
327
|
const onImageError = newCardPreview => {
|
|
328
|
+
var _onErrorRef$current;
|
|
312
329
|
if (metadata.mimeType === 'image/svg+xml') {
|
|
313
330
|
return;
|
|
314
331
|
}
|
|
315
332
|
onImageErrorBase(newCardPreview);
|
|
333
|
+
|
|
334
|
+
// The image error is not reflected in the status,
|
|
335
|
+
// as the preview might fail to load if the file itself is broken.
|
|
336
|
+
// In that case we want call onError callback.
|
|
337
|
+
(_onErrorRef$current = onErrorRef.current) === null || _onErrorRef$current === void 0 ? void 0 : _onErrorRef$current.call(onErrorRef, IMAGE_LOAD_ERROR);
|
|
316
338
|
};
|
|
317
339
|
const onSvgLoad = () => {
|
|
318
340
|
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
|
|
@@ -357,6 +362,17 @@ export var FileCard = function FileCard(_ref) {
|
|
|
357
362
|
}
|
|
358
363
|
});
|
|
359
364
|
|
|
365
|
+
//----------------------------------------------------------------//
|
|
366
|
+
//--------------------- Handling Errors---------------------------//
|
|
367
|
+
//----------------------------------------------------------------//
|
|
368
|
+
|
|
369
|
+
useEffect(function () {
|
|
370
|
+
if (onErrorRef.current && finalError) {
|
|
371
|
+
var errorReason = finalError.primaryReason;
|
|
372
|
+
onErrorRef.current(errorReason);
|
|
373
|
+
}
|
|
374
|
+
}, [finalError, onErrorRef]);
|
|
375
|
+
|
|
360
376
|
//----------------------------------------------------------------//
|
|
361
377
|
//--------------------- Focus on Close Viewer -------------------//
|
|
362
378
|
//----------------------------------------------------------------//
|
|
@@ -378,10 +394,16 @@ export var FileCard = function FileCard(_ref) {
|
|
|
378
394
|
setStatus('error');
|
|
379
395
|
};
|
|
380
396
|
var onImageError = function onImageError(newCardPreview) {
|
|
397
|
+
var _onErrorRef$current;
|
|
381
398
|
if (metadata.mimeType === 'image/svg+xml') {
|
|
382
399
|
return;
|
|
383
400
|
}
|
|
384
401
|
onImageErrorBase(newCardPreview);
|
|
402
|
+
|
|
403
|
+
// The image error is not reflected in the status,
|
|
404
|
+
// as the preview might fail to load if the file itself is broken.
|
|
405
|
+
// In that case we want call onError callback.
|
|
406
|
+
(_onErrorRef$current = onErrorRef.current) === null || _onErrorRef$current === void 0 || _onErrorRef$current.call(onErrorRef, IMAGE_LOAD_ERROR);
|
|
385
407
|
};
|
|
386
408
|
var onSvgLoad = function onSvgLoad() {
|
|
387
409
|
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.0",
|
|
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",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@atlaskit/spinner": "^19.0.0",
|
|
50
50
|
"@atlaskit/theme": "^21.0.0",
|
|
51
51
|
"@atlaskit/tokens": "^7.0.0",
|
|
52
|
-
"@atlaskit/tooltip": "^20.
|
|
52
|
+
"@atlaskit/tooltip": "^20.6.0",
|
|
53
53
|
"@atlaskit/ufo": "^0.4.0",
|
|
54
54
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
55
55
|
"@babel/runtime": "^7.0.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",
|