@atlaskit/media-picker 64.3.0 → 64.4.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/components/browser/index.js +26 -28
  3. package/dist/cjs/components/clipboard/index.js +24 -26
  4. package/dist/cjs/components/dropzone/dropzone.js +58 -57
  5. package/dist/cjs/components/dropzone/index.js +33 -35
  6. package/dist/cjs/components/localUploadReact.js +29 -31
  7. package/dist/cjs/service/types.js +4 -4
  8. package/dist/cjs/service/uploadServiceImpl.js +181 -128
  9. package/dist/cjs/util/analytics.js +3 -1
  10. package/dist/cjs/util/getPreviewFromBlob.js +30 -32
  11. package/dist/cjs/util/getPreviewFromImage.js +31 -33
  12. package/dist/cjs/util/ufoExperiences.js +1 -1
  13. package/dist/cjs/version.json +1 -1
  14. package/dist/es2019/components/dropzone/dropzone.js +7 -3
  15. package/dist/es2019/service/types.js +3 -3
  16. package/dist/es2019/service/uploadServiceImpl.js +62 -33
  17. package/dist/es2019/util/analytics.js +4 -1
  18. package/dist/es2019/util/ufoExperiences.js +1 -1
  19. package/dist/es2019/version.json +1 -1
  20. package/dist/esm/components/browser/index.js +22 -24
  21. package/dist/esm/components/clipboard/index.js +20 -22
  22. package/dist/esm/components/dropzone/dropzone.js +58 -57
  23. package/dist/esm/components/dropzone/index.js +27 -29
  24. package/dist/esm/components/localUploadReact.js +29 -31
  25. package/dist/esm/service/types.js +3 -3
  26. package/dist/esm/service/uploadServiceImpl.js +181 -128
  27. package/dist/esm/util/analytics.js +4 -1
  28. package/dist/esm/util/getPreviewFromBlob.js +30 -32
  29. package/dist/esm/util/getPreviewFromImage.js +31 -33
  30. package/dist/esm/util/ufoExperiences.js +1 -1
  31. package/dist/esm/version.json +1 -1
  32. package/dist/types/service/types.d.ts +7 -1
  33. package/dist/types/service/uploadServiceImpl.d.ts +5 -2
  34. package/package.json +4 -5
@@ -22,21 +22,19 @@ export var UploadServiceImpl = /*#__PURE__*/function () {
22
22
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(cancellableFileUpload, fileId, traceContext) {
23
23
  var mediaFile;
24
24
  return _regeneratorRuntime.wrap(function _callee$(_context) {
25
- while (1) {
26
- switch (_context.prev = _context.next) {
27
- case 0:
28
- mediaFile = cancellableFileUpload.mediaFile;
29
- _this.emit('file-converting', {
30
- file: mediaFile,
31
- traceContext: traceContext
32
- });
33
- cancellableFileUpload.cancel = function () {
34
- _this.releaseCancellableFile(mediaFile);
35
- };
36
- case 3:
37
- case "end":
38
- return _context.stop();
39
- }
25
+ while (1) switch (_context.prev = _context.next) {
26
+ case 0:
27
+ mediaFile = cancellableFileUpload.mediaFile;
28
+ _this.emit('file-converting', {
29
+ file: mediaFile,
30
+ traceContext: traceContext
31
+ });
32
+ cancellableFileUpload.cancel = function () {
33
+ _this.releaseCancellableFile(mediaFile);
34
+ };
35
+ case 3:
36
+ case "end":
37
+ return _context.stop();
40
38
  }
41
39
  }, _callee);
42
40
  }));
@@ -103,121 +101,171 @@ export var UploadServiceImpl = /*#__PURE__*/function () {
103
101
  }
