@atlaskit/media-client 22.0.3 → 22.0.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,17 @@
1
1
  # @atlaskit/media-client
2
2
 
3
+ ## 22.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a7281dbb78f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a7281dbb78f) - Moved onFileRejection prop to Upload params and added file-size-limit API changes to /upload endpoint
8
+
9
+ ## 22.0.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [`4d139e63f12`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4d139e63f12) - [ux] As part of migrating from the classic card experience to the new card experience, media of type 'doc' displays a preview by default
14
+
3
15
  ## 22.0.3
4
16
 
5
17
  ### Patch Changes
@@ -295,7 +295,8 @@ var FileFetcherImpl = /*#__PURE__*/function () {
295
295
  content: blob,
296
296
  mimeType: type,
297
297
  collection: collection,
298
- name: name
298
+ name: name,
299
+ size: size
299
300
  };
300
301
  mediaType = (0, _mediaTypeUtils.getMediaTypeFromMimeType)(type); // we emit a richer state after the blob is fetched
301
302
  subject.next({
@@ -4,18 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isPreviewableType = exports.DATA_UNIT = void 0;
7
- var _mediaCommon = require("@atlaskit/media-common");
8
7
  // Warning! You can't add new media file processing status!
9
8
  // See packages/media/media-core/src/__tests__/cache-backward-compatibility.spec.ts
10
9
 
11
10
  var isPreviewableType = function isPreviewableType(type, featureFlags) {
12
- // in classic experience, only audio/video/image are previewable
13
- var defaultPreviewableTypes = ['audio', 'video', 'image'];
14
-
15
- // in the new experience, docs are previewable too
16
- if ((0, _mediaCommon.getMediaFeatureFlag)('newCardExperience', featureFlags)) {
17
- return [].concat(defaultPreviewableTypes, ['doc']).indexOf(type) > -1;
18
- }
11
+ var defaultPreviewableTypes = ['audio', 'video', 'image', 'doc'];
19
12
  return defaultPreviewableTypes.indexOf(type) > -1;
20
13
  };
21
14
  exports.isPreviewableType = isPreviewableType;
@@ -137,22 +137,30 @@ var createProcessingFunction = function createProcessingFunction(store, deferred
137
137
  };
138
138
  var createFileFromUpload = /*#__PURE__*/function () {
139
139
  var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(file, store, uploadableFileUpfrontIds, uploadId, traceContext) {
140
- var collection, name, mimeType, id, occurrenceKey;
140
+ var collection, name, mimeType, id, occurrenceKey, body;
141
141
  return _regenerator.default.wrap(function _callee5$(_context5) {
142
142
  while (1) switch (_context5.prev = _context5.next) {
143
143
  case 0:
144
144
  collection = file.collection, name = file.name, mimeType = file.mimeType;
145
145
  id = uploadableFileUpfrontIds.id, occurrenceKey = uploadableFileUpfrontIds.occurrenceKey;
146
- return _context5.abrupt("return", store.createFileFromUpload({
146
+ body = file.size ? {
147
+ uploadId: uploadId,
148
+ name: name,
149
+ mimeType: mimeType,
150
+ conditions: {
151
+ size: file.size
152
+ }
153
+ } : {
147
154
  uploadId: uploadId,
148
155
  name: name,
149
156
  mimeType: mimeType
150
- }, {
157
+ };
158
+ return _context5.abrupt("return", store.createFileFromUpload(body, {
151
159
  occurrenceKey: occurrenceKey,
152
160
  collection: collection,
153
161
  replaceFileId: id
154
162
  }, traceContext));
155
- case 3:
163
+ case 4:
156
164
  case "end":
157
165
  return _context5.stop();
158
166
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "22.0.3",
3
+ "version": "22.0.5",
4
4
  "sideEffects": false
5
5
  }
@@ -202,7 +202,8 @@ export class FileFetcherImpl {
202
202
  content: blob,
203
203
  mimeType: type,
204
204
  collection,
205
- name
205
+ name,
206
+ size
206
207
  };
207
208
  const mediaType = getMediaTypeFromMimeType(type);
208
209
 
@@ -1,15 +1,7 @@
1
- import { getMediaFeatureFlag } from '@atlaskit/media-common';
2
-
3
1
  // Warning! You can't add new media file processing status!
4
2
  // See packages/media/media-core/src/__tests__/cache-backward-compatibility.spec.ts
5
3
  export const isPreviewableType = (type, featureFlags) => {
6
- // in classic experience, only audio/video/image are previewable
7
- const defaultPreviewableTypes = ['audio', 'video', 'image'];
8
-
9
- // in the new experience, docs are previewable too
10
- if (getMediaFeatureFlag('newCardExperience', featureFlags)) {
11
- return [...defaultPreviewableTypes, 'doc'].indexOf(type) > -1;
12
- }
4
+ const defaultPreviewableTypes = ['audio', 'video', 'image', 'doc'];
13
5
  return defaultPreviewableTypes.indexOf(type) > -1;
14
6
  };
15
7
  export let DATA_UNIT = /*#__PURE__*/function (DATA_UNIT) {
@@ -40,11 +40,19 @@ const createFileFromUpload = async (file, store, uploadableFileUpfrontIds, uploa
40
40
  id,
41
41
  occurrenceKey
42
42
  } = uploadableFileUpfrontIds;
43
- return store.createFileFromUpload({
43
+ const body = file.size ? {
44
+ uploadId,
45
+ name,
46
+ mimeType,
47
+ conditions: {
48
+ size: file.size
49
+ }
50
+ } : {
44
51
  uploadId,
45
52
  name,
46
53
  mimeType
47
- }, {
54
+ };
55
+ return store.createFileFromUpload(body, {
48
56
  occurrenceKey,
49
57
  collection,
50
58
  replaceFileId: id
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "22.0.3",
3
+ "version": "22.0.5",
4
4
  "sideEffects": false
5
5
  }
@@ -278,7 +278,8 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
278
278
  content: blob,
279
279
  mimeType: type,
280
280
  collection: collection,
281
- name: name
281
+ name: name,
282
+ size: size
282
283
  };
283
284
  mediaType = getMediaTypeFromMimeType(type); // we emit a richer state after the blob is fetched
284
285
  subject.next({
@@ -1,15 +1,7 @@
1
- import { getMediaFeatureFlag } from '@atlaskit/media-common';
2
-
3
1
  // Warning! You can't add new media file processing status!
4
2
  // See packages/media/media-core/src/__tests__/cache-backward-compatibility.spec.ts
5
3
  export var isPreviewableType = function isPreviewableType(type, featureFlags) {
6
- // in classic experience, only audio/video/image are previewable
7
- var defaultPreviewableTypes = ['audio', 'video', 'image'];
8
-
9
- // in the new experience, docs are previewable too
10
- if (getMediaFeatureFlag('newCardExperience', featureFlags)) {
11
- return [].concat(defaultPreviewableTypes, ['doc']).indexOf(type) > -1;
12
- }
4
+ var defaultPreviewableTypes = ['audio', 'video', 'image', 'doc'];
13
5
  return defaultPreviewableTypes.indexOf(type) > -1;
14
6
  };
15
7
  export var DATA_UNIT = /*#__PURE__*/function (DATA_UNIT) {
@@ -131,22 +131,30 @@ var createProcessingFunction = function createProcessingFunction(store, deferred
131
131
  };
132
132
  var createFileFromUpload = /*#__PURE__*/function () {
133
133
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(file, store, uploadableFileUpfrontIds, uploadId, traceContext) {
134
- var collection, name, mimeType, id, occurrenceKey;
134
+ var collection, name, mimeType, id, occurrenceKey, body;
135
135
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
136
136
  while (1) switch (_context5.prev = _context5.next) {
137
137
  case 0:
138
138
  collection = file.collection, name = file.name, mimeType = file.mimeType;
139
139
  id = uploadableFileUpfrontIds.id, occurrenceKey = uploadableFileUpfrontIds.occurrenceKey;
140
- return _context5.abrupt("return", store.createFileFromUpload({
140
+ body = file.size ? {
141
+ uploadId: uploadId,
142
+ name: name,
143
+ mimeType: mimeType,
144
+ conditions: {
145
+ size: file.size
146
+ }
147
+ } : {
141
148
  uploadId: uploadId,
142
149
  name: name,
143
150
  mimeType: mimeType
144
- }, {
151
+ };
152
+ return _context5.abrupt("return", store.createFileFromUpload(body, {
145
153
  occurrenceKey: occurrenceKey,
146
154
  collection: collection,
147
155
  replaceFileId: id
148
156
  }, traceContext));
149
- case 3:
157
+ case 4:
150
158
  case "end":
151
159
  return _context5.stop();
152
160
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "22.0.3",
3
+ "version": "22.0.5",
4
4
  "sideEffects": false
5
5
  }
@@ -102,8 +102,8 @@ export type MediaStoreCreateFileFromBinaryParams = {
102
102
  readonly name?: string;
103
103
  };
104
104
  export type MediaStoreCreateFileFromUploadConditions = {
105
- readonly hash: string;
106
- readonly size: number;
105
+ readonly hash?: string;
106
+ readonly size?: number;
107
107
  };
108
108
  export type MediaStoreCreateFileFromUploadBody = {
109
109
  readonly uploadId: string;
@@ -1,4 +1,4 @@
1
- import { MediaFeatureFlags, MediaTraceContext, MediaType } from '@atlaskit/media-common';
1
+ import { MediaTraceContext, MediaFeatureFlags, MediaType } from '@atlaskit/media-common';
2
2
  import type { MediaFileArtifacts } from './artifacts';
3
3
  export type MediaFileProcessingStatus = 'pending' | 'succeeded' | 'failed';
4
4
  export type { MediaType } from '@atlaskit/media-common';
@@ -6,6 +6,7 @@ export type UploadableFile = {
6
6
  name?: string;
7
7
  mimeType?: string;
8
8
  collection?: string;
9
+ size?: number;
9
10
  };
10
11
  export type UploadableFileUpfrontIds = {
11
12
  id: string;
@@ -102,8 +102,8 @@ export type MediaStoreCreateFileFromBinaryParams = {
102
102
  readonly name?: string;
103
103
  };
104
104
  export type MediaStoreCreateFileFromUploadConditions = {
105
- readonly hash: string;
106
- readonly size: number;
105
+ readonly hash?: string;
106
+ readonly size?: number;
107
107
  };
108
108
  export type MediaStoreCreateFileFromUploadBody = {
109
109
  readonly uploadId: string;
@@ -1,4 +1,4 @@
1
- import { MediaFeatureFlags, MediaTraceContext, MediaType } from '@atlaskit/media-common';
1
+ import { MediaTraceContext, MediaFeatureFlags, MediaType } from '@atlaskit/media-common';
2
2
  import type { MediaFileArtifacts } from './artifacts';
3
3
  export type MediaFileProcessingStatus = 'pending' | 'succeeded' | 'failed';
4
4
  export type { MediaType } from '@atlaskit/media-common';
@@ -6,6 +6,7 @@ export type UploadableFile = {
6
6
  name?: string;
7
7
  mimeType?: string;
8
8
  collection?: string;
9
+ size?: number;
9
10
  };
10
11
  export type UploadableFileUpfrontIds = {
11
12
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "22.0.3",
3
+ "version": "22.0.5",
4
4
  "description": "Media API Web Client Library",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -61,7 +61,7 @@
61
61
  "@atlaskit/media-core": "^34.1.0",
62
62
  "@atlaskit/media-test-helpers": "^33.0.0",
63
63
  "@atlaskit/ssr": "*",
64
- "@atlaskit/tokens": "^1.4.0",
64
+ "@atlaskit/tokens": "^1.5.0",
65
65
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
66
66
  "@emotion/react": "^11.7.1",
67
67
  "@types/deep-equal": "^1.0.1",