@atlaskit/media-card 77.3.0 → 77.4.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 +17 -0
- package/dist/cjs/card/card.js +1 -1
- package/dist/cjs/card/getCardPreview/cache.js +1 -1
- package/dist/cjs/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/cjs/card/v2/cardV2.js +1 -1
- package/dist/cjs/card/v2/fileCard.js +1 -1
- package/dist/cjs/errors.js +33 -55
- 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/getCardPreview/cache.js +2 -0
- package/dist/es2019/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/es2019/card/v2/cardV2.js +1 -1
- package/dist/es2019/card/v2/fileCard.js +2 -2
- package/dist/es2019/errors.js +1 -17
- 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/getCardPreview/cache.js +2 -0
- package/dist/esm/card/media-card-analytics-error-boundary.js +1 -1
- package/dist/esm/card/v2/cardV2.js +1 -1
- package/dist/esm/card/v2/fileCard.js +2 -2
- package/dist/esm/errors.js +31 -55
- package/dist/esm/inline/loader.js +1 -1
- package/dist/esm/utils/ufoExperiences.js +1 -1
- package/dist/types/errors.d.ts +1 -7
- package/dist/types-ts4.5/errors.d.ts +1 -7
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/media-card
|
|
2
2
|
|
|
3
|
+
## 77.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 77.4.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#43014](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/43014) [`f021d31543e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f021d31543e) - create useFileState hook versions of header and itemviewer, create list-v2, refactor MediaFileStateError to media-client-react
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#42702](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42702) [`79e5ed8fac7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/79e5ed8fac7) - ED-19543 remove unused FF check
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 77.3.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/dist/cjs/card/card.js
CHANGED
|
@@ -49,7 +49,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
49
49
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
50
50
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
51
51
|
var packageName = "@atlaskit/media-card";
|
|
52
|
-
var packageVersion = "77.
|
|
52
|
+
var packageVersion = "77.4.1";
|
|
53
53
|
var CardBase = exports.CardBase = /*#__PURE__*/function (_Component) {
|
|
54
54
|
(0, _inherits2.default)(CardBase, _Component);
|
|
55
55
|
var _super = _createSuper(CardBase);
|
|
@@ -35,5 +35,5 @@ var CardPreviewCacheImpl = exports.CardPreviewCacheImpl = /*#__PURE__*/(0, _crea
|
|
|
35
35
|
_this.previewCache.clear();
|
|
36
36
|
});
|
|
37
37
|
this.previewCache = previewCache;
|
|
38
|
-
});
|
|
38
|
+
}); // eslint-disable-next-line import/no-anonymous-default-export
|
|
39
39
|
var _default = exports.default = new CardPreviewCacheImpl((0, _objectURLCache.createObjectURLCache)());
|
|
@@ -90,7 +90,7 @@ var WrappedMediaCardAnalyticsErrorBoundary = /*#__PURE__*/function (_React$Compo
|
|
|
90
90
|
}(_react.default.Component);
|
|
91
91
|
(0, _defineProperty2.default)(WrappedMediaCardAnalyticsErrorBoundary, "displayName", 'MediaCardAnalyticsErrorBoundary');
|
|
92
92
|
var packageName = "@atlaskit/media-card";
|
|
93
|
-
var packageVersion = "77.
|
|
93
|
+
var packageVersion = "77.4.1";
|
|
94
94
|
var MediaCardAnalyticsErrorBoundary = (0, _mediaCommon.withMediaAnalyticsContext)({
|
|
95
95
|
packageVersion: packageVersion,
|
|
96
96
|
packageName: packageName,
|
|
@@ -16,7 +16,7 @@ var _externalImageCard = require("./externalImageCard");
|
|
|
16
16
|
var _fileCard = require("./fileCard");
|
|
17
17
|
var _excluded = ["identifier"];
|
|
18
18
|
var packageName = "@atlaskit/media-card";
|
|
19
|
-
var packageVersion = "77.
|
|
19
|
+
var packageVersion = "77.4.1";
|
|
20
20
|
var CardV2Base = exports.CardV2Base = function CardV2Base(_ref) {
|
|
21
21
|
var identifier = _ref.identifier,
|
|
22
22
|
otherProps = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -878,7 +878,7 @@ var FileCard = exports.FileCard = function FileCard(_ref) {
|
|
|
878
878
|
setStatus(newStatus);
|
|
879
879
|
uploadProgressRef.current = newProgress;
|
|
880
880
|
} else {
|
|
881
|
-
var e = new
|
|
881
|
+
var e = new _mediaClientReact.MediaFileStateError(fileState.id, fileState.reason, fileState.message, fileState.details);
|
|
882
882
|
var errorReason = status === 'uploading' ? 'upload' : 'metadata-fetch';
|
|
883
883
|
setError(new _errors.MediaCardError(errorReason, e));
|
|
884
884
|
setStatus('error');
|
package/dist/cjs/errors.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.ensureMediaCardError = exports.SsrPreviewError = exports.RemotePreviewError = exports.
|
|
7
|
+
exports.ensureMediaCardError = exports.SsrPreviewError = exports.RemotePreviewError = exports.MediaCardError = exports.LocalPreviewError = exports.ImageLoadError = void 0;
|
|
8
8
|
exports.getFileStateErrorReason = getFileStateErrorReason;
|
|
9
9
|
exports.getImageLoadPrimaryReason = void 0;
|
|
10
10
|
exports.isImageLoadError = isImageLoadError;
|
|
@@ -22,38 +22,16 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
22
22
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
23
|
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
24
24
|
var _mediaClient = require("@atlaskit/media-client");
|
|
25
|
+
var _mediaClientReact = require("@atlaskit/media-client-react");
|
|
25
26
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
26
27
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
27
28
|
/**
|
|
28
29
|
* Primary reason is logged through Data Portal.
|
|
29
30
|
* Make sure all the values are whitelisted in Measure -> Event Regitry -> "mediaCardRender failed" event
|
|
30
31
|
*/
|
|
31
|
-
var MediaFileStateError = exports.MediaFileStateError = /*#__PURE__*/function (_Error) {
|
|
32
|
-
(0, _inherits2.default)(MediaFileStateError, _Error);
|
|
33
|
-
var _super = _createSuper(MediaFileStateError);
|
|
34
|
-
function MediaFileStateError(id, reason) {
|
|
35
|
-
var _this;
|
|
36
|
-
var message = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
37
|
-
var details = arguments.length > 3 ? arguments[3] : undefined;
|
|
38
|
-
(0, _classCallCheck2.default)(this, MediaFileStateError);
|
|
39
|
-
_this = _super.call(this, reason);
|
|
40
|
-
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
|
|
41
|
-
_this.id = id;
|
|
42
|
-
_this.reason = reason;
|
|
43
|
-
_this.message = message;
|
|
44
|
-
_this.details = details;
|
|
45
|
-
Object.setPrototypeOf((0, _assertThisInitialized2.default)(_this), (this instanceof MediaFileStateError ? this.constructor : void 0).prototype);
|
|
46
32
|
|
|
47
|
-
// https://v8.dev/docs/stack-trace-api
|
|
48
|
-
if ('captureStackTrace' in Error) {
|
|
49
|
-
Error.captureStackTrace((0, _assertThisInitialized2.default)(_this), this instanceof MediaFileStateError ? this.constructor : void 0);
|
|
50
|
-
}
|
|
51
|
-
return _this;
|
|
52
|
-
}
|
|
53
|
-
return (0, _createClass2.default)(MediaFileStateError);
|
|
54
|
-
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
55
33
|
function isMediaFileStateError(err) {
|
|
56
|
-
return err instanceof MediaFileStateError;
|
|
34
|
+
return err instanceof _mediaClientReact.MediaFileStateError;
|
|
57
35
|
}
|
|
58
36
|
function getFileStateErrorReason(err) {
|
|
59
37
|
var _err$details$reason, _err$details;
|
|
@@ -79,62 +57,62 @@ function isRateLimitedError(error) {
|
|
|
79
57
|
}
|
|
80
58
|
return false;
|
|
81
59
|
}
|
|
82
|
-
var MediaCardError = exports.MediaCardError = /*#__PURE__*/function (
|
|
83
|
-
(0, _inherits2.default)(MediaCardError,
|
|
84
|
-
var
|
|
60
|
+
var MediaCardError = exports.MediaCardError = /*#__PURE__*/function (_Error) {
|
|
61
|
+
(0, _inherits2.default)(MediaCardError, _Error);
|
|
62
|
+
var _super = _createSuper(MediaCardError);
|
|
85
63
|
function MediaCardError(primaryReason, secondaryError) {
|
|
86
|
-
var
|
|
64
|
+
var _this;
|
|
87
65
|
(0, _classCallCheck2.default)(this, MediaCardError);
|
|
88
|
-
|
|
66
|
+
_this = _super.call(this, primaryReason);
|
|
89
67
|
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
Object.setPrototypeOf((0, _assertThisInitialized2.default)(
|
|
68
|
+
_this.primaryReason = primaryReason;
|
|
69
|
+
_this.secondaryError = secondaryError;
|
|
70
|
+
Object.setPrototypeOf((0, _assertThisInitialized2.default)(_this), (this instanceof MediaCardError ? this.constructor : void 0).prototype);
|
|
93
71
|
|
|
94
72
|
// https://v8.dev/docs/stack-trace-api
|
|
95
73
|
if ('captureStackTrace' in Error) {
|
|
96
|
-
Error.captureStackTrace((0, _assertThisInitialized2.default)(
|
|
74
|
+
Error.captureStackTrace((0, _assertThisInitialized2.default)(_this), this instanceof MediaCardError ? this.constructor : void 0);
|
|
97
75
|
}
|
|
98
|
-
return
|
|
76
|
+
return _this;
|
|
99
77
|
}
|
|
100
78
|
return (0, _createClass2.default)(MediaCardError);
|
|
101
79
|
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
102
80
|
var LocalPreviewError = exports.LocalPreviewError = /*#__PURE__*/function (_MediaCardError) {
|
|
103
81
|
(0, _inherits2.default)(LocalPreviewError, _MediaCardError);
|
|
104
|
-
var
|
|
82
|
+
var _super2 = _createSuper(LocalPreviewError);
|
|
105
83
|
function LocalPreviewError(primaryReason, secondaryError) {
|
|
106
|
-
var
|
|
84
|
+
var _this2;
|
|
107
85
|
(0, _classCallCheck2.default)(this, LocalPreviewError);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return
|
|
86
|
+
_this2 = _super2.call(this, primaryReason, secondaryError);
|
|
87
|
+
_this2.primaryReason = primaryReason;
|
|
88
|
+
_this2.secondaryError = secondaryError;
|
|
89
|
+
return _this2;
|
|
112
90
|
}
|
|
113
91
|
return (0, _createClass2.default)(LocalPreviewError);
|
|
114
92
|
}(MediaCardError);
|
|
115
93
|
var RemotePreviewError = exports.RemotePreviewError = /*#__PURE__*/function (_MediaCardError2) {
|
|
116
94
|
(0, _inherits2.default)(RemotePreviewError, _MediaCardError2);
|
|
117
|
-
var
|
|
95
|
+
var _super3 = _createSuper(RemotePreviewError);
|
|
118
96
|
function RemotePreviewError(primaryReason, secondaryError) {
|
|
119
|
-
var
|
|
97
|
+
var _this3;
|
|
120
98
|
(0, _classCallCheck2.default)(this, RemotePreviewError);
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return
|
|
99
|
+
_this3 = _super3.call(this, primaryReason, secondaryError);
|
|
100
|
+
_this3.primaryReason = primaryReason;
|
|
101
|
+
_this3.secondaryError = secondaryError;
|
|
102
|
+
return _this3;
|
|
125
103
|
}
|
|
126
104
|
return (0, _createClass2.default)(RemotePreviewError);
|
|
127
105
|
}(MediaCardError);
|
|
128
106
|
var SsrPreviewError = exports.SsrPreviewError = /*#__PURE__*/function (_MediaCardError3) {
|
|
129
107
|
(0, _inherits2.default)(SsrPreviewError, _MediaCardError3);
|
|
130
|
-
var
|
|
108
|
+
var _super4 = _createSuper(SsrPreviewError);
|
|
131
109
|
function SsrPreviewError(primaryReason, secondaryError) {
|
|
132
|
-
var
|
|
110
|
+
var _this4;
|
|
133
111
|
(0, _classCallCheck2.default)(this, SsrPreviewError);
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return
|
|
112
|
+
_this4 = _super4.call(this, primaryReason, secondaryError);
|
|
113
|
+
_this4.primaryReason = primaryReason;
|
|
114
|
+
_this4.secondaryError = secondaryError;
|
|
115
|
+
return _this4;
|
|
138
116
|
}
|
|
139
117
|
return (0, _createClass2.default)(SsrPreviewError);
|
|
140
118
|
}(MediaCardError);
|
|
@@ -157,10 +135,10 @@ var getImageLoadPrimaryReason = exports.getImageLoadPrimaryReason = function get
|
|
|
157
135
|
};
|
|
158
136
|
var ImageLoadError = exports.ImageLoadError = /*#__PURE__*/function (_MediaCardError4) {
|
|
159
137
|
(0, _inherits2.default)(ImageLoadError, _MediaCardError4);
|
|
160
|
-
var
|
|
138
|
+
var _super5 = _createSuper(ImageLoadError);
|
|
161
139
|
function ImageLoadError(source) {
|
|
162
140
|
(0, _classCallCheck2.default)(this, ImageLoadError);
|
|
163
|
-
return
|
|
141
|
+
return _super5.call(this, getImageLoadPrimaryReason(source));
|
|
164
142
|
}
|
|
165
143
|
return (0, _createClass2.default)(ImageLoadError);
|
|
166
144
|
}(MediaCardError);
|
|
@@ -119,7 +119,7 @@ var MediaInlineCardLoader = exports.default = /*#__PURE__*/function (_React$Pure
|
|
|
119
119
|
ErrorBoundary = _this$state.ErrorBoundary;
|
|
120
120
|
var analyticsContext = {
|
|
121
121
|
packageVersion: "@atlaskit/media-card",
|
|
122
|
-
packageName: "77.
|
|
122
|
+
packageName: "77.4.1",
|
|
123
123
|
componentName: 'mediaInlineCard',
|
|
124
124
|
component: 'mediaInlineCard'
|
|
125
125
|
};
|
|
@@ -14,7 +14,7 @@ var _mediaClient = require("@atlaskit/media-client");
|
|
|
14
14
|
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; }
|
|
15
15
|
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; }
|
|
16
16
|
var packageName = "@atlaskit/media-card";
|
|
17
|
-
var packageVersion = "77.
|
|
17
|
+
var packageVersion = "77.4.1";
|
|
18
18
|
var concurrentExperience;
|
|
19
19
|
var getExperience = function getExperience(id) {
|
|
20
20
|
if (!concurrentExperience) {
|
package/dist/es2019/card/card.js
CHANGED
|
@@ -27,7 +27,7 @@ import { getMediaCardCursor } from '../utils/getMediaCardCursor';
|
|
|
27
27
|
import { completeUfoExperience, startUfoExperience, abortUfoExperience } from '../utils/ufoExperiences';
|
|
28
28
|
import { generateUniqueId } from '../utils/generateUniqueId';
|
|
29
29
|
const packageName = "@atlaskit/media-card";
|
|
30
|
-
const packageVersion = "77.
|
|
30
|
+
const packageVersion = "77.4.1";
|
|
31
31
|
export class CardBase extends Component {
|
|
32
32
|
constructor(props) {
|
|
33
33
|
super(props);
|
|
@@ -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 = "77.
|
|
69
|
+
const packageVersion = "77.4.1";
|
|
70
70
|
const MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
71
71
|
packageVersion,
|
|
72
72
|
packageName,
|
|
@@ -7,7 +7,7 @@ import { IntlProvider, injectIntl } from 'react-intl-next';
|
|
|
7
7
|
import { ExternalImageCard } from './externalImageCard';
|
|
8
8
|
import { FileCard } from './fileCard';
|
|
9
9
|
const packageName = "@atlaskit/media-card";
|
|
10
|
-
const packageVersion = "77.
|
|
10
|
+
const packageVersion = "77.4.1";
|
|
11
11
|
export const CardV2Base = ({
|
|
12
12
|
identifier,
|
|
13
13
|
...otherProps
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import DownloadIcon from '@atlaskit/icon/glyph/download';
|
|
2
2
|
import { RECENTS_COLLECTION, addFileAttrsToUrl, globalMediaEventEmitter, imageResizeModeToFileImageMode, isFileIdentifier, isImageRepresentationReady } from '@atlaskit/media-client';
|
|
3
|
-
import { useFileState } from '@atlaskit/media-client-react';
|
|
3
|
+
import { MediaFileStateError, useFileState } from '@atlaskit/media-client-react';
|
|
4
4
|
import { getMediaTypeFromMimeType, getRandomHex, isMimeTypeSupportedByBrowser } from '@atlaskit/media-common';
|
|
5
5
|
import { getOrientation } from '@atlaskit/media-ui';
|
|
6
6
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
7
7
|
import React, { Suspense, useEffect, useMemo, useRef, useState } from 'react';
|
|
8
8
|
import ReactDOM from 'react-dom';
|
|
9
|
-
import { ImageLoadError, LocalPreviewError, MediaCardError,
|
|
9
|
+
import { ImageLoadError, LocalPreviewError, MediaCardError, ensureMediaCardError, isLocalPreviewError, isUnsupportedLocalPreviewError } from '../../errors';
|
|
10
10
|
import { extractErrorInfo } from '../../utils/analytics';
|
|
11
11
|
import { isBigger } from '../../utils/dimensionComparer';
|
|
12
12
|
import getDocument from '../../utils/document';
|
package/dist/es2019/errors.js
CHANGED
|
@@ -1,26 +1,10 @@
|
|
|
1
1
|
import { isPollingError as isMediaClientPollingError, isRateLimitedError as isMediaClientRateLimitedError } from '@atlaskit/media-client';
|
|
2
|
-
|
|
2
|
+
import { MediaFileStateError } from '@atlaskit/media-client-react';
|
|
3
3
|
/**
|
|
4
4
|
* Primary reason is logged through Data Portal.
|
|
5
5
|
* Make sure all the values are whitelisted in Measure -> Event Regitry -> "mediaCardRender failed" event
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
export class MediaFileStateError extends Error {
|
|
9
|
-
constructor(id, reason, message = '', details) {
|
|
10
|
-
super(reason);
|
|
11
|
-
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
|
|
12
|
-
this.id = id;
|
|
13
|
-
this.reason = reason;
|
|
14
|
-
this.message = message;
|
|
15
|
-
this.details = details;
|
|
16
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
17
|
-
|
|
18
|
-
// https://v8.dev/docs/stack-trace-api
|
|
19
|
-
if ('captureStackTrace' in Error) {
|
|
20
|
-
Error.captureStackTrace(this, new.target);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
8
|
export function isMediaFileStateError(err) {
|
|
25
9
|
return err instanceof MediaFileStateError;
|
|
26
10
|
}
|
|
@@ -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: "77.
|
|
40
|
+
packageName: "77.4.1",
|
|
41
41
|
componentName: 'mediaInlineCard',
|
|
42
42
|
component: 'mediaInlineCard'
|
|
43
43
|
};
|
|
@@ -4,7 +4,7 @@ import { extractErrorInfo, getRenderErrorRequestMetadata } from './analytics';
|
|
|
4
4
|
import { MediaCardError } from '../errors';
|
|
5
5
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
6
6
|
const packageName = "@atlaskit/media-card";
|
|
7
|
-
const packageVersion = "77.
|
|
7
|
+
const packageVersion = "77.4.1";
|
|
8
8
|
let concurrentExperience;
|
|
9
9
|
const getExperience = id => {
|
|
10
10
|
if (!concurrentExperience) {
|
package/dist/esm/card/card.js
CHANGED
|
@@ -40,7 +40,7 @@ import { getMediaCardCursor } from '../utils/getMediaCardCursor';
|
|
|
40
40
|
import { completeUfoExperience, startUfoExperience, abortUfoExperience } from '../utils/ufoExperiences';
|
|
41
41
|
import { generateUniqueId } from '../utils/generateUniqueId';
|
|
42
42
|
var packageName = "@atlaskit/media-card";
|
|
43
|
-
var packageVersion = "77.
|
|
43
|
+
var packageVersion = "77.4.1";
|
|
44
44
|
export var CardBase = /*#__PURE__*/function (_Component) {
|
|
45
45
|
_inherits(CardBase, _Component);
|
|
46
46
|
var _super = _createSuper(CardBase);
|
|
@@ -29,4 +29,6 @@ export var CardPreviewCacheImpl = /*#__PURE__*/_createClass(function CardPreview
|
|
|
29
29
|
});
|
|
30
30
|
this.previewCache = previewCache;
|
|
31
31
|
});
|
|
32
|
+
|
|
33
|
+
// eslint-disable-next-line import/no-anonymous-default-export
|
|
32
34
|
export default new CardPreviewCacheImpl(createObjectURLCache());
|
|
@@ -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 = "77.
|
|
86
|
+
var packageVersion = "77.4.1";
|
|
87
87
|
var MediaCardAnalyticsErrorBoundary = withMediaAnalyticsContext({
|
|
88
88
|
packageVersion: packageVersion,
|
|
89
89
|
packageName: packageName,
|
|
@@ -9,7 +9,7 @@ import { IntlProvider, injectIntl } from 'react-intl-next';
|
|
|
9
9
|
import { ExternalImageCard } from './externalImageCard';
|
|
10
10
|
import { FileCard } from './fileCard';
|
|
11
11
|
var packageName = "@atlaskit/media-card";
|
|
12
|
-
var packageVersion = "77.
|
|
12
|
+
var packageVersion = "77.4.1";
|
|
13
13
|
export var CardV2Base = function CardV2Base(_ref) {
|
|
14
14
|
var identifier = _ref.identifier,
|
|
15
15
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -7,13 +7,13 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
7
7
|
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) { _defineProperty(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; }
|
|
8
8
|
import DownloadIcon from '@atlaskit/icon/glyph/download';
|
|
9
9
|
import { RECENTS_COLLECTION, addFileAttrsToUrl, globalMediaEventEmitter, imageResizeModeToFileImageMode, isFileIdentifier, isImageRepresentationReady } from '@atlaskit/media-client';
|
|
10
|
-
import { useFileState } from '@atlaskit/media-client-react';
|
|
10
|
+
import { MediaFileStateError, useFileState } from '@atlaskit/media-client-react';
|
|
11
11
|
import { getMediaTypeFromMimeType, getRandomHex, isMimeTypeSupportedByBrowser } from '@atlaskit/media-common';
|
|
12
12
|
import { getOrientation } from '@atlaskit/media-ui';
|
|
13
13
|
import { MediaViewer } from '@atlaskit/media-viewer';
|
|
14
14
|
import React, { Suspense, useEffect, useMemo, useRef, useState } from 'react';
|
|
15
15
|
import ReactDOM from 'react-dom';
|
|
16
|
-
import { ImageLoadError, LocalPreviewError, MediaCardError,
|
|
16
|
+
import { ImageLoadError, LocalPreviewError, MediaCardError, ensureMediaCardError, isLocalPreviewError, isUnsupportedLocalPreviewError } from '../../errors';
|
|
17
17
|
import { extractErrorInfo } from '../../utils/analytics';
|
|
18
18
|
import { isBigger } from '../../utils/dimensionComparer';
|
|
19
19
|
import getDocument from '../../utils/document';
|
package/dist/esm/errors.js
CHANGED
|
@@ -8,36 +8,12 @@ import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
|
|
|
8
8
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
9
9
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
10
|
import { isPollingError as isMediaClientPollingError, isRateLimitedError as isMediaClientRateLimitedError } from '@atlaskit/media-client';
|
|
11
|
-
|
|
11
|
+
import { MediaFileStateError } from '@atlaskit/media-client-react';
|
|
12
12
|
/**
|
|
13
13
|
* Primary reason is logged through Data Portal.
|
|
14
14
|
* Make sure all the values are whitelisted in Measure -> Event Regitry -> "mediaCardRender failed" event
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
export var MediaFileStateError = /*#__PURE__*/function (_Error) {
|
|
18
|
-
_inherits(MediaFileStateError, _Error);
|
|
19
|
-
var _super = _createSuper(MediaFileStateError);
|
|
20
|
-
function MediaFileStateError(id, reason) {
|
|
21
|
-
var _this;
|
|
22
|
-
var message = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
23
|
-
var details = arguments.length > 3 ? arguments[3] : undefined;
|
|
24
|
-
_classCallCheck(this, MediaFileStateError);
|
|
25
|
-
_this = _super.call(this, reason);
|
|
26
|
-
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
|
|
27
|
-
_this.id = id;
|
|
28
|
-
_this.reason = reason;
|
|
29
|
-
_this.message = message;
|
|
30
|
-
_this.details = details;
|
|
31
|
-
Object.setPrototypeOf(_assertThisInitialized(_this), (this instanceof MediaFileStateError ? this.constructor : void 0).prototype);
|
|
32
|
-
|
|
33
|
-
// https://v8.dev/docs/stack-trace-api
|
|
34
|
-
if ('captureStackTrace' in Error) {
|
|
35
|
-
Error.captureStackTrace(_assertThisInitialized(_this), this instanceof MediaFileStateError ? this.constructor : void 0);
|
|
36
|
-
}
|
|
37
|
-
return _this;
|
|
38
|
-
}
|
|
39
|
-
return _createClass(MediaFileStateError);
|
|
40
|
-
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
41
17
|
export function isMediaFileStateError(err) {
|
|
42
18
|
return err instanceof MediaFileStateError;
|
|
43
19
|
}
|
|
@@ -65,62 +41,62 @@ export function isRateLimitedError(error) {
|
|
|
65
41
|
}
|
|
66
42
|
return false;
|
|
67
43
|
}
|
|
68
|
-
export var MediaCardError = /*#__PURE__*/function (
|
|
69
|
-
_inherits(MediaCardError,
|
|
70
|
-
var
|
|
44
|
+
export var MediaCardError = /*#__PURE__*/function (_Error) {
|
|
45
|
+
_inherits(MediaCardError, _Error);
|
|
46
|
+
var _super = _createSuper(MediaCardError);
|
|
71
47
|
function MediaCardError(primaryReason, secondaryError) {
|
|
72
|
-
var
|
|
48
|
+
var _this;
|
|
73
49
|
_classCallCheck(this, MediaCardError);
|
|
74
|
-
|
|
50
|
+
_this = _super.call(this, primaryReason);
|
|
75
51
|
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
Object.setPrototypeOf(_assertThisInitialized(
|
|
52
|
+
_this.primaryReason = primaryReason;
|
|
53
|
+
_this.secondaryError = secondaryError;
|
|
54
|
+
Object.setPrototypeOf(_assertThisInitialized(_this), (this instanceof MediaCardError ? this.constructor : void 0).prototype);
|
|
79
55
|
|
|
80
56
|
// https://v8.dev/docs/stack-trace-api
|
|
81
57
|
if ('captureStackTrace' in Error) {
|
|
82
|
-
Error.captureStackTrace(_assertThisInitialized(
|
|
58
|
+
Error.captureStackTrace(_assertThisInitialized(_this), this instanceof MediaCardError ? this.constructor : void 0);
|
|
83
59
|
}
|
|
84
|
-
return
|
|
60
|
+
return _this;
|
|
85
61
|
}
|
|
86
62
|
return _createClass(MediaCardError);
|
|
87
63
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
88
64
|
export var LocalPreviewError = /*#__PURE__*/function (_MediaCardError) {
|
|
89
65
|
_inherits(LocalPreviewError, _MediaCardError);
|
|
90
|
-
var
|
|
66
|
+
var _super2 = _createSuper(LocalPreviewError);
|
|
91
67
|
function LocalPreviewError(primaryReason, secondaryError) {
|
|
92
|
-
var
|
|
68
|
+
var _this2;
|
|
93
69
|
_classCallCheck(this, LocalPreviewError);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return
|
|
70
|
+
_this2 = _super2.call(this, primaryReason, secondaryError);
|
|
71
|
+
_this2.primaryReason = primaryReason;
|
|
72
|
+
_this2.secondaryError = secondaryError;
|
|
73
|
+
return _this2;
|
|
98
74
|
}
|
|
99
75
|
return _createClass(LocalPreviewError);
|
|
100
76
|
}(MediaCardError);
|
|
101
77
|
export var RemotePreviewError = /*#__PURE__*/function (_MediaCardError2) {
|
|
102
78
|
_inherits(RemotePreviewError, _MediaCardError2);
|
|
103
|
-
var
|
|
79
|
+
var _super3 = _createSuper(RemotePreviewError);
|
|
104
80
|
function RemotePreviewError(primaryReason, secondaryError) {
|
|
105
|
-
var
|
|
81
|
+
var _this3;
|
|
106
82
|
_classCallCheck(this, RemotePreviewError);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return
|
|
83
|
+
_this3 = _super3.call(this, primaryReason, secondaryError);
|
|
84
|
+
_this3.primaryReason = primaryReason;
|
|
85
|
+
_this3.secondaryError = secondaryError;
|
|
86
|
+
return _this3;
|
|
111
87
|
}
|
|
112
88
|
return _createClass(RemotePreviewError);
|
|
113
89
|
}(MediaCardError);
|
|
114
90
|
export var SsrPreviewError = /*#__PURE__*/function (_MediaCardError3) {
|
|
115
91
|
_inherits(SsrPreviewError, _MediaCardError3);
|
|
116
|
-
var
|
|
92
|
+
var _super4 = _createSuper(SsrPreviewError);
|
|
117
93
|
function SsrPreviewError(primaryReason, secondaryError) {
|
|
118
|
-
var
|
|
94
|
+
var _this4;
|
|
119
95
|
_classCallCheck(this, SsrPreviewError);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
return
|
|
96
|
+
_this4 = _super4.call(this, primaryReason, secondaryError);
|
|
97
|
+
_this4.primaryReason = primaryReason;
|
|
98
|
+
_this4.secondaryError = secondaryError;
|
|
99
|
+
return _this4;
|
|
124
100
|
}
|
|
125
101
|
return _createClass(SsrPreviewError);
|
|
126
102
|
}(MediaCardError);
|
|
@@ -143,10 +119,10 @@ export var getImageLoadPrimaryReason = function getImageLoadPrimaryReason(source
|
|
|
143
119
|
};
|
|
144
120
|
export var ImageLoadError = /*#__PURE__*/function (_MediaCardError4) {
|
|
145
121
|
_inherits(ImageLoadError, _MediaCardError4);
|
|
146
|
-
var
|
|
122
|
+
var _super5 = _createSuper(ImageLoadError);
|
|
147
123
|
function ImageLoadError(source) {
|
|
148
124
|
_classCallCheck(this, ImageLoadError);
|
|
149
|
-
return
|
|
125
|
+
return _super5.call(this, getImageLoadPrimaryReason(source));
|
|
150
126
|
}
|
|
151
127
|
return _createClass(ImageLoadError);
|
|
152
128
|
}(MediaCardError);
|
|
@@ -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: "77.
|
|
106
|
+
packageName: "77.4.1",
|
|
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 = "77.
|
|
10
|
+
var packageVersion = "77.4.1";
|
|
11
11
|
var concurrentExperience;
|
|
12
12
|
var getExperience = function getExperience(id) {
|
|
13
13
|
if (!concurrentExperience) {
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MediaClientErrorReason } from '@atlaskit/media-client';
|
|
2
2
|
import { CardPreview } from './types';
|
|
3
|
+
import { MediaFileStateError } from '@atlaskit/media-client-react';
|
|
3
4
|
/**
|
|
4
5
|
* Primary reason is logged through Data Portal.
|
|
5
6
|
* Make sure all the values are whitelisted in Measure -> Event Regitry -> "mediaCardRender failed" event
|
|
@@ -9,13 +10,6 @@ export type ImageLoadPrimaryReason = 'cache-remote-uri' | 'cache-local-uri' | 'l
|
|
|
9
10
|
export type RemotePreviewPrimaryReason = 'remote-preview-fetch' | 'remote-preview-not-ready' | 'remote-preview-fetch-ssr';
|
|
10
11
|
export type LocalPreviewPrimaryReason = 'local-preview-get' | 'local-preview-unsupported' | 'local-preview-rejected' | 'local-preview-image' | 'local-preview-video';
|
|
11
12
|
export type SsrPreviewPrimaryReason = 'ssr-client-uri' | 'ssr-client-load' | 'ssr-server-uri' | 'ssr-server-load';
|
|
12
|
-
export declare class MediaFileStateError extends Error {
|
|
13
|
-
readonly id: string;
|
|
14
|
-
readonly reason?: string | undefined;
|
|
15
|
-
readonly message: string;
|
|
16
|
-
readonly details?: Record<string, any> | undefined;
|
|
17
|
-
constructor(id: string, reason?: string | undefined, message?: string, details?: Record<string, any> | undefined);
|
|
18
|
-
}
|
|
19
13
|
export declare function isMediaFileStateError(err: Error): err is MediaFileStateError;
|
|
20
14
|
export declare function getFileStateErrorReason(err: MediaFileStateError): MediaClientErrorReason | 'unknown';
|
|
21
15
|
export declare function isPollingError(err?: Error): boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MediaClientErrorReason } from '@atlaskit/media-client';
|
|
2
2
|
import { CardPreview } from './types';
|
|
3
|
+
import { MediaFileStateError } from '@atlaskit/media-client-react';
|
|
3
4
|
/**
|
|
4
5
|
* Primary reason is logged through Data Portal.
|
|
5
6
|
* Make sure all the values are whitelisted in Measure -> Event Regitry -> "mediaCardRender failed" event
|
|
@@ -9,13 +10,6 @@ export type ImageLoadPrimaryReason = 'cache-remote-uri' | 'cache-local-uri' | 'l
|
|
|
9
10
|
export type RemotePreviewPrimaryReason = 'remote-preview-fetch' | 'remote-preview-not-ready' | 'remote-preview-fetch-ssr';
|
|
10
11
|
export type LocalPreviewPrimaryReason = 'local-preview-get' | 'local-preview-unsupported' | 'local-preview-rejected' | 'local-preview-image' | 'local-preview-video';
|
|
11
12
|
export type SsrPreviewPrimaryReason = 'ssr-client-uri' | 'ssr-client-load' | 'ssr-server-uri' | 'ssr-server-load';
|
|
12
|
-
export declare class MediaFileStateError extends Error {
|
|
13
|
-
readonly id: string;
|
|
14
|
-
readonly reason?: string | undefined;
|
|
15
|
-
readonly message: string;
|
|
16
|
-
readonly details?: Record<string, any> | undefined;
|
|
17
|
-
constructor(id: string, reason?: string | undefined, message?: string, details?: Record<string, any> | undefined);
|
|
18
|
-
}
|
|
19
13
|
export declare function isMediaFileStateError(err: Error): err is MediaFileStateError;
|
|
20
14
|
export declare function getFileStateErrorReason(err: MediaFileStateError): MediaClientErrorReason | 'unknown';
|
|
21
15
|
export declare function isPollingError(err?: Error): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-card",
|
|
3
|
-
"version": "77.
|
|
3
|
+
"version": "77.4.1",
|
|
4
4
|
"description": "Includes all media card related components, CardView, CardViewSmall, Card...",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -41,15 +41,15 @@
|
|
|
41
41
|
"@atlaskit/editor-shared-styles": "^2.8.0",
|
|
42
42
|
"@atlaskit/icon": "^21.12.0",
|
|
43
43
|
"@atlaskit/media-client": "^25.0.0",
|
|
44
|
-
"@atlaskit/media-client-react": "^1.
|
|
45
|
-
"@atlaskit/media-common": "^
|
|
44
|
+
"@atlaskit/media-client-react": "^1.4.0",
|
|
45
|
+
"@atlaskit/media-common": "^11.0.0",
|
|
46
46
|
"@atlaskit/media-ui": "^25.0.0",
|
|
47
|
-
"@atlaskit/media-viewer": "^48.
|
|
47
|
+
"@atlaskit/media-viewer": "^48.2.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^0.2.2",
|
|
49
49
|
"@atlaskit/spinner": "^15.6.0",
|
|
50
50
|
"@atlaskit/theme": "^12.6.0",
|
|
51
51
|
"@atlaskit/tokens": "^1.28.0",
|
|
52
|
-
"@atlaskit/tooltip": "^
|
|
52
|
+
"@atlaskit/tooltip": "^18.0.0",
|
|
53
53
|
"@atlaskit/ufo": "^0.2.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
55
55
|
"classnames": "^2.2.5",
|