@atlaskit/media-picker 62.0.0 → 63.0.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/cjs/components/browser/browser.js +1 -8
  3. package/dist/cjs/components/clipboard/clipboard.js +1 -8
  4. package/dist/cjs/components/dropzone/dropzone.js +1 -8
  5. package/dist/cjs/util/analytics.js +20 -3
  6. package/dist/cjs/util/ufoExperiences.js +9 -6
  7. package/dist/cjs/version.json +1 -1
  8. package/dist/es2019/components/browser/browser.js +3 -10
  9. package/dist/es2019/components/clipboard/clipboard.js +3 -10
  10. package/dist/es2019/components/dropzone/dropzone.js +3 -10
  11. package/dist/es2019/util/analytics.js +14 -1
  12. package/dist/es2019/util/ufoExperiences.js +5 -2
  13. package/dist/es2019/version.json +1 -1
  14. package/dist/esm/components/browser/browser.js +3 -10
  15. package/dist/esm/components/browser/index.js +1 -1
  16. package/dist/esm/components/clipboard/clipboard.js +3 -10
  17. package/dist/esm/components/clipboard/index.js +1 -1
  18. package/dist/esm/components/dropzone/dropzone.js +4 -11
  19. package/dist/esm/components/dropzone/index.js +1 -1
  20. package/dist/esm/components/localUploadReact.js +1 -1
  21. package/dist/esm/service/uploadServiceImpl.js +1 -1
  22. package/dist/esm/util/analytics.js +14 -1
  23. package/dist/esm/util/getPreviewFromBlob.js +1 -1
  24. package/dist/esm/util/getPreviewFromImage.js +1 -1
  25. package/dist/esm/util/ufoExperiences.js +5 -2
  26. package/dist/esm/version.json +1 -1
  27. package/dist/types/util/analytics.d.ts +2 -0
  28. package/example-helpers/UfoWrapper.tsx +12 -0
  29. package/example-helpers/{styled.ts → styles.ts} +27 -28
  30. package/example-helpers/stylesWrapper.tsx +105 -0
  31. package/example-helpers/upload-preview.tsx +1 -1
  32. package/example-helpers/upload-previews.tsx +1 -1
  33. package/package.json +11 -11
  34. package/report.api.md +244 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @atlaskit/media-picker
2
2
 
3
+ ## 63.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e3d4c39b20c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e3d4c39b20c) - Remove version.json file.
8
+ Use injected package name and version from environment variable instead.
9
+ - Updated dependencies
10
+
11
+ ## 63.0.1
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
17
+ ## 63.0.0
18
+
19
+ ### Major Changes
20
+
21
+ - [`e9de546cfc7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e9de546cfc7) - Migrate to emotion from styled-components
22
+
23
+ ### Minor Changes
24
+
25
+ - [`bfde909c9b4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bfde909c9b4) - Add new feature flag mediaUploadApiV2
26
+ - [`35e43fcc798`](https://bitbucket.org/atlassian/atlassian-frontend/commits/35e43fcc798) - Add ufo feature flag logging
27
+
28
+ ### Patch Changes
29
+
30
+ - [`c0f85687ea0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c0f85687ea0) - Enabled UFO logger for all examples for Media-Picker
31
+ - [`c2ede50a80a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c2ede50a80a) - Add media region and environment returned from media API response into failed analytic events.
32
+ - [`19899f3e100`](https://bitbucket.org/atlassian/atlassian-frontend/commits/19899f3e100) - Make emotion as dev dependency instead peer dependency
33
+ - Updated dependencies
34
+
3
35
  ## 62.0.0
4
36
 
5
37
  ### Major Changes
@@ -182,13 +182,6 @@ exports.BrowserBase = BrowserBase;
182
182
  config: defaultConfig
183
183
  });
184
184
  var Browser = (0, _mediaCommon.withMediaAnalyticsContext)((0, _analytics.getPackageAttributes)(COMPONENT_NAME), {
185
- filterFeatureFlags: (0, _mediaCommon.filterFeatureFlagNames)({
186
- newCardExperience: true,
187
- captions: false,
188
- timestampOnVideo: false,
189
- observedWidth: false,
190
- mediaInline: false,
191
- folderUploads: true
192
- })
185
+ filterFeatureFlags: _analytics.LOGGED_FEATURE_FLAGS
193
186
  })((0, _analyticsNext.withAnalyticsEvents)()(BrowserBase));
194
187
  exports.Browser = Browser;
@@ -200,13 +200,6 @@ exports.ClipboardBase = ClipboardBase;
200
200
  config: defaultConfig
201
201
  });
202
202
  var Clipboard = (0, _mediaCommon.withMediaAnalyticsContext)((0, _analytics.getPackageAttributes)(COMPONENT_NAME), {
203
- filterFeatureFlags: (0, _mediaCommon.filterFeatureFlagNames)({
204
- newCardExperience: true,
205
- captions: false,
206
- timestampOnVideo: false,
207
- observedWidth: false,
208
- mediaInline: false,
209
- folderUploads: true
210
- })
203
+ filterFeatureFlags: _analytics.LOGGED_FEATURE_FLAGS
211
204
  })((0, _analyticsNext.withAnalyticsEvents)()(ClipboardBase));
212
205
  exports.Clipboard = Clipboard;