104
102
  }, {
105
103
  key: "addFilesWithSource",
106
- value: function addFilesWithSource(files, featureFlags) {
107
- var _this2 = this;
108
- if (files.length === 0) {
109
- return;
110
- }
111
- var creationDate = Date.now();
112
- var userMediaClient = this.userMediaClient,
113
- tenantMediaClient = this.tenantMediaClient,
114
- shouldCopyFileToRecents = this.shouldCopyFileToRecents;
115
- var mediaClient = shouldCopyFileToRecents ? tenantMediaClient : userMediaClient;
116
- var _this$tenantUploadPar = this.tenantUploadParams,
117
- collectionTentant = _this$tenantUploadPar.collection,
118
- expireAfter = _this$tenantUploadPar.expireAfter;
119
- var collection = shouldCopyFileToRecents ? collectionTentant : RECENTS_COLLECTION;
120
- if (!mediaClient) {
121
- return;
122
- }
123
- var touchFileDescriptors = [];
124
- for (var i = 0; i < files.length; i++) {
125
- var replaceFileId = files[i].replaceFileId;
126
- touchFileDescriptors.push({
127
- fileId: replaceFileId || uuidV4(),
128
- occurrenceKey: uuidV4(),
129
- collection: collection,
130
- expireAfter: expireAfter
131
- });
132
- }
133
- var traceContext = {
134
- traceId: getRandomHex(8)
135
- };
136
- var promisedTouchFiles = mediaClient.file.touchFiles(touchFileDescriptors, collection, traceContext);
137
- var cancellableFileUploads = files.map(function (fileWithSource, i) {
138
- var file = fileWithSource.file,
139
- source = fileWithSource.source;
140
- var _touchFileDescriptors = touchFileDescriptors[i],
141
- id = _touchFileDescriptors.fileId,
142
- occurrenceKey = _touchFileDescriptors.occurrenceKey;
143
- var deferredUploadId = promisedTouchFiles.then(function (touchedFiles) {
144
- var touchedFile = touchedFiles.created.find(function (touchedFile) {
145
- return touchedFile.fileId === id;
146
- });
147
- if (!touchedFile) {
148
- // TODO No one seems to be caring about this error
149
- throw new Error('Cant retrieve uploadId from result of touch endpoint call');
150
- }
151
- return touchedFile.uploadId;
152
- }).catch(function (error) {
153
- // note: any failures in this block will result in an error event being bubbled as required
154
- if (error instanceof RequestError) {
155
- var requestError = error;
156
- if (requestError.metadata && requestError.metadata.statusCode === 409) {
157
- return mediaClient.mediaStore.createUpload(1, collection, traceContext).then(function (res) {
158
- return res.data[0].id;
159
- });
160
- }
161
- }
162
- throw error;
163
- });
164
- var uploadableFile = {
165
- collection: collection,
166
- content: file,
167
- name: file.name,
168
- mimeType: file.type
169
- };
170
- var uploadableUpfrontIds = {
171
- id: id,
172
- occurrenceKey: occurrenceKey,
173
- deferredUploadId: deferredUploadId
174
- };
175
- var controller = _this2.createUploadController();
176
- var sourceFileObservable = mediaClient.file.upload(uploadableFile, controller, uploadableUpfrontIds, traceContext, featureFlags);
177
- var mediaFile = {
178
- id: id,
179
- name: file.name,
180
- size: file.size,
181
- creationDate: creationDate,
182
- type: file.type,
183
- occurrenceKey: occurrenceKey
184
- };
185
- var cancellableFileUpload = {
186
- mediaFile: mediaFile,
187
- file: file,
188
- source: source,
189
- cancel: function cancel() {
190
- // we can't do "cancellableFileUpload.cancel = controller.abort" because will change the "this" mediaClient
191
- controller.abort();
192
- }
193
- };
194
- var onFileSuccess = _this2.onFileSuccess.bind(_this2);
195
- sourceFileObservable.subscribe({
196
- next: function next(state) {
197
- if (state.status === 'processing') {
198
- this.unsubscribe();
199
- if (shouldCopyFileToRecents) {
200
- mediaClient.emit('file-added', state);
201
- globalMediaEventEmitter.emit('file-added', state);
104
+ value: function () {
105
+ var _addFilesWithSource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(files, featureFlags) {
106
+ var _this2 = this;
107
+ var creationDate, userMediaClient, tenantMediaClient, shouldCopyFileToRecents, mediaClient, _this$tenantUploadPar, collectionTentant, expireAfter, collection, touchFileDescriptors, i, _files$i, replaceFileId, file, traceContext, touchedFiles, caughtError, cancellableFileUploads, filteredCancellableFileUploads, mediaFiles;
108
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
109
+ while (1) switch (_context2.prev = _context2.next) {
110
+ case 0:
111
+ if (!(files.length === 0)) {
112
+ _context2.next = 2;
113
+ break;
114
+ }
115
+ return _context2.abrupt("return");
116
+ case 2:
117
+ creationDate = Date.now();
118
+ userMediaClient = this.userMediaClient, tenantMediaClient = this.tenantMediaClient, shouldCopyFileToRecents = this.shouldCopyFileToRecents;
119
+ mediaClient = shouldCopyFileToRecents ? tenantMediaClient : userMediaClient;
120
+ _this$tenantUploadPar = this.tenantUploadParams, collectionTentant = _this$tenantUploadPar.collection, expireAfter = _this$tenantUploadPar.expireAfter;
121
+ collection = shouldCopyFileToRecents ? collectionTentant : RECENTS_COLLECTION;
122
+ if (mediaClient) {
123
+ _context2.next = 9;
124
+ break;
202
125
  }
203
- onFileSuccess(cancellableFileUpload, id, traceContext);
204
- }
205
- },
206
- error: function error(_error) {
207
- _this2.onFileError(mediaFile, 'upload_fail', _error, traceContext);
126
+ return _context2.abrupt("return");
127
+ case 9:
128
+ touchFileDescriptors = [];
129
+ for (i = 0; i < files.length; i++) {
130
+ _files$i = files[i], replaceFileId = _files$i.replaceFileId, file = _files$i.file;
131
+ touchFileDescriptors.push({
132
+ fileId: replaceFileId || uuidV4(),
133
+ occurrenceKey: uuidV4(),
134
+ collection: collection,
135
+ size: file.size,
136
+ expireAfter: expireAfter
137
+ });
138
+ }
139
+ traceContext = {
140
+ traceId: getRandomHex(8)
141
+ };
142
+ _context2.prev = 12;
143
+ _context2.next = 15;
144
+ return mediaClient.file.touchFiles(touchFileDescriptors, collection, traceContext);
145
+ case 15:
146
+ touchedFiles = _context2.sent;
147
+ _context2.next = 21;
148
+ break;
149
+ case 18:
150
+ _context2.prev = 18;
151
+ _context2.t0 = _context2["catch"](12);
152
+ caughtError = _context2.t0;
153
+ case 21:
154
+ cancellableFileUploads = files.map(function (_ref2, i) {
155
+ var _touchedFiles, _touchedFiles2;
156
+ var file = _ref2.file,
157
+ source = _ref2.source;
158
+ var _touchFileDescriptors = touchFileDescriptors[i],
159
+ id = _touchFileDescriptors.fileId,
160
+ occurrenceKey = _touchFileDescriptors.occurrenceKey;
161
+
162
+ // exclude rejected files from being uploaded
163
+ var rejectedFile = (_touchedFiles = touchedFiles) === null || _touchedFiles === void 0 ? void 0 : _touchedFiles.rejected.find(function (_ref3) {
164
+ var rejectedFileId = _ref3.fileId;
165
+ return rejectedFileId === id;
166
+ });
167
+ if (rejectedFile) {
168
+ if (_this2.fileRejectionHandler) {
169
+ _this2.fileRejectionHandler({
170
+ reason: 'fileSizeLimitExceeded',
171
+ file: file,
172
+ limit: rejectedFile.error.limit
173
+ });
174
+ }
175
+ return null;
176
+ }
177
+ var touchedFile = (_touchedFiles2 = touchedFiles) === null || _touchedFiles2 === void 0 ? void 0 : _touchedFiles2.created.find(function (touchedFile) {
178
+ return touchedFile.fileId === id;
179
+ });
180
+ var deferredUploadId;
181
+ var isIdConflictError = caughtError && caughtError instanceof RequestError && caughtError.metadata && caughtError.metadata.statusCode === 409;
182
+ if (touchedFile) {
183
+ deferredUploadId = Promise.resolve(touchedFile.uploadId);
184
+ } else if (isIdConflictError) {
185
+ // will occur when the backend receives a fileId that already exists in which case
186
+ // we will create a single upload session for that file and use that uploadId
187
+ deferredUploadId = mediaClient.mediaStore.createUpload(1, collection, traceContext).then(function (res) {
188
+ return res.data[0].id;
189
+ });
190
+ } else {
191
+ // in the case of unexpected errors, we want to defer the throwing of the error
192
+ // until after the files-added has been emitted,
193
+ // allows editor to show a broken media card for unexpected errors
194
+ deferredUploadId = Promise.reject(caughtError);
195
+ }
196
+ var uploadableFile = {
197
+ collection: collection,
198
+ content: file,
199
+ name: file.name,
200
+ mimeType: file.type
201
+ };
202
+ var uploadableUpfrontIds = {
203
+ id: id,
204
+ occurrenceKey: occurrenceKey,
205
+ deferredUploadId: deferredUploadId
206
+ };
207
+ var controller = _this2.createUploadController();
208
+ var sourceFileObservable = mediaClient.file.upload(uploadableFile, controller, uploadableUpfrontIds, traceContext, featureFlags);
209
+ var mediaFile = {
210
+ id: id,
211
+ name: file.name,
212
+ size: file.size,
213
+ creationDate: creationDate,
214
+ type: file.type,
215
+ occurrenceKey: occurrenceKey
216
+ };
217
+ var cancellableFileUpload = {
218
+ mediaFile: mediaFile,
219
+ file: file,
220
+ source: source,
221
+ cancel: function cancel() {
222
+ // we can't do "cancellableFileUpload.cancel = controller.abort" because will change the "this" mediaClient
223
+ controller.abort();
224
+ }
225
+ };
226
+ var _sourceFileObservable = sourceFileObservable.subscribe({
227
+ next: function next(state) {
228
+ if (state.status === 'processing') {
229
+ unsubscribe();
230
+ if (shouldCopyFileToRecents) {
231
+ mediaClient.emit('file-added', state);
232
+ globalMediaEventEmitter.emit('file-added', state);
233
+ }
234
+ _this2.onFileSuccess(cancellableFileUpload, id, traceContext);
235
+ }
236
+ },
237
+ error: function error(_error) {
238
+ _this2.onFileError(mediaFile, 'upload_fail', _error, traceContext);
239
+ }
240
+ }),
241
+ unsubscribe = _sourceFileObservable.unsubscribe;
242
+ _this2.cancellableFilesUploads[id] = cancellableFileUpload;
243
+ return cancellableFileUpload;
244
+ });
245
+ filteredCancellableFileUploads = cancellableFileUploads.filter(this.isCancellableFileUpload);
246
+ mediaFiles = filteredCancellableFileUploads.map(function (cancellableFileUpload) {
247
+ return cancellableFileUpload.mediaFile;
248
+ });
249
+ this.emit('files-added', {
250
+ files: mediaFiles,
251
+ traceContext: traceContext
252
+ });
253
+ this.emitPreviews(filteredCancellableFileUploads);
254
+ case 26:
255
+ case "end":
256
+ return _context2.stop();
208
257
  }
209
- });
210
- _this2.cancellableFilesUploads[id] = cancellableFileUpload;
211
- return cancellableFileUpload;
212
- });
213
- var mediaFiles = cancellableFileUploads.map(function (cancellableFileUpload) {
214
- return cancellableFileUpload.mediaFile;
215
- });
216
- this.emit('files-added', {
217
- files: mediaFiles,
218
- traceContext: traceContext
219
- });
220
- this.emitPreviews(cancellableFileUploads);
258
+ }, _callee2, this, [[12, 18]]);
259
+ }));
260
+ function addFilesWithSource(_x4, _x5) {
261
+ return _addFilesWithSource.apply(this, arguments);
262
+ }
263
+ return addFilesWithSource;
264
+ }()
265
+ }, {
266
+ key: "isCancellableFileUpload",
267
+ value: function isCancellableFileUpload(fileUpload) {
268
+ return fileUpload !== null;
221
269
  }
222
270
  }, {
223
271
  key: "cancel",
@@ -297,6 +345,11 @@ export var UploadServiceImpl = /*#__PURE__*/function () {
297
345
  value: function releaseCancellableFile(mediaFile) {
298
346
  delete this.cancellableFilesUploads[mediaFile.id];
299
347
  }
348
+ }, {
349
+ key: "onFileRejection",
350
+ value: function onFileRejection(handler) {
351
+ this.fileRejectionHandler = handler;
352
+ }
300
353
  }]);
