@atlaskit/media-viewer 54.5.30 → 54.5.32
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 +18 -0
- package/dist/cjs/analytics/index.js +1 -1
- package/dist/cjs/analytics/ufoExperiences.js +1 -1
- package/dist/cjs/viewers/image/index.js +11 -7
- package/dist/es2019/analytics/index.js +1 -1
- package/dist/es2019/analytics/ufoExperiences.js +1 -1
- package/dist/es2019/viewers/image/index.js +11 -2
- package/dist/esm/analytics/index.js +1 -1
- package/dist/esm/analytics/ufoExperiences.js +1 -1
- package/dist/esm/viewers/image/index.js +11 -7
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/media-viewer
|
|
2
2
|
|
|
3
|
+
## 54.5.32
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`aa2113836d418`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/aa2113836d418) -
|
|
8
|
+
[BMPT-8156] Image viewer now decides unsupported-MIME routing based on the MIME type of the actual
|
|
9
|
+
fetched bytes (`Blob.type`) rather than the declared `mimeType` from the items call. This handles
|
|
10
|
+
just-in-time (JIT) transformation correctly (e.g. a TIFF that is transcoded to JPEG on the fly, or
|
|
11
|
+
left as TIFF when the transform fails). Behaviour is unchanged when the
|
|
12
|
+
`platform_media_unsupported_mime_routing` feature gate is off.
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 54.5.31
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 54.5.30
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -10,7 +10,7 @@ exports.packageVersion = exports.packageName = void 0;
|
|
|
10
10
|
var _analytics = require("@atlaskit/media-common/analytics");
|
|
11
11
|
var componentName = exports.component = exports.componentName = 'mediaViewer';
|
|
12
12
|
var packageName = exports.packageName = "@atlaskit/media-viewer";
|
|
13
|
-
var packageVersion = exports.packageVersion = "54.5.
|
|
13
|
+
var packageVersion = exports.packageVersion = "54.5.31";
|
|
14
14
|
function getFileAttributes(fileState) {
|
|
15
15
|
if (!fileState) {
|
|
16
16
|
return {
|
|
@@ -13,7 +13,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
13
13
|
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; }
|
|
14
14
|
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; }
|
|
15
15
|
var packageName = "@atlaskit/media-viewer";
|
|
16
|
-
var packageVersion = "54.5.
|
|
16
|
+
var packageVersion = "54.5.31";
|
|
17
17
|
var ufoExperience;
|
|
18
18
|
var getExperience = function getExperience() {
|
|
19
19
|
if (!ufoExperience) {
|
|
@@ -67,7 +67,7 @@ var ImageViewer = exports.ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
67
67
|
key: "init",
|
|
68
68
|
value: function () {
|
|
69
69
|
var _init = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
70
|
-
var _this$props, fileState, mediaClient, collectionName, traceContext, controller, orientation, objectUrl, originalBinaryImageUrl, isLocalFileReference, clientId, preview, _yield$preview, value, origin, item, response, unsupportedError, imgError, _t, _t2
|
|
70
|
+
var _this$props, fileState, mediaClient, collectionName, traceContext, controller, orientation, objectUrl, originalBinaryImageUrl, isLocalFileReference, clientId, renderedBlobMimeType, preview, _yield$preview, value, origin, item, response, blob, effectiveMimeType, unsupportedError, imgError, _t, _t2;
|
|
71
71
|
return _regenerator.default.wrap(function (_context) {
|
|
72
72
|
while (1) switch (_context.prev = _context.next) {
|
|
73
73
|
case 0:
|
|
@@ -81,7 +81,7 @@ var ImageViewer = exports.ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
81
81
|
controller = typeof AbortController !== 'undefined' ? new AbortController() : undefined;
|
|
82
82
|
_context.prev = 2;
|
|
83
83
|
orientation = 1;
|
|
84
|
-
isLocalFileReference = false;
|
|
84
|
+
isLocalFileReference = false; // The MIME type of the actual bytes that will be rendered.
|
|
85
85
|
_context.prev = 3;
|
|
86
86
|
_context.next = 4;
|
|
87
87
|
return mediaClient.getClientId(collectionName);
|
|
@@ -114,6 +114,7 @@ var ImageViewer = exports.ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
114
114
|
orientation = _context.sent;
|
|
115
115
|
objectUrl = URL.createObjectURL(value);
|
|
116
116
|
isLocalFileReference = origin === 'local';
|
|
117
|
+
renderedBlobMimeType = value.type || undefined;
|
|
117
118
|
_context.next = 10;
|
|
118
119
|
break;
|
|
119
120
|
case 9:
|
|
@@ -134,11 +135,12 @@ var ImageViewer = exports.ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
134
135
|
this.cancelImageFetch = function () {
|
|
135
136
|
return controller === null || controller === void 0 ? void 0 : controller.abort();
|
|
136
137
|
};
|
|
137
|
-
_t2 = URL;
|
|
138
138
|
_context.next = 12;
|
|
139
139
|
return response;
|
|
140
140
|
case 12:
|
|
141
|
-
|
|
141
|
+
blob = _context.sent;
|
|
142
|
+
renderedBlobMimeType = blob.type || undefined;
|
|
143
|
+
objectUrl = URL.createObjectURL(blob);
|
|
142
144
|
_context.next = 14;
|
|
143
145
|
break;
|
|
144
146
|
case 13:
|
|
@@ -153,7 +155,9 @@ var ImageViewer = exports.ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
153
155
|
_context.next = 17;
|
|
154
156
|
break;
|
|
155
157
|
}
|
|
156
|
-
|
|
158
|
+
// Prefer the MIME type of the actual fetched bytes over the declared one.
|
|
159
|
+
effectiveMimeType = (0, _platformFeatureFlags.fg)('platform_media_unsupported_mime_routing') ? renderedBlobMimeType !== null && renderedBlobMimeType !== void 0 ? renderedBlobMimeType : fileState.mimeType : fileState.mimeType;
|
|
160
|
+
if (!(0, _mediaCommon.isImageMimeTypeSupportedByBrowser)(effectiveMimeType)) {
|
|
157
161
|
_context.next = 16;
|
|
158
162
|
break;
|
|
159
163
|
}
|
|
@@ -192,10 +196,10 @@ var ImageViewer = exports.ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
192
196
|
break;
|
|
193
197
|
case 18:
|
|
194
198
|
_context.prev = 18;
|
|
195
|
-
|
|
199
|
+
_t2 = _context["catch"](2);
|
|
196
200
|
// TODO : properly handle aborted requests (MS-2843)
|
|
197
201
|
if (!(controller !== null && controller !== void 0 && controller.signal.aborted)) {
|
|
198
|
-
imgError = new _errors.MediaViewerError('imageviewer-fetch-url',
|
|
202
|
+
imgError = new _errors.MediaViewerError('imageviewer-fetch-url', _t2 instanceof Error ? _t2 : undefined);
|
|
199
203
|
this.setState({
|
|
200
204
|
content: _domain.Outcome.failed(imgError)
|
|
201
205
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ANALYTICS_MEDIA_CHANNEL, sanitiseAnalyticsPayload } from '@atlaskit/media-common/analytics';
|
|
2
2
|
const componentName = 'mediaViewer';
|
|
3
3
|
const packageName = "@atlaskit/media-viewer";
|
|
4
|
-
const packageVersion = "54.5.
|
|
4
|
+
const packageVersion = "54.5.31";
|
|
5
5
|
export { packageName, packageVersion, componentName, componentName as component };
|
|
6
6
|
export function getFileAttributes(fileState) {
|
|
7
7
|
if (!fileState) {
|
|
@@ -3,7 +3,7 @@ import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
|
3
3
|
import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
const packageName = "@atlaskit/media-viewer";
|
|
6
|
-
const packageVersion = "54.5.
|
|
6
|
+
const packageVersion = "54.5.31";
|
|
7
7
|
let ufoExperience;
|
|
8
8
|
const getExperience = () => {
|
|
9
9
|
if (!ufoExperience) {
|
|
@@ -55,6 +55,8 @@ export class ImageViewer extends BaseViewer {
|
|
|
55
55
|
let originalBinaryImageUrl;
|
|
56
56
|
let isLocalFileReference = false;
|
|
57
57
|
let clientId;
|
|
58
|
+
// The MIME type of the actual bytes that will be rendered.
|
|
59
|
+
let renderedBlobMimeType;
|
|
58
60
|
|
|
59
61
|
// Fetch clientId for cross-client copy
|
|
60
62
|
try {
|
|
@@ -74,6 +76,7 @@ export class ImageViewer extends BaseViewer {
|
|
|
74
76
|
orientation = await getOrientation(value);
|
|
75
77
|
objectUrl = URL.createObjectURL(value);
|
|
76
78
|
isLocalFileReference = origin === 'local';
|
|
79
|
+
renderedBlobMimeType = value.type || undefined;
|
|
77
80
|
} else {
|
|
78
81
|
objectUrl = value;
|
|
79
82
|
}
|
|
@@ -84,7 +87,9 @@ export class ImageViewer extends BaseViewer {
|
|
|
84
87
|
mode: 'fit'
|
|
85
88
|
}, controller, true, traceContext);
|
|
86
89
|
this.cancelImageFetch = () => controller === null || controller === void 0 ? void 0 : controller.abort();
|
|
87
|
-
|
|
90
|
+
const blob = await response;
|
|
91
|
+
renderedBlobMimeType = blob.type || undefined;
|
|
92
|
+
objectUrl = URL.createObjectURL(blob);
|
|
88
93
|
} else {
|
|
89
94
|
this.setState({
|
|
90
95
|
content: Outcome.pending()
|
|
@@ -94,7 +99,11 @@ export class ImageViewer extends BaseViewer {
|
|
|
94
99
|
if (!isLocalFileReference &&
|
|
95
100
|
// objectUrl at this point is binary file already
|
|
96
101
|
!isErrorFileState(fileState) && fileState.status !== 'uploading' && fileState.mediaType === 'image') {
|
|
97
|
-
|
|
102
|
+
var _renderedBlobMimeType;
|
|
103
|
+
// Prefer the MIME type of the actual fetched bytes over the declared one.
|
|
104
|
+
|
|
105
|
+
const effectiveMimeType = fg('platform_media_unsupported_mime_routing') ? (_renderedBlobMimeType = renderedBlobMimeType) !== null && _renderedBlobMimeType !== void 0 ? _renderedBlobMimeType : fileState.mimeType : fileState.mimeType;
|
|
106
|
+
if (isImageMimeTypeSupportedByBrowser(effectiveMimeType)) {
|
|
98
107
|
originalBinaryImageUrl = await mediaClient.file.getFileBinaryURL(fileState.id, collectionName);
|
|
99
108
|
} else if (fg('platform_media_unsupported_mime_routing')) {
|
|
100
109
|
// Route unsupported MIME types browser can't natively decode straight to the
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ANALYTICS_MEDIA_CHANNEL, sanitiseAnalyticsPayload } from '@atlaskit/media-common/analytics';
|
|
2
2
|
var componentName = 'mediaViewer';
|
|
3
3
|
var packageName = "@atlaskit/media-viewer";
|
|
4
|
-
var packageVersion = "54.5.
|
|
4
|
+
var packageVersion = "54.5.31";
|
|
5
5
|
export { packageName, packageVersion, componentName, componentName as component };
|
|
6
6
|
export function getFileAttributes(fileState) {
|
|
7
7
|
if (!fileState) {
|
|
@@ -6,7 +6,7 @@ import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
|
6
6
|
import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
|
|
7
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
var packageName = "@atlaskit/media-viewer";
|
|
9
|
-
var packageVersion = "54.5.
|
|
9
|
+
var packageVersion = "54.5.31";
|
|
10
10
|
var ufoExperience;
|
|
11
11
|
var getExperience = function getExperience() {
|
|
12
12
|
if (!ufoExperience) {
|
|
@@ -60,7 +60,7 @@ export var ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
60
60
|
key: "init",
|
|
61
61
|
value: function () {
|
|
62
62
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
63
|
-
var _this$props, fileState, mediaClient, collectionName, traceContext, controller, orientation, objectUrl, originalBinaryImageUrl, isLocalFileReference, clientId, preview, _yield$preview, value, origin, item, response, unsupportedError, imgError, _t, _t2
|
|
63
|
+
var _this$props, fileState, mediaClient, collectionName, traceContext, controller, orientation, objectUrl, originalBinaryImageUrl, isLocalFileReference, clientId, renderedBlobMimeType, preview, _yield$preview, value, origin, item, response, blob, effectiveMimeType, unsupportedError, imgError, _t, _t2;
|
|
64
64
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
65
65
|
while (1) switch (_context.prev = _context.next) {
|
|
66
66
|
case 0:
|
|
@@ -74,7 +74,7 @@ export var ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
74
74
|
controller = typeof AbortController !== 'undefined' ? new AbortController() : undefined;
|
|
75
75
|
_context.prev = 2;
|
|
76
76
|
orientation = 1;
|
|
77
|
-
isLocalFileReference = false;
|
|
77
|
+
isLocalFileReference = false; // The MIME type of the actual bytes that will be rendered.
|
|
78
78
|
_context.prev = 3;
|
|
79
79
|
_context.next = 4;
|
|
80
80
|
return mediaClient.getClientId(collectionName);
|
|
@@ -107,6 +107,7 @@ export var ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
107
107
|
orientation = _context.sent;
|
|
108
108
|
objectUrl = URL.createObjectURL(value);
|
|
109
109
|
isLocalFileReference = origin === 'local';
|
|
110
|
+
renderedBlobMimeType = value.type || undefined;
|
|
110
111
|
_context.next = 10;
|
|
111
112
|
break;
|
|
112
113
|
case 9:
|
|
@@ -127,11 +128,12 @@ export var ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
127
128
|
this.cancelImageFetch = function () {
|
|
128
129
|
return controller === null || controller === void 0 ? void 0 : controller.abort();
|
|
129
130
|
};
|
|
130
|
-
_t2 = URL;
|
|
131
131
|
_context.next = 12;
|
|
132
132
|
return response;
|
|
133
133
|
case 12:
|
|
134
|
-
|
|
134
|
+
blob = _context.sent;
|
|
135
|
+
renderedBlobMimeType = blob.type || undefined;
|
|
136
|
+
objectUrl = URL.createObjectURL(blob);
|
|
135
137
|
_context.next = 14;
|
|
136
138
|
break;
|
|
137
139
|
case 13:
|
|
@@ -146,7 +148,9 @@ export var ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
146
148
|
_context.next = 17;
|
|
147
149
|
break;
|
|
148
150
|
}
|
|
149
|
-
|
|
151
|
+
// Prefer the MIME type of the actual fetched bytes over the declared one.
|
|
152
|
+
effectiveMimeType = fg('platform_media_unsupported_mime_routing') ? renderedBlobMimeType !== null && renderedBlobMimeType !== void 0 ? renderedBlobMimeType : fileState.mimeType : fileState.mimeType;
|
|
153
|
+
if (!isImageMimeTypeSupportedByBrowser(effectiveMimeType)) {
|
|
150
154
|
_context.next = 16;
|
|
151
155
|
break;
|
|
152
156
|
}
|
|
@@ -185,10 +189,10 @@ export var ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
185
189
|
break;
|
|
186
190
|
case 18:
|
|
187
191
|
_context.prev = 18;
|
|
188
|
-
|
|
192
|
+
_t2 = _context["catch"](2);
|
|
189
193
|
// TODO : properly handle aborted requests (MS-2843)
|
|
190
194
|
if (!(controller !== null && controller !== void 0 && controller.signal.aborted)) {
|
|
191
|
-
imgError = new MediaViewerError('imageviewer-fetch-url',
|
|
195
|
+
imgError = new MediaViewerError('imageviewer-fetch-url', _t2 instanceof Error ? _t2 : undefined);
|
|
192
196
|
this.setState({
|
|
193
197
|
content: Outcome.failed(imgError)
|
|
194
198
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-viewer",
|
|
3
|
-
"version": "54.5.
|
|
3
|
+
"version": "54.5.32",
|
|
4
4
|
"description": "MediaViewer is Atlassian's powerful solution for viewing files on the web. It's both powerful and extendable yet easy-to-integrate",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@atlaskit/media-client": "^37.2.0",
|
|
43
43
|
"@atlaskit/media-client-react": "^6.1.0",
|
|
44
44
|
"@atlaskit/media-common": "^14.4.0",
|
|
45
|
-
"@atlaskit/media-document-viewer": "^
|
|
45
|
+
"@atlaskit/media-document-viewer": "^2.0.0",
|
|
46
46
|
"@atlaskit/media-state": "^3.1.0",
|
|
47
47
|
"@atlaskit/media-svg": "^3.1.0",
|
|
48
48
|
"@atlaskit/media-ui": "^30.11.0",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"@atlaskit/side-navigation": "^12.3.0",
|
|
54
54
|
"@atlaskit/spinner": "^20.1.0",
|
|
55
55
|
"@atlaskit/textfield": "^10.0.0",
|
|
56
|
-
"@atlaskit/theme": "^
|
|
57
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
58
|
-
"@atlaskit/tokens": "^16.
|
|
56
|
+
"@atlaskit/theme": "^27.0.0",
|
|
57
|
+
"@atlaskit/tmp-editor-statsig": "^142.0.0",
|
|
58
|
+
"@atlaskit/tokens": "^16.4.0",
|
|
59
59
|
"@atlaskit/tooltip": "^24.0.0",
|
|
60
60
|
"@atlaskit/ufo": "^1.0.0",
|
|
61
61
|
"@babel/runtime": "^7.0.0",
|