@@ -382,13 +382,6 @@ var DropzoneBase = /*#__PURE__*/function (_LocalUploadComponent) {
382
382
 
383
383
  exports.DropzoneBase = DropzoneBase;
384
384
  var Dropzone = (0, _mediaCommon.withMediaAnalyticsContext)((0, _analytics.getPackageAttributes)(COMPONENT_NAME), {
385
- filterFeatureFlags: (0, _mediaCommon.filterFeatureFlagNames)({
386
- newCardExperience: true,
387
- captions: false,
388
- timestampOnVideo: false,
389
- observedWidth: false,
390
- mediaInline: false,
391
- folderUploads: true
392
- })
385
+ filterFeatureFlags: _analytics.LOGGED_FEATURE_FLAGS
393
386
  })((0, _analyticsNext.withAnalyticsEvents)()(DropzoneBase));
394
387
  exports.Dropzone = Dropzone;
@@ -3,17 +3,34 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.LOGGED_FEATURE_FLAG_KEYS = exports.LOGGED_FEATURE_FLAGS = void 0;
6
7
  exports.getPackageAttributes = getPackageAttributes;
7
8
  exports.getRequestMetadata = getRequestMetadata;
8
9
 
9
10
  var _mediaClient = require("@atlaskit/media-client");
10
11
 
11
- var _version = require("../version.json");
12
+ var _mediaCommon = require("@atlaskit/media-common");
13
+
14
+ var relevantFlags = {
15
+ newCardExperience: true,
16
+ captions: false,
17
+ timestampOnVideo: false,
18
+ observedWidth: false,
19
+ mediaInline: false,
20
+ folderUploads: true,
21
+ mediaUploadApiV2: true
22
+ };
23
+ var packageName = "@atlaskit/media-picker";
24
+ var packageVersion = "63.0.2";
25
+ var LOGGED_FEATURE_FLAGS = (0, _mediaCommon.filterFeatureFlagNames)(relevantFlags);
26
+ exports.LOGGED_FEATURE_FLAGS = LOGGED_FEATURE_FLAGS;
27
+ var LOGGED_FEATURE_FLAG_KEYS = (0, _mediaCommon.filterFeatureFlagKeysAllProducts)(relevantFlags);
28
+ exports.LOGGED_FEATURE_FLAG_KEYS = LOGGED_FEATURE_FLAG_KEYS;
12
29
 
13
30
  function getPackageAttributes(componentName) {
14
31
  return {
15
- packageName: _version.name,
16
- packageVersion: _version.version,
32
+ packageName: packageName,
33
+ packageVersion: packageVersion,
17
34
  componentName: componentName,
18
35
  component: componentName
19
36
  };
@@ -13,12 +13,14 @@ var _ufo = require("@atlaskit/ufo");
13
13
 
14
14
  var _mediaClient = require("@atlaskit/media-client");
15
15
 
16
- var _version = require("../version.json");
16
+ var _analytics = require("./analytics");
17
17
 
18
18
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
19
 
20
20
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21
21
 
22
+ var packageName = "@atlaskit/media-picker";
23
+ var packageVersion = "63.0.2";
22
24
  var ufoExperience;
23
25
 
24
26
  var initExperience = function initExperience(id, componentName) {
@@ -28,7 +30,8 @@ var initExperience = function initExperience(id, componentName) {
28
30
  component: "media-picker-".concat(componentName)
29
31
  },
30
32
  type: _ufo.ExperienceTypes.Experience,
31
- performanceType: _ufo.ExperiencePerformanceTypes.InlineResult
33
+ performanceType: _ufo.ExperiencePerformanceTypes.InlineResult,
34
+ featureFlags: _analytics.LOGGED_FEATURE_FLAG_KEYS
32
35
  };
33
36
  ufoExperience = new _ufo.ConcurrentExperience('media-upload', inlineExperience);
34
37
  }
@@ -54,8 +57,8 @@ var succeedMediaUploadUfoExperience = function succeedMediaUploadUfoExperience(i
54
57
  (_getExperience = getExperience(id)) === null || _getExperience === void 0 ? void 0 : _getExperience.success({
55
58
  metadata: {
56
59
  fileAttributes: properties,
57
- packageName: _version.name,
58
- packageVersion: _version.version,
60
+ packageName: packageName,
61
+ packageVersion: packageVersion,
59
62
  mediaEnvironment: (0, _mediaClient.getMediaEnvironment)(),
60
63
  mediaRegion: (0, _mediaClient.getMediaRegion)()
61
64
  }
@@ -68,8 +71,8 @@ var failMediaUploadUfoExperience = function failMediaUploadUfoExperience(id, pro
68
71
  var _getExperience2;
69
72
 
70
73
  var refinedMetadata = _objectSpread(_objectSpread({}, properties), {}, {
71
- packageName: _version.name,
72
- packageVersion: _version.version,
74
+ packageName: packageName,
75
+ packageVersion: packageVersion,
73
76
  mediaEnvironment: (0, _mediaClient.getMediaEnvironment)(),
74
77
  mediaRegion: (0, _mediaClient.getMediaRegion)()
75
78
  });
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/media-picker",
3
- "version": "62.0.0"
3
+ "version": "63.0.2"
4
4
  }
@@ -1,10 +1,10 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
4
- import { withMediaAnalyticsContext, filterFeatureFlagNames } from '@atlaskit/media-common';
4
+ import { withMediaAnalyticsContext } from '@atlaskit/media-common';
5
5
  import isValidId from 'uuid-validate';
6
6
  import { LocalUploadComponentReact } from '../localUploadReact';
7
- import { getPackageAttributes } from '../../util/analytics';
7
+ import { getPackageAttributes, LOGGED_FEATURE_FLAGS } from '../../util/analytics';
8
8
  const defaultConfig = {
9
9
  uploadParams: {}
10
10
  };
@@ -153,12 +153,5 @@ _defineProperty(BrowserBase, "defaultProps", {
153
153
  });
154
154
 
155
155
  export const Browser = withMediaAnalyticsContext(getPackageAttributes(COMPONENT_NAME), {
156
- filterFeatureFlags: filterFeatureFlagNames({
157
- newCardExperience: true,
158
- captions: false,
159
- timestampOnVideo: false,
160
- observedWidth: false,
161
- mediaInline: false,
162
- folderUploads: true
163
- })
156
+ filterFeatureFlags: LOGGED_FEATURE_FLAGS
164
157
  })(withAnalyticsEvents()(BrowserBase));
@@ -1,9 +1,9 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
3
- import { ANALYTICS_MEDIA_CHANNEL, withMediaAnalyticsContext, filterFeatureFlagNames } from '@atlaskit/media-common';
3
+ import { ANALYTICS_MEDIA_CHANNEL, withMediaAnalyticsContext } from '@atlaskit/media-common';
4
4
  import { LocalUploadComponentReact } from '../localUploadReact';
5
5
  import { LocalFileSource } from '../../service/types';
6
- import { getPackageAttributes } from '../../util/analytics';
6
+ import { getPackageAttributes, LOGGED_FEATURE_FLAGS } from '../../util/analytics';
7
7
  import { appendTimestamp } from '../../util/appendTimestamp';
8
8
  export const getFilesFromClipboard = files => {
9
9
  return Array.from(files).map(file => {
@@ -147,12 +147,5 @@ _defineProperty(ClipboardBase, "defaultProps", {
147
147
  });
148
148
 
149
149
  export const Clipboard = withMediaAnalyticsContext(getPackageAttributes(COMPONENT_NAME), {
150
- filterFeatureFlags: filterFeatureFlagNames({
151
- newCardExperience: true,
152
- captions: false,
153
- timestampOnVideo: false,
154
- observedWidth: false,
155
- mediaInline: false,
156
- folderUploads: true
157
- })
150
+ filterFeatureFlags: LOGGED_FEATURE_FLAGS
158
151
  })(withAnalyticsEvents()(ClipboardBase));
@@ -1,10 +1,10 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
3
- import { ANALYTICS_MEDIA_CHANNEL, getMediaFeatureFlag, withMediaAnalyticsContext, filterFeatureFlagNames } from '@atlaskit/media-common';
3
+ import { ANALYTICS_MEDIA_CHANNEL, getMediaFeatureFlag, withMediaAnalyticsContext } from '@atlaskit/media-common';
4
4
  import { isWebkitSupported } from '@atlaskit/media-ui/browser';
5
5
  import { getFilesFromItems, getFilesFromFileSystemEntries } from 'flat-files';
6
6
  import { LocalUploadComponentReact } from '../localUploadReact';
7
- import { getPackageAttributes } from '../../util/analytics';
7
+ import { getPackageAttributes, LOGGED_FEATURE_FLAGS } from '../../util/analytics';
8
8
 
9
9
  function dragContainsFiles(event) {
10
10
  if (!event.dataTransfer) {
@@ -281,12 +281,5 @@ export class DropzoneBase extends LocalUploadComponentReact {
281
281
 
282
282
  }
283
283
  export const Dropzone = withMediaAnalyticsContext(getPackageAttributes(COMPONENT_NAME), {
284
- filterFeatureFlags: filterFeatureFlagNames({
285
- newCardExperience: true,
286
- captions: false,
287
- timestampOnVideo: false,
288
- observedWidth: false,
289
- mediaInline: false,
290
- folderUploads: true
291
- })
284
+ filterFeatureFlags: LOGGED_FEATURE_FLAGS
292
285
  })(withAnalyticsEvents()(DropzoneBase));
@@ -1,6 +1,19 @@
1
1
  import { isRequestError } from '@atlaskit/media-client';
2
- import { name as packageName, version as packageVersion } from '../version.json'; // Component name will be prefixed with "media-picker-" in logs. Check ufoExperiences in utils files
2
+ import { filterFeatureFlagKeysAllProducts, filterFeatureFlagNames } from '@atlaskit/media-common'; // Component name will be prefixed with "media-picker-" in logs. Check ufoExperiences in utils files
3
3
 
4
+ const relevantFlags = {
5
+ newCardExperience: true,
6
+ captions: false,
7
+ timestampOnVideo: false,
8
+ observedWidth: false,
9
+ mediaInline: false,
10
+ folderUploads: true,
11
+ mediaUploadApiV2: true
12
+ };
13
+ const packageName = "@atlaskit/media-picker";
14
+ const packageVersion = "63.0.2";
15
+ export const LOGGED_FEATURE_FLAGS = filterFeatureFlagNames(relevantFlags);
16
+ export const LOGGED_FEATURE_FLAG_KEYS = filterFeatureFlagKeysAllProducts(relevantFlags);
4
17
  export function getPackageAttributes(componentName) {
5
18
  return {
6
19
  packageName,
@@ -1,6 +1,8 @@
1
1
  import { ConcurrentExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo';
2
2
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
3
- import { name as packageName, version as packageVersion } from '../version.json';
3
+ import { LOGGED_FEATURE_FLAG_KEYS } from './analytics';
4
+ const packageName = "@atlaskit/media-picker";
5
+ const packageVersion = "63.0.2";
4
6
  let ufoExperience;
5
7
 
6
8
  const initExperience = (id, componentName) => {
@@ -10,7 +12,8 @@ const initExperience = (id, componentName) => {
10
12
  component: `media-picker-${componentName}`
11
13
  },
12
14
  type: ExperienceTypes.Experience,
13
- performanceType: ExperiencePerformanceTypes.InlineResult
15
+ performanceType: ExperiencePerformanceTypes.InlineResult,
16
+ featureFlags: LOGGED_FEATURE_FLAG_KEYS
14
17
  };
15
18
  ufoExperience = new ConcurrentExperience('media-upload', inlineExperience);
16
19
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/media-picker",
3
- "version": "62.0.0"
3
+ "version": "63.0.2"
4
4
  }
@@ -12,10 +12,10 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
12
12
 
13
13
  import React from 'react';
14
14
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
15
- import { withMediaAnalyticsContext, filterFeatureFlagNames } from '@atlaskit/media-common';
15
+ import { withMediaAnalyticsContext } from '@atlaskit/media-common';
16
16
  import isValidId from 'uuid-validate';
17
17
  import { LocalUploadComponentReact } from '../localUploadReact';
18
- import { getPackageAttributes } from '../../util/analytics';
18
+ import { getPackageAttributes, LOGGED_FEATURE_FLAGS } from '../../util/analytics';
19
19
  var defaultConfig = {
20
20
  uploadParams: {}
21
21
  };
@@ -166,12 +166,5 @@ _defineProperty(BrowserBase, "defaultProps", {
166
166
  });
167
167
 
168
168
  export var Browser = withMediaAnalyticsContext(getPackageAttributes(COMPONENT_NAME), {
169
- filterFeatureFlags: filterFeatureFlagNames({
170
- newCardExperience: true,
171
- captions: false,
172
- timestampOnVideo: false,
173
- observedWidth: false,
174
- mediaInline: false,
175
- folderUploads: true
176
- })
169
+ filterFeatureFlags: LOGGED_FEATURE_FLAGS
177
170
  })(withAnalyticsEvents()(BrowserBase));
@@ -1,4 +1,3 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
@@ -8,6 +7,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
8
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
9
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
10
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
11
11
 
12
12
  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); }; }
13
13
 
@@ -11,10 +11,10 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
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
 
13
13
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
14
- import { ANALYTICS_MEDIA_CHANNEL, withMediaAnalyticsContext, filterFeatureFlagNames } from '@atlaskit/media-common';
14
+ import { ANALYTICS_MEDIA_CHANNEL, withMediaAnalyticsContext } from '@atlaskit/media-common';
15
15
  import { LocalUploadComponentReact } from '../localUploadReact';
16
16
  import { LocalFileSource } from '../../service/types';
17
- import { getPackageAttributes } from '../../util/analytics';
17
+ import { getPackageAttributes, LOGGED_FEATURE_FLAGS } from '../../util/analytics';
18
18
  import { appendTimestamp } from '../../util/appendTimestamp';
19
19
  export var getFilesFromClipboard = function getFilesFromClipboard(files) {
20
20
  return Array.from(files).map(function (file) {
@@ -184,12 +184,5 @@ _defineProperty(ClipboardBase, "defaultProps", {
184
184
  });
185
185
 
186
186
  export var Clipboard = withMediaAnalyticsContext(getPackageAttributes(COMPONENT_NAME), {
187
- filterFeatureFlags: filterFeatureFlagNames({
188
- newCardExperience: true,
189
- captions: false,
190
- timestampOnVideo: false,
191
- observedWidth: false,
192
- mediaInline: false,
193
- folderUploads: true
194
- })
187
+ filterFeatureFlags: LOGGED_FEATURE_FLAGS
195
188
  })(withAnalyticsEvents()(ClipboardBase));
@@ -1,4 +1,3 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
@@ -8,6 +7,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
8
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
9
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
10
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
11
11
 
12
12
  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); }; }
13
13
 
@@ -1,4 +1,3 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
3
  import _createClass from "@babel/runtime/helpers/createClass";
@@ -7,17 +6,18 @@ import _inherits from "@babel/runtime/helpers/inherits";
7
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
8
7
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
 
11
11
  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); }; }
12
12
 
13
13
  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; } }
14
14
 
15
15
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
16
- import { ANALYTICS_MEDIA_CHANNEL, getMediaFeatureFlag, withMediaAnalyticsContext, filterFeatureFlagNames } from '@atlaskit/media-common';
16
+ import { ANALYTICS_MEDIA_CHANNEL, getMediaFeatureFlag, withMediaAnalyticsContext } from '@atlaskit/media-common';
17
17
  import { isWebkitSupported } from '@atlaskit/media-ui/browser';
18
18
  import { getFilesFromItems, getFilesFromFileSystemEntries } from 'flat-files';
19
19
  import { LocalUploadComponentReact } from '../localUploadReact';
20
- import { getPackageAttributes } from '../../util/analytics';
20
+ import { getPackageAttributes, LOGGED_FEATURE_FLAGS } from '../../util/analytics';
21
21
 
22
22
  function dragContainsFiles(event) {
23
23
  if (!event.dataTransfer) {
@@ -372,12 +372,5 @@ export var DropzoneBase = /*#__PURE__*/function (_LocalUploadComponent) {
372
372
  return DropzoneBase;
373
373
  }(LocalUploadComponentReact);
374
374
  export var Dropzone = withMediaAnalyticsContext(getPackageAttributes(COMPONENT_NAME), {
375
- filterFeatureFlags: filterFeatureFlagNames({
376
- newCardExperience: true,
377
- captions: false,
378
- timestampOnVideo: false,
379
- observedWidth: false,
380
- mediaInline: false,
381
- folderUploads: true
382
- })
375
+ filterFeatureFlags: LOGGED_FEATURE_FLAGS
383
376
  })(withAnalyticsEvents()(DropzoneBase));
@@ -1,4 +1,3 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
@@ -8,6 +7,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
8
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
9
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
10
9
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
11
11
 
12
12
  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); }; }
13
13
 
@@ -1,4 +1,3 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
3
  import _createClass from "@babel/runtime/helpers/createClass";
@@ -7,6 +6,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
7
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
8
7
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
 
11
11
  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); }; }