301
354
  return UploadServiceImpl;
302
355
  }();
@@ -1,6 +1,9 @@
1
1
  import { isRequestError } from '@atlaskit/media-client';
2
+
3
+ // Component name will be prefixed with "media-picker-" in logs. Check ufoExperiences in utils files
4
+
2
5
  var packageName = "@atlaskit/media-picker";
3
- var packageVersion = "64.3.0";
6
+ var packageVersion = "64.4.0";
4
7
  export function getPackageAttributes(componentName) {
5
8
  return {
6
9
  packageName: packageName,
@@ -11,39 +11,37 @@ function _getPreviewFromBlob() {
11
11
  _getPreviewFromBlob = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(mediaType, file) {
12
12
  var dimensions;
13
13
  return _regeneratorRuntime.wrap(function _callee$(_context) {
14
- while (1) {
15
- switch (_context.prev = _context.next) {
16
- case 0:
17
- _context.t0 = mediaType;
18
- _context.next = _context.t0 === 'image' ? 3 : _context.t0 === 'video' ? 3 : 9;
14
+ while (1) switch (_context.prev = _context.next) {
15
+ case 0:
16
+ _context.t0 = mediaType;
17
+ _context.next = _context.t0 === 'image' ? 3 : _context.t0 === 'video' ? 3 : 9;
18
+ break;
19
+ case 3:
20
+ _context.next = 5;
21
+ return getDimensionsFromBlob(mediaType, file);
22
+ case 5:
23
+ dimensions = _context.sent;
24
+ if (!isUnknownDimensions(dimensions)) {
25
+ _context.next = 8;
19
26
  break;
20
- case 3:
21
- _context.next = 5;
22
- return getDimensionsFromBlob(mediaType, file);
23
- case 5:
24
- dimensions = _context.sent;
25
- if (!isUnknownDimensions(dimensions)) {
26
- _context.next = 8;
27
- break;
28
- }
29
- return _context.abrupt("return", {
30
- file: file,
31
- scaleFactor: 1
32
- });
33
- case 8:
34
- return _context.abrupt("return", {
35
- file: file,
36
- dimensions: dimensions,
37
- scaleFactor: 1
38
- });
39
- case 9:
40
- return _context.abrupt("return", {
41
- file: file
42
- });
43
- case 10:
44
- case "end":
45
- return _context.stop();
46
- }
27
+ }
28
+ return _context.abrupt("return", {
29
+ file: file,
30
+ scaleFactor: 1
31
+ });
32
+ case 8:
33
+ return _context.abrupt("return", {
34
+ file: file,
35
+ dimensions: dimensions,
36
+ scaleFactor: 1
37
+ });
38
+ case 9:
39
+ return _context.abrupt("return", {
40
+ file: file
41
+ });
42
+ case 10:
43
+ case "end":
44
+ return _context.stop();
47
45
  }
48
46
  }, _callee);
49
47
  }));
@@ -8,39 +8,37 @@ function _getPreviewFromImage() {
8
8
  _getPreviewFromImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(file, devicePixelRatio) {
9
9
  var fileInfo, imageInfo, width, height, scaleFactor, preview;
10
10
  return _regeneratorRuntime.wrap(function _callee$(_context) {
11
- while (1) {
12
- switch (_context.prev = _context.next) {
13
- case 0:
14
- _context.next = 2;
15
- return getFileInfo(file);
16
- case 2:
17
- fileInfo = _context.sent;
18
- _context.next = 5;
19
- return getImageInfo(fileInfo);
20
- case 5:
21
- imageInfo = _context.sent;
22
- if (!(imageInfo === null)) {
23
- _context.next = 10;
24
- break;
25
- }
26
- return _context.abrupt("return", {
27
- file: file
28
- });
29
- case 10:
30
- width = imageInfo.width, height = imageInfo.height, scaleFactor = imageInfo.scaleFactor;
31
- preview = {
32
- file: file,
33
- dimensions: {
34
- width: width,
35
- height: height
36
- },
37
- scaleFactor: devicePixelRatio || scaleFactor
38
- };
39
- return _context.abrupt("return", preview);
40
- case 13:
41
- case "end":
42
- return _context.stop();
43
- }
11
+ while (1) switch (_context.prev = _context.next) {
12
+ case 0:
13
+ _context.next = 2;
14
+ return getFileInfo(file);
15
+ case 2:
16
+ fileInfo = _context.sent;
17
+ _context.next = 5;
18
+ return getImageInfo(fileInfo);
19
+ case 5:
20
+ imageInfo = _context.sent;
21
+ if (!(imageInfo === null)) {
22
+ _context.next = 10;
23
+ break;
24
+ }
25
+ return _context.abrupt("return", {
26
+ file: file
27
+ });
28
+ case 10:
29
+ width = imageInfo.width, height = imageInfo.height, scaleFactor = imageInfo.scaleFactor;
30
+ preview = {
31
+ file: file,
32
+ dimensions: {
33
+ width: width,
34
+ height: height
35
+ },
36
+ scaleFactor: devicePixelRatio || scaleFactor
37
+ };
38
+ return _context.abrupt("return", preview);
39
+ case 13:
40
+ case "end":
41
+ return _context.stop();
44
42
  }
45
43
  }, _callee);
46
44
  }));
@@ -5,7 +5,7 @@ import { ConcurrentExperience, ExperiencePerformanceTypes, ExperienceTypes } fro
5
5
  import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
6
6
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
7
7
  var packageName = "@atlaskit/media-picker";
8
- var packageVersion = "64.3.0";
8
+ var packageVersion = "64.4.0";
9
9
  var ufoExperience;
10
10
  var initExperience = function initExperience(id, componentName) {
11
11
  if (!ufoExperience) {
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/media-picker",
3
- "version": "64.3.0"
3
+ "version": "64.4.0"
4
4
  }
@@ -13,11 +13,17 @@ export interface UploadService {
13
13
  setUploadParams(uploadParams: UploadParams): void;
14
14
  addFile(file: File, replaceFileId?: string, featureFlags?: MediaFeatureFlags): void;
15
15
  addFiles(files: File[], featureFlags?: MediaFeatureFlags): void;
16
- addFilesWithSource(files: LocalFileWithSource[], featureFlags?: MediaFeatureFlags): void;
16
+ addFilesWithSource(files: LocalFileWithSource[], featureFlags?: MediaFeatureFlags): Promise<void>;
17
17
  cancel(id?: string): void;
18
18
  on<E extends keyof UploadServiceEventPayloadTypes>(event: E, listener: UploadServiceEventListener<E>): void;
19
19
  off<E extends keyof UploadServiceEventPayloadTypes>(event: E, listener: UploadServiceEventListener<E>): void;
20
+ onFileRejection(handler: (rejectionData: RejectionData) => void): void;
20
21
  }
22
+ export declare type RejectionData = {
23
+ reason: 'fileSizeLimitExceeded';
24
+ file: File;
25
+ limit: number;
26
+ };
21
27
  export declare enum LocalFileSource {
22
28
  PastedFile = "pastedFile",
23
29
  PastedScreenshot = "pastedScreenshot",
@@ -1,6 +1,6 @@
1
1
  import { MediaClient } from '@atlaskit/media-client';
2
2
  import { MediaFile, UploadParams } from '../types';
3
- import { UploadService, UploadServiceEventListener, UploadServiceEventPayloadTypes } from './types';
3
+ import { RejectionData, UploadService, UploadServiceEventListener, UploadServiceEventPayloadTypes } from './types';
4
4
  import { LocalFileSource, LocalFileWithSource } from '../service/types';
5
5
  import { MediaFeatureFlags } from '@atlaskit/media-common';
6
6
  export interface CancellableFileUpload {
@@ -16,12 +16,14 @@ export declare class UploadServiceImpl implements UploadService {
16
16
  private readonly userMediaClient?;
17
17
  private readonly emitter;
18
18
  private cancellableFilesUploads;
19
+ private fileRejectionHandler?;
19
20
  constructor(tenantMediaClient: MediaClient, tenantUploadParams: UploadParams, shouldCopyFileToRecents: boolean);
20
21
  setUploadParams(uploadParams: UploadParams): void;
21
22
  private createUploadController;
22
23
  addFiles(files: File[], featureFlags?: MediaFeatureFlags): void;
23
24
  addFile(file: File, replaceFileId?: string): void;
24
- addFilesWithSource(files: LocalFileWithSource[], featureFlags?: MediaFeatureFlags): void;
25
+ addFilesWithSource(files: LocalFileWithSource[], featureFlags?: MediaFeatureFlags): Promise<void>;
26
+ isCancellableFileUpload(fileUpload: null | CancellableFileUpload): fileUpload is CancellableFileUpload;
25
27
  cancel(id?: string): void;
26
28
  on<E extends keyof UploadServiceEventPayloadTypes>(event: E, listener: UploadServiceEventListener<E>): void;
27
29
  off<E extends keyof UploadServiceEventPayloadTypes>(event: E, listener: UploadServiceEventListener<E>): void;
@@ -31,4 +33,5 @@ export declare class UploadServiceImpl implements UploadService {
31
33
  private releaseCancellableFile;
32
34
  private readonly onFileSuccess;
33
35
  private readonly onFileError;
36
+ onFileRejection(handler: (rejectionData: RejectionData) => void): void;
34
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-picker",
3
- "version": "64.3.0",
3
+ "version": "64.4.0",
4
4
  "description": "Library for handling file uploads",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@atlaskit/analytics-next": "^9.0.0",
30
- "@atlaskit/media-client": "^20.2.0",
30
+ "@atlaskit/media-client": "^21.1.0",
31
31
  "@atlaskit/media-common": "^4.0.0",
32
32
  "@atlaskit/media-ui": "^22.3.0",
33
33
  "@atlaskit/ufo": "^0.1.0",
@@ -36,7 +36,6 @@
36
36
  "exenv": "^1.2.2",
37
37
  "flat-files": "^1.0.6",
38
38
  "perf-marks": "^1.5.0",
39
- "rxjs": "^5.5.0",
40
39
  "uuid": "^3.1.0",
41
40
  "uuid-validate": "^0.0.3"
42
41
  },
@@ -47,14 +46,14 @@
47
46
  "react-intl-next": "npm:react-intl@^5.18.1"
48
47
  },
49
48
  "devDependencies": {
50
- "@atlaskit/analytics-listeners": "^8.5.0",
49
+ "@atlaskit/analytics-listeners": "^8.6.0",
51
50
  "@atlaskit/analytics-namespaced-context": "^6.6.0",
52
51
  "@atlaskit/button": "^16.6.0",
53
52
  "@atlaskit/docs": "*",
54
53
  "@atlaskit/dropdown-menu": "^11.7.0",
55
54
  "@atlaskit/media-card": "^74.7.0",
56
55
  "@atlaskit/media-core": "^34.0.0",
57
- "@atlaskit/media-test-helpers": "^31.0.0",
56
+ "@atlaskit/media-test-helpers": "^32.1.0",
58
57
  "@atlaskit/spinner": "^15.4.0",
59
58
  "@atlaskit/ssr": "*",
60
59
  "@atlaskit/toggle": "^12.5.0",