@atlaskit/media-viewer 48.2.14 → 48.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/analytics/events/screen/passwordPdf.js +14 -0
- package/dist/cjs/analytics/events/screen/pdfPasswordInput.js +14 -0
- package/dist/cjs/analytics/index.js +1 -1
- package/dist/cjs/analytics/ufoExperiences.js +1 -1
- package/dist/cjs/domain/outcome.js +5 -22
- package/dist/cjs/item-viewer.js +23 -17
- package/dist/cjs/media-viewer.js +2 -1
- package/dist/cjs/navigation.js +4 -2
- package/dist/cjs/v2/item-viewer-v2.js +10 -10
- package/dist/cjs/viewers/doc/index.js +50 -67
- package/dist/cjs/viewers/doc/pdfPasswordInput.js +100 -0
- package/dist/cjs/viewers/doc/pdfRenderer.js +114 -21
- package/dist/cjs/viewers/image/index.js +17 -17
- package/dist/es2019/analytics/events/screen/passwordPdf.js +6 -0
- package/dist/es2019/analytics/events/screen/pdfPasswordInput.js +6 -0
- package/dist/es2019/analytics/index.js +1 -1
- package/dist/es2019/analytics/ufoExperiences.js +1 -1
- package/dist/es2019/domain/outcome.js +5 -18
- package/dist/es2019/item-viewer.js +14 -9
- package/dist/es2019/media-viewer.js +2 -1
- package/dist/es2019/navigation.js +4 -2
- package/dist/es2019/v2/item-viewer-v2.js +10 -10
- package/dist/es2019/viewers/doc/index.js +20 -17
- package/dist/es2019/viewers/doc/pdfPasswordInput.js +85 -0
- package/dist/es2019/viewers/doc/pdfRenderer.js +98 -75
- package/dist/es2019/viewers/image/index.js +4 -4
- package/dist/esm/analytics/events/screen/passwordPdf.js +8 -0
- package/dist/esm/analytics/events/screen/pdfPasswordInput.js +8 -0
- package/dist/esm/analytics/index.js +1 -1
- package/dist/esm/analytics/ufoExperiences.js +1 -1
- package/dist/esm/domain/outcome.js +5 -22
- package/dist/esm/item-viewer.js +23 -17
- package/dist/esm/media-viewer.js +2 -1
- package/dist/esm/navigation.js +4 -2
- package/dist/esm/v2/item-viewer-v2.js +10 -10
- package/dist/esm/viewers/doc/index.js +50 -62
- package/dist/esm/viewers/doc/pdfPasswordInput.js +90 -0
- package/dist/esm/viewers/doc/pdfRenderer.js +115 -22
- package/dist/esm/viewers/image/index.js +18 -18
- package/dist/types/analytics/events/index.d.ts +3 -1
- package/dist/types/analytics/events/screen/passwordPdf.d.ts +3 -0
- package/dist/types/analytics/events/screen/pdfPasswordInput.d.ts +3 -0
- package/dist/types/domain/outcome.d.ts +5 -6
- package/dist/types/viewers/doc/index.d.ts +0 -3
- package/dist/types/viewers/doc/pdfPasswordInput.d.ts +11 -0
- package/dist/types/viewers/doc/pdfRenderer.d.ts +4 -3
- package/dist/types-ts4.5/analytics/events/index.d.ts +3 -1
- package/dist/types-ts4.5/analytics/events/screen/passwordPdf.d.ts +3 -0
- package/dist/types-ts4.5/analytics/events/screen/pdfPasswordInput.d.ts +3 -0
- package/dist/types-ts4.5/domain/outcome.d.ts +5 -6
- package/dist/types-ts4.5/viewers/doc/index.d.ts +0 -3
- package/dist/types-ts4.5/viewers/doc/pdfPasswordInput.d.ts +11 -0
- package/dist/types-ts4.5/viewers/doc/pdfRenderer.d.ts +4 -3
- package/package.json +16 -7
|
@@ -10,7 +10,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
10
10
|
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); }; }
|
|
11
11
|
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; } }
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import {
|
|
13
|
+
import { isImageRepresentationReady, isErrorFileState, addFileAttrsToUrl } from '@atlaskit/media-client';
|
|
14
14
|
import { isImageMimeTypeSupportedByBrowser } from '@atlaskit/media-common';
|
|
15
15
|
import { getOrientation } from '@atlaskit/media-ui';
|
|
16
16
|
import { Outcome } from '../../domain';
|
|
@@ -55,7 +55,7 @@ export var ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
55
55
|
key: "init",
|
|
56
56
|
value: function () {
|
|
57
57
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
58
|
-
var _this$props, fileState, mediaClient, collectionName, traceContext, orientation, objectUrl, originalBinaryImageUrl, isLocalFileReference, preview, _yield$preview, value, origin, item,
|
|
58
|
+
var _this$props, fileState, mediaClient, collectionName, traceContext, controller, orientation, objectUrl, originalBinaryImageUrl, isLocalFileReference, preview, _yield$preview, value, origin, item, response, imgError;
|
|
59
59
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
60
60
|
while (1) switch (_context.prev = _context.next) {
|
|
61
61
|
case 0:
|
|
@@ -66,50 +66,50 @@ export var ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
66
66
|
}
|
|
67
67
|
return _context.abrupt("return");
|
|
68
68
|
case 3:
|
|
69
|
-
|
|
69
|
+
controller = typeof AbortController !== 'undefined' ? new AbortController() : undefined;
|
|
70
|
+
_context.prev = 4;
|
|
70
71
|
orientation = 1;
|
|
71
72
|
isLocalFileReference = false;
|
|
72
73
|
preview = fileState.preview;
|
|
73
74
|
if (!preview) {
|
|
74
|
-
_context.next =
|
|
75
|
+
_context.next = 25;
|
|
75
76
|
break;
|
|
76
77
|
}
|
|
77
|
-
_context.next =
|
|
78
|
+
_context.next = 11;
|
|
78
79
|
return preview;
|
|
79
|
-
case
|
|
80
|
+
case 11:
|
|
80
81
|
_yield$preview = _context.sent;
|
|
81
82
|
value = _yield$preview.value;
|
|
82
83
|
origin = _yield$preview.origin;
|
|
83
84
|
if (!(value instanceof Blob)) {
|
|
84
|
-
_context.next =
|
|
85
|
+
_context.next = 22;
|
|
85
86
|
break;
|
|
86
87
|
}
|
|
87
|
-
_context.next =
|
|
88
|
+
_context.next = 17;
|
|
88
89
|
return getOrientation(value);
|
|
89
|
-
case
|
|
90
|
+
case 17:
|
|
90
91
|
orientation = _context.sent;
|
|
91
92
|
objectUrl = URL.createObjectURL(value);
|
|
92
93
|
isLocalFileReference = origin === 'local';
|
|
93
|
-
_context.next =
|
|
94
|
+
_context.next = 23;
|
|
94
95
|
break;
|
|
95
|
-
case 21:
|
|
96
|
-
objectUrl = value;
|
|
97
96
|
case 22:
|
|
97
|
+
objectUrl = value;
|
|
98
|
+
case 23:
|
|
98
99
|
_context.next = 38;
|
|
99
100
|
break;
|
|
100
|
-
case
|
|
101
|
+
case 25:
|
|
101
102
|
if (!isImageRepresentationReady(fileState)) {
|
|
102
103
|
_context.next = 36;
|
|
103
104
|
break;
|
|
104
105
|
}
|
|
105
106
|
item = processedFileStateToMediaItem(fileState);
|
|
106
|
-
controller = typeof AbortController !== 'undefined' ? new AbortController() : undefined;
|
|
107
107
|
response = mediaClient.getImage(item.details.id, {
|
|
108
108
|
collection: collectionName,
|
|
109
109
|
mode: 'fit'
|
|
110
110
|
}, controller, true, traceContext);
|
|
111
111
|
this.cancelImageFetch = function () {
|
|
112
|
-
return controller
|
|
112
|
+
return controller === null || controller === void 0 ? void 0 : controller.abort();
|
|
113
113
|
};
|
|
114
114
|
_context.t0 = URL;
|
|
115
115
|
_context.next = 32;
|
|
@@ -147,9 +147,9 @@ export var ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
147
147
|
break;
|
|
148
148
|
case 45:
|
|
149
149
|
_context.prev = 45;
|
|
150
|
-
_context.t2 = _context["catch"](
|
|
150
|
+
_context.t2 = _context["catch"](4);
|
|
151
151
|
// TODO : properly handle aborted requests (MS-2843)
|
|
152
|
-
if (!
|
|
152
|
+
if (!(controller !== null && controller !== void 0 && controller.signal.aborted)) {
|
|
153
153
|
imgError = new MediaViewerError('imageviewer-fetch-url', _context.t2 instanceof Error ? _context.t2 : undefined);
|
|
154
154
|
this.setState({
|
|
155
155
|
content: Outcome.failed(imgError)
|
|
@@ -160,7 +160,7 @@ export var ImageViewer = /*#__PURE__*/function (_BaseViewer) {
|
|
|
160
160
|
case "end":
|
|
161
161
|
return _context.stop();
|
|
162
162
|
}
|
|
163
|
-
}, _callee, this, [[
|
|
163
|
+
}, _callee, this, [[4, 45]]);
|
|
164
164
|
}));
|
|
165
165
|
function init() {
|
|
166
166
|
return _init.apply(this, arguments);
|
|
@@ -5,10 +5,12 @@ import { PreviewUnsupportedEventPayload } from './operational/previewUnsupported
|
|
|
5
5
|
import { ZipEntryLoadFailedEventPayload } from './operational/zipEntryLoadFailed';
|
|
6
6
|
import { ZipEntryLoadSucceededEventPayload } from './operational/zipEntryLoadSucceeded';
|
|
7
7
|
import { ModalEventPayload } from './screen/modal';
|
|
8
|
+
import { PdfPasswordInputScreenEventPayload } from './screen/pdfPasswordInput';
|
|
9
|
+
import { PasswordPdfScreenEventPayload } from './screen/passwordPdf';
|
|
8
10
|
import { ClosedEventPayload } from './ui/closed';
|
|
9
11
|
import { DownloadButtonClickedEventPayload } from './ui/downloadButtonClicked';
|
|
10
12
|
import { FailedPreviewDownloadButtonClickedEventPayload } from './ui/failedPreviewDownloadButtonClicked';
|
|
11
13
|
import { NavigatedEventPayload } from './ui/navigated';
|
|
12
14
|
import { ZoomInButtonClickEventPayload } from './ui/zoomInButtonClicked';
|
|
13
15
|
import { ZoomOutButtonClickEventPayload } from './ui/zoomOutButtonClicked';
|
|
14
|
-
export type MediaViewerEventPayload = CommencedEventPayload | LoadFailedEventPayload | LoadSucceededEventPayload | PreviewUnsupportedEventPayload | ZipEntryLoadFailedEventPayload | ZipEntryLoadSucceededEventPayload | ModalEventPayload | ClosedEventPayload | DownloadButtonClickedEventPayload | FailedPreviewDownloadButtonClickedEventPayload | NavigatedEventPayload | ZoomInButtonClickEventPayload | ZoomOutButtonClickEventPayload;
|
|
16
|
+
export type MediaViewerEventPayload = CommencedEventPayload | LoadFailedEventPayload | LoadSucceededEventPayload | PreviewUnsupportedEventPayload | ZipEntryLoadFailedEventPayload | ZipEntryLoadSucceededEventPayload | ModalEventPayload | PdfPasswordInputScreenEventPayload | PasswordPdfScreenEventPayload | ClosedEventPayload | DownloadButtonClickedEventPayload | FailedPreviewDownloadButtonClickedEventPayload | NavigatedEventPayload | ZoomInButtonClickEventPayload | ZoomOutButtonClickEventPayload;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ScreenEventPayload, ScreenAttributes } from '@atlaskit/media-common';
|
|
2
|
+
export type PasswordPdfScreenEventPayload = Omit<ScreenEventPayload<ScreenAttributes, 'mediaViewerPasswordPdfScreen'>, 'attributes'>;
|
|
3
|
+
export declare const createPasswordPdfScreenEvent: () => PasswordPdfScreenEventPayload;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ScreenEventPayload, ScreenAttributes } from '@atlaskit/media-common';
|
|
2
|
+
export type PdfPasswordInputScreenEventPayload = Omit<ScreenEventPayload<ScreenAttributes, 'mediaViewerPdfPasswordInputScreen'>, 'attributes'>;
|
|
3
|
+
export declare const createPdfPasswordInputScreenEvent: () => PdfPasswordInputScreenEventPayload;
|
|
@@ -5,17 +5,18 @@ export type SuccessfulState<Data> = {
|
|
|
5
5
|
status: 'SUCCESSFUL';
|
|
6
6
|
data: Data;
|
|
7
7
|
};
|
|
8
|
-
export type FailedState<Err> = {
|
|
8
|
+
export type FailedState<Err, Data> = {
|
|
9
9
|
status: 'FAILED';
|
|
10
10
|
err: Err;
|
|
11
|
+
data?: Data;
|
|
11
12
|
};
|
|
12
|
-
export type State<Data, Err> = PendingState | SuccessfulState<Data> | FailedState<Err>;
|
|
13
|
+
export type State<Data, Err> = PendingState | SuccessfulState<Data> | FailedState<Err, Data>;
|
|
13
14
|
export declare class Outcome<Data, Err = Error> {
|
|
14
15
|
private readonly state;
|
|
15
16
|
private constructor();
|
|
16
17
|
static successful<Data, Err>(data: Data): Outcome<Data, Err>;
|
|
17
18
|
static pending<Data, Err>(): Outcome<Data, Err>;
|
|
18
|
-
static failed<Data, Err>(err: Err): Outcome<Data, Err>;
|
|
19
|
+
static failed<Data, Err>(err: Err, data?: Data): Outcome<Data, Err>;
|
|
19
20
|
get status(): 'PENDING' | 'SUCCESSFUL' | 'FAILED';
|
|
20
21
|
get data(): Data | undefined;
|
|
21
22
|
get err(): Err | undefined;
|
|
@@ -25,8 +26,6 @@ export declare class Outcome<Data, Err = Error> {
|
|
|
25
26
|
match<Result>({ successful, pending, failed, }: {
|
|
26
27
|
successful: (data: Data) => Result;
|
|
27
28
|
pending: () => Result;
|
|
28
|
-
failed: (err: Err) => Result;
|
|
29
|
+
failed: (err: Err, data?: Data) => Result;
|
|
29
30
|
}): Result;
|
|
30
|
-
mapSuccessful<MappedData>(map: (data: Data) => MappedData): Outcome<MappedData, Err>;
|
|
31
|
-
mapFailed<MappedErr>(map: (err: Err) => MappedErr): Outcome<Data, MappedErr>;
|
|
32
31
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { MediaClient, FileState } from '@atlaskit/media-client';
|
|
3
3
|
import { Outcome } from '../../domain';
|
|
4
4
|
import { MediaViewerError } from '../../errors';
|
|
5
|
-
import { Props as RendererProps } from './pdfRenderer';
|
|
6
5
|
import { BaseViewer } from '../base-viewer';
|
|
7
6
|
export type Props = {
|
|
8
7
|
mediaClient: MediaClient;
|
|
@@ -16,12 +15,10 @@ export type State = {
|
|
|
16
15
|
content: Outcome<string, MediaViewerError>;
|
|
17
16
|
};
|
|
18
17
|
export declare class DocViewer extends BaseViewer<string, Props> {
|
|
19
|
-
static PDFComponent: (props: RendererProps) => JSX.Element;
|
|
20
18
|
protected get initialState(): {
|
|
21
19
|
content: Outcome<string, MediaViewerError>;
|
|
22
20
|
};
|
|
23
21
|
protected init(): Promise<void>;
|
|
24
|
-
private loadDocViewer;
|
|
25
22
|
protected release(): void;
|
|
26
23
|
protected renderSuccessful(content: string): JSX.Element;
|
|
27
24
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { OnSubmitHandler } from '@atlaskit/form';
|
|
3
|
+
interface PDFPasswordInputProps {
|
|
4
|
+
onSubmit: OnSubmitHandler<{
|
|
5
|
+
password: string;
|
|
6
|
+
}>;
|
|
7
|
+
hasPasswordError?: boolean;
|
|
8
|
+
onRender?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const PDFPasswordInput: ({ onSubmit, hasPasswordError, onRender, }: PDFPasswordInputProps) => JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { FileState } from '@atlaskit/media-client';
|
|
3
|
+
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
4
|
import { MediaViewerError } from '../../errors';
|
|
4
5
|
export declare const pdfViewerClassName = "pdfViewer";
|
|
5
6
|
export type Props = {
|
|
@@ -9,5 +10,5 @@ export type Props = {
|
|
|
9
10
|
onClose?: () => void;
|
|
10
11
|
onSuccess?: () => void;
|
|
11
12
|
onError?: (error: MediaViewerError) => void;
|
|
12
|
-
};
|
|
13
|
-
export declare const PDFRenderer:
|
|
13
|
+
} & WithAnalyticsEventsProps;
|
|
14
|
+
export declare const PDFRenderer: React.ForwardRefExoticComponent<Omit<Props, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
|
@@ -5,10 +5,12 @@ import { PreviewUnsupportedEventPayload } from './operational/previewUnsupported
|
|
|
5
5
|
import { ZipEntryLoadFailedEventPayload } from './operational/zipEntryLoadFailed';
|
|
6
6
|
import { ZipEntryLoadSucceededEventPayload } from './operational/zipEntryLoadSucceeded';
|
|
7
7
|
import { ModalEventPayload } from './screen/modal';
|
|
8
|
+
import { PdfPasswordInputScreenEventPayload } from './screen/pdfPasswordInput';
|
|
9
|
+
import { PasswordPdfScreenEventPayload } from './screen/passwordPdf';
|
|
8
10
|
import { ClosedEventPayload } from './ui/closed';
|
|
9
11
|
import { DownloadButtonClickedEventPayload } from './ui/downloadButtonClicked';
|
|
10
12
|
import { FailedPreviewDownloadButtonClickedEventPayload } from './ui/failedPreviewDownloadButtonClicked';
|
|
11
13
|
import { NavigatedEventPayload } from './ui/navigated';
|
|
12
14
|
import { ZoomInButtonClickEventPayload } from './ui/zoomInButtonClicked';
|
|
13
15
|
import { ZoomOutButtonClickEventPayload } from './ui/zoomOutButtonClicked';
|
|
14
|
-
export type MediaViewerEventPayload = CommencedEventPayload | LoadFailedEventPayload | LoadSucceededEventPayload | PreviewUnsupportedEventPayload | ZipEntryLoadFailedEventPayload | ZipEntryLoadSucceededEventPayload | ModalEventPayload | ClosedEventPayload | DownloadButtonClickedEventPayload | FailedPreviewDownloadButtonClickedEventPayload | NavigatedEventPayload | ZoomInButtonClickEventPayload | ZoomOutButtonClickEventPayload;
|
|
16
|
+
export type MediaViewerEventPayload = CommencedEventPayload | LoadFailedEventPayload | LoadSucceededEventPayload | PreviewUnsupportedEventPayload | ZipEntryLoadFailedEventPayload | ZipEntryLoadSucceededEventPayload | ModalEventPayload | PdfPasswordInputScreenEventPayload | PasswordPdfScreenEventPayload | ClosedEventPayload | DownloadButtonClickedEventPayload | FailedPreviewDownloadButtonClickedEventPayload | NavigatedEventPayload | ZoomInButtonClickEventPayload | ZoomOutButtonClickEventPayload;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ScreenEventPayload, ScreenAttributes } from '@atlaskit/media-common';
|
|
2
|
+
export type PasswordPdfScreenEventPayload = Omit<ScreenEventPayload<ScreenAttributes, 'mediaViewerPasswordPdfScreen'>, 'attributes'>;
|
|
3
|
+
export declare const createPasswordPdfScreenEvent: () => PasswordPdfScreenEventPayload;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ScreenEventPayload, ScreenAttributes } from '@atlaskit/media-common';
|
|
2
|
+
export type PdfPasswordInputScreenEventPayload = Omit<ScreenEventPayload<ScreenAttributes, 'mediaViewerPdfPasswordInputScreen'>, 'attributes'>;
|
|
3
|
+
export declare const createPdfPasswordInputScreenEvent: () => PdfPasswordInputScreenEventPayload;
|
|
@@ -5,17 +5,18 @@ export type SuccessfulState<Data> = {
|
|
|
5
5
|
status: 'SUCCESSFUL';
|
|
6
6
|
data: Data;
|
|
7
7
|
};
|
|
8
|
-
export type FailedState<Err> = {
|
|
8
|
+
export type FailedState<Err, Data> = {
|
|
9
9
|
status: 'FAILED';
|
|
10
10
|
err: Err;
|
|
11
|
+
data?: Data;
|
|
11
12
|
};
|
|
12
|
-
export type State<Data, Err> = PendingState | SuccessfulState<Data> | FailedState<Err>;
|
|
13
|
+
export type State<Data, Err> = PendingState | SuccessfulState<Data> | FailedState<Err, Data>;
|
|
13
14
|
export declare class Outcome<Data, Err = Error> {
|
|
14
15
|
private readonly state;
|
|
15
16
|
private constructor();
|
|
16
17
|
static successful<Data, Err>(data: Data): Outcome<Data, Err>;
|
|
17
18
|
static pending<Data, Err>(): Outcome<Data, Err>;
|
|
18
|
-
static failed<Data, Err>(err: Err): Outcome<Data, Err>;
|
|
19
|
+
static failed<Data, Err>(err: Err, data?: Data): Outcome<Data, Err>;
|
|
19
20
|
get status(): 'PENDING' | 'SUCCESSFUL' | 'FAILED';
|
|
20
21
|
get data(): Data | undefined;
|
|
21
22
|
get err(): Err | undefined;
|
|
@@ -25,8 +26,6 @@ export declare class Outcome<Data, Err = Error> {
|
|
|
25
26
|
match<Result>({ successful, pending, failed, }: {
|
|
26
27
|
successful: (data: Data) => Result;
|
|
27
28
|
pending: () => Result;
|
|
28
|
-
failed: (err: Err) => Result;
|
|
29
|
+
failed: (err: Err, data?: Data) => Result;
|
|
29
30
|
}): Result;
|
|
30
|
-
mapSuccessful<MappedData>(map: (data: Data) => MappedData): Outcome<MappedData, Err>;
|
|
31
|
-
mapFailed<MappedErr>(map: (err: Err) => MappedErr): Outcome<Data, MappedErr>;
|
|
32
31
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { MediaClient, FileState } from '@atlaskit/media-client';
|
|
3
3
|
import { Outcome } from '../../domain';
|
|
4
4
|
import { MediaViewerError } from '../../errors';
|
|
5
|
-
import { Props as RendererProps } from './pdfRenderer';
|
|
6
5
|
import { BaseViewer } from '../base-viewer';
|
|
7
6
|
export type Props = {
|
|
8
7
|
mediaClient: MediaClient;
|
|
@@ -16,12 +15,10 @@ export type State = {
|
|
|
16
15
|
content: Outcome<string, MediaViewerError>;
|
|
17
16
|
};
|
|
18
17
|
export declare class DocViewer extends BaseViewer<string, Props> {
|
|
19
|
-
static PDFComponent: (props: RendererProps) => JSX.Element;
|
|
20
18
|
protected get initialState(): {
|
|
21
19
|
content: Outcome<string, MediaViewerError>;
|
|
22
20
|
};
|
|
23
21
|
protected init(): Promise<void>;
|
|
24
|
-
private loadDocViewer;
|
|
25
22
|
protected release(): void;
|
|
26
23
|
protected renderSuccessful(content: string): JSX.Element;
|
|
27
24
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { OnSubmitHandler } from '@atlaskit/form';
|
|
3
|
+
interface PDFPasswordInputProps {
|
|
4
|
+
onSubmit: OnSubmitHandler<{
|
|
5
|
+
password: string;
|
|
6
|
+
}>;
|
|
7
|
+
hasPasswordError?: boolean;
|
|
8
|
+
onRender?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const PDFPasswordInput: ({ onSubmit, hasPasswordError, onRender, }: PDFPasswordInputProps) => JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { FileState } from '@atlaskit/media-client';
|
|
3
|
+
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
4
|
import { MediaViewerError } from '../../errors';
|
|
4
5
|
export declare const pdfViewerClassName = "pdfViewer";
|
|
5
6
|
export type Props = {
|
|
@@ -9,5 +10,5 @@ export type Props = {
|
|
|
9
10
|
onClose?: () => void;
|
|
10
11
|
onSuccess?: () => void;
|
|
11
12
|
onError?: (error: MediaViewerError) => void;
|
|
12
|
-
};
|
|
13
|
-
export declare const PDFRenderer:
|
|
13
|
+
} & WithAnalyticsEventsProps;
|
|
14
|
+
export declare const PDFRenderer: React.ForwardRefExoticComponent<Omit<Props, keyof WithAnalyticsEventsProps> & React.RefAttributes<any>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-viewer",
|
|
3
|
-
"version": "48.
|
|
3
|
+
"version": "48.3.0",
|
|
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/"
|
|
@@ -36,19 +36,23 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@atlaskit/analytics-next": "^9.2.0",
|
|
39
|
-
"@atlaskit/button": "^17.
|
|
39
|
+
"@atlaskit/button": "^17.6.0",
|
|
40
40
|
"@atlaskit/code": "^15.1.0",
|
|
41
|
-
"@atlaskit/
|
|
41
|
+
"@atlaskit/form": "^9.0.3",
|
|
42
|
+
"@atlaskit/heading": "^1.6.0",
|
|
43
|
+
"@atlaskit/icon": "^22.1.0",
|
|
42
44
|
"@atlaskit/icon-file-type": "^6.4.0",
|
|
43
|
-
"@atlaskit/media-client": "^26.
|
|
45
|
+
"@atlaskit/media-client": "^26.2.0",
|
|
44
46
|
"@atlaskit/media-client-react": "^2.0.0",
|
|
45
47
|
"@atlaskit/media-common": "^11.0.0",
|
|
46
|
-
"@atlaskit/media-ui": "^25.
|
|
48
|
+
"@atlaskit/media-ui": "^25.3.0",
|
|
47
49
|
"@atlaskit/platform-feature-flags": "^0.2.4",
|
|
50
|
+
"@atlaskit/primitives": "^3.1.0",
|
|
48
51
|
"@atlaskit/side-navigation": "^3.0.0",
|
|
49
52
|
"@atlaskit/spinner": "^16.0.0",
|
|
53
|
+
"@atlaskit/textfield": "^6.0.0",
|
|
50
54
|
"@atlaskit/theme": "^12.6.0",
|
|
51
|
-
"@atlaskit/tokens": "^1.
|
|
55
|
+
"@atlaskit/tokens": "^1.38.0",
|
|
52
56
|
"@atlaskit/ufo": "^0.2.0",
|
|
53
57
|
"@babel/runtime": "^7.0.0",
|
|
54
58
|
"@kenjiuno/msgreader": "^1.2.6",
|
|
@@ -70,7 +74,8 @@
|
|
|
70
74
|
},
|
|
71
75
|
"devDependencies": {
|
|
72
76
|
"@af/integration-testing": "*",
|
|
73
|
-
"@
|
|
77
|
+
"@af/visual-regression": "*",
|
|
78
|
+
"@atlaskit/media-core": "^34.2.0",
|
|
74
79
|
"@atlaskit/media-integration-test-helpers": "^3.0.0",
|
|
75
80
|
"@atlaskit/media-state": "^1.0.0",
|
|
76
81
|
"@atlaskit/media-test-data": "^1.2.0",
|
|
@@ -78,6 +83,7 @@
|
|
|
78
83
|
"@atlaskit/ssr": "*",
|
|
79
84
|
"@atlaskit/visual-regression": "*",
|
|
80
85
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
86
|
+
"@atlassian/feature-flags-test-utils": "*",
|
|
81
87
|
"@atlassian/ufo": "^0.2.0",
|
|
82
88
|
"@testing-library/dom": "^8.17.1",
|
|
83
89
|
"@testing-library/react": "^12.1.5",
|
|
@@ -99,6 +105,9 @@
|
|
|
99
105
|
"platform-feature-flags": {
|
|
100
106
|
"platform.media-experience.media-viewer-v2_hgsii": {
|
|
101
107
|
"type": "boolean"
|
|
108
|
+
},
|
|
109
|
+
"platform.corex.password-protected-pdf_ht8re": {
|
|
110
|
+
"type": "boolean"
|
|
102
111
|
}
|
|
103
112
|
},
|
|
104
113
|
"techstack": {
|