@atlaskit/media-viewer 53.2.5 → 54.1.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/AGENTS.md +62 -0
- package/CHANGELOG.md +38 -0
- package/classnames/package.json +1 -8
- package/dist/cjs/analytics/index.js +1 -1
- package/dist/cjs/analytics/ufoExperiences.js +1 -1
- package/dist/cjs/components/media-viewer.js +4 -2
- package/dist/cjs/download.js +2 -2
- package/dist/cjs/header.js +27 -2
- package/dist/cjs/list.js +4 -2
- package/dist/cjs/media-viewer.js +4 -2
- package/dist/cjs/utils/getObjectUrlFromFileState.js +15 -16
- package/dist/cjs/utils/index.js +16 -17
- package/dist/cjs/viewers/archiveSidebar/archive-sidebar-folder-entry.js +11 -11
- package/dist/cjs/viewers/archiveSidebar/archive-sidebar-renderer.js +12 -12
- package/dist/cjs/viewers/archiveSidebar/archive-sidebar.js +28 -28
- package/dist/cjs/viewers/archiveSidebar/archive.js +29 -29
- package/dist/cjs/viewers/archiveSidebar/archiveViewerLoader.js +12 -12
- package/dist/cjs/viewers/audio.js +37 -37
- package/dist/cjs/viewers/codeViewer/codeViewerRenderer-compiled.js +2 -2
- package/dist/cjs/viewers/codeViewer/index.js +35 -35
- package/dist/cjs/viewers/doc/doc-viewer.js +29 -27
- package/dist/cjs/viewers/doc/index.js +2 -2
- package/dist/cjs/viewers/image/index.js +43 -44
- package/dist/cjs/viewers/video.js +20 -20
- package/dist/es2019/analytics/index.js +1 -1
- package/dist/es2019/analytics/ufoExperiences.js +1 -1
- package/dist/es2019/components/media-viewer.js +4 -2
- package/dist/es2019/header.js +24 -2
- package/dist/es2019/list.js +4 -2
- package/dist/es2019/media-viewer.js +4 -2
- package/dist/esm/analytics/index.js +1 -1
- package/dist/esm/analytics/ufoExperiences.js +1 -1
- package/dist/esm/components/media-viewer.js +4 -2
- package/dist/esm/download.js +2 -2
- package/dist/esm/header.js +27 -2
- package/dist/esm/list.js +4 -2
- package/dist/esm/media-viewer.js +4 -2
- package/dist/esm/utils/getObjectUrlFromFileState.js +15 -16
- package/dist/esm/utils/index.js +16 -17
- package/dist/esm/viewers/archiveSidebar/archive-sidebar-folder-entry.js +11 -11
- package/dist/esm/viewers/archiveSidebar/archive-sidebar-renderer.js +11 -11
- package/dist/esm/viewers/archiveSidebar/archive-sidebar.js +28 -28
- package/dist/esm/viewers/archiveSidebar/archive.js +29 -29
- package/dist/esm/viewers/archiveSidebar/archiveViewerLoader.js +11 -11
- package/dist/esm/viewers/audio.js +37 -37
- package/dist/esm/viewers/codeViewer/codeViewerRenderer-compiled.js +2 -2
- package/dist/esm/viewers/codeViewer/index.js +34 -34
- package/dist/esm/viewers/doc/doc-viewer.js +28 -26
- package/dist/esm/viewers/doc/index.js +2 -2
- package/dist/esm/viewers/image/index.js +43 -44
- package/dist/esm/viewers/video.js +20 -20
- package/dist/types/components/media-viewer.d.ts +1 -1
- package/dist/types/components/types.d.ts +1 -0
- package/dist/types/header.d.ts +2 -1
- package/dist/types/list.d.ts +2 -1
- package/dist/types/media-viewer.d.ts +1 -0
- package/media-viewer-loader/package.json +1 -8
- package/package.json +34 -42
- package/types/package.json +1 -8
- package/viewer-options/package.json +1 -8
- package/dist/types-ts4.5/analytics/events/index.d.ts +0 -17
- package/dist/types-ts4.5/analytics/events/operational/_mediaFile.d.ts +0 -3
- package/dist/types-ts4.5/analytics/events/operational/commenced.d.ts +0 -5
- package/dist/types-ts4.5/analytics/events/operational/download.d.ts +0 -9
- package/dist/types-ts4.5/analytics/events/operational/loadFailed.d.ts +0 -7
- package/dist/types-ts4.5/analytics/events/operational/loadSucceeded.d.ts +0 -11
- package/dist/types-ts4.5/analytics/events/operational/previewUnsupported.d.ts +0 -6
- package/dist/types-ts4.5/analytics/events/operational/zipEntryLoadFailed.d.ts +0 -13
- package/dist/types-ts4.5/analytics/events/operational/zipEntryLoadSucceeded.d.ts +0 -12
- package/dist/types-ts4.5/analytics/events/screen/modal.d.ts +0 -3
- package/dist/types-ts4.5/analytics/events/screen/passwordPdf.d.ts +0 -3
- package/dist/types-ts4.5/analytics/events/screen/pdfPasswordInput.d.ts +0 -3
- package/dist/types-ts4.5/analytics/events/ui/_clickedButton.d.ts +0 -2
- package/dist/types-ts4.5/analytics/events/ui/closed.d.ts +0 -8
- package/dist/types-ts4.5/analytics/events/ui/downloadButtonClicked.d.ts +0 -8
- package/dist/types-ts4.5/analytics/events/ui/failedPreviewDownloadButtonClicked.d.ts +0 -10
- package/dist/types-ts4.5/analytics/events/ui/navigated.d.ts +0 -12
- package/dist/types-ts4.5/analytics/events/ui/zoomInButtonClicked.d.ts +0 -8
- package/dist/types-ts4.5/analytics/events/ui/zoomOutButtonClicked.d.ts +0 -6
- package/dist/types-ts4.5/analytics/index.d.ts +0 -17
- package/dist/types-ts4.5/analytics/ufoExperiences.d.ts +0 -19
- package/dist/types-ts4.5/classnames.d.ts +0 -5
- package/dist/types-ts4.5/components/media-viewer-error-boundary.d.ts +0 -3
- package/dist/types-ts4.5/components/media-viewer-loader.d.ts +0 -3
- package/dist/types-ts4.5/components/media-viewer.d.ts +0 -5
- package/dist/types-ts4.5/components/portal.d.ts +0 -4
- package/dist/types-ts4.5/components/types.d.ts +0 -45
- package/dist/types-ts4.5/content.d.ts +0 -11
- package/dist/types-ts4.5/domain/index.d.ts +0 -1
- package/dist/types-ts4.5/domain/outcome.d.ts +0 -31
- package/dist/types-ts4.5/domain/zoomLevel.d.ts +0 -15
- package/dist/types-ts4.5/download.d.ts +0 -20
- package/dist/types-ts4.5/error-images.d.ts +0 -2
- package/dist/types-ts4.5/errorMessage.d.ts +0 -33
- package/dist/types-ts4.5/errors.d.ts +0 -23
- package/dist/types-ts4.5/header.d.ts +0 -19
- package/dist/types-ts4.5/index.d.ts +0 -3
- package/dist/types-ts4.5/item-viewer.d.ts +0 -32
- package/dist/types-ts4.5/list.d.ts +0 -24
- package/dist/types-ts4.5/loading.d.ts +0 -2
- package/dist/types-ts4.5/media-viewer.d.ts +0 -16
- package/dist/types-ts4.5/navigation.d.ts +0 -25
- package/dist/types-ts4.5/styleWrappers.d.ts +0 -122
- package/dist/types-ts4.5/styles.d.ts +0 -2
- package/dist/types-ts4.5/utils/closeOnDirectClick.d.ts +0 -2
- package/dist/types-ts4.5/utils/getIdentifierCollection.d.ts +0 -2
- package/dist/types-ts4.5/utils/getObjectUrlFromFileState.d.ts +0 -2
- package/dist/types-ts4.5/utils/index.d.ts +0 -10
- package/dist/types-ts4.5/utils/isIE.d.ts +0 -1
- package/dist/types-ts4.5/viewerOptions.d.ts +0 -20
- package/dist/types-ts4.5/viewers/archiveSidebar/archive-download-button.d.ts +0 -8
- package/dist/types-ts4.5/viewers/archiveSidebar/archive-sidebar-folder-entry.d.ts +0 -24
- package/dist/types-ts4.5/viewers/archiveSidebar/archive-sidebar-header.d.ts +0 -9
- package/dist/types-ts4.5/viewers/archiveSidebar/archive-sidebar-renderer.d.ts +0 -26
- package/dist/types-ts4.5/viewers/archiveSidebar/archive-sidebar.d.ts +0 -28
- package/dist/types-ts4.5/viewers/archiveSidebar/archive.d.ts +0 -37
- package/dist/types-ts4.5/viewers/archiveSidebar/archiveViewerLoader.d.ts +0 -12
- package/dist/types-ts4.5/viewers/archiveSidebar/consts.d.ts +0 -2
- package/dist/types-ts4.5/viewers/archiveSidebar/custom-button-item.d.ts +0 -2
- package/dist/types-ts4.5/viewers/archiveSidebar/nativePdfViewer.d.ts +0 -9
- package/dist/types-ts4.5/viewers/archiveSidebar/styleWrappers.d.ts +0 -30
- package/dist/types-ts4.5/viewers/archiveSidebar/styles.d.ts +0 -1
- package/dist/types-ts4.5/viewers/archiveSidebar/types.d.ts +0 -13
- package/dist/types-ts4.5/viewers/audio.d.ts +0 -33
- package/dist/types-ts4.5/viewers/base-viewer.d.ts +0 -32
- package/dist/types-ts4.5/viewers/codeViewer/CodeRendererAdvanced/CodeRendererAdvanced.d.ts +0 -11
- package/dist/types-ts4.5/viewers/codeViewer/CodeRendererAdvanced/theme.d.ts +0 -4
- package/dist/types-ts4.5/viewers/codeViewer/codeViewerRenderer-compiled.d.ts +0 -29
- package/dist/types-ts4.5/viewers/codeViewer/codeViewerRenderer.d.ts +0 -23
- package/dist/types-ts4.5/viewers/codeViewer/index.d.ts +0 -27
- package/dist/types-ts4.5/viewers/codeViewer/msg-parser.d.ts +0 -8
- package/dist/types-ts4.5/viewers/codeViewer/styles.d.ts +0 -4
- package/dist/types-ts4.5/viewers/codeViewer/util.d.ts +0 -4
- package/dist/types-ts4.5/viewers/customViewer/customViewer.d.ts +0 -13
- package/dist/types-ts4.5/viewers/doc/doc-viewer.d.ts +0 -13
- package/dist/types-ts4.5/viewers/doc/index.d.ts +0 -36
- package/dist/types-ts4.5/viewers/doc/passwordInput.d.ts +0 -10
- package/dist/types-ts4.5/viewers/image/index.d.ts +0 -35
- package/dist/types-ts4.5/viewers/image/interactive-img.d.ts +0 -42
- package/dist/types-ts4.5/viewers/modalSpinner.d.ts +0 -8
- package/dist/types-ts4.5/viewers/svg/ImageWrapper-compiled.d.ts +0 -7
- package/dist/types-ts4.5/viewers/svg/ImageWrapper.d.ts +0 -7
- package/dist/types-ts4.5/viewers/svg/errors.d.ts +0 -3
- package/dist/types-ts4.5/viewers/svg/index.d.ts +0 -14
- package/dist/types-ts4.5/viewers/svg/utils.d.ts +0 -5
- package/dist/types-ts4.5/viewers/video.d.ts +0 -32
- package/dist/types-ts4.5/zoomControls.d.ts +0 -15
|
@@ -43,86 +43,86 @@ export var CodeViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
43
43
|
key: "init",
|
|
44
44
|
value: function () {
|
|
45
45
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
46
|
-
var _this$props, item, mediaClient, collectionName, onError, downloadUrl, response, ext, arrayBuffer, src, _src, codeViewerError;
|
|
47
|
-
return _regeneratorRuntime.wrap(function
|
|
46
|
+
var _this$props, item, mediaClient, collectionName, onError, downloadUrl, response, ext, arrayBuffer, src, _src, codeViewerError, _t;
|
|
47
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
48
48
|
while (1) switch (_context.prev = _context.next) {
|
|
49
49
|
case 0:
|
|
50
50
|
if (CodeViewer.CodeViewerComponent) {
|
|
51
|
-
_context.next =
|
|
51
|
+
_context.next = 1;
|
|
52
52
|
break;
|
|
53
53
|
}
|
|
54
|
-
_context.next =
|
|
54
|
+
_context.next = 1;
|
|
55
55
|
return this.loadCodeViewer();
|
|
56
|
-
case
|
|
56
|
+
case 1:
|
|
57
57
|
_this$props = this.props, item = _this$props.item, mediaClient = _this$props.mediaClient, collectionName = _this$props.collectionName, onError = _this$props.onError;
|
|
58
58
|
if (!(item.status === 'processed' || item.status === 'processing')) {
|
|
59
|
-
_context.next =
|
|
59
|
+
_context.next = 12;
|
|
60
60
|
break;
|
|
61
61
|
}
|
|
62
|
-
_context.prev =
|
|
63
|
-
_context.next =
|
|
62
|
+
_context.prev = 2;
|
|
63
|
+
_context.next = 3;
|
|
64
64
|
return mediaClient.file.getFileBinaryURL(item.id, collectionName);
|
|
65
|
-
case
|
|
65
|
+
case 3:
|
|
66
66
|
downloadUrl = _context.sent;
|
|
67
|
-
_context.next =
|
|
67
|
+
_context.next = 4;
|
|
68
68
|
return request(downloadUrl, {
|
|
69
69
|
method: 'GET',
|
|
70
70
|
endpoint: '/file/{fileId}/binary'
|
|
71
71
|
});
|
|
72
|
-
case
|
|
72
|
+
case 4:
|
|
73
73
|
response = _context.sent;
|
|
74
74
|
ext = getExtension(item.name); // Pass through EmailViewer logic
|
|
75
75
|
if (!(ext === 'msg')) {
|
|
76
|
-
_context.next =
|
|
76
|
+
_context.next = 8;
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
|
-
_context.next =
|
|
79
|
+
_context.next = 5;
|
|
80
80
|
return response.arrayBuffer();
|
|
81
|
-
case
|
|
81
|
+
case 5:
|
|
82
82
|
arrayBuffer = _context.sent;
|
|
83
83
|
src = msgToText(arrayBuffer); // email contents parsed successfully
|
|
84
84
|
if (!(typeof src === 'string')) {
|
|
85
|
-
_context.next =
|
|
85
|
+
_context.next = 6;
|
|
86
86
|
break;
|
|
87
87
|
}
|
|
88
88
|
this.onMediaDisplayed();
|
|
89
89
|
this.setState({
|
|
90
90
|
content: Outcome.successful(normaliseLineBreaks(src))
|
|
91
91
|
});
|
|
92
|
-
_context.next =
|
|
92
|
+
_context.next = 7;
|
|
93
93
|
break;
|
|
94
|
-
case
|
|
94
|
+
case 6:
|
|
95
95
|
throw new MediaViewerError('codeviewer-parse-email');
|
|
96
|
-
case
|
|
97
|
-
_context.next =
|
|
96
|
+
case 7:
|
|
97
|
+
_context.next = 10;
|
|
98
98
|
break;
|
|
99
|
-
case
|
|
100
|
-
_context.next =
|
|
99
|
+
case 8:
|
|
100
|
+
_context.next = 9;
|
|
101
101
|
return response.text();
|
|
102
|
-
case
|
|
102
|
+
case 9:
|
|
103
103
|
_src = _context.sent;
|
|
104
104
|
this.onMediaDisplayed();
|
|
105
105
|
this.setState({
|
|
106
106
|
content: Outcome.successful(normaliseLineBreaks(_src))
|
|
107
107
|
});
|
|
108
|
-
case
|
|
109
|
-
_context.next =
|
|
108
|
+
case 10:
|
|
109
|
+
_context.next = 12;
|
|
110
110
|
break;
|
|
111
|
-
case
|
|
112
|
-
_context.prev =
|
|
113
|
-
|
|
114
|
-
codeViewerError = new MediaViewerError('codeviewer-fetch-src',
|
|
111
|
+
case 11:
|
|
112
|
+
_context.prev = 11;
|
|
113
|
+
_t = _context["catch"](2);
|
|
114
|
+
codeViewerError = new MediaViewerError('codeviewer-fetch-src', _t instanceof Error ? _t : undefined);
|
|
115
115
|
this.setState({
|
|
116
116
|
content: Outcome.failed(codeViewerError)
|
|
117
117
|
});
|
|
118
118
|
if (onError) {
|
|
119
119
|
onError(codeViewerError);
|
|
120
120
|
}
|
|
121
|
-
case
|
|
121
|
+
case 12:
|
|
122
122
|
case "end":
|
|
123
123
|
return _context.stop();
|
|
124
124
|
}
|
|
125
|
-
}, _callee, this, [[
|
|
125
|
+
}, _callee, this, [[2, 11]]);
|
|
126
126
|
}));
|
|
127
127
|
function init() {
|
|
128
128
|
return _init.apply(this, arguments);
|
|
@@ -133,15 +133,15 @@ export var CodeViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
133
133
|
key: "loadCodeViewer",
|
|
134
134
|
value: function () {
|
|
135
135
|
var _loadCodeViewer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
136
|
-
return _regeneratorRuntime.wrap(function
|
|
136
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
137
137
|
while (1) switch (_context2.prev = _context2.next) {
|
|
138
138
|
case 0:
|
|
139
|
-
_context2.next =
|
|
139
|
+
_context2.next = 1;
|
|
140
140
|
return componentLoader();
|
|
141
|
-
case
|
|
141
|
+
case 1:
|
|
142
142
|
CodeViewer.CodeViewerComponent = _context2.sent;
|
|
143
143
|
this.forceUpdate();
|
|
144
|
-
case
|
|
144
|
+
case 2:
|
|
145
145
|
case "end":
|
|
146
146
|
return _context2.stop();
|
|
147
147
|
}
|
|
@@ -77,35 +77,36 @@ export var DocViewer = function DocViewer(_ref) {
|
|
|
77
77
|
var enableLazyPageRendering = isExcel && fg('platform_media_excel_lazy_load');
|
|
78
78
|
var getContent = useStaticCallback( /*#__PURE__*/function () {
|
|
79
79
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(pageStart, pageEnd) {
|
|
80
|
-
|
|
80
|
+
var _t;
|
|
81
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
81
82
|
while (1) switch (_context.prev = _context.next) {
|
|
82
83
|
case 0:
|
|
83
84
|
_context.prev = 0;
|
|
84
|
-
_context.next =
|
|
85
|
+
_context.next = 1;
|
|
85
86
|
return mediaClient.mediaStore.getDocumentContent(fileState.id, {
|
|
86
87
|
pageStart: pageStart,
|
|
87
88
|
pageEnd: pageEnd,
|
|
88
89
|
collectionName: collectionName,
|
|
89
90
|
password: state.password
|
|
90
91
|
}, traceContext);
|
|
91
|
-
case
|
|
92
|
+
case 1:
|
|
92
93
|
return _context.abrupt("return", _context.sent);
|
|
93
|
-
case
|
|
94
|
-
_context.prev =
|
|
95
|
-
|
|
96
|
-
if (isCommonMediaClientError(
|
|
94
|
+
case 2:
|
|
95
|
+
_context.prev = 2;
|
|
96
|
+
_t = _context["catch"](0);
|
|
97
|
+
if (isCommonMediaClientError(_t) && _t.reason === 'serverEntityLocked') {
|
|
97
98
|
dispatch({
|
|
98
99
|
type: 'content_fetch_failed_password_required'
|
|
99
100
|
});
|
|
100
101
|
} else {
|
|
101
|
-
onError(new MediaViewerError('docviewer-content-fetch-failed',
|
|
102
|
+
onError(new MediaViewerError('docviewer-content-fetch-failed', _t instanceof Error ? _t : undefined));
|
|
102
103
|
}
|
|
103
|
-
throw
|
|
104
|
-
case
|
|
104
|
+
throw _t;
|
|
105
|
+
case 3:
|
|
105
106
|
case "end":
|
|
106
107
|
return _context.stop();
|
|
107
108
|
}
|
|
108
|
-
}, _callee, null, [[0,
|
|
109
|
+
}, _callee, null, [[0, 2]]);
|
|
109
110
|
}));
|
|
110
111
|
return function (_x, _x2) {
|
|
111
112
|
return _ref2.apply(this, arguments);
|
|
@@ -113,7 +114,8 @@ export var DocViewer = function DocViewer(_ref) {
|
|
|
113
114
|
}());
|
|
114
115
|
var onPasswordSubmit = useStaticCallback( /*#__PURE__*/function () {
|
|
115
116
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(data) {
|
|
116
|
-
|
|
117
|
+
var _t2;
|
|
118
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
117
119
|
while (1) switch (_context2.prev = _context2.next) {
|
|
118
120
|
case 0:
|
|
119
121
|
dispatch({
|
|
@@ -121,34 +123,34 @@ export var DocViewer = function DocViewer(_ref) {
|
|
|
121
123
|
password: data.password
|
|
122
124
|
});
|
|
123
125
|
_context2.prev = 1;
|
|
124
|
-
_context2.next =
|
|
126
|
+
_context2.next = 2;
|
|
125
127
|
return mediaClient.mediaStore.getDocumentContent(fileState.id, {
|
|
126
128
|
pageStart: 0,
|
|
127
129
|
pageEnd: 1,
|
|
128
130
|
collectionName: collectionName,
|
|
129
131
|
password: data.password
|
|
130
132
|
}, traceContext);
|
|
131
|
-
case
|
|
133
|
+
case 2:
|
|
132
134
|
dispatch({
|
|
133
135
|
type: 'password_validation_succeeded'
|
|
134
136
|
});
|
|
135
|
-
_context2.next =
|
|
137
|
+
_context2.next = 4;
|
|
136
138
|
break;
|
|
137
|
-
case
|
|
138
|
-
_context2.prev =
|
|
139
|
-
|
|
140
|
-
if (isCommonMediaClientError(
|
|
139
|
+
case 3:
|
|
140
|
+
_context2.prev = 3;
|
|
141
|
+
_t2 = _context2["catch"](1);
|
|
142
|
+
if (isCommonMediaClientError(_t2) && _t2.reason === 'serverEntityLocked') {
|
|
141
143
|
dispatch({
|
|
142
144
|
type: 'password_validation_failed'
|
|
143
145
|
});
|
|
144
146
|
} else {
|
|
145
|
-
onError(new MediaViewerError('docviewer-content-fetch-failed',
|
|
147
|
+
onError(new MediaViewerError('docviewer-content-fetch-failed', _t2 instanceof Error ? _t2 : undefined));
|
|
146
148
|
}
|
|
147
|
-
case
|
|
149
|
+
case 4:
|
|
148
150
|
case "end":
|
|
149
151
|
return _context2.stop();
|
|
150
152
|
}
|
|
151
|
-
}, _callee2, null, [[1,
|
|
153
|
+
}, _callee2, null, [[1, 3]]);
|
|
152
154
|
}));
|
|
153
155
|
return function (_x3) {
|
|
154
156
|
return _ref3.apply(this, arguments);
|
|
@@ -157,20 +159,20 @@ export var DocViewer = function DocViewer(_ref) {
|
|
|
157
159
|
var getPageImageUrl = useStaticCallback( /*#__PURE__*/function () {
|
|
158
160
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(pageNumber, zoom) {
|
|
159
161
|
var src;
|
|
160
|
-
return _regeneratorRuntime.wrap(function
|
|
162
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
161
163
|
while (1) switch (_context3.prev = _context3.next) {
|
|
162
164
|
case 0:
|
|
163
|
-
_context3.next =
|
|
165
|
+
_context3.next = 1;
|
|
164
166
|
return mediaClient.mediaStore.getDocumentPageImage(fileState.id, {
|
|
165
167
|
page: pageNumber,
|
|
166
168
|
zoom: zoom,
|
|
167
169
|
collectionName: collectionName,
|
|
168
170
|
password: state.password
|
|
169
171
|
}, traceContext);
|
|
170
|
-
case
|
|
172
|
+
case 1:
|
|
171
173
|
src = _context3.sent;
|
|
172
174
|
return _context3.abrupt("return", URL.createObjectURL(src));
|
|
173
|
-
case
|
|
175
|
+
case 2:
|
|
174
176
|
case "end":
|
|
175
177
|
return _context3.stop();
|
|
176
178
|
}
|
|
@@ -49,7 +49,7 @@ export var DocViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
49
49
|
value: function () {
|
|
50
50
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
51
51
|
var item;
|
|
52
|
-
return _regeneratorRuntime.wrap(function
|
|
52
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
53
53
|
while (1) switch (_context.prev = _context.next) {
|
|
54
54
|
case 0:
|
|
55
55
|
item = this.props.item;
|
|
@@ -59,7 +59,7 @@ export var DocViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
59
59
|
if (fg('download_event_for_jira_attachments')) {
|
|
60
60
|
this.onMediaDisplayed();
|
|
61
61
|
}
|
|
62
|
-
case
|
|
62
|
+
case 1:
|
|
63
63
|
case "end":
|
|
64
64
|
return _context.stop();
|
|
65
65
|
}
|
|
@@ -53,63 +53,63 @@ export var ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
53
53
|
key: "init",
|
|
54
54
|
value: function () {
|
|
55
55
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
56
|
-
var _this$props, fileState, mediaClient, collectionName, traceContext, controller, orientation, objectUrl, originalBinaryImageUrl, isLocalFileReference, clientId, preview, _yield$preview, value, origin, item, response, imgError;
|
|
57
|
-
return _regeneratorRuntime.wrap(function
|
|
56
|
+
var _this$props, fileState, mediaClient, collectionName, traceContext, controller, orientation, objectUrl, originalBinaryImageUrl, isLocalFileReference, clientId, preview, _yield$preview, value, origin, item, response, imgError, _t, _t2, _t3;
|
|
57
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
58
58
|
while (1) switch (_context.prev = _context.next) {
|
|
59
59
|
case 0:
|
|
60
60
|
_this$props = this.props, fileState = _this$props.item, mediaClient = _this$props.mediaClient, collectionName = _this$props.collectionName, traceContext = _this$props.traceContext;
|
|
61
61
|
if (!isErrorFileState(fileState)) {
|
|
62
|
-
_context.next =
|
|
62
|
+
_context.next = 1;
|
|
63
63
|
break;
|
|
64
64
|
}
|
|
65
65
|
return _context.abrupt("return");
|
|
66
|
-
case
|
|
66
|
+
case 1:
|
|
67
67
|
controller = typeof AbortController !== 'undefined' ? new AbortController() : undefined;
|
|
68
|
-
_context.prev =
|
|
68
|
+
_context.prev = 2;
|
|
69
69
|
orientation = 1;
|
|
70
70
|
isLocalFileReference = false;
|
|
71
|
-
_context.prev =
|
|
72
|
-
_context.next =
|
|
71
|
+
_context.prev = 3;
|
|
72
|
+
_context.next = 4;
|
|
73
73
|
return mediaClient.getClientId(collectionName);
|
|
74
|
-
case
|
|
74
|
+
case 4:
|
|
75
75
|
clientId = _context.sent;
|
|
76
|
-
_context.next =
|
|
76
|
+
_context.next = 6;
|
|
77
77
|
break;
|
|
78
|
-
case
|
|
79
|
-
_context.prev =
|
|
80
|
-
|
|
81
|
-
case
|
|
78
|
+
case 5:
|
|
79
|
+
_context.prev = 5;
|
|
80
|
+
_t = _context["catch"](3);
|
|
81
|
+
case 6:
|
|
82
82
|
preview = fileState.preview;
|
|
83
83
|
if (!preview) {
|
|
84
|
-
_context.next =
|
|
84
|
+
_context.next = 11;
|
|
85
85
|
break;
|
|
86
86
|
}
|
|
87
|
-
_context.next =
|
|
87
|
+
_context.next = 7;
|
|
88
88
|
return preview;
|
|
89
|
-
case
|
|
89
|
+
case 7:
|
|
90
90
|
_yield$preview = _context.sent;
|
|
91
91
|
value = _yield$preview.value;
|
|
92
92
|
origin = _yield$preview.origin;
|
|
93
93
|
if (!(value instanceof Blob)) {
|
|
94
|
-
_context.next =
|
|
94
|
+
_context.next = 9;
|
|
95
95
|
break;
|
|
96
96
|
}
|
|
97
|
-
_context.next =
|
|
97
|
+
_context.next = 8;
|
|
98
98
|
return getOrientation(value);
|
|
99
|
-
case
|
|
99
|
+
case 8:
|
|
100
100
|
orientation = _context.sent;
|
|
101
101
|
objectUrl = URL.createObjectURL(value);
|
|
102
102
|
isLocalFileReference = origin === 'local';
|
|
103
|
-
_context.next =
|
|
103
|
+
_context.next = 10;
|
|
104
104
|
break;
|
|
105
|
-
case
|
|
105
|
+
case 9:
|
|
106
106
|
objectUrl = value;
|
|
107
|
-
case
|
|
108
|
-
_context.next =
|
|
107
|
+
case 10:
|
|
108
|
+
_context.next = 14;
|
|
109
109
|
break;
|
|
110
|
-
case
|
|
110
|
+
case 11:
|
|
111
111
|
if (!isImageRepresentationReady(fileState)) {
|
|
112
|
-
_context.next =
|
|
112
|
+
_context.next = 13;
|
|
113
113
|
break;
|
|
114
114
|
}
|
|
115
115
|
item = processedFileStateToMediaItem(fileState);
|
|
@@ -120,31 +120,30 @@ export var ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
120
120
|
this.cancelImageFetch = function () {
|
|
121
121
|
return controller === null || controller === void 0 ? void 0 : controller.abort();
|
|
122
122
|
};
|
|
123
|
-
|
|
124
|
-
_context.next =
|
|
123
|
+
_t2 = URL;
|
|
124
|
+
_context.next = 12;
|
|
125
125
|
return response;
|
|
126
|
-
case
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
_context.next = 46;
|
|
126
|
+
case 12:
|
|
127
|
+
objectUrl = _t2.createObjectURL.call(_t2, _context.sent);
|
|
128
|
+
_context.next = 14;
|
|
130
129
|
break;
|
|
131
|
-
case
|
|
130
|
+
case 13:
|
|
132
131
|
this.setState({
|
|
133
132
|
content: Outcome.pending()
|
|
134
133
|
});
|
|
135
134
|
return _context.abrupt("return");
|
|
136
|
-
case
|
|
135
|
+
case 14:
|
|
137
136
|
if (!(!isLocalFileReference &&
|
|
138
137
|
// objectUrl at this point is binary file already
|
|
139
138
|
!isErrorFileState(fileState) && fileState.status !== 'uploading' && fileState.mediaType === 'image' && isImageMimeTypeSupportedByBrowser(fileState.mimeType))) {
|
|
140
|
-
_context.next =
|
|
139
|
+
_context.next = 16;
|
|
141
140
|
break;
|
|
142
141
|
}
|
|
143
|
-
_context.next =
|
|
142
|
+
_context.next = 15;
|
|
144
143
|
return mediaClient.file.getFileBinaryURL(fileState.id, collectionName);
|
|
145
|
-
case
|
|
144
|
+
case 15:
|
|
146
145
|
originalBinaryImageUrl = _context.sent;
|
|
147
|
-
case
|
|
146
|
+
case 16:
|
|
148
147
|
this.setState({
|
|
149
148
|
content: Outcome.successful({
|
|
150
149
|
objectUrl: objectUrl,
|
|
@@ -153,24 +152,24 @@ export var ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
153
152
|
clientId: clientId
|
|
154
153
|
})
|
|
155
154
|
});
|
|
156
|
-
_context.next =
|
|
155
|
+
_context.next = 18;
|
|
157
156
|
break;
|
|
158
|
-
case
|
|
159
|
-
_context.prev =
|
|
160
|
-
|
|
157
|
+
case 17:
|
|
158
|
+
_context.prev = 17;
|
|
159
|
+
_t3 = _context["catch"](2);
|
|
161
160
|
// TODO : properly handle aborted requests (MS-2843)
|
|
162
161
|
if (!(controller !== null && controller !== void 0 && controller.signal.aborted)) {
|
|
163
|
-
imgError = new MediaViewerError('imageviewer-fetch-url',
|
|
162
|
+
imgError = new MediaViewerError('imageviewer-fetch-url', _t3 instanceof Error ? _t3 : undefined);
|
|
164
163
|
this.setState({
|
|
165
164
|
content: Outcome.failed(imgError)
|
|
166
165
|
});
|
|
167
166
|
this.props.onError(imgError);
|
|
168
167
|
}
|
|
169
|
-
case
|
|
168
|
+
case 18:
|
|
170
169
|
case "end":
|
|
171
170
|
return _context.stop();
|
|
172
171
|
}
|
|
173
|
-
}, _callee, this, [[
|
|
172
|
+
}, _callee, this, [[2, 17], [3, 5]]);
|
|
174
173
|
}));
|
|
175
174
|
function init() {
|
|
176
175
|
return _init.apply(this, arguments);
|
|
@@ -116,58 +116,58 @@ export var VideoViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
116
116
|
key: "init",
|
|
117
117
|
value: function () {
|
|
118
118
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
119
|
-
var _this$props3, mediaClient, item, collectionName, contentUrl;
|
|
120
|
-
return _regeneratorRuntime.wrap(function
|
|
119
|
+
var _this$props3, mediaClient, item, collectionName, contentUrl, _t;
|
|
120
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
121
121
|
while (1) switch (_context.prev = _context.next) {
|
|
122
122
|
case 0:
|
|
123
123
|
_this$props3 = this.props, mediaClient = _this$props3.mediaClient, item = _this$props3.item, collectionName = _this$props3.collectionName;
|
|
124
124
|
_context.prev = 1;
|
|
125
125
|
if (!(item.status === 'processed')) {
|
|
126
|
-
_context.next =
|
|
126
|
+
_context.next = 4;
|
|
127
127
|
break;
|
|
128
128
|
}
|
|
129
|
-
_context.next =
|
|
129
|
+
_context.next = 2;
|
|
130
130
|
return mediaClient.file.getArtifactURL(item.artifacts, hdArtifact, collectionName);
|
|
131
|
-
case
|
|
131
|
+
case 2:
|
|
132
132
|
contentUrl = _context.sent;
|
|
133
133
|
if (contentUrl) {
|
|
134
|
-
_context.next =
|
|
134
|
+
_context.next = 3;
|
|
135
135
|
break;
|
|
136
136
|
}
|
|
137
137
|
throw new MediaViewerError("videoviewer-missing-artefact");
|
|
138
|
-
case
|
|
139
|
-
_context.next =
|
|
138
|
+
case 3:
|
|
139
|
+
_context.next = 6;
|
|
140
140
|
break;
|
|
141
|
-
case
|
|
142
|
-
_context.next =
|
|
141
|
+
case 4:
|
|
142
|
+
_context.next = 5;
|
|
143
143
|
return getObjectUrlFromFileState(item);
|
|
144
|
-
case
|
|
144
|
+
case 5:
|
|
145
145
|
contentUrl = _context.sent;
|
|
146
146
|
if (contentUrl) {
|
|
147
|
-
_context.next =
|
|
147
|
+
_context.next = 6;
|
|
148
148
|
break;
|
|
149
149
|
}
|
|
150
150
|
this.setState({
|
|
151
151
|
content: Outcome.pending()
|
|
152
152
|
});
|
|
153
153
|
return _context.abrupt("return");
|
|
154
|
-
case
|
|
154
|
+
case 6:
|
|
155
155
|
this.setState({
|
|
156
156
|
content: Outcome.successful(contentUrl)
|
|
157
157
|
});
|
|
158
|
-
_context.next =
|
|
158
|
+
_context.next = 8;
|
|
159
159
|
break;
|
|
160
|
-
case
|
|
161
|
-
_context.prev =
|
|
162
|
-
|
|
160
|
+
case 7:
|
|
161
|
+
_context.prev = 7;
|
|
162
|
+
_t = _context["catch"](1);
|
|
163
163
|
this.setState({
|
|
164
|
-
content: Outcome.failed(new MediaViewerError('videoviewer-fetch-url',
|
|
164
|
+
content: Outcome.failed(new MediaViewerError('videoviewer-fetch-url', _t instanceof Error ? _t : undefined))
|
|
165
165
|
});
|
|
166
|
-
case
|
|
166
|
+
case 8:
|
|
167
167
|
case "end":
|
|
168
168
|
return _context.stop();
|
|
169
169
|
}
|
|
170
|
-
}, _callee, this, [[1,
|
|
170
|
+
}, _callee, this, [[1, 7]]);
|
|
171
171
|
}));
|
|
172
172
|
function init() {
|
|
173
173
|
return _init.apply(this, arguments);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type MediaViewerProps } from './types';
|
|
3
3
|
import type { MediaViewerWithMediaClientConfigProps } from './types';
|
|
4
|
-
export declare const MediaViewerBase: ({ featureFlags, onClose, selectedItem, collectionName, items, extensions, contextId, viewerOptions, }: MediaViewerProps) => React.JSX.Element;
|
|
4
|
+
export declare const MediaViewerBase: ({ featureFlags, onClose, selectedItem, collectionName, items, extensions, contextId, viewerOptions, fallbackMediaNameFetcher, }: MediaViewerProps) => React.JSX.Element;
|
|
5
5
|
export declare const MediaViewerWithMediaClient: (props: MediaViewerWithMediaClientConfigProps) => React.JSX.Element;
|
|
@@ -37,6 +37,7 @@ export interface MediaViewerProps {
|
|
|
37
37
|
readonly extensions?: MediaViewerExtensions;
|
|
38
38
|
readonly contextId?: string;
|
|
39
39
|
readonly viewerOptions?: ViewerOptionsProps;
|
|
40
|
+
readonly fallbackMediaNameFetcher?: (id: string) => Promise<string>;
|
|
40
41
|
}
|
|
41
42
|
export type MediaMessage = {
|
|
42
43
|
source: 'media';
|
package/dist/types/header.d.ts
CHANGED
|
@@ -13,7 +13,8 @@ export type Props = {
|
|
|
13
13
|
readonly onSetArchiveSideBarVisible?: (isVisible: boolean) => void;
|
|
14
14
|
readonly isArchiveSideBarVisible?: boolean;
|
|
15
15
|
traceContext: MediaTraceContext;
|
|
16
|
+
readonly fallbackMediaNameFetcher?: (id: string) => Promise<string>;
|
|
16
17
|
};
|
|
17
|
-
export declare const Header: ({ isArchiveSideBarVisible, extensions, isSidebarVisible, onSidebarButtonClick, identifier, onClose, onSetArchiveSideBarVisible, traceContext, }: Props & WrappedComponentProps) => React.JSX.Element;
|
|
18
|
+
export declare const Header: ({ isArchiveSideBarVisible, extensions, isSidebarVisible, onSidebarButtonClick, identifier, onClose, onSetArchiveSideBarVisible, traceContext, fallbackMediaNameFetcher, }: Props & WrappedComponentProps) => React.JSX.Element;
|
|
18
19
|
declare const _default: React.FC<Props>;
|
|
19
20
|
export default _default;
|
package/dist/types/list.d.ts
CHANGED
|
@@ -15,10 +15,11 @@ export type Props = Readonly<{
|
|
|
15
15
|
contextId?: string;
|
|
16
16
|
featureFlags?: MediaFeatureFlags;
|
|
17
17
|
viewerOptions?: ViewerOptionsProps;
|
|
18
|
+
fallbackMediaNameFetcher?: (id: string) => Promise<string>;
|
|
18
19
|
} & WithShowControlMethodProp>;
|
|
19
20
|
export type State = {
|
|
20
21
|
selectedItem: Identifier;
|
|
21
22
|
previewCount: number;
|
|
22
23
|
isArchiveSideBarVisible: boolean;
|
|
23
24
|
};
|
|
24
|
-
export declare const List: ({ defaultSelectedItem, onClose, showControls, extensions, onSidebarButtonClick, contextId, featureFlags, isSidebarVisible, onNavigationChange, items, viewerOptions, }: Props) => React.JSX.Element;
|
|
25
|
+
export declare const List: ({ defaultSelectedItem, onClose, showControls, extensions, onSidebarButtonClick, contextId, featureFlags, isSidebarVisible, onNavigationChange, items, viewerOptions, fallbackMediaNameFetcher, }: Props) => React.JSX.Element;
|
|
@@ -6,12 +6,5 @@
|
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"*.compiled.css"
|
|
8
8
|
],
|
|
9
|
-
"types": "../dist/types/components/media-viewer-loader.d.ts"
|
|
10
|
-
"typesVersions": {
|
|
11
|
-
">=4.5 <5.9": {
|
|
12
|
-
"*": [
|
|
13
|
-
"../dist/types-ts4.5/components/media-viewer-loader.d.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
9
|
+
"types": "../dist/types/components/media-viewer-loader.d.ts"
|
|
17
10
|
}
|