12
12
 
@@ -1,8 +1,8 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
3
  import _createClass from "@babel/runtime/helpers/createClass";
5
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
6
6
  import uuidV4 from 'uuid/v4';
7
7
  import { UploadController, getMediaTypeFromMimeType, isMimeTypeSupportedByBrowser, globalMediaEventEmitter, RequestError } from '@atlaskit/media-client';
8
8
  import { RECENTS_COLLECTION } from '@atlaskit/media-client/constants';
@@ -1,6 +1,19 @@
1
1
  import { isRequestError } from '@atlaskit/media-client';
2
- import { name as packageName, version as packageVersion } from '../version.json'; // Component name will be prefixed with "media-picker-" in logs. Check ufoExperiences in utils files
2
+ import { filterFeatureFlagKeysAllProducts, filterFeatureFlagNames } from '@atlaskit/media-common'; // Component name will be prefixed with "media-picker-" in logs. Check ufoExperiences in utils files
3
3
 
4
+ var relevantFlags = {
5
+ newCardExperience: true,
6
+ captions: false,
7
+ timestampOnVideo: false,
8
+ observedWidth: false,
9
+ mediaInline: false,
10
+ folderUploads: true,
11
+ mediaUploadApiV2: true
12
+ };
13
+ var packageName = "@atlaskit/media-picker";
14
+ var packageVersion = "63.0.2";
15
+ export var LOGGED_FEATURE_FLAGS = filterFeatureFlagNames(relevantFlags);
16
+ export var LOGGED_FEATURE_FLAG_KEYS = filterFeatureFlagKeysAllProducts(relevantFlags);
4
17
  export function getPackageAttributes(componentName) {
5
18
  return {
6
19
  packageName: packageName,
@@ -1,5 +1,5 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { getDimensionsFromBlob } from '@atlaskit/media-client';
4
4
  export var isUnknownDimensions = function isUnknownDimensions(dimensions) {
5
5
  return !dimensions.width && !dimensions.height;
@@ -1,5 +1,5 @@
1
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { getImageInfo, getFileInfo } from '@atlaskit/media-ui';
4
4
  export function getPreviewFromImage(_x, _x2) {
5
5
  return _getPreviewFromImage.apply(this, arguments);
@@ -6,7 +6,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
6
6
 
7
7
  import { ConcurrentExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo';
8
8
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
9
- import { name as packageName, version as packageVersion } from '../version.json';
9
+ import { LOGGED_FEATURE_FLAG_KEYS } from './analytics';
10
+ var packageName = "@atlaskit/media-picker";
11
+ var packageVersion = "63.0.2";
10
12
  var ufoExperience;
11
13
 
12
14
  var initExperience = function initExperience(id, componentName) {
@@ -16,7 +18,8 @@ var initExperience = function initExperience(id, componentName) {
16
18
  component: "media-picker-".concat(componentName)
17
19
  },
18
20
  type: ExperienceTypes.Experience,
19
- performanceType: ExperiencePerformanceTypes.InlineResult
21
+ performanceType: ExperiencePerformanceTypes.InlineResult,
22
+ featureFlags: LOGGED_FEATURE_FLAG_KEYS
20
23
  };
21
24
  ufoExperience = new ConcurrentExperience('media-upload', inlineExperience);
22
25
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/media-picker",
3
- "version": "62.0.0"
3
+ "version": "63.0.2"
4
4
  }
@@ -1,5 +1,7 @@
1
1
  import { RequestMetadata } from '@atlaskit/media-client';
2
2
  import { PackageAttributes } from '@atlaskit/media-common';
3
3
  export declare type ComponentName = 'browser' | 'clipboard' | 'dropzone';
4
+ export declare const LOGGED_FEATURE_FLAGS: (keyof import("@atlaskit/media-common").MediaFeatureFlags)[];
5
+ export declare const LOGGED_FEATURE_FLAG_KEYS: string[];
4
6
  export declare function getPackageAttributes(componentName: ComponentName): PackageAttributes;
5
7
  export declare function getRequestMetadata(error?: Error): RequestMetadata | undefined;
@@ -0,0 +1,12 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { enableMediaUfoLogger } from '@atlaskit/media-test-helpers';
3
+ import { payloadPublisher } from '@atlassian/ufo';
4
+
5
+ type Props = {
6
+ children: ReactNode;
7
+ };
8
+
9
+ export const UfoLoggerWrapper: React.FC<Props> = ({ children }) => {
10
+ enableMediaUfoLogger(payloadPublisher);
11
+ return <>{children}</>;
12
+ };
@@ -1,15 +1,17 @@
1
- import styled from 'styled-components';
2
- export interface DropzoneContainerProps {
1
+ import { css } from '@emotion/react';
2
+ import { PastedImageStyleType } from './stylesWrapper';
3
+
4
+ interface DropzoneContainerProps {
3
5
  isActive: boolean;
4
6
  }
5
7
 
6
- export const PopupContainer = styled.div`
8
+ export const popupContainerStyles = css`
7
9
  display: flex;
8
10
  flex-direction: column;
9
11
  overflow: scroll;
10
12
  `;
11
13
 
12
- export const PopupHeader = styled.div`
14
+ export const popupHeaderStyles = css`
13
15
  border-bottom: 1px solid #ccc;
14
16
  margin-bottom: 15px;
15
17
  display: flex;
@@ -21,12 +23,12 @@ export const PopupHeader = styled.div`
21
23
  }
22
24
  `;
23
25
 
24
- export const PreviewImageWrapper = styled.div`
26
+ export const previewImageWrapperStyles = css`
25
27
  position: relative;
26
28
  margin-right: 15px;
27
29
  `;
28
30
 
29
- export const InfoWrapper = styled.pre`
31
+ export const infoWrapperStyles = css`
30
32
  position: absolute;
31
33
  width: 160px;
32
34
  color: black;
@@ -36,30 +38,25 @@ export const InfoWrapper = styled.pre`
36
38
  text-align: center;
37
39
  `;
38
40
 
39
- export const DropzoneContainer = styled.div`
41
+ export const dropzoneContainerStyles = ({
42
+ isActive,
43
+ }: DropzoneContainerProps) => css`
40
44
  width: 600px;
41
45
  min-height: 500px;
42
46
  border: 1px dashed transparent;
43
-
44
- ${(props: DropzoneContainerProps) =>
45
- props.isActive
46
- ? `
47
- border-color: gray;
48
- `
49
- : ''};
47
+ ${isActive ? `border-color: gray;` : ''}
50
48
  `;
51
49
 
52
- export const DropzoneConfigOptions = styled.div``;
53
- export const DropzoneRoot = styled.div`
50
+ export const dropzoneRootStyles = css`
54
51
  display: flex;
55
52
  `;
56
53
 
57
- export const DropzoneContentWrapper = styled.div`
54
+ export const dropzoneContentWrapperStyles = css`
58
55
  display: flex;
59
56
  min-height: 200px;
60
57
  `;
61
58
 
62
- export const PreviewsWrapper = styled.div`
59
+ export const previewsWrapperStyles = css`
63
60
  display: flex;
64
61
  flex-direction: column;
65
62
  overflow: visible;
@@ -67,17 +64,17 @@ export const PreviewsWrapper = styled.div`
67
64
  margin-bottom: 20px;
68
65
  `;
69
66
 
70
- export const PreviewsTitle = styled.h1`
67
+ export const previewsTitleStyles = css`
71
68
  width: 100%;
72
69
  `;
73
70
 
74
- export const UploadPreviewsFlexRow = styled.div`
71
+ export const uploadPreviewsFlexRowStyles = css`
75
72
  display: flex;
76
73
  flex-direction: row;
77
74
  flex-wrap: wrap;
78
75
  `;
79
76
 
80
- export const DropzoneItemsInfo = styled.div`
77
+ export const dropzoneItemsInfoStyles = css`
81
78
  flex: 1;
82
79
  min-width: 600px;
83
80
  display: flex;
@@ -85,19 +82,20 @@ export const DropzoneItemsInfo = styled.div`
85
82
  flex-direction: column;
86
83
  `;
87
84
 
88
- export interface ClipboardContainerProps {
85
+ interface ClipboardContainerProps {
89
86
  isWindowFocused: boolean;
90
87
  }
91
88
 
92
- export const ClipboardContainer = styled.div`
89
+ export const clipboardContainerStyles = ({
90
+ isWindowFocused,
91
+ }: ClipboardContainerProps) => css`
93
92
  padding: 10px;
94
93
  min-height: 400px;
95
94
 
96
- border: ${({ isWindowFocused }: ClipboardContainerProps) =>
97
- isWindowFocused ? `1px dashed gray` : `1px dashed transparent`};
95
+ border: ${isWindowFocused ? `1px dashed gray` : `1px dashed transparent`};
98
96
  `;
99
97
 
100
- export const InfoContainer = styled.div`
98
+ export const infoContainerStyles = css`
101
99
  position: absolute;
102
100
  top: 0;
103
101
  left: 0;
@@ -122,6 +120,7 @@ export const InfoContainer = styled.div`
122
120
  }
123
121
  `;
124
122
 
125
- export const PastedImage = styled.img`
126
- width: 100%;
123
+ export const pastedImageStyles = (style: PastedImageStyleType) => css`
124
+ width: ${style.width ? `${style.width}px` : '100%'};
125
+ ${style.height ? `height: ${style.height}px` : ''};
127
126
  `;
@@ -0,0 +1,105 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { ReactNode, forwardRef } from 'react';
4
+
5
+ import {
6
+ clipboardContainerStyles,
7
+ dropzoneContainerStyles,
8
+ dropzoneContentWrapperStyles,
9
+ dropzoneItemsInfoStyles,
10
+ infoContainerStyles,
11
+ infoWrapperStyles,
12
+ pastedImageStyles,
13
+ popupContainerStyles,
14
+ popupHeaderStyles,
15
+ previewImageWrapperStyles,
16
+ previewsTitleStyles,
17
+ previewsWrapperStyles,
18
+ uploadPreviewsFlexRowStyles,
19
+ } from './styles';
20
+
21
+ export const PopupContainer = ({ children }: { children: ReactNode }) => {
22
+ return <div css={popupContainerStyles}>{children}</div>;
23
+ };
24
+
25
+ export const PopupHeader = ({ children }: { children: ReactNode }) => {
26
+ return <div css={popupHeaderStyles}>{children}</div>;
27
+ };
28
+
29
+ export const PreviewImageWrapper = ({ children }: { children: ReactNode }) => {
30
+ return <div css={previewImageWrapperStyles}>{children}</div>;
31
+ };
32
+
33
+ export const InfoWrapper = ({ children }: { children: ReactNode }) => {
34
+ return <pre css={infoWrapperStyles}>{children}</pre>;
35
+ };
36
+
37
+ export const DropzoneContainer = forwardRef(
38
+ ({ isActive }: { isActive: boolean }, ref) => {
39
+ return (
40
+ <div
41
+ css={dropzoneContainerStyles({ isActive })}
42
+ ref={ref as React.RefObject<HTMLDivElement>}
43
+ />
44
+ );
45
+ },
46
+ );
47
+
48
+ export const DropzoneContentWrapper = ({
49
+ children,
50
+ }: {
51
+ children: ReactNode;
52
+ }) => {
53
+ return <div css={dropzoneContentWrapperStyles}>{children}</div>;
54
+ };
55
+
56
+ export const PreviewsWrapper = ({ children }: { children: ReactNode }) => {
57
+ return <div css={previewsWrapperStyles}>{children}</div>;
58
+ };
59
+
60
+ export const PreviewsTitle = ({ children }: { children: ReactNode }) => {
61
+ return <h1 css={previewsTitleStyles}>{children}</h1>;
62
+ };
63
+
64
+ export const UploadPreviewsFlexRow = ({
65
+ children,
66
+ }: {
67
+ children: ReactNode;
68
+ }) => {
69
+ return <div css={uploadPreviewsFlexRowStyles}>{children}</div>;
70
+ };
71
+
72
+ export const DropzoneItemsInfo = ({ children }: { children: ReactNode }) => {
73
+ return <div css={dropzoneItemsInfoStyles}>{children}</div>;
74
+ };
75
+
76
+ export const ClipboardContainer = ({
77
+ isWindowFocused,
78
+ children,
79
+ }: {
80
+ isWindowFocused: boolean;
81
+ children: ReactNode;
82
+ }) => {
83
+ return (
84
+ <div css={clipboardContainerStyles({ isWindowFocused })}>{children}</div>
85
+ );
86
+ };
87
+
88
+ export const InfoContainer = ({ children }: { children: ReactNode }) => {
89
+ return <div css={infoContainerStyles}>{children}</div>;
90
+ };
91
+
92
+ export type PastedImageStyleType = {
93
+ width: number | string;
94
+ height: number | string;
95
+ };
96
+
97
+ type PastedImageProps = {
98
+ src: string;
99
+ title: string;
100
+ style: PastedImageStyleType;
101
+ };
102
+
103
+ export const PastedImage = ({ src, style, title }: PastedImageProps) => {
104
+ return <img src={src} title={title} css={pastedImageStyles(style)} />;
105
+ };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { PreviewImageWrapper, InfoWrapper } from './styled';
2
+ import { PreviewImageWrapper, InfoWrapper } from './stylesWrapper';
3
3
  import { PreviewData } from './types';
4
4
  import { Card } from '@atlaskit/media-card';
5
5
  import { FileIdentifier } from '@atlaskit/media-client';
@@ -9,7 +9,7 @@ import {
9
9
  PreviewsTitle,
10
10
  PreviewsWrapper,
11
11
  UploadPreviewsFlexRow,
12
- } from './styled';
12
+ } from './stylesWrapper';
13
13
  import { PreviewData } from './types';
14
14
 
15
15
  export interface PreviewsDataState {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-picker",
3
- "version": "62.0.0",
3
+ "version": "63.0.2",
4
4
  "description": "Library for handling file uploads",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -27,9 +27,9 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@atlaskit/analytics-next": "^8.2.0",
30
- "@atlaskit/media-client": "^16.0.0",
31
- "@atlaskit/media-common": "^2.13.0",
32
- "@atlaskit/media-ui": "^22.0.0",
30
+ "@atlaskit/media-client": "^17.1.0",
31
+ "@atlaskit/media-common": "^2.15.0",
32
+ "@atlaskit/media-ui": "^22.1.0",
33
33
  "@atlaskit/ufo": "^0.1.0",
34
34
  "@babel/runtime": "^7.0.0",
35
35
  "eventemitter2": "^4.1.0",
@@ -41,19 +41,18 @@
41
41
  "uuid-validate": "^0.0.3"
42
42
  },
43
43
  "peerDependencies": {
44
- "@atlaskit/media-core": "^33.0.0",
44
+ "@atlaskit/media-core": "^33.0.1",
45
45
  "react": "^16.8.0",
46
46
  "react-dom": "^16.8.0",
47
- "react-intl-next": "npm:react-intl@^5.18.1",
48
- "styled-components": "^3.2.6"
47
+ "react-intl-next": "npm:react-intl@^5.18.1"
49
48
  },
50
49
  "devDependencies": {
51
- "@atlaskit/analytics-listeners": "^8.2.0",
52
- "@atlaskit/analytics-namespaced-context": "^6.4.0",
50
+ "@atlaskit/analytics-listeners": "^8.3.0",
51
+ "@atlaskit/analytics-namespaced-context": "^6.5.0",
53
52
  "@atlaskit/button": "^16.3.0",
54
53
  "@atlaskit/docs": "*",
55
- "@atlaskit/dropdown-menu": "^11.1.0",
56
- "@atlaskit/media-card": "^73.6.0",
54
+ "@atlaskit/dropdown-menu": "^11.2.0",
55
+ "@atlaskit/media-card": "^74.0.0",
57
56
  "@atlaskit/media-core": "^33.0.0",
58
57
  "@atlaskit/media-test-helpers": "^30.0.0",
59
58
  "@atlaskit/spinner": "^15.0.0",
@@ -61,6 +60,7 @@
61
60
  "@atlaskit/toggle": "^12.4.0",
62
61
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
63
62
  "@atlassian/ufo": "^0.1.12",
63
+ "@emotion/react": "^11.7.1",
64
64
  "@types/enzyme": "^3.1.15",
65
65
  "@types/react": "^16.8.0",
66
66
  "enzyme": "^3.10.0",
package/report.api.md ADDED
@@ -0,0 +1,244 @@
1
+ ## API Report File for "@atlaskit/media-picker"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+ /// <reference types="react" />
7
+
8
+ import { MediaClient } from '@atlaskit/media-client';
9
+ import { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
10
+ import { MediaFeatureFlags as MediaFeatureFlags_2 } from '@atlaskit/media-common';
11
+ import { default as React_2 } from 'react';
12
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
13
+ import { WithMediaClientConfigProps } from '@atlaskit/media-client';
14
+
15
+ export declare class Browser extends React_2.PureComponent<
16
+ BrowserWithMediaClientConfigProps,
17
+ State_3
18
+ > {
19
+ private mounted;
20
+ static displayName: string;
21
+ static Browser?: BrowserWithMediaClientConfigComponent;
22
+ state: {
23
+ Browser: BrowserWithMediaClientConfigComponent | undefined;
24
+ };
25
+ componentDidMount(): void;
26
+ componentWillUnmount(): void;
27
+ UNSAFE_componentWillMount(): Promise<void>;
28
+ render(): JSX.Element | null;
29
+ }
30
+
31
+ export declare interface BrowserConfig extends LocalUploadConfig {
32
+ readonly multiple?: boolean;
33
+ readonly fileExtensions?: Array<string>;
34
+ readonly replaceFileId?: string;
35
+ }
36
+
37
+ declare interface BrowserOwnProps {
38
+ config: BrowserConfig;
39
+ isOpen?: boolean;
40
+ onClose?: () => void;
41
+ /**
42
+ * This prop will be mainly used for those contexts (like Editor) where there is no react lifecylce and we cannot rerender easily.
43
+ * Otherwise, isOpen prop is preferred.
44
+ */
45
+ onBrowseFn?: (browse: () => void) => void;
46
+ onCancelFn?: (cancel: (uniqueIdentifier: string) => void) => void;
47
+ children?: (browse: () => void) => React_2.ReactChild;
48
+ }
49
+
50
+ declare type BrowserProps = LocalUploadComponentBaseProps & BrowserOwnProps;
51
+
52
+ declare type BrowserWithMediaClientConfigComponent = React_2.ComponentType<
53
+ BrowserWithMediaClientConfigProps
54
+ >;
55
+
56
+ declare type BrowserWithMediaClientConfigProps = WithMediaClientConfigProps<
57
+ Omit<BrowserProps, 'config'> & {
58
+ config?: BrowserConfig;
59
+ }
60
+ >;
61
+
62
+ declare class Clipboard_2 extends React_2.PureComponent<
63
+ ClipboardWithMediaClientConfigProps,
64
+ State_2
65
+ > {
66
+ static displayName: string;
67
+ static Clipboard?: ClipboardWithMediaClientConfigComponent;
68
+ state: {
69
+ Clipboard: ClipboardWithMediaClientConfigComponent | undefined;
70
+ };
71
+ UNSAFE_componentWillMount(): Promise<void>;
72
+ render(): JSX.Element | null;
73
+ }
74
+ export { Clipboard_2 as Clipboard };
75
+
76
+ declare interface ClipboardConfig extends LocalUploadConfig {}
77
+
78
+ declare type ClipboardProps = LocalUploadComponentBaseProps & {
79
+ config: ClipboardConfig;
80
+ };
81
+
82
+ declare type ClipboardWithMediaClientConfigComponent = React_2.ComponentType<
83
+ ClipboardWithMediaClientConfigProps
84
+ >;
85
+
86
+ declare type ClipboardWithMediaClientConfigProps = WithMediaClientConfigProps<
87
+ Omit<ClipboardProps, 'config'> & {
88
+ config?: ClipboardConfig;
89
+ }
90
+ >;
91
+
92
+ export declare class Dropzone extends React_2.PureComponent<
93
+ DropzoneWithMediaClientConfigProps,
94
+ State
95
+ > {
96
+ static displayName: string;
97
+ static Dropzone?: DropzoneWithMediaClientConfigComponent;
98
+ static MediaPickerErrorBoundary?: MediaPickerErrorBoundaryComponent;
99
+ state: {
100
+ Dropzone: DropzoneWithMediaClientConfigComponent | undefined;
101
+ MediaPickerErrorBoundary: MediaPickerErrorBoundaryComponent | undefined;
102
+ };
103
+ UNSAFE_componentWillMount(): Promise<void>;
104
+ render(): JSX.Element | null;
105
+ }
106
+
107
+ export declare interface DropzoneConfig extends LocalUploadConfig {
108
+ container?: HTMLElement;
109
+ headless?: boolean;
110
+ }
111
+
112
+ declare interface DropzoneDragEnterEventPayload {
113
+ length: number;
114
+ }
115
+
116
+ declare interface DropzoneDragLeaveEventPayload {
117
+ length: number;
118
+ }
119
+
120
+ declare type DropzoneProps = LocalUploadComponentBaseProps & {
121
+ config: DropzoneConfig;
122
+ onDrop?: () => void;
123
+ onDragEnter?: (payload: DropzoneDragEnterEventPayload) => void;
124
+ onDragLeave?: (payload: DropzoneDragLeaveEventPayload) => void;
125
+ onCancelFn?: (cancel: (uniqueIdentifier: string) => void) => void;
126
+ };
127
+
128
+ declare type DropzoneWithMediaClientConfigComponent = React_2.ComponentType<
129
+ DropzoneWithMediaClientConfigProps
130
+ >;
131
+
132
+ declare type DropzoneWithMediaClientConfigProps = WithMediaClientConfigProps<
133
+ DropzoneProps
134
+ >;
135
+
136
+ export declare type ImagePreview = NonImagePreview & {
137
+ readonly dimensions: {
138
+ readonly width: number;
139
+ readonly height: number;
140
+ };
141
+ readonly scaleFactor: number;
142
+ };
143
+
144
+ export declare const isImagePreview: (
145
+ preview: Preview,
146
+ ) => preview is ImagePreview;
147
+
148
+ declare type LocalUploadComponentBaseProps = {
149
+ mediaClient: MediaClient;
150
+ config: LocalUploadConfig;
151
+ onUploadsStart?: (payload: UploadsStartEventPayload) => void;
152
+ onPreviewUpdate?: (payload: UploadPreviewUpdateEventPayload) => void;
153
+ onEnd?: (payload: UploadEndEventPayload) => void;
154
+ onError?: (payload: UploadErrorEventPayload) => void;
155
+ featureFlags?: MediaFeatureFlags_2;
156
+ } & WithAnalyticsEventsProps;
157
+
158
+ export declare interface LocalUploadConfig {
159
+ uploadParams: UploadParams;
160
+ shouldCopyFileToRecents?: boolean;
161
+ featureFlags?: MediaFeatureFlags;
162
+ }
163
+
164
+ declare type MediaError_2 = {
165
+ readonly fileId?: string;
166
+ readonly name: MediaErrorName;
167
+ readonly description: string;
168
+ readonly rawError?: Error;
169
+ };
170
+ export { MediaError_2 as MediaError };
171
+
172
+ export declare type MediaErrorName =
173
+ | 'object_create_fail'
174
+ | 'metadata_fetch_fail'
175
+ | 'token_fetch_fail'
176
+ | 'token_update_fail'
177
+ | 'token_source_empty'
178
+ | 'upload_fail'
179
+ | 'user_token_fetch_fail'
180
+ | 'remote_upload_fail'
181
+ | 'invalid_uuid';
182
+
183
+ export declare type MediaFile = {
184
+ readonly id: string;
185
+ readonly name: string;
186
+ readonly size: number;
187
+ readonly creationDate: number;
188
+ readonly type: string;
189
+ readonly occurrenceKey?: string;
190
+ };
191
+
192
+ declare type MediaPickerAnalyticsErrorBoundaryProps = {
193
+ data?: {
194
+ [k: string]: any;
195
+ };
196
+ };
197
+
198
+ declare type MediaPickerErrorBoundaryComponent = React_2.ComponentType<
199
+ MediaPickerAnalyticsErrorBoundaryProps
200
+ >;
201
+
202
+ export declare type NonImagePreview = {
203
+ readonly file?: Blob;
204
+ };
205
+
206
+ export declare type Preview = NonImagePreview | ImagePreview;
207
+
208
+ declare type State = {
209
+ Dropzone?: DropzoneWithMediaClientConfigComponent;
210
+ MediaPickerErrorBoundary?: MediaPickerErrorBoundaryComponent;
211
+ };
212
+
213
+ declare type State_2 = {
214
+ Clipboard?: ClipboardWithMediaClientConfigComponent;
215
+ };
216
+
217
+ declare type State_3 = {
218
+ Browser?: BrowserWithMediaClientConfigComponent;
219
+ };
220
+
221
+ export declare type UploadEndEventPayload = {
222
+ readonly file: MediaFile;
223
+ };
224
+
225
+ export declare type UploadErrorEventPayload = {
226
+ readonly fileId: string;
227
+ readonly error: MediaError_2;
228
+ };
229
+
230
+ export declare interface UploadParams {
231
+ collection?: string;
232
+ }
233
+
234
+ export declare type UploadPreviewUpdateEventPayload = {
235
+ readonly file: MediaFile;
236
+ readonly preview: Preview;
237
+ };
238
+
239
+ export declare type UploadsStartEventPayload = {
240
+ readonly files: MediaFile[];
241
+ };
242
+
243
+ export {};
244
+ ```