@atlaskit/media-viewer 49.2.0 → 49.2.2
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/doc/index.js +49 -36
- package/dist/cjs/viewers/doc/pdfRenderer.js +1 -1
- package/dist/es2019/analytics/index.js +1 -1
- package/dist/es2019/analytics/ufoExperiences.js +1 -1
- package/dist/es2019/viewers/doc/index.js +21 -9
- package/dist/es2019/viewers/doc/pdfRenderer.js +1 -1
- package/dist/esm/analytics/index.js +1 -1
- package/dist/esm/analytics/ufoExperiences.js +1 -1
- package/dist/esm/viewers/doc/index.js +49 -36
- package/dist/esm/viewers/doc/pdfRenderer.js +1 -1
- package/dist/types/viewers/doc/index.d.ts +3 -1
- package/dist/types-ts4.5/viewers/doc/index.d.ts +3 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/media-viewer
|
|
2
2
|
|
|
3
|
+
## 49.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#154712](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154712)
|
|
8
|
+
[`9b74c0d52fcc1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9b74c0d52fcc1) -
|
|
9
|
+
fix pdf viewer flicker issue
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 49.2.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#153881](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/153881)
|
|
17
|
+
[`36ca6fc71c619`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/36ca6fc71c619) -
|
|
18
|
+
[ux] patch pdf.js fliker issues due to refetch
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 49.2.0
|
|
4
22
|
|
|
5
23
|
### Minor 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 = "49.2.
|
|
13
|
+
var packageVersion = exports.packageVersion = "49.2.2";
|
|
14
14
|
function getFileAttributes(fileState) {
|
|
15
15
|
if (!fileState) {
|
|
16
16
|
return {
|
|
@@ -12,7 +12,7 @@ var _mediaCommon = require("@atlaskit/media-common");
|
|
|
12
12
|
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; }
|
|
13
13
|
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; }
|
|
14
14
|
var packageName = "@atlaskit/media-viewer";
|
|
15
|
-
var packageVersion = "49.2.
|
|
15
|
+
var packageVersion = "49.2.2";
|
|
16
16
|
var ufoExperience;
|
|
17
17
|
var getExperience = function getExperience() {
|
|
18
18
|
if (!ufoExperience) {
|
|
@@ -9,9 +9,11 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
12
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
13
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
14
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
17
|
var _react = _interopRequireDefault(require("react"));
|
|
16
18
|
var _mediaClient = require("@atlaskit/media-client");
|
|
17
19
|
var _domain = require("../../domain");
|
|
@@ -25,8 +27,14 @@ var DocViewer = exports.DocViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
25
27
|
(0, _inherits2.default)(DocViewer, _BaseViewer);
|
|
26
28
|
var _super = _createSuper(DocViewer);
|
|
27
29
|
function DocViewer() {
|
|
30
|
+
var _this;
|
|
28
31
|
(0, _classCallCheck2.default)(this, DocViewer);
|
|
29
|
-
|
|
32
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
33
|
+
args[_key] = arguments[_key];
|
|
34
|
+
}
|
|
35
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
36
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isObjectUrl", false);
|
|
37
|
+
return _this;
|
|
30
38
|
}
|
|
31
39
|
(0, _createClass2.default)(DocViewer, [{
|
|
32
40
|
key: "initialState",
|
|
@@ -35,6 +43,14 @@ var DocViewer = exports.DocViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
35
43
|
content: _domain.Outcome.pending()
|
|
36
44
|
};
|
|
37
45
|
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "needsReset",
|
|
48
|
+
value: function needsReset(propsA, propsB) {
|
|
49
|
+
if (this.state.content.status === 'SUCCESSFUL') {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return propsA.item.status !== propsB.item.status;
|
|
53
|
+
}
|
|
38
54
|
}, {
|
|
39
55
|
key: "init",
|
|
40
56
|
value: function () {
|
|
@@ -45,46 +61,41 @@ var DocViewer = exports.DocViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
45
61
|
case 0:
|
|
46
62
|
_this$props = this.props, item = _this$props.item, mediaClient = _this$props.mediaClient, collectionName = _this$props.collectionName, onError = _this$props.onError;
|
|
47
63
|
if (!((0, _mediaClient.isPreviewableFileState)(item) && item.mimeType.toLowerCase() === 'application/pdf')) {
|
|
48
|
-
_context.next =
|
|
64
|
+
_context.next = 9;
|
|
49
65
|
break;
|
|
50
66
|
}
|
|
51
67
|
_context.next = 4;
|
|
52
68
|
return (0, _getObjectUrlFromFileState.getObjectUrlFromFileState)(item);
|
|
53
69
|
case 4:
|
|
54
70
|
src = _context.sent;
|
|
55
|
-
if (src) {
|
|
56
|
-
_context.next =
|
|
71
|
+
if (!src) {
|
|
72
|
+
_context.next = 9;
|
|
57
73
|
break;
|
|
58
74
|
}
|
|
59
|
-
this.
|
|
60
|
-
content: _domain.Outcome.pending()
|
|
61
|
-
});
|
|
62
|
-
return _context.abrupt("return");
|
|
63
|
-
case 8:
|
|
75
|
+
this.isObjectUrl = true;
|
|
64
76
|
this.setState({
|
|
65
77
|
content: _domain.Outcome.successful(src)
|
|
66
78
|
});
|
|
67
|
-
_context.
|
|
68
|
-
|
|
69
|
-
case 11:
|
|
79
|
+
return _context.abrupt("return");
|
|
80
|
+
case 9:
|
|
70
81
|
if (!(item.status === 'processed')) {
|
|
71
|
-
_context.next =
|
|
82
|
+
_context.next = 25;
|
|
72
83
|
break;
|
|
73
84
|
}
|
|
74
|
-
_context.prev =
|
|
75
|
-
_context.next =
|
|
85
|
+
_context.prev = 10;
|
|
86
|
+
_context.next = 13;
|
|
76
87
|
return mediaClient.file.getArtifactURL(item.artifacts, 'document.pdf', collectionName);
|
|
77
|
-
case
|
|
88
|
+
case 13:
|
|
78
89
|
_src = _context.sent;
|
|
79
90
|
this.onMediaDisplayed();
|
|
80
91
|
this.setState({
|
|
81
92
|
content: _domain.Outcome.successful(_src)
|
|
82
93
|
});
|
|
83
|
-
_context.next =
|
|
94
|
+
_context.next = 23;
|
|
84
95
|
break;
|
|
85
|
-
case
|
|
86
|
-
_context.prev =
|
|
87
|
-
_context.t0 = _context["catch"](
|
|
96
|
+
case 18:
|
|
97
|
+
_context.prev = 18;
|
|
98
|
+
_context.t0 = _context["catch"](10);
|
|
88
99
|
docError = new _errors.MediaViewerError('docviewer-fetch-url', _context.t0 instanceof Error ? _context.t0 : undefined);
|
|
89
100
|
this.setState({
|
|
90
101
|
content: _domain.Outcome.failed(docError)
|
|
@@ -92,29 +103,29 @@ var DocViewer = exports.DocViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
92
103
|
if (onError) {
|
|
93
104
|
onError(docError);
|
|
94
105
|
}
|
|
95
|
-
case
|
|
96
|
-
_context.next =
|
|
106
|
+
case 23:
|
|
107
|
+
_context.next = 39;
|
|
97
108
|
break;
|
|
98
|
-
case
|
|
109
|
+
case 25:
|
|
99
110
|
if (!(item.status === 'failed-processing')) {
|
|
100
|
-
_context.next =
|
|
111
|
+
_context.next = 39;
|
|
101
112
|
break;
|
|
102
113
|
}
|
|
103
|
-
_context.prev =
|
|
104
|
-
_context.next =
|
|
114
|
+
_context.prev = 26;
|
|
115
|
+
_context.next = 29;
|
|
105
116
|
return mediaClient.file.getFileBinaryURL(item.id, collectionName, 2940 // 2940 seconds ~= 50 mins
|
|
106
117
|
);
|
|
107
|
-
case
|
|
118
|
+
case 29:
|
|
108
119
|
_src2 = _context.sent;
|
|
109
120
|
this.onMediaDisplayed();
|
|
110
121
|
this.setState({
|
|
111
122
|
content: _domain.Outcome.successful(_src2)
|
|
112
123
|
});
|
|
113
|
-
_context.next =
|
|
124
|
+
_context.next = 39;
|
|
114
125
|
break;
|
|
115
|
-
case
|
|
116
|
-
_context.prev =
|
|
117
|
-
_context.t1 = _context["catch"](
|
|
126
|
+
case 34:
|
|
127
|
+
_context.prev = 34;
|
|
128
|
+
_context.t1 = _context["catch"](26);
|
|
118
129
|
_docError = new _errors.MediaViewerError('docviewer-fetch-url', _context.t1 instanceof Error ? _context.t1 : undefined);
|
|
119
130
|
this.setState({
|
|
120
131
|
content: _domain.Outcome.failed(_docError)
|
|
@@ -122,11 +133,11 @@ var DocViewer = exports.DocViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
122
133
|
if (onError) {
|
|
123
134
|
onError(_docError);
|
|
124
135
|
}
|
|
125
|
-
case
|
|
136
|
+
case 39:
|
|
126
137
|
case "end":
|
|
127
138
|
return _context.stop();
|
|
128
139
|
}
|
|
129
|
-
}, _callee, this, [[
|
|
140
|
+
}, _callee, this, [[10, 18], [26, 34]]);
|
|
130
141
|
}));
|
|
131
142
|
function init() {
|
|
132
143
|
return _init.apply(this, arguments);
|
|
@@ -136,11 +147,13 @@ var DocViewer = exports.DocViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
136
147
|
}, {
|
|
137
148
|
key: "release",
|
|
138
149
|
value: function release() {
|
|
139
|
-
|
|
140
|
-
if (!content.data) {
|
|
150
|
+
if (!this.isObjectUrl) {
|
|
141
151
|
return;
|
|
142
152
|
}
|
|
143
|
-
|
|
153
|
+
var content = this.state.content;
|
|
154
|
+
if (content.data) {
|
|
155
|
+
URL.revokeObjectURL(content.data);
|
|
156
|
+
}
|
|
144
157
|
}
|
|
145
158
|
}, {
|
|
146
159
|
key: "renderSuccessful",
|
|
@@ -264,7 +264,7 @@ var PDFRendererBase = function PDFRendererBase(_ref2) {
|
|
|
264
264
|
if (onSuccessRef.current) {
|
|
265
265
|
onSuccessRef.current();
|
|
266
266
|
}
|
|
267
|
-
}, [createAnalyticsEvent, docOutcome]);
|
|
267
|
+
}, [createAnalyticsEvent, docOutcome.status]);
|
|
268
268
|
var savePdfElement = function savePdfElement(el) {
|
|
269
269
|
pdfWrapperRef.current = el;
|
|
270
270
|
};
|
|
@@ -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 = "49.2.
|
|
4
|
+
const packageVersion = "49.2.2";
|
|
5
5
|
export { packageName, packageVersion, componentName, componentName as component };
|
|
6
6
|
export function getFileAttributes(fileState) {
|
|
7
7
|
if (!fileState) {
|
|
@@ -2,7 +2,7 @@ import { UFOExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atl
|
|
|
2
2
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
3
3
|
import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
|
|
4
4
|
const packageName = "@atlaskit/media-viewer";
|
|
5
|
-
const packageVersion = "49.2.
|
|
5
|
+
const packageVersion = "49.2.2";
|
|
6
6
|
let ufoExperience;
|
|
7
7
|
const getExperience = () => {
|
|
8
8
|
if (!ufoExperience) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { isPreviewableFileState } from '@atlaskit/media-client';
|
|
3
4
|
import { Outcome } from '../../domain';
|
|
@@ -6,11 +7,21 @@ import { PDFRenderer } from './pdfRenderer';
|
|
|
6
7
|
import { BaseViewer } from '../base-viewer';
|
|
7
8
|
import { getObjectUrlFromFileState } from '../../utils/getObjectUrlFromFileState';
|
|
8
9
|
export class DocViewer extends BaseViewer {
|
|
10
|
+
constructor(...args) {
|
|
11
|
+
super(...args);
|
|
12
|
+
_defineProperty(this, "isObjectUrl", false);
|
|
13
|
+
}
|
|
9
14
|
get initialState() {
|
|
10
15
|
return {
|
|
11
16
|
content: Outcome.pending()
|
|
12
17
|
};
|
|
13
18
|
}
|
|
19
|
+
needsReset(propsA, propsB) {
|
|
20
|
+
if (this.state.content.status === 'SUCCESSFUL') {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
return propsA.item.status !== propsB.item.status;
|
|
24
|
+
}
|
|
14
25
|
async init() {
|
|
15
26
|
const {
|
|
16
27
|
item,
|
|
@@ -20,16 +31,15 @@ export class DocViewer extends BaseViewer {
|
|
|
20
31
|
} = this.props;
|
|
21
32
|
if (isPreviewableFileState(item) && item.mimeType.toLowerCase() === 'application/pdf') {
|
|
22
33
|
const src = await getObjectUrlFromFileState(item);
|
|
23
|
-
if (
|
|
34
|
+
if (src) {
|
|
35
|
+
this.isObjectUrl = true;
|
|
24
36
|
this.setState({
|
|
25
|
-
content: Outcome.
|
|
37
|
+
content: Outcome.successful(src)
|
|
26
38
|
});
|
|
27
39
|
return;
|
|
28
40
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
} else if (item.status === 'processed') {
|
|
41
|
+
}
|
|
42
|
+
if (item.status === 'processed') {
|
|
33
43
|
try {
|
|
34
44
|
const src = await mediaClient.file.getArtifactURL(item.artifacts, 'document.pdf', collectionName);
|
|
35
45
|
this.onMediaDisplayed();
|
|
@@ -65,13 +75,15 @@ export class DocViewer extends BaseViewer {
|
|
|
65
75
|
}
|
|
66
76
|
}
|
|
67
77
|
release() {
|
|
78
|
+
if (!this.isObjectUrl) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
68
81
|
const {
|
|
69
82
|
content
|
|
70
83
|
} = this.state;
|
|
71
|
-
if (
|
|
72
|
-
|
|
84
|
+
if (content.data) {
|
|
85
|
+
URL.revokeObjectURL(content.data);
|
|
73
86
|
}
|
|
74
|
-
URL.revokeObjectURL(content.data);
|
|
75
87
|
}
|
|
76
88
|
renderSuccessful(content) {
|
|
77
89
|
const {
|
|
@@ -187,7 +187,7 @@ const PDFRendererBase = ({
|
|
|
187
187
|
if (onSuccessRef.current) {
|
|
188
188
|
onSuccessRef.current();
|
|
189
189
|
}
|
|
190
|
-
}, [createAnalyticsEvent, docOutcome]);
|
|
190
|
+
}, [createAnalyticsEvent, docOutcome.status]);
|
|
191
191
|
const savePdfElement = el => {
|
|
192
192
|
pdfWrapperRef.current = el;
|
|
193
193
|
};
|
|
@@ -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 = "49.2.
|
|
4
|
+
var packageVersion = "49.2.2";
|
|
5
5
|
export { packageName, packageVersion, componentName, componentName as component };
|
|
6
6
|
export function getFileAttributes(fileState) {
|
|
7
7
|
if (!fileState) {
|
|
@@ -5,7 +5,7 @@ import { UFOExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atl
|
|
|
5
5
|
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
6
6
|
import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
|
|
7
7
|
var packageName = "@atlaskit/media-viewer";
|
|
8
|
-
var packageVersion = "49.2.
|
|
8
|
+
var packageVersion = "49.2.2";
|
|
9
9
|
var ufoExperience;
|
|
10
10
|
var getExperience = function getExperience() {
|
|
11
11
|
if (!ufoExperience) {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
10
|
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
|
|
9
11
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
@@ -18,8 +20,14 @@ export var DocViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
18
20
|
_inherits(DocViewer, _BaseViewer);
|
|
19
21
|
var _super = _createSuper(DocViewer);
|
|
20
22
|
function DocViewer() {
|
|
23
|
+
var _this;
|
|
21
24
|
_classCallCheck(this, DocViewer);
|
|
22
|
-
|
|
25
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
26
|
+
args[_key] = arguments[_key];
|
|
27
|
+
}
|
|
28
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
29
|
+
_defineProperty(_assertThisInitialized(_this), "isObjectUrl", false);
|
|
30
|
+
return _this;
|
|
23
31
|
}
|
|
24
32
|
_createClass(DocViewer, [{
|
|
25
33
|
key: "initialState",
|
|
@@ -28,6 +36,14 @@ export var DocViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
28
36
|
content: Outcome.pending()
|
|
29
37
|
};
|
|
30
38
|
}
|
|
39
|
+
}, {
|
|
40
|
+
key: "needsReset",
|
|
41
|
+
value: function needsReset(propsA, propsB) {
|
|
42
|
+
if (this.state.content.status === 'SUCCESSFUL') {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return propsA.item.status !== propsB.item.status;
|
|
46
|
+
}
|
|
31
47
|
}, {
|
|
32
48
|
key: "init",
|
|
33
49
|
value: function () {
|
|
@@ -38,46 +54,41 @@ export var DocViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
38
54
|
case 0:
|
|
39
55
|
_this$props = this.props, item = _this$props.item, mediaClient = _this$props.mediaClient, collectionName = _this$props.collectionName, onError = _this$props.onError;
|
|
40
56
|
if (!(isPreviewableFileState(item) && item.mimeType.toLowerCase() === 'application/pdf')) {
|
|
41
|
-
_context.next =
|
|
57
|
+
_context.next = 9;
|
|
42
58
|
break;
|
|
43
59
|
}
|
|
44
60
|
_context.next = 4;
|
|
45
61
|
return getObjectUrlFromFileState(item);
|
|
46
62
|
case 4:
|
|
47
63
|
src = _context.sent;
|
|
48
|
-
if (src) {
|
|
49
|
-
_context.next =
|
|
64
|
+
if (!src) {
|
|
65
|
+
_context.next = 9;
|
|
50
66
|
break;
|
|
51
67
|
}
|
|
52
|
-
this.
|
|
53
|
-
content: Outcome.pending()
|
|
54
|
-
});
|
|
55
|
-
return _context.abrupt("return");
|
|
56
|
-
case 8:
|
|
68
|
+
this.isObjectUrl = true;
|
|
57
69
|
this.setState({
|
|
58
70
|
content: Outcome.successful(src)
|
|
59
71
|
});
|
|
60
|
-
_context.
|
|
61
|
-
|
|
62
|
-
case 11:
|
|
72
|
+
return _context.abrupt("return");
|
|
73
|
+
case 9:
|
|
63
74
|
if (!(item.status === 'processed')) {
|
|
64
|
-
_context.next =
|
|
75
|
+
_context.next = 25;
|
|
65
76
|
break;
|
|
66
77
|
}
|
|
67
|
-
_context.prev =
|
|
68
|
-
_context.next =
|
|
78
|
+
_context.prev = 10;
|
|
79
|
+
_context.next = 13;
|
|
69
80
|
return mediaClient.file.getArtifactURL(item.artifacts, 'document.pdf', collectionName);
|
|
70
|
-
case
|
|
81
|
+
case 13:
|
|
71
82
|
_src = _context.sent;
|
|
72
83
|
this.onMediaDisplayed();
|
|
73
84
|
this.setState({
|
|
74
85
|
content: Outcome.successful(_src)
|
|
75
86
|
});
|
|
76
|
-
_context.next =
|
|
87
|
+
_context.next = 23;
|
|
77
88
|
break;
|
|
78
|
-
case
|
|
79
|
-
_context.prev =
|
|
80
|
-
_context.t0 = _context["catch"](
|
|
89
|
+
case 18:
|
|
90
|
+
_context.prev = 18;
|
|
91
|
+
_context.t0 = _context["catch"](10);
|
|
81
92
|
docError = new MediaViewerError('docviewer-fetch-url', _context.t0 instanceof Error ? _context.t0 : undefined);
|
|
82
93
|
this.setState({
|
|
83
94
|
content: Outcome.failed(docError)
|
|
@@ -85,29 +96,29 @@ export var DocViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
85
96
|
if (onError) {
|
|
86
97
|
onError(docError);
|
|
87
98
|
}
|
|
88
|
-
case
|
|
89
|
-
_context.next =
|
|
99
|
+
case 23:
|
|
100
|
+
_context.next = 39;
|
|
90
101
|
break;
|
|
91
|
-
case
|
|
102
|
+
case 25:
|
|
92
103
|
if (!(item.status === 'failed-processing')) {
|
|
93
|
-
_context.next =
|
|
104
|
+
_context.next = 39;
|
|
94
105
|
break;
|
|
95
106
|
}
|
|
96
|
-
_context.prev =
|
|
97
|
-
_context.next =
|
|
107
|
+
_context.prev = 26;
|
|
108
|
+
_context.next = 29;
|
|
98
109
|
return mediaClient.file.getFileBinaryURL(item.id, collectionName, 2940 // 2940 seconds ~= 50 mins
|
|
99
110
|
);
|
|
100
|
-
case
|
|
111
|
+
case 29:
|
|
101
112
|
_src2 = _context.sent;
|
|
102
113
|
this.onMediaDisplayed();
|
|
103
114
|
this.setState({
|
|
104
115
|
content: Outcome.successful(_src2)
|
|
105
116
|
});
|
|
106
|
-
_context.next =
|
|
117
|
+
_context.next = 39;
|
|
107
118
|
break;
|
|
108
|
-
case
|
|
109
|
-
_context.prev =
|
|
110
|
-
_context.t1 = _context["catch"](
|
|
119
|
+
case 34:
|
|
120
|
+
_context.prev = 34;
|
|
121
|
+
_context.t1 = _context["catch"](26);
|
|
111
122
|
_docError = new MediaViewerError('docviewer-fetch-url', _context.t1 instanceof Error ? _context.t1 : undefined);
|
|
112
123
|
this.setState({
|
|
113
124
|
content: Outcome.failed(_docError)
|
|
@@ -115,11 +126,11 @@ export var DocViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
115
126
|
if (onError) {
|
|
116
127
|
onError(_docError);
|
|
117
128
|
}
|
|
118
|
-
case
|
|
129
|
+
case 39:
|
|
119
130
|
case "end":
|
|
120
131
|
return _context.stop();
|
|
121
132
|
}
|
|
122
|
-
}, _callee, this, [[
|
|
133
|
+
}, _callee, this, [[10, 18], [26, 34]]);
|
|
123
134
|
}));
|
|
124
135
|
function init() {
|
|
125
136
|
return _init.apply(this, arguments);
|
|
@@ -129,11 +140,13 @@ export var DocViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
129
140
|
}, {
|
|
130
141
|
key: "release",
|
|
131
142
|
value: function release() {
|
|
132
|
-
|
|
133
|
-
if (!content.data) {
|
|
143
|
+
if (!this.isObjectUrl) {
|
|
134
144
|
return;
|
|
135
145
|
}
|
|
136
|
-
|
|
146
|
+
var content = this.state.content;
|
|
147
|
+
if (content.data) {
|
|
148
|
+
URL.revokeObjectURL(content.data);
|
|
149
|
+
}
|
|
137
150
|
}
|
|
138
151
|
}, {
|
|
139
152
|
key: "renderSuccessful",
|
|
@@ -253,7 +253,7 @@ var PDFRendererBase = function PDFRendererBase(_ref2) {
|
|
|
253
253
|
if (onSuccessRef.current) {
|
|
254
254
|
onSuccessRef.current();
|
|
255
255
|
}
|
|
256
|
-
}, [createAnalyticsEvent, docOutcome]);
|
|
256
|
+
}, [createAnalyticsEvent, docOutcome.status]);
|
|
257
257
|
var savePdfElement = function savePdfElement(el) {
|
|
258
258
|
pdfWrapperRef.current = el;
|
|
259
259
|
};
|
|
@@ -14,10 +14,12 @@ export type Props = {
|
|
|
14
14
|
export type State = {
|
|
15
15
|
content: Outcome<string, MediaViewerError>;
|
|
16
16
|
};
|
|
17
|
-
export declare class DocViewer extends BaseViewer<string, Props> {
|
|
17
|
+
export declare class DocViewer extends BaseViewer<string, Props, State> {
|
|
18
|
+
private isObjectUrl;
|
|
18
19
|
protected get initialState(): {
|
|
19
20
|
content: Outcome<string, MediaViewerError>;
|
|
20
21
|
};
|
|
22
|
+
protected needsReset(propsA: Props, propsB: Props): boolean;
|
|
21
23
|
protected init(): Promise<void>;
|
|
22
24
|
protected release(): void;
|
|
23
25
|
protected renderSuccessful(content: string): JSX.Element;
|
|
@@ -14,10 +14,12 @@ export type Props = {
|
|
|
14
14
|
export type State = {
|
|
15
15
|
content: Outcome<string, MediaViewerError>;
|
|
16
16
|
};
|
|
17
|
-
export declare class DocViewer extends BaseViewer<string, Props> {
|
|
17
|
+
export declare class DocViewer extends BaseViewer<string, Props, State> {
|
|
18
|
+
private isObjectUrl;
|
|
18
19
|
protected get initialState(): {
|
|
19
20
|
content: Outcome<string, MediaViewerError>;
|
|
20
21
|
};
|
|
22
|
+
protected needsReset(propsA: Props, propsB: Props): boolean;
|
|
21
23
|
protected init(): Promise<void>;
|
|
22
24
|
protected release(): void;
|
|
23
25
|
protected renderSuccessful(content: string): JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-viewer",
|
|
3
|
-
"version": "49.2.
|
|
3
|
+
"version": "49.2.2",
|
|
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/"
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
38
|
-
"@atlaskit/button": "^20.
|
|
38
|
+
"@atlaskit/button": "^20.3.0",
|
|
39
39
|
"@atlaskit/code": "^15.6.0",
|
|
40
40
|
"@atlaskit/form": "^10.5.0",
|
|
41
|
-
"@atlaskit/icon": "^22.
|
|
42
|
-
"@atlaskit/icon-file-type": "^6.
|
|
41
|
+
"@atlaskit/icon": "^22.23.0",
|
|
42
|
+
"@atlaskit/icon-file-type": "^6.6.0",
|
|
43
43
|
"@atlaskit/media-client": "^28.0.0",
|
|
44
44
|
"@atlaskit/media-client-react": "^2.2.0",
|
|
45
45
|
"@atlaskit/media-common": "^11.6.0",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@atlaskit/side-navigation": "^3.5.0",
|
|
51
51
|
"@atlaskit/spinner": "^16.3.0",
|
|
52
52
|
"@atlaskit/textfield": "^6.5.0",
|
|
53
|
-
"@atlaskit/theme": "^
|
|
53
|
+
"@atlaskit/theme": "^14.0.0",
|
|
54
54
|
"@atlaskit/tokens": "^2.0.0",
|
|
55
55
|
"@atlaskit/ufo": "^0.3.0",
|
|
56
56
|
"@babel/runtime": "^7.0.0",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@atlaskit/media-test-data": "^2.6.0",
|
|
82
82
|
"@atlaskit/media-test-helpers": "^34.5.0",
|
|
83
83
|
"@atlaskit/ssr": "*",
|
|
84
|
-
"@atlaskit/toggle": "13.4.
|
|
84
|
+
"@atlaskit/toggle": "13.4.6",
|
|
85
85
|
"@atlaskit/visual-regression": "*",
|
|
86
86
|
"@atlassian/feature-flags-test-utils": "*",
|
|
87
87
|
"@atlassian/ufo": "^0.4.0",
|