@atlaskit/media-picker 66.2.4 → 66.2.5

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/media-picker
2
2
 
3
+ ## 66.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b4e36677fdb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b4e36677fdb) - Batch 255 items for 'addFilesWithSource' due to backend limits
8
+
3
9
  ## 66.2.4
4
10
 
5
11
  ### Patch Changes
@@ -97,17 +97,12 @@ var UploadServiceImpl = /*#__PURE__*/function () {
97
97
  }, {
98
98
  key: "addFiles",
99
99
  value: function addFiles(files) {
100
- var maxUploadBatchSize = this.maxUploadBatchSize;
101
- var traceContext = generateTraceContext();
102
- for (var iterator = 0; iterator < files.length; iterator += maxUploadBatchSize) {
103
- var filesArray = files.slice(iterator, iterator + maxUploadBatchSize).map(function (file) {
104
- return {
105
- file: file,
106
- source: _types.LocalFileSource.LocalUpload
107
- };
108
- });
109
- this.addFilesWithSource(filesArray, traceContext);
110
- }
100
+ this.addFilesWithSource(files.map(function (file) {
101
+ return {
102
+ file: file,
103
+ source: _types.LocalFileSource.LocalUpload
104
+ };
105
+ }));
111
106
  }
112
107
  }, {
113
108
  key: "addFile",
@@ -122,49 +117,90 @@ var UploadServiceImpl = /*#__PURE__*/function () {
122
117
  key: "addFilesWithSource",
123
118
  value: function () {
124
119
  var _addFilesWithSource = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(files) {
125
- var _this2 = this;
126
120
  var traceContext,
127
- creationDate,
128
- userMediaClient,
129
- tenantMediaClient,
130
- shouldCopyFileToRecents,
131
- mediaClient,
132
- _this$tenantUploadPar,
133
- collectionTentant,
134
- expireAfter,
135
- collection,
136
- touchFileDescriptors,
137
- i,
138
- _files$i,
139
- replaceFileId,
140
- file,
141
- touchedFiles,
142
- caughtError,
143
- cancellableFileUploads,
144
- filteredCancellableFileUploads,
145
- mediaFiles,
121
+ batches,
122
+ iterator,
146
123
  _args2 = arguments;
147
124
  return _regenerator.default.wrap(function _callee2$(_context2) {
148
125
  while (1) switch (_context2.prev = _context2.next) {
149
126
  case 0:
150
127
  traceContext = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : generateTraceContext();
128
+ batches = [];
129
+ for (iterator = 0; iterator < files.length; iterator += this.maxUploadBatchSize) {
130
+ batches.push(this.addFilesAndUpload(files.slice(iterator, iterator + this.maxUploadBatchSize), traceContext));
131
+ }
132
+ _context2.next = 5;
133
+ return Promise.all(batches);
134
+ case 5:
135
+ case "end":
136
+ return _context2.stop();
137
+ }
138
+ }, _callee2, this);
139
+ }));
140
+ function addFilesWithSource(_x4) {
141
+ return _addFilesWithSource.apply(this, arguments);
142
+ }
143
+ return addFilesWithSource;
144
+ }()
145
+ }, {
146
+ key: "isCancellableFileUpload",
147
+ value: function isCancellableFileUpload(fileUpload) {
148
+ return fileUpload !== null;
149
+ }
150
+ }, {
151
+ key: "cancel",
152
+ value: function cancel(id) {
153
+ var _this2 = this;
154
+ if (id) {
155
+ var cancellableFileUpload = this.cancellableFilesUploads[id];
156
+ if (cancellableFileUpload && cancellableFileUpload.cancel) {
157
+ cancellableFileUpload.cancel();
158
+ }
159
+ } else {
160
+ Object.keys(this.cancellableFilesUploads).forEach(function (key) {
161
+ var cancellableFileUpload = _this2.cancellableFilesUploads[key];
162
+ if (cancellableFileUpload.cancel) {
163
+ cancellableFileUpload.cancel();
164
+ }
165
+ });
166
+ }
167
+ }
168
+ }, {
169
+ key: "on",
170
+ value: function on(event, listener) {
171
+ this.emitter.on(event, listener);
172
+ }
173
+ }, {
174
+ key: "off",
175
+ value: function off(event, listener) {
176
+ this.emitter.off(event, listener);
177
+ }
178
+ }, {
179
+ key: "addFilesAndUpload",
180
+ value: function () {
181
+ var _addFilesAndUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(files, traceContext) {
182
+ var _this3 = this;
183
+ var creationDate, userMediaClient, tenantMediaClient, shouldCopyFileToRecents, mediaClient, _this$tenantUploadPar, collectionTentant, expireAfter, collection, touchFileDescriptors, i, _files$i, replaceFileId, file, touchedFiles, caughtError, cancellableFileUploads, filteredCancellableFileUploads, mediaFiles;
184
+ return _regenerator.default.wrap(function _callee3$(_context3) {
185
+ while (1) switch (_context3.prev = _context3.next) {
186
+ case 0:
151
187
  if (!(files.length === 0)) {
152
- _context2.next = 3;
188
+ _context3.next = 2;
153
189
  break;
154
190
  }
155
- return _context2.abrupt("return");
156
- case 3:
191
+ return _context3.abrupt("return");
192
+ case 2:
157
193
  creationDate = Date.now();
158
194
  userMediaClient = this.userMediaClient, tenantMediaClient = this.tenantMediaClient, shouldCopyFileToRecents = this.shouldCopyFileToRecents;
159
195
  mediaClient = shouldCopyFileToRecents ? tenantMediaClient : userMediaClient;
160
196
  _this$tenantUploadPar = this.tenantUploadParams, collectionTentant = _this$tenantUploadPar.collection, expireAfter = _this$tenantUploadPar.expireAfter;
161
197
  collection = shouldCopyFileToRecents ? collectionTentant : _constants.RECENTS_COLLECTION;
162
198
  if (mediaClient) {
163
- _context2.next = 10;
199
+ _context3.next = 9;
164
200
  break;
165
201
  }
166
- return _context2.abrupt("return");
167
- case 10:
202
+ return _context3.abrupt("return");
203
+ case 9:
168
204
  touchFileDescriptors = [];
169
205
  for (i = 0; i < files.length; i++) {
170
206
  _files$i = files[i], replaceFileId = _files$i.replaceFileId, file = _files$i.file;
@@ -176,18 +212,18 @@ var UploadServiceImpl = /*#__PURE__*/function () {
176
212
  expireAfter: expireAfter
177
213
  });
178
214
  }
179
- _context2.prev = 12;
180
- _context2.next = 15;
215
+ _context3.prev = 11;
216
+ _context3.next = 14;
181
217
  return mediaClient.file.touchFiles(touchFileDescriptors, collection, traceContext);
182
- case 15:
183
- touchedFiles = _context2.sent;
184
- _context2.next = 21;
218
+ case 14:
219
+ touchedFiles = _context3.sent;
220
+ _context3.next = 20;
185
221
  break;
186
- case 18:
187
- _context2.prev = 18;
188
- _context2.t0 = _context2["catch"](12);
189
- caughtError = _context2.t0;
190
- case 21:
222
+ case 17:
223
+ _context3.prev = 17;
224
+ _context3.t0 = _context3["catch"](11);
225
+ caughtError = _context3.t0;
226
+ case 20:
191
227
  cancellableFileUploads = files.map(function (_ref2, i) {
192
228
  var _touchedFiles, _touchedFiles$rejecte, _touchedFiles2, _caughtError$metadata;
193
229
  var file = _ref2.file,
@@ -202,8 +238,8 @@ var UploadServiceImpl = /*#__PURE__*/function () {
202
238
  return rejectedFileId === id;
203
239
  });
204
240
  if (rejectedFile) {
205
- if (_this2.fileRejectionHandler) {
206
- _this2.fileRejectionHandler({
241
+ if (_this3.fileRejectionHandler) {
242
+ _this3.fileRejectionHandler({
207
243
  reason: 'fileSizeLimitExceeded',
208
244
  fileName: file.name,
209
245
  limit: rejectedFile.error.limit
@@ -242,7 +278,7 @@ var UploadServiceImpl = /*#__PURE__*/function () {
242
278
  occurrenceKey: occurrenceKey,
243
279
  deferredUploadId: deferredUploadId
244
280
  };
245
- var controller = _this2.createUploadController();
281
+ var controller = _this3.createUploadController();
246
282
  var sourceFileObservable = mediaClient.file.upload(uploadableFile, controller, uploadableUpfrontIds, traceContext);
247
283
  var mediaFile = {
248
284
  id: id,
@@ -269,18 +305,18 @@ var UploadServiceImpl = /*#__PURE__*/function () {
269
305
  mediaClient.emit('file-added', state);
270
306
  _mediaClient.globalMediaEventEmitter.emit('file-added', state);
271
307
  }
272
- _this2.onFileSuccess(cancellableFileUpload, id, traceContext);
308
+ _this3.onFileSuccess(cancellableFileUpload, id, traceContext);
273
309
  }
274
310
  if (state.status === 'error') {
275
- _this2.onFileError(mediaFile, 'upload_fail', state.message || 'no-message', traceContext);
311
+ _this3.onFileError(mediaFile, 'upload_fail', state.message || 'no-message', traceContext);
276
312
  }
277
313
  },
278
314
  error: function error(_error) {
279
- _this2.onFileError(mediaFile, 'upload_fail', _error, traceContext);
315
+ _this3.onFileError(mediaFile, 'upload_fail', _error, traceContext);
280
316
  }
281
317
  }),
282
318
  unsubscribe = _sourceFileObservable.unsubscribe;
283
- _this2.cancellableFilesUploads[id] = cancellableFileUpload;
319
+ _this3.cancellableFilesUploads[id] = cancellableFileUpload;
284
320
  return cancellableFileUpload;
285
321
  });
286
322
  filteredCancellableFileUploads = cancellableFileUploads.filter(this.isCancellableFileUpload);
@@ -292,50 +328,17 @@ var UploadServiceImpl = /*#__PURE__*/function () {
292
328
  traceContext: traceContext
293
329
  });
294
330
  this.emitPreviews(filteredCancellableFileUploads);
295
- case 26:
331
+ case 25:
296
332
  case "end":
297
- return _context2.stop();
333
+ return _context3.stop();
298
334
  }
299
- }, _callee2, this, [[12, 18]]);
335
+ }, _callee3, this, [[11, 17]]);
300
336
  }));
