@atlaskit/media-picker 61.0.1 → 63.0.1
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 +41 -0
- package/dist/cjs/components/browser/browser.js +1 -8
- package/dist/cjs/components/clipboard/clipboard.js +1 -8
- package/dist/cjs/components/dropzone/dropzone.js +1 -8
- package/dist/cjs/service/uploadServiceImpl.js +1 -54
- package/dist/cjs/util/analytics.js +17 -0
- package/dist/cjs/util/ufoExperiences.js +15 -6
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/browser/browser.js +3 -10
- package/dist/es2019/components/clipboard/clipboard.js +3 -10
- package/dist/es2019/components/dropzone/dropzone.js +3 -10
- package/dist/es2019/service/uploadServiceImpl.js +1 -56
- package/dist/es2019/util/analytics.js +14 -1
- package/dist/es2019/util/ufoExperiences.js +13 -6
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/browser/browser.js +3 -10
- package/dist/esm/components/clipboard/clipboard.js +3 -10
- package/dist/esm/components/dropzone/dropzone.js +3 -10
- package/dist/esm/service/uploadServiceImpl.js +2 -55
- package/dist/esm/util/analytics.js +14 -1
- package/dist/esm/util/ufoExperiences.js +13 -6
- package/dist/esm/version.json +1 -1
- package/dist/types/popup/domain/index.d.ts +1 -4
- package/dist/types/service/uploadServiceImpl.d.ts +0 -2
- package/dist/types/util/analytics.d.ts +2 -0
- package/dist/types/util/ufoExperiences.d.ts +1 -1
- package/example-helpers/UfoWrapper.tsx +12 -0
- package/example-helpers/{styled.ts → styles.ts} +27 -28
- package/example-helpers/stylesWrapper.tsx +105 -0
- package/example-helpers/upload-preview.tsx +1 -1
- package/example-helpers/upload-previews.tsx +1 -1
- package/package.json +11 -14
- package/dist/cjs/components/popup-auth.js +0 -97
- package/dist/cjs/popup/domain/auth.js +0 -37
- package/dist/cjs/popup/domain/source-file.js +0 -20
- package/dist/es2019/components/popup-auth.js +0 -44
- package/dist/es2019/popup/domain/auth.js +0 -27
- package/dist/es2019/popup/domain/source-file.js +0 -12
- package/dist/esm/components/popup-auth.js +0 -83
- package/dist/esm/popup/domain/auth.js +0 -27
- package/dist/esm/popup/domain/source-file.js +0 -12
- package/dist/types/components/popup-auth.d.ts +0 -3
- package/dist/types/popup/domain/auth.d.ts +0 -21
- package/dist/types/popup/domain/source-file.d.ts +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @atlaskit/media-picker
|
|
2
2
|
|
|
3
|
+
## 63.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 63.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- [`e9de546cfc7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e9de546cfc7) - Migrate to emotion from styled-components
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [`bfde909c9b4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bfde909c9b4) - Add new feature flag mediaUploadApiV2
|
|
18
|
+
- [`35e43fcc798`](https://bitbucket.org/atlassian/atlassian-frontend/commits/35e43fcc798) - Add ufo feature flag logging
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [`c0f85687ea0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c0f85687ea0) - Enabled UFO logger for all examples for Media-Picker
|
|
23
|
+
- [`c2ede50a80a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c2ede50a80a) - Add media region and environment returned from media API response into failed analytic events.
|
|
24
|
+
- [`19899f3e100`](https://bitbucket.org/atlassian/atlassian-frontend/commits/19899f3e100) - Make emotion as dev dependency instead peer dependency
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
27
|
+
## 62.0.0
|
|
28
|
+
|
|
29
|
+
### Major Changes
|
|
30
|
+
|
|
31
|
+
- [`ad13b4d0bc6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ad13b4d0bc6) - [MEX-1525] Remove userAuth from Media-Core & Media-client
|
|
32
|
+
|
|
33
|
+
### Minor Changes
|
|
34
|
+
|
|
35
|
+
- [`fe7a1aaddd6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fe7a1aaddd6) - Attach media environment to Media Picker UFO events
|
|
36
|
+
- [`7dad7e0c299`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7dad7e0c299) - [MEX-1413] Removed user auth from media-picker
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- [`a5d25a077bc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a5d25a077bc) - removed duplicated module from Confluence's node_modules introduced with our components
|
|
41
|
+
- [`e368c622418`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e368c622418) - Updated component names in UFO experiences
|
|
42
|
+
- Updated dependencies
|
|
43
|
+
|
|
3
44
|
## 61.0.1
|
|
4
45
|
|
|
5
46
|
### Patch 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:
|
|
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:
|
|
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:
|
|
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;
|
|
@@ -25,18 +25,12 @@ var _constants = require("@atlaskit/media-client/constants");
|
|
|
25
25
|
|
|
26
26
|
var _eventemitter = require("eventemitter2");
|
|
27
27
|
|
|
28
|
-
var _sourceFile = require("../popup/domain/source-file");
|
|
29
|
-
|
|
30
28
|
var _getPreviewFromImage = require("../util/getPreviewFromImage");
|
|
31
29
|
|
|
32
30
|
var _types = require("../service/types");
|
|
33
31
|
|
|
34
32
|
var _getPreviewFromBlob = require("../util/getPreviewFromBlob");
|
|
35
33
|
|
|
36
|
-
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; }
|
|
37
|
-
|
|
38
|
-
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; }
|
|
39
|
-
|
|
40
34
|
var UploadServiceImpl = /*#__PURE__*/function () {
|
|
41
35
|
function UploadServiceImpl(tenantMediaClient, tenantUploadParams, shouldCopyFileToRecents) {
|
|
42
36
|
var _this = this;
|
|
@@ -54,10 +48,6 @@ var UploadServiceImpl = /*#__PURE__*/function () {
|
|
|
54
48
|
case 0:
|
|
55
49
|
mediaFile = cancellableFileUpload.mediaFile;
|
|
56
50
|
|
|
57
|
-
_this.copyFileToUsersCollection(fileId) // eslint-disable-next-line no-console
|
|
58
|
-
.catch(console.log); // We intentionally swallow these errors
|
|
59
|
-
|
|
60
|
-
|
|
61
51
|
_this.emit('file-converting', {
|
|
62
52
|
file: mediaFile
|
|
63
53
|
});
|
|
@@ -66,7 +56,7 @@ var UploadServiceImpl = /*#__PURE__*/function () {
|
|
|
66
56
|
_this.releaseCancellableFile(mediaFile);
|
|
67
57
|
};
|
|
68
58
|
|
|
69
|
-
case
|
|
59
|
+
case 3:
|
|
70
60
|
case "end":
|
|
71
61
|
return _context.stop();
|
|
72
62
|
}
|
|
@@ -105,18 +95,6 @@ var UploadServiceImpl = /*#__PURE__*/function () {
|
|
|
105
95
|
this.shouldCopyFileToRecents = shouldCopyFileToRecents;
|
|
106
96
|
this.emitter = new _eventemitter.EventEmitter2();
|
|
107
97
|
this.cancellableFilesUploads = {};
|
|
108
|
-
var userAuthProvider = tenantMediaClient.config.userAuthProvider;
|
|
109
|
-
|
|
110
|
-
if (userAuthProvider) {
|
|
111
|
-
this.userMediaStore = new _mediaClient.MediaStore({
|
|
112
|
-
authProvider: userAuthProvider
|
|
113
|
-
}); // We need to use the userAuth to upload this file (recents)
|
|
114
|
-
|
|
115
|
-
this.userMediaClient = new _mediaClient.MediaClient({
|
|
116
|
-
userAuthProvider: userAuthProvider,
|
|
117
|
-
authProvider: userAuthProvider
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
98
|
}
|
|
121
99
|
|
|
122
100
|
(0, _createClass2.default)(UploadServiceImpl, [{
|
|
@@ -362,37 +340,6 @@ var UploadServiceImpl = /*#__PURE__*/function () {
|
|
|
362
340
|
value: function releaseCancellableFile(mediaFile) {
|
|
363
341
|
delete this.cancellableFilesUploads[mediaFile.id];
|
|
364
342
|
}
|
|
365
|
-
}, {
|
|
366
|
-
key: "copyFileToUsersCollection",
|
|
367
|
-
value: // This method copies the file from the "tenant collection" to the "user collection" (recents).
|
|
368
|
-
// that means we need "tenant auth" as input and "user auth" as output
|
|
369
|
-
function copyFileToUsersCollection(sourceFileId) {
|
|
370
|
-
var shouldCopyFileToRecents = this.shouldCopyFileToRecents,
|
|
371
|
-
userMediaStore = this.userMediaStore,
|
|
372
|
-
tenantUploadParams = this.tenantUploadParams;
|
|
373
|
-
|
|
374
|
-
if (!shouldCopyFileToRecents || !userMediaStore) {
|
|
375
|
-
return Promise.resolve();
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
var sourceCollection = tenantUploadParams.collection;
|
|
379
|
-
var tenantAuthProvider = this.tenantMediaClient.config.authProvider;
|
|
380
|
-
return tenantAuthProvider({
|
|
381
|
-
collectionName: sourceCollection
|
|
382
|
-
}).then(function (auth) {
|
|
383
|
-
var body = {
|
|
384
|
-
sourceFile: {
|
|
385
|
-
id: sourceFileId,
|
|
386
|
-
collection: sourceCollection,
|
|
387
|
-
owner: _objectSpread({}, (0, _sourceFile.mapAuthToSourceFileOwner)(auth))
|
|
388
|
-
}
|
|
389
|
-
};
|
|
390
|
-
var params = {
|
|
391
|
-
collection: _constants.RECENTS_COLLECTION
|
|
392
|
-
};
|
|
393
|
-
return userMediaStore.copyFileWithToken(body, params);
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
343
|
}]);
|
|
397
344
|
return UploadServiceImpl;
|
|
398
345
|
}();
|
|
@@ -3,13 +3,30 @@
|
|
|
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
|
|
|
12
|
+
var _mediaCommon = require("@atlaskit/media-common");
|
|
13
|
+
|
|
11
14
|
var _version = require("../version.json");
|
|
12
15
|
|
|
16
|
+
var relevantFlags = {
|
|
17
|
+
newCardExperience: true,
|
|
18
|
+
captions: false,
|
|
19
|
+
timestampOnVideo: false,
|
|
20
|
+
observedWidth: false,
|
|
21
|
+
mediaInline: false,
|
|
22
|
+
folderUploads: true,
|
|
23
|
+
mediaUploadApiV2: true
|
|
24
|
+
};
|
|
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;
|
|
29
|
+
|
|
13
30
|
function getPackageAttributes(componentName) {
|
|
14
31
|
return {
|
|
15
32
|
packageName: _version.name,
|
|
@@ -11,6 +11,10 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
11
11
|
|
|
12
12
|
var _ufo = require("@atlaskit/ufo");
|
|
13
13
|
|
|
14
|
+
var _mediaClient = require("@atlaskit/media-client");
|
|
15
|
+
|
|
16
|
+
var _analytics = require("./analytics");
|
|
17
|
+
|
|
14
18
|
var _version = require("../version.json");
|
|
15
19
|
|
|
16
20
|
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; }
|
|
@@ -23,10 +27,11 @@ var initExperience = function initExperience(id, componentName) {
|
|
|
23
27
|
if (!ufoExperience) {
|
|
24
28
|
var inlineExperience = {
|
|
25
29
|
platform: {
|
|
26
|
-
component: componentName
|
|
30
|
+
component: "media-picker-".concat(componentName)
|
|
27
31
|
},
|
|
28
32
|
type: _ufo.ExperienceTypes.Experience,
|
|
29
|
-
performanceType: _ufo.ExperiencePerformanceTypes.InlineResult
|
|
33
|
+
performanceType: _ufo.ExperiencePerformanceTypes.InlineResult,
|
|
34
|
+
featureFlags: _analytics.LOGGED_FEATURE_FLAG_KEYS
|
|
30
35
|
};
|
|
31
36
|
ufoExperience = new _ufo.ConcurrentExperience('media-upload', inlineExperience);
|
|
32
37
|
}
|
|
@@ -40,8 +45,8 @@ var getExperience = function getExperience(id) {
|
|
|
40
45
|
}
|
|
41
46
|
};
|
|
42
47
|
|
|
43
|
-
var startMediaUploadUfoExperience = function startMediaUploadUfoExperience(id,
|
|
44
|
-
initExperience(id,
|
|
48
|
+
var startMediaUploadUfoExperience = function startMediaUploadUfoExperience(id, componentName) {
|
|
49
|
+
initExperience(id, componentName).start();
|
|
45
50
|
};
|
|
46
51
|
|
|
47
52
|
exports.startMediaUploadUfoExperience = startMediaUploadUfoExperience;
|
|
@@ -53,7 +58,9 @@ var succeedMediaUploadUfoExperience = function succeedMediaUploadUfoExperience(i
|
|
|
53
58
|
metadata: {
|
|
54
59
|
fileAttributes: properties,
|
|
55
60
|
packageName: _version.name,
|
|
56
|
-
packageVersion: _version.version
|
|
61
|
+
packageVersion: _version.version,
|
|
62
|
+
mediaEnvironment: (0, _mediaClient.getMediaEnvironment)(),
|
|
63
|
+
mediaRegion: (0, _mediaClient.getMediaRegion)()
|
|
57
64
|
}
|
|
58
65
|
});
|
|
59
66
|
};
|
|
@@ -65,7 +72,9 @@ var failMediaUploadUfoExperience = function failMediaUploadUfoExperience(id, pro
|
|
|
65
72
|
|
|
66
73
|
var refinedMetadata = _objectSpread(_objectSpread({}, properties), {}, {
|
|
67
74
|
packageName: _version.name,
|
|
68
|
-
packageVersion: _version.version
|
|
75
|
+
packageVersion: _version.version,
|
|
76
|
+
mediaEnvironment: (0, _mediaClient.getMediaEnvironment)(),
|
|
77
|
+
mediaRegion: (0, _mediaClient.getMediaRegion)()
|
|
69
78
|
});
|
|
70
79
|
|
|
71
80
|
(_getExperience2 = getExperience(id)) === null || _getExperience2 === void 0 ? void 0 : _getExperience2.failure({
|
package/dist/cjs/version.json
CHANGED
|
@@ -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
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
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:
|
|
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,9 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import uuidV4 from 'uuid/v4';
|
|
3
|
-
import {
|
|
3
|
+
import { UploadController, getMediaTypeFromMimeType, isMimeTypeSupportedByBrowser, globalMediaEventEmitter, RequestError } from '@atlaskit/media-client';
|
|
4
4
|
import { RECENTS_COLLECTION } from '@atlaskit/media-client/constants';
|
|
5
5
|
import { EventEmitter2 } from 'eventemitter2';
|
|
6
|
-
import { mapAuthToSourceFileOwner } from '../popup/domain/source-file';
|
|
7
6
|
import { getPreviewFromImage } from '../util/getPreviewFromImage';
|
|
8
7
|
import { LocalFileSource } from '../service/types';
|
|
9
8
|
import { getPreviewFromBlob } from '../util/getPreviewFromBlob';
|
|
@@ -17,9 +16,6 @@ export class UploadServiceImpl {
|
|
|
17
16
|
const {
|
|
18
17
|
mediaFile
|
|
19
18
|
} = cancellableFileUpload;
|
|
20
|
-
this.copyFileToUsersCollection(fileId) // eslint-disable-next-line no-console
|
|
21
|
-
.catch(console.log); // We intentionally swallow these errors
|
|
22
|
-
|
|
23
19
|
this.emit('file-converting', {
|
|
24
20
|
file: mediaFile
|
|
25
21
|
});
|
|
@@ -56,20 +52,6 @@ export class UploadServiceImpl {
|
|
|
56
52
|
this.shouldCopyFileToRecents = shouldCopyFileToRecents;
|
|
57
53
|
this.emitter = new EventEmitter2();
|
|
58
54
|
this.cancellableFilesUploads = {};
|
|
59
|
-
const {
|
|
60
|
-
userAuthProvider
|
|
61
|
-
} = tenantMediaClient.config;
|
|
62
|
-
|
|
63
|
-
if (userAuthProvider) {
|
|
64
|
-
this.userMediaStore = new MediaStore({
|
|
65
|
-
authProvider: userAuthProvider
|
|
66
|
-
}); // We need to use the userAuth to upload this file (recents)
|
|
67
|
-
|
|
68
|
-
this.userMediaClient = new MediaClient({
|
|
69
|
-
userAuthProvider,
|
|
70
|
-
authProvider: userAuthProvider
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
55
|
}
|
|
74
56
|
|
|
75
57
|
setUploadParams(uploadParams) {
|
|
@@ -297,41 +279,4 @@ export class UploadServiceImpl {
|
|
|
297
279
|
delete this.cancellableFilesUploads[mediaFile.id];
|
|
298
280
|
}
|
|
299
281
|
|
|
300
|
-
// This method copies the file from the "tenant collection" to the "user collection" (recents).
|
|
301
|
-
// that means we need "tenant auth" as input and "user auth" as output
|
|
302
|
-
copyFileToUsersCollection(sourceFileId) {
|
|
303
|
-
const {
|
|
304
|
-
shouldCopyFileToRecents,
|
|
305
|
-
userMediaStore,
|
|
306
|
-
tenantUploadParams
|
|
307
|
-
} = this;
|
|
308
|
-
|
|
309
|
-
if (!shouldCopyFileToRecents || !userMediaStore) {
|
|
310
|
-
return Promise.resolve();
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
const {
|
|
314
|
-
collection: sourceCollection
|
|
315
|
-
} = tenantUploadParams;
|
|
316
|
-
const {
|
|
317
|
-
authProvider: tenantAuthProvider
|
|
318
|
-
} = this.tenantMediaClient.config;
|
|
319
|
-
return tenantAuthProvider({
|
|
320
|
-
collectionName: sourceCollection
|
|
321
|
-
}).then(auth => {
|
|
322
|
-
const body = {
|
|
323
|
-
sourceFile: {
|
|
324
|
-
id: sourceFileId,
|
|
325
|
-
collection: sourceCollection,
|
|
326
|
-
owner: { ...mapAuthToSourceFileOwner(auth)
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
const params = {
|
|
331
|
-
collection: RECENTS_COLLECTION
|
|
332
|
-
};
|
|
333
|
-
return userMediaStore.copyFileWithToken(body, params);
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
|
|
337
282
|
}
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { isRequestError } from '@atlaskit/media-client';
|
|
2
|
-
import {
|
|
2
|
+
import { filterFeatureFlagKeysAllProducts, filterFeatureFlagNames } from '@atlaskit/media-common';
|
|
3
|
+
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
|
|
4
|
+
|
|
5
|
+
const relevantFlags = {
|
|
6
|
+
newCardExperience: true,
|
|
7
|
+
captions: false,
|
|
8
|
+
timestampOnVideo: false,
|
|
9
|
+
observedWidth: false,
|
|
10
|
+
mediaInline: false,
|
|
11
|
+
folderUploads: true,
|
|
12
|
+
mediaUploadApiV2: true
|
|
13
|
+
};
|
|
14
|
+
export const LOGGED_FEATURE_FLAGS = filterFeatureFlagNames(relevantFlags);
|
|
15
|
+
export const LOGGED_FEATURE_FLAG_KEYS = filterFeatureFlagKeysAllProducts(relevantFlags);
|
|
3
16
|
export function getPackageAttributes(componentName) {
|
|
4
17
|
return {
|
|
5
18
|
packageName,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ConcurrentExperience, ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo';
|
|
2
|
+
import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
|
|
3
|
+
import { LOGGED_FEATURE_FLAG_KEYS } from './analytics';
|
|
2
4
|
import { name as packageName, version as packageVersion } from '../version.json';
|
|
3
5
|
let ufoExperience;
|
|
4
6
|
|
|
@@ -6,10 +8,11 @@ const initExperience = (id, componentName) => {
|
|
|
6
8
|
if (!ufoExperience) {
|
|
7
9
|
const inlineExperience = {
|
|
8
10
|
platform: {
|
|
9
|
-
component: componentName
|
|
11
|
+
component: `media-picker-${componentName}`
|
|
10
12
|
},
|
|
11
13
|
type: ExperienceTypes.Experience,
|
|
12
|
-
performanceType: ExperiencePerformanceTypes.InlineResult
|
|
14
|
+
performanceType: ExperiencePerformanceTypes.InlineResult,
|
|
15
|
+
featureFlags: LOGGED_FEATURE_FLAG_KEYS
|
|
13
16
|
};
|
|
14
17
|
ufoExperience = new ConcurrentExperience('media-upload', inlineExperience);
|
|
15
18
|
}
|
|
@@ -23,8 +26,8 @@ const getExperience = id => {
|
|
|
23
26
|
}
|
|
24
27
|
};
|
|
25
28
|
|
|
26
|
-
export const startMediaUploadUfoExperience = (id,
|
|
27
|
-
initExperience(id,
|
|
29
|
+
export const startMediaUploadUfoExperience = (id, componentName) => {
|
|
30
|
+
initExperience(id, componentName).start();
|
|
28
31
|
};
|
|
29
32
|
export const succeedMediaUploadUfoExperience = (id, properties) => {
|
|
30
33
|
var _getExperience;
|
|
@@ -33,7 +36,9 @@ export const succeedMediaUploadUfoExperience = (id, properties) => {
|
|
|
33
36
|
metadata: {
|
|
34
37
|
fileAttributes: properties,
|
|
35
38
|
packageName,
|
|
36
|
-
packageVersion
|
|
39
|
+
packageVersion,
|
|
40
|
+
mediaEnvironment: getMediaEnvironment(),
|
|
41
|
+
mediaRegion: getMediaRegion()
|
|
37
42
|
}
|
|
38
43
|
});
|
|
39
44
|
};
|
|
@@ -42,7 +47,9 @@ export const failMediaUploadUfoExperience = (id, properties) => {
|
|
|
42
47
|
|
|
43
48
|
const refinedMetadata = { ...properties,
|
|
44
49
|
packageName,
|
|
45
|
-
packageVersion
|
|
50
|
+
packageVersion,
|
|
51
|
+
mediaEnvironment: getMediaEnvironment(),
|
|
52
|
+
mediaRegion: getMediaRegion()
|
|
46
53
|
};
|
|
47
54
|
(_getExperience2 = getExperience(id)) === null || _getExperience2 === void 0 ? void 0 : _getExperience2.failure({
|
|
48
55
|
metadata: refinedMetadata
|
package/dist/es2019/version.json
CHANGED
|
@@ -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
|
|
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:
|
|
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));
|
|
@@ -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
|
|
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:
|
|
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));
|
|
@@ -13,11 +13,11 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
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
|
|
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:
|
|
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));
|