301
- function addFilesWithSource(_x4) {
302
- return _addFilesWithSource.apply(this, arguments);
337
+ function addFilesAndUpload(_x5, _x6) {
338
+ return _addFilesAndUpload.apply(this, arguments);
303
339
  }
304
- return addFilesWithSource;
340
+ return addFilesAndUpload;
305
341
  }()
306
- }, {
307
- key: "isCancellableFileUpload",
308
- value: function isCancellableFileUpload(fileUpload) {
309
- return fileUpload !== null;
310
- }
311
- }, {
312
- key: "cancel",
313
- value: function cancel(id) {
314
- var _this3 = this;
315
- if (id) {
316
- var cancellableFileUpload = this.cancellableFilesUploads[id];
317
- if (cancellableFileUpload && cancellableFileUpload.cancel) {
318
- cancellableFileUpload.cancel();
319
- }
320
- } else {
321
- Object.keys(this.cancellableFilesUploads).forEach(function (key) {
322
- var cancellableFileUpload = _this3.cancellableFilesUploads[key];
323
- if (cancellableFileUpload.cancel) {
324
- cancellableFileUpload.cancel();
325
- }
326
- });
327
- }
328
- }
329
- }, {
330
- key: "on",
331
- value: function on(event, listener) {
332
- this.emitter.on(event, listener);
333
- }
334
- }, {
335
- key: "off",
336
- value: function off(event, listener) {
337
- this.emitter.off(event, listener);
338
- }
339
342
  }, {
340
343
  key: "emitPreviews",
341
344
  value: function emitPreviews(cancellableFileUploads) {
@@ -9,7 +9,7 @@ var _mediaClient = require("@atlaskit/media-client");
9
9
  // Component name will be prefixed with "media-picker-" in logs. Check ufoExperiences in utils files
10
10
 
11
11
  var packageName = "@atlaskit/media-picker";
12
- var packageVersion = "66.2.4";
12
+ var packageVersion = "66.2.5";
13
13
  function getPackageAttributes(componentName) {
14
14
  return {
15
15
  packageName: packageName,
@@ -12,7 +12,7 @@ var _mediaClient = require("@atlaskit/media-client");
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-picker";
15
- var packageVersion = "66.2.4";
15
+ var packageVersion = "66.2.5";
16
16
  var ufoExperience;
17
17
  var initExperience = function initExperience(id, componentName) {
18
18
  if (!ufoExperience) {
@@ -64,17 +64,10 @@ export class UploadServiceImpl {
64
64
  return new UploadController();
65
65
  }
66
66
  addFiles(files) {
67
- const {
68
- maxUploadBatchSize
69
- } = this;
70
- const traceContext = generateTraceContext();
71
- for (let iterator = 0; iterator < files.length; iterator += maxUploadBatchSize) {
72
- const filesArray = files.slice(iterator, iterator + maxUploadBatchSize).map(file => ({
73
- file,
74
- source: LocalFileSource.LocalUpload
75
- }));
76
- this.addFilesWithSource(filesArray, traceContext);
77
- }
67
+ this.addFilesWithSource(files.map(file => ({
68
+ file,
69
+ source: LocalFileSource.LocalUpload
70
+ })));
78
71
  }
79
72
  addFile(file, replaceFileId) {
80
73
  this.addFilesWithSource([{
@@ -84,6 +77,37 @@ export class UploadServiceImpl {
84
77
  }]);
85
78
  }
86
79
  async addFilesWithSource(files, traceContext = generateTraceContext()) {
80
+ const batches = [];
81
+ for (let iterator = 0; iterator < files.length; iterator += this.maxUploadBatchSize) {
82
+ batches.push(this.addFilesAndUpload(files.slice(iterator, iterator + this.maxUploadBatchSize), traceContext));
83
+ }
84
+ await Promise.all(batches);
85
+ }
86
+ isCancellableFileUpload(fileUpload) {
87
+ return fileUpload !== null;
88
+ }
89
+ cancel(id) {
90
+ if (id) {
91
+ const cancellableFileUpload = this.cancellableFilesUploads[id];
92
+ if (cancellableFileUpload && cancellableFileUpload.cancel) {
93
+ cancellableFileUpload.cancel();
94
+ }
95
+ } else {
96
+ Object.keys(this.cancellableFilesUploads).forEach(key => {
97
+ const cancellableFileUpload = this.cancellableFilesUploads[key];
98
+ if (cancellableFileUpload.cancel) {
99
+ cancellableFileUpload.cancel();
100
+ }
101
+ });
102
+ }
103
+ }
104
+ on(event, listener) {
105
+ this.emitter.on(event, listener);
106
+ }
107
+ off(event, listener) {
108
+ this.emitter.off(event, listener);
109
+ }
110
+ async addFilesAndUpload(files, traceContext) {
87
111
  if (files.length === 0) {
88
112
  return;
89
113
  }
@@ -226,30 +250,6 @@ export class UploadServiceImpl {
226
250
  });
227
251
  this.emitPreviews(filteredCancellableFileUploads);
228
252
  }
229
- isCancellableFileUpload(fileUpload) {
230
- return fileUpload !== null;
231
- }
232
- cancel(id) {
233
- if (id) {
234
- const cancellableFileUpload = this.cancellableFilesUploads[id];
235
- if (cancellableFileUpload && cancellableFileUpload.cancel) {
236
- cancellableFileUpload.cancel();
237
- }
238
- } else {
239
- Object.keys(this.cancellableFilesUploads).forEach(key => {
240
- const cancellableFileUpload = this.cancellableFilesUploads[key];
241
- if (cancellableFileUpload.cancel) {
242
- cancellableFileUpload.cancel();
243
- }
244
- });
245
- }
246
- }
247
- on(event, listener) {
248
- this.emitter.on(event, listener);
249
- }
250
- off(event, listener) {
251
- this.emitter.off(event, listener);
252
- }
253
253
  emitPreviews(cancellableFileUploads) {
254
254
  cancellableFileUploads.forEach(cancellableFileUpload => {
255
255
  const {
@@ -3,7 +3,7 @@ import { isRequestError } from '@atlaskit/media-client';
3
3
  // Component name will be prefixed with "media-picker-" in logs. Check ufoExperiences in utils files
4
4
 
5
5
  const packageName = "@atlaskit/media-picker";
6
- const packageVersion = "66.2.4";
6
+ const packageVersion = "66.2.5";
7
7
  export function getPackageAttributes(componentName) {
8
8
  return {
9
9
  packageName,
@@ -2,7 +2,7 @@ import { ConcurrentExperience, ExperiencePerformanceTypes, ExperienceTypes } fro
2
2
  import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
3
3
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
4
4
  const packageName = "@atlaskit/media-picker";
5
- const packageVersion = "66.2.4";
5
+ const packageVersion = "66.2.5";
6
6
  let ufoExperience;
7
7
  const initExperience = (id, componentName) => {
8
8
  if (!ufoExperience) {
@@ -90,17 +90,12 @@ export var UploadServiceImpl = /*#__PURE__*/function () {
90
90
  }, {
91
91
  key: "addFiles",
92
92
  value: function addFiles(files) {
93
- var maxUploadBatchSize = this.maxUploadBatchSize;
94
- var traceContext = generateTraceContext();
95
- for (var iterator = 0; iterator < files.length; iterator += maxUploadBatchSize) {
96
- var filesArray = files.slice(iterator, iterator + maxUploadBatchSize).map(function (file) {
97
- return {
98
- file: file,
99
- source: LocalFileSource.LocalUpload
100
- };
101
- });
102
- this.addFilesWithSource(filesArray, traceContext);
103
- }
93
+ this.addFilesWithSource(files.map(function (file) {
94
+ return {
95
+ file: file,
96
+ source: LocalFileSource.LocalUpload
97
+ };
98
+ }));
104
99
  }
105
100
  }, {
106
101
  key: "addFile",
@@ -115,49 +110,90 @@ export var UploadServiceImpl = /*#__PURE__*/function () {
115
110
  key: "addFilesWithSource",
116
111
  value: function () {
117
112
  var _addFilesWithSource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(files) {
118
- var _this2 = this;
119
113
  var traceContext,
120
- creationDate,
121
- userMediaClient,
122
- tenantMediaClient,
123
- shouldCopyFileToRecents,
124
- mediaClient,
125
- _this$tenantUploadPar,
126
- collectionTentant,
127
- expireAfter,
128
- collection,
129
- touchFileDescriptors,
130
- i,
131
- _files$i,
132
- replaceFileId,
133
- file,
134
- touchedFiles,
135
- caughtError,
136
- cancellableFileUploads,
137
- filteredCancellableFileUploads,
138
- mediaFiles,
114
+ batches,
115
+ iterator,
139
116
  _args2 = arguments;
140
117
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
141
118
  while (1) switch (_context2.prev = _context2.next) {
142
119
  case 0:
143
120
  traceContext = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : generateTraceContext();
121
+ batches = [];
122
+ for (iterator = 0; iterator < files.length; iterator += this.maxUploadBatchSize) {
123
+ batches.push(this.addFilesAndUpload(files.slice(iterator, iterator + this.maxUploadBatchSize), traceContext));
124
+ }
125
+ _context2.next = 5;
126
+ return Promise.all(batches);
127
+ case 5:
128
+ case "end":
129
+ return _context2.stop();
130
+ }
131
+ }, _callee2, this);
132
+ }));
133
+ function addFilesWithSource(_x4) {
134
+ return _addFilesWithSource.apply(this, arguments);
135
+ }
136
+ return addFilesWithSource;
137
+ }()
138
+ }, {
139
+ key: "isCancellableFileUpload",
140
+ value: function isCancellableFileUpload(fileUpload) {
141
+ return fileUpload !== null;
142
+ }
143
+ }, {
144
+ key: "cancel",
145
+ value: function cancel(id) {
146
+ var _this2 = this;
147
+ if (id) {
148
+ var cancellableFileUpload = this.cancellableFilesUploads[id];
149
+ if (cancellableFileUpload && cancellableFileUpload.cancel) {
150
+ cancellableFileUpload.cancel();
151
+ }
152
+ } else {
153
+ Object.keys(this.cancellableFilesUploads).forEach(function (key) {
154
+ var cancellableFileUpload = _this2.cancellableFilesUploads[key];
155
+ if (cancellableFileUpload.cancel) {
156
+ cancellableFileUpload.cancel();
157
+ }
158
+ });
159
+ }
160
+ }
161
+ }, {
162
+ key: "on",
163
+ value: function on(event, listener) {
164
+ this.emitter.on(event, listener);
165
+ }
166
+ }, {
167
+ key: "off",
168
+ value: function off(event, listener) {
169
+ this.emitter.off(event, listener);
170
+ }
171
+ }, {
172
+ key: "addFilesAndUpload",
173
+ value: function () {
174
+ var _addFilesAndUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(files, traceContext) {
175
+ var _this3 = this;
176
+ var creationDate, userMediaClient, tenantMediaClient, shouldCopyFileToRecents, mediaClient, _this$tenantUploadPar, collectionTentant, expireAfter, collection, touchFileDescriptors, i, _files$i, replaceFileId, file, touchedFiles, caughtError, cancellableFileUploads, filteredCancellableFileUploads, mediaFiles;
177
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
178
+ while (1) switch (_context3.prev = _context3.next) {
179
+ case 0:
144
180
  if (!(files.length === 0)) {
145
- _context2.next = 3;
181
+ _context3.next = 2;
146
182
  break;
147
183
  }
148
- return _context2.abrupt("return");
149
- case 3:
184
+ return _context3.abrupt("return");
185
+ case 2:
150
186
  creationDate = Date.now();
151
187
  userMediaClient = this.userMediaClient, tenantMediaClient = this.tenantMediaClient, shouldCopyFileToRecents = this.shouldCopyFileToRecents;
152
188
  mediaClient = shouldCopyFileToRecents ? tenantMediaClient : userMediaClient;
153
189
  _this$tenantUploadPar = this.tenantUploadParams, collectionTentant = _this$tenantUploadPar.collection, expireAfter = _this$tenantUploadPar.expireAfter;
154
190
  collection = shouldCopyFileToRecents ? collectionTentant : RECENTS_COLLECTION;
155
191
  if (mediaClient) {
156
- _context2.next = 10;
192
+ _context3.next = 9;
157
193
  break;
158
194
  }
159
- return _context2.abrupt("return");
160
- case 10:
195
+ return _context3.abrupt("return");
196
+ case 9:
161
197
  touchFileDescriptors = [];
162
198
  for (i = 0; i < files.length; i++) {
163
199
  _files$i = files[i], replaceFileId = _files$i.replaceFileId, file = _files$i.file;
@@ -169,18 +205,18 @@ export var UploadServiceImpl = /*#__PURE__*/function () {
169
205
  expireAfter: expireAfter
170
206
  });
171
207
  }
172
- _context2.prev = 12;
173
- _context2.next = 15;
208
+ _context3.prev = 11;
209
+ _context3.next = 14;
174
210
  return mediaClient.file.touchFiles(touchFileDescriptors, collection, traceContext);
175
- case 15:
176
- touchedFiles = _context2.sent;
177
- _context2.next = 21;
211
+ case 14:
212
+ touchedFiles = _context3.sent;
213
+ _context3.next = 20;
178
214
  break;
179
- case 18:
180
- _context2.prev = 18;
181
- _context2.t0 = _context2["catch"](12);
182
- caughtError = _context2.t0;
183
- case 21:
215
+ case 17:
216
+ _context3.prev = 17;
217
+ _context3.t0 = _context3["catch"](11);
218
+ caughtError = _context3.t0;
219
+ case 20:
184
220
  cancellableFileUploads = files.map(function (_ref2, i) {
185
221
  var _touchedFiles, _touchedFiles$rejecte, _touchedFiles2, _caughtError$metadata;
186
222
  var file = _ref2.file,
@@ -195,8 +231,8 @@ export var UploadServiceImpl = /*#__PURE__*/function () {
195
231
  return rejectedFileId === id;
196
232
  });
197
233
  if (rejectedFile) {
198
- if (_this2.fileRejectionHandler) {
199
- _this2.fileRejectionHandler({
234
+ if (_this3.fileRejectionHandler) {
235
+ _this3.fileRejectionHandler({
200
236
  reason: 'fileSizeLimitExceeded',
201
237
  fileName: file.name,
202
238
  limit: rejectedFile.error.limit
@@ -235,7 +271,7 @@ export var UploadServiceImpl = /*#__PURE__*/function () {
235
271
  occurrenceKey: occurrenceKey,
236
272
  deferredUploadId: deferredUploadId
237
273
  };
238
- var controller = _this2.createUploadController();
274
+ var controller = _this3.createUploadController();
239
275
  var sourceFileObservable = mediaClient.file.upload(uploadableFile, controller, uploadableUpfrontIds, traceContext);
240
276
  var mediaFile = {
241
277
  id: id,
@@ -262,18 +298,18 @@ export var UploadServiceImpl = /*#__PURE__*/function () {
262
298
  mediaClient.emit('file-added', state);
263
299
  globalMediaEventEmitter.emit('file-added', state);
264
300
  }
265
- _this2.onFileSuccess(cancellableFileUpload, id, traceContext);
301
+ _this3.onFileSuccess(cancellableFileUpload, id, traceContext);
266
302
  }
267
303
  if (state.status === 'error') {
268
- _this2.onFileError(mediaFile, 'upload_fail', state.message || 'no-message', traceContext);
304
+ _this3.onFileError(mediaFile, 'upload_fail', state.message || 'no-message', traceContext);
269
305
  }
270
306
  },
271
307
  error: function error(_error) {
272
- _this2.onFileError(mediaFile, 'upload_fail', _error, traceContext);
308
+ _this3.onFileError(mediaFile, 'upload_fail', _error, traceContext);
273
309
  }
274
310
  }),
275
311
  unsubscribe = _sourceFileObservable.unsubscribe;
276
- _this2.cancellableFilesUploads[id] = cancellableFileUpload;
312
+ _this3.cancellableFilesUploads[id] = cancellableFileUpload;
277
313
  return cancellableFileUpload;
278
314
  });
279
315
  filteredCancellableFileUploads = cancellableFileUploads.filter(this.isCancellableFileUpload);
@@ -285,50 +321,17 @@ export var UploadServiceImpl = /*#__PURE__*/function () {
285
321
  traceContext: traceContext
286
322
  });
287
323
  this.emitPreviews(filteredCancellableFileUploads);
288
- case 26:
324
+ case 25:
289
325
  case "end":
290
- return _context2.stop();
326
+ return _context3.stop();
291
327
  }
292
- }, _callee2, this, [[12, 18]]);
328
+ }, _callee3, this, [[11, 17]]);
293
329
  }));
294
- function addFilesWithSource(_x4) {
295
- return _addFilesWithSource.apply(this, arguments);
330
+ function addFilesAndUpload(_x5, _x6) {
331
+ return _addFilesAndUpload.apply(this, arguments);
296
332
  }
297
- return addFilesWithSource;
333
+ return addFilesAndUpload;
298
334
  }()
299
- }, {
300
- key: "isCancellableFileUpload",
301
- value: function isCancellableFileUpload(fileUpload) {
302
- return fileUpload !== null;
303
- }
304
- }, {
305
- key: "cancel",
306
- value: function cancel(id) {
307
- var _this3 = this;
308
- if (id) {
309
- var cancellableFileUpload = this.cancellableFilesUploads[id];
310
- if (cancellableFileUpload && cancellableFileUpload.cancel) {
311
- cancellableFileUpload.cancel();
312
- }
313
- } else {
314
- Object.keys(this.cancellableFilesUploads).forEach(function (key) {
315
- var cancellableFileUpload = _this3.cancellableFilesUploads[key];
316
- if (cancellableFileUpload.cancel) {
317
- cancellableFileUpload.cancel();
318
- }
319
- });
320
- }
321
- }
322
- }, {
323
- key: "on",
324
- value: function on(event, listener) {
325
- this.emitter.on(event, listener);
326
- }
327
- }, {
328
- key: "off",
329
- value: function off(event, listener) {
330
- this.emitter.off(event, listener);
331
- }
332
335
  }, {
333
336
  key: "emitPreviews",
334
337
  value: function emitPreviews(cancellableFileUploads) {
@@ -3,7 +3,7 @@ import { isRequestError } from '@atlaskit/media-client';
3
3
  // Component name will be prefixed with "media-picker-" in logs. Check ufoExperiences in utils files
4
4
 
5
5
  var packageName = "@atlaskit/media-picker";
6
- var packageVersion = "66.2.4";
6
+ var packageVersion = "66.2.5";
7
7
  export function getPackageAttributes(componentName) {
8
8
  return {
9
9
  packageName: packageName,
@@ -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 = "66.2.4";
8
+ var packageVersion = "66.2.5";
9
9
  var ufoExperience;
10
10
  var initExperience = function initExperience(id, componentName) {
11
11
  if (!ufoExperience) {
@@ -29,6 +29,7 @@ export declare class UploadServiceImpl implements UploadService {
29
29
  cancel(id?: string): void;
30
30
  on<E extends keyof UploadServiceEventPayloadTypes>(event: E, listener: UploadServiceEventListener<E>): void;
31
31
  off<E extends keyof UploadServiceEventPayloadTypes>(event: E, listener: UploadServiceEventListener<E>): void;
32
+ private addFilesAndUpload;
32
33
  private readonly emit;
33
34
  private emitPreviews;
34
35
  private getMediaTypeFromFile;
@@ -29,6 +29,7 @@ export declare class UploadServiceImpl implements UploadService {
29
29
  cancel(id?: string): void;
30
30
  on<E extends keyof UploadServiceEventPayloadTypes>(event: E, listener: UploadServiceEventListener<E>): void;
31
31
  off<E extends keyof UploadServiceEventPayloadTypes>(event: E, listener: UploadServiceEventListener<E>): void;
32
+ private addFilesAndUpload;
32
33
  private readonly emit;
33
34
  private emitPreviews;
34
35
  private getMediaTypeFromFile;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-picker",
3
- "version": "66.2.4",
3
+ "version": "66.2.5",
4
4
  "description": "Library for handling file uploads",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -41,7 +41,7 @@
41
41
  "@atlaskit/media-common": "^9.0.0",
42
42
  "@atlaskit/media-ui": "^25.0.0",
43
43
  "@atlaskit/theme": "^12.6.0",
44
- "@atlaskit/tokens": "^1.22.0",
44
+ "@atlaskit/tokens": "^1.25.0",
45
45
  "@atlaskit/ufo": "^0.2.0",
46
46
  "@babel/runtime": "^7.0.0",
47
47
  "eventemitter2": "^4.1.0",
@@ -64,7 +64,7 @@
64
64
  "@atlaskit/media-core": "^34.1.0",
65
65
  "@atlaskit/media-test-helpers": "^33.0.0",
66
66
  "@atlaskit/ssr": "*",
67
- "@atlaskit/tokens": "^1.22.0",
67
+ "@atlaskit/tokens": "^1.25.0",
68
68
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
69
69
  "@atlassian/ufo": "^0.2.0",
70
70
  "@babel/plugin-proposal-numeric-separator": "^7.18.6",