@atlaskit/media-common 2.6.2 → 2.9.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 +51 -0
- package/dist/cjs/analytics/withMediaAnalyticsContext.js +7 -3
- package/dist/cjs/docs/index.js +13 -0
- package/dist/cjs/docs/rxjs-notice.js +21 -0
- package/dist/cjs/index.js +63 -1
- package/dist/cjs/mediaFeatureFlags.js +1 -6
- package/dist/cjs/mediaTypeUtils/index.js +104 -0
- package/dist/cjs/mediaTypeUtils/isArchive.js +13 -0
- package/dist/cjs/mediaTypeUtils/isMimeTypeSupportedByBrowser.js +48 -0
- package/dist/cjs/mediaTypeUtils/isMimeTypeSupportedByServer.js +57 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/docs/index.js +1 -0
- package/dist/es2019/docs/rxjs-notice.js +10 -0
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/mediaFeatureFlags.js +3 -7
- package/dist/es2019/mediaTypeUtils/index.js +28 -0
- package/dist/es2019/mediaTypeUtils/isArchive.js +2 -0
- package/dist/es2019/mediaTypeUtils/isMimeTypeSupportedByBrowser.js +17 -0
- package/dist/es2019/mediaTypeUtils/isMimeTypeSupportedByServer.js +21 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/withMediaAnalyticsContext.js +1 -1
- package/dist/esm/docs/index.js +1 -0
- package/dist/esm/docs/rxjs-notice.js +10 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/mediaFeatureFlags.js +3 -7
- package/dist/esm/mediaTypeUtils/index.js +28 -0
- package/dist/esm/mediaTypeUtils/isArchive.js +4 -0
- package/dist/esm/mediaTypeUtils/isMimeTypeSupportedByBrowser.js +27 -0
- package/dist/esm/mediaTypeUtils/isMimeTypeSupportedByServer.js +33 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/types.d.ts +17 -5
- package/dist/types/docs/index.d.ts +1 -0
- package/dist/types/docs/rxjs-notice.d.ts +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/mediaFeatureFlags.d.ts +2 -9
- package/dist/types/mediaTypeUtils/index.d.ts +4 -0
- package/dist/types/mediaTypeUtils/isArchive.d.ts +1 -0
- package/dist/types/mediaTypeUtils/isMimeTypeSupportedByBrowser.d.ts +14 -0
- package/dist/types/mediaTypeUtils/isMimeTypeSupportedByServer.d.ts +6 -0
- package/mediaTypeUtils/package.json +7 -0
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# @atlaskit/media-common
|
|
2
2
|
|
|
3
|
+
## 2.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`fe9ced0cd70`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fe9ced0cd70) - Removed feature flags for polling settings
|
|
8
|
+
|
|
9
|
+
## 2.9.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`46d9d2872b4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/46d9d2872b4) - Video Analytics - Add UI events for CustomMediaPlayer
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`4777a174e6d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4777a174e6d) - Added analytics support for customMediaPlayer + screen event + entrypoint for locales
|
|
18
|
+
- [`b77bfe8e99c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b77bfe8e99c) - Add performance attributes to Commenced, Succeeded, Failed events for media card
|
|
19
|
+
- [`35d85025b4d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/35d85025b4d) - MEX-860 Changed base track events payload + added CustomMediaPlayerType
|
|
20
|
+
|
|
21
|
+
## 2.8.0
|
|
22
|
+
|
|
23
|
+
### Minor Changes
|
|
24
|
+
|
|
25
|
+
- [`c74e598326e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c74e598326e) - Add new members (see below). Extra entry point `mediaTypeUtils` for all of them is added.
|
|
26
|
+
|
|
27
|
+
New members:
|
|
28
|
+
|
|
29
|
+
- getMediaTypeFromMimeType
|
|
30
|
+
- isImageMimeTypeSupportedByBrowser
|
|
31
|
+
- isDocumentMimeTypeSupportedByBrowser
|
|
32
|
+
- isMimeTypeSupportedByBrowser
|
|
33
|
+
- isImageMimeTypeSupportedByServer
|
|
34
|
+
- isDocumentMimeTypeSupportedByServer
|
|
35
|
+
- isAudioMimeTypeSupportedByServer
|
|
36
|
+
- isVideoMimeTypeSupportedByServer
|
|
37
|
+
- isUnknownMimeTypeSupportedByServer
|
|
38
|
+
- isMimeTypeSupportedByServer
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- [`8cba1694b5e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cba1694b5e) - Remove pollingMaxFailuresExceeded error from implementation and feature flags
|
|
43
|
+
|
|
44
|
+
## 2.7.0
|
|
45
|
+
|
|
46
|
+
### Minor Changes
|
|
47
|
+
|
|
48
|
+
- [`3cd9ee2d15b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3cd9ee2d15b) - Added RxJS compatiblity notice in Media docs
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- [`6be6879ef6d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6be6879ef6d) - Enforce types
|
|
53
|
+
|
|
3
54
|
## 2.6.2
|
|
4
55
|
|
|
5
56
|
### Patch Changes
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
@@ -21,7 +21,11 @@ var _MediaAnalyticsContext = require("@atlaskit/analytics-namespaced-context/Med
|
|
|
21
21
|
|
|
22
22
|
var _mediaFeatureFlags = require("../mediaFeatureFlags");
|
|
23
23
|
|
|
24
|
-
function
|
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
+
|
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
+
|
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
25
29
|
|
|
26
30
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
27
31
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "createRxjsNotice", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _rxjsNotice.createRxjsNotice;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _rxjsNotice = require("./rxjs-notice");
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createRxjsNotice = createRxjsNotice;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _sectionMessage = _interopRequireDefault(require("@atlaskit/section-message"));
|
|
13
|
+
|
|
14
|
+
function createRxjsNotice(componentName) {
|
|
15
|
+
return /*#__PURE__*/_react.default.createElement(_sectionMessage.default, {
|
|
16
|
+
title: "RxJS compatilbity",
|
|
17
|
+
appearance: "warning"
|
|
18
|
+
}, /*#__PURE__*/_react.default.createElement("p", null, componentName, " currently requires", ' ', /*#__PURE__*/_react.default.createElement("a", {
|
|
19
|
+
href: "https://www.npmjs.com/package/rxjs/v/5.5.12"
|
|
20
|
+
}, "rxjs@^5.5.0"), " as peer dependency."));
|
|
21
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -33,6 +33,66 @@ Object.defineProperty(exports, "ANALYTICS_MEDIA_CHANNEL", {
|
|
|
33
33
|
return _constants.ANALYTICS_MEDIA_CHANNEL;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "getMediaTypeFromMimeType", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _mediaTypeUtils.getMediaTypeFromMimeType;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "isImageMimeTypeSupportedByBrowser", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _mediaTypeUtils.isImageMimeTypeSupportedByBrowser;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "isDocumentMimeTypeSupportedByBrowser", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _mediaTypeUtils.isDocumentMimeTypeSupportedByBrowser;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "isMimeTypeSupportedByBrowser", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function get() {
|
|
57
|
+
return _mediaTypeUtils.isMimeTypeSupportedByBrowser;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "isImageMimeTypeSupportedByServer", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function get() {
|
|
63
|
+
return _mediaTypeUtils.isImageMimeTypeSupportedByServer;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "isDocumentMimeTypeSupportedByServer", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function get() {
|
|
69
|
+
return _mediaTypeUtils.isDocumentMimeTypeSupportedByServer;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "isAudioMimeTypeSupportedByServer", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function get() {
|
|
75
|
+
return _mediaTypeUtils.isAudioMimeTypeSupportedByServer;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "isVideoMimeTypeSupportedByServer", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function get() {
|
|
81
|
+
return _mediaTypeUtils.isVideoMimeTypeSupportedByServer;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "isUnknownMimeTypeSupportedByServer", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function get() {
|
|
87
|
+
return _mediaTypeUtils.isUnknownMimeTypeSupportedByServer;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "isMimeTypeSupportedByServer", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function get() {
|
|
93
|
+
return _mediaTypeUtils.isMimeTypeSupportedByServer;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
36
96
|
|
|
37
97
|
var _downloadUrl = require("./downloadUrl");
|
|
38
98
|
|
|
@@ -40,4 +100,6 @@ var _mediaFeatureFlags = require("./mediaFeatureFlags");
|
|
|
40
100
|
|
|
41
101
|
var _withMediaAnalyticsContext = require("./analytics/withMediaAnalyticsContext");
|
|
42
102
|
|
|
43
|
-
var _constants = require("./analytics/constants");
|
|
103
|
+
var _constants = require("./analytics/constants");
|
|
104
|
+
|
|
105
|
+
var _mediaTypeUtils = require("./mediaTypeUtils");
|
|
@@ -14,12 +14,7 @@ var defaultMediaFeatureFlags = {
|
|
|
14
14
|
zipPreviews: false,
|
|
15
15
|
captions: false,
|
|
16
16
|
folderUploads: false,
|
|
17
|
-
codeViewer: false
|
|
18
|
-
poll_intervalMs: 3000,
|
|
19
|
-
poll_maxAttempts: 30,
|
|
20
|
-
poll_backoffFactor: 1.25,
|
|
21
|
-
poll_maxIntervalMs: 200000,
|
|
22
|
-
poll_maxGlobalFailures: 10
|
|
17
|
+
codeViewer: false
|
|
23
18
|
};
|
|
24
19
|
/**
|
|
25
20
|
* Public accessor from components to fallback to defaults if flags not passed,
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "isImageMimeTypeSupportedByBrowser", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _isMimeTypeSupportedByBrowser.isImageMimeTypeSupportedByBrowser;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "isDocumentMimeTypeSupportedByBrowser", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _isMimeTypeSupportedByBrowser.isDocumentMimeTypeSupportedByBrowser;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "isAudioMimeTypeSupportedByBrowser", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _isMimeTypeSupportedByBrowser.isAudioMimeTypeSupportedByBrowser;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "isVideoMimeTypeSupportedByBrowser", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _isMimeTypeSupportedByBrowser.isVideoMimeTypeSupportedByBrowser;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "isMimeTypeSupportedByBrowser", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _isMimeTypeSupportedByBrowser.isMimeTypeSupportedByBrowser;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "isImageMimeTypeSupportedByServer", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _isMimeTypeSupportedByServer.isImageMimeTypeSupportedByServer;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "isDocumentMimeTypeSupportedByServer", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _isMimeTypeSupportedByServer.isDocumentMimeTypeSupportedByServer;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "isAudioMimeTypeSupportedByServer", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _isMimeTypeSupportedByServer.isAudioMimeTypeSupportedByServer;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "isVideoMimeTypeSupportedByServer", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function get() {
|
|
57
|
+
return _isMimeTypeSupportedByServer.isVideoMimeTypeSupportedByServer;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "isUnknownMimeTypeSupportedByServer", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function get() {
|
|
63
|
+
return _isMimeTypeSupportedByServer.isUnknownMimeTypeSupportedByServer;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "isMimeTypeSupportedByServer", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function get() {
|
|
69
|
+
return _isMimeTypeSupportedByServer.isMimeTypeSupportedByServer;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
exports.getMediaTypeFromMimeType = void 0;
|
|
73
|
+
|
|
74
|
+
var _isArchive = require("./isArchive");
|
|
75
|
+
|
|
76
|
+
var _isMimeTypeSupportedByBrowser = require("./isMimeTypeSupportedByBrowser");
|
|
77
|
+
|
|
78
|
+
var _isMimeTypeSupportedByServer = require("./isMimeTypeSupportedByServer");
|
|
79
|
+
|
|
80
|
+
var getMediaTypeFromMimeType = function getMediaTypeFromMimeType(mimeType) {
|
|
81
|
+
if ((0, _isArchive.isArchive)(mimeType)) {
|
|
82
|
+
return 'archive';
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if ((0, _isMimeTypeSupportedByBrowser.isImageMimeTypeSupportedByBrowser)(mimeType) || (0, _isMimeTypeSupportedByServer.isImageMimeTypeSupportedByServer)(mimeType)) {
|
|
86
|
+
return 'image';
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if ((0, _isMimeTypeSupportedByBrowser.isDocumentMimeTypeSupportedByBrowser)(mimeType) || (0, _isMimeTypeSupportedByServer.isDocumentMimeTypeSupportedByServer)(mimeType)) {
|
|
90
|
+
return 'doc';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if ((0, _isMimeTypeSupportedByBrowser.isAudioMimeTypeSupportedByBrowser)(mimeType) || (0, _isMimeTypeSupportedByServer.isAudioMimeTypeSupportedByServer)(mimeType)) {
|
|
94
|
+
return 'audio';
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if ((0, _isMimeTypeSupportedByBrowser.isVideoMimeTypeSupportedByBrowser)(mimeType) || (0, _isMimeTypeSupportedByServer.isVideoMimeTypeSupportedByServer)(mimeType)) {
|
|
98
|
+
return 'video';
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return 'unknown';
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
exports.getMediaTypeFromMimeType = getMediaTypeFromMimeType;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isArchive = void 0;
|
|
7
|
+
|
|
8
|
+
// Based on https://en.wikipedia.org/wiki/List_of_archive_formats
|
|
9
|
+
var isArchive = function isArchive(mimeType) {
|
|
10
|
+
return ['application/x-archive', 'application/x-cpio', 'application/x-shar', 'application/x-iso9660-image', 'application/x-sbx', 'application/x-tar', 'application/x-bzip2', 'application/gzip', 'application/x-gzip', 'application/x-lzip', 'application/x-lzma', 'application/x-lzop', 'application/x-snappy-framed', 'application/x-xz', 'application/x-compress', 'application/zstd', 'application/x-7z-compressed', 'application/x-ace-compressed', 'application/x-astrotite-afa', 'application/x-alz-compressed', 'application/vnd.android.package-archive', 'application/x-freearc', 'application/x-arj', 'application/x-b1', 'application/vnd.ms-cab-compressed', 'application/x-cfs-compressed', 'application/x-dar', 'application/x-dgc-compressed', 'application/x-apple-diskimage', 'application/x-gca-compressed', 'application/java-archive', 'application/x-lzh', 'application/x-lzx', 'application/x-rar-compressed', 'application/x-stuffit', 'application/x-stuffitx', 'application/x-gtar', 'application/x-ms-wim', 'application/x-xar', 'application/zip', 'application/x-zoo', 'application/x-par2'].indexOf(mimeType.toLowerCase()) > -1;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
exports.isArchive = isArchive;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isMimeTypeSupportedByBrowser = exports.isVideoMimeTypeSupportedByBrowser = exports.isAudioMimeTypeSupportedByBrowser = exports.isDocumentMimeTypeSupportedByBrowser = exports.isImageMimeTypeSupportedByBrowser = void 0;
|
|
7
|
+
|
|
8
|
+
// Based on https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types
|
|
9
|
+
var isImageMimeTypeSupportedByBrowser = function isImageMimeTypeSupportedByBrowser(mimeType) {
|
|
10
|
+
return ['image/apng', 'image/bmp', 'image/gif', 'image/x-icon', 'image/jpeg', 'image/png', 'image/webp' //'image/svg+xml', // Removed because of https://product-fabric.atlassian.net/browse/BMPT-625
|
|
11
|
+
].indexOf(mimeType.toLowerCase()) > -1;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.isImageMimeTypeSupportedByBrowser = isImageMimeTypeSupportedByBrowser;
|
|
15
|
+
|
|
16
|
+
var isDocumentMimeTypeSupportedByBrowser = function isDocumentMimeTypeSupportedByBrowser(mimeType) {
|
|
17
|
+
return mimeType.toLowerCase() === 'application/pdf';
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
exports.isDocumentMimeTypeSupportedByBrowser = isDocumentMimeTypeSupportedByBrowser;
|
|
21
|
+
|
|
22
|
+
var isAudioMimeTypeSupportedByBrowser = function isAudioMimeTypeSupportedByBrowser(mimeType) {
|
|
23
|
+
return ['audio/aac', 'audio/flac', 'audio/mp4', 'audio/mpeg', 'audio/ogg', 'audio/x-ogg', 'audio/wav', 'audio/x-wav'].indexOf(mimeType.toLowerCase()) > -1;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* For backward compatilbity, we assume MP4/MOV is natively supported.
|
|
27
|
+
* TODO: Improve detection of supported video formats by the browser.
|
|
28
|
+
*
|
|
29
|
+
* See related tickets:
|
|
30
|
+
* - https://product-fabric.atlassian.net/browse/MPT-477
|
|
31
|
+
* - https://product-fabric.atlassian.net/browse/EDM-634
|
|
32
|
+
* - https://product-fabric.atlassian.net/browse/EDM-426
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
exports.isAudioMimeTypeSupportedByBrowser = isAudioMimeTypeSupportedByBrowser;
|
|
37
|
+
|
|
38
|
+
var isVideoMimeTypeSupportedByBrowser = function isVideoMimeTypeSupportedByBrowser(mimeType) {
|
|
39
|
+
return ['video/mp4', 'video/quicktime'].indexOf(mimeType.toLowerCase()) > -1;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
exports.isVideoMimeTypeSupportedByBrowser = isVideoMimeTypeSupportedByBrowser;
|
|
43
|
+
|
|
44
|
+
var isMimeTypeSupportedByBrowser = function isMimeTypeSupportedByBrowser(mimeType) {
|
|
45
|
+
return isDocumentMimeTypeSupportedByBrowser(mimeType) || isImageMimeTypeSupportedByBrowser(mimeType) || isAudioMimeTypeSupportedByBrowser(mimeType) || isVideoMimeTypeSupportedByBrowser(mimeType);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
exports.isMimeTypeSupportedByBrowser = isMimeTypeSupportedByBrowser;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isMimeTypeSupportedByServer = exports.isUnknownMimeTypeSupportedByServer = exports.isVideoMimeTypeSupportedByServer = exports.isAudioMimeTypeSupportedByServer = exports.isDocumentMimeTypeSupportedByServer = exports.isImageMimeTypeSupportedByServer = void 0;
|
|
7
|
+
|
|
8
|
+
// Based on https://developer.atlassian.com/platform/media/learning/file-previews/
|
|
9
|
+
var isImageMimeTypeSupportedByServer = function isImageMimeTypeSupportedByServer(mimeType) {
|
|
10
|
+
return ['image/bmp', 'image/x-windows-bmp', 'application/dicom', 'image/gif', 'image/jpeg', 'image/jpg', 'image/jp_', 'application/jpg', 'application/x-jpg', 'image/png', 'application/png', 'application/x-png', 'application/vnd.adobe.photoshop', 'image/vnd.adobe.photoshop', 'image/photoshop', 'image/x-photoshop', 'image/psd', 'application/photoshop', 'application/psd', 'zz-application/zz-winassoc-psd', 'image/tiff', 'image/x-tif', 'image/x-tiff', 'application/tif', 'application/x-tif', 'application/tiff', 'application/x-tiff', 'image/svg+xml', 'image/heif', 'image/heif-sequence', 'image/heic', 'image/heic-sequence'].indexOf(mimeType.toLowerCase()) > -1;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
exports.isImageMimeTypeSupportedByServer = isImageMimeTypeSupportedByServer;
|
|
14
|
+
|
|
15
|
+
var isDocumentMimeTypeSupportedByServer = function isDocumentMimeTypeSupportedByServer(mimeType) {
|
|
16
|
+
return [// Adobe PDF
|
|
17
|
+
'application/pdf', 'application/x-pdf', 'application/acrobat', 'applications/vnd.pdf', 'text/pdf', 'text/x-pdf', // Adobe Illustrator
|
|
18
|
+
'application/vnd.adobe.illustrator', // Microsoft Office
|
|
19
|
+
'application/vnd.ms-office', // Microsoft Word
|
|
20
|
+
'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'application/vnd.ms-word.document.macroenabled.12', 'application/vnd.ms-word.template.macroenabled.12', // Microsoft Excel
|
|
21
|
+
'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', 'application/vnd.ms-excel.sheet.macroenabled.12', 'application/vnd.ms-excel.template.macroenabled.12', 'application/vnd.ms-excel.addin.macroenabled.12', 'application/vnd.ms-excel.sheet.macroenabled', 'application/vnd.ms-excel.template.macroenabled', 'application/vnd.ms-excel.addin.macroenabled', // Microsoft Powerpoint
|
|
22
|
+
'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/vnd.openxmlformats-officedocument.presentationml.template', 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'application/vnd.ms-powerpoint.presentation.macroenabled.12', 'application/vnd.ms-powerpoint.template.macroenabled.12', 'application/vnd.ms-powerpoint.slideshow.macroenabled.12', // OpenOffice
|
|
23
|
+
'application/vnd.sun.xml.writer', 'application/vnd.sun.xml.writer.template', // OpenDocument
|
|
24
|
+
'application/vnd.sun.xml.draw', 'application/vnd.sun.xml.draw.template', 'application/vnd.oasis.opendocument.graphics', 'application/vnd.oasis.opendocument.presentation', 'application/x-vnd.oasis.opendocument.presentation', 'application/vnd.sun.xml.calc', 'application/vnd.sun.xml.calc.template', 'application/vnd.oasis.opendocument.spreadsheet', 'application/x-vnd.oasis.opendocument.spreadsheet', 'application/vnd.oasis.opendocument.spreadsheet-template', 'application/vnd.oasis.opendocument.text', 'application/vnd.oasis.opendocument.text-template', 'application/vnd.oasis.opendocument.text-master', 'application/x-vnd.oasis.opendocument.text', 'application/x-vnd.oasis.opendocument.text-template', 'application/x-vnd.oasis.opendocument.text-master', // WordPerfect
|
|
25
|
+
'application/vnd.wordperfect', // Text files
|
|
26
|
+
'text/csv', 'text/x-diff', 'text/x-perl', 'text/x-python', 'text/x-ruby', 'text/rtf', 'text/richtext', 'text/plain', 'application/txt', // Rich text
|
|
27
|
+
'application/rtf', 'application/x-rtf', // PostScript
|
|
28
|
+
'application/postscript'].indexOf(mimeType.toLowerCase()) > -1;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.isDocumentMimeTypeSupportedByServer = isDocumentMimeTypeSupportedByServer;
|
|
32
|
+
|
|
33
|
+
var isAudioMimeTypeSupportedByServer = function isAudioMimeTypeSupportedByServer(mimeType) {
|
|
34
|
+
return ['audio/aac', 'audio/x-hx-aac-adts', 'audio/vnd.dolby.dd-raw', 'audio/aiff', 'audio/x-aiff', 'audio/x-monkeys-audio', 'audio/x-ape', 'audio/basic', 'audio/flac', 'audio/mp4', 'audio/midi', 'audio/x-matroska', 'audio/x-mod', 'audio/mpeg', 'audio/ogg', 'audio/x-ogg', 'audio/x-pn-realaudio', 'audio/wav', 'audio/x-wav', 'audio/x-ms-wma'].indexOf(mimeType.toLowerCase()) > -1;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.isAudioMimeTypeSupportedByServer = isAudioMimeTypeSupportedByServer;
|
|
38
|
+
|
|
39
|
+
var isVideoMimeTypeSupportedByServer = function isVideoMimeTypeSupportedByServer(mimeType) {
|
|
40
|
+
return ['video/3gpp', 'video/3gpp2', 'video/x-ms-asf', 'video/avi', 'video/msvideo', 'video/x-msvideo', 'video/x-dv', 'video/x-flv', 'video/m2ts', 'video/x-m4v', 'video/x-matroska', 'video/quicktime', 'video/mp4', 'video/mpeg', 'video/ogg', 'video/x-ogg', 'video/webm', 'video/x-ms-wmv'].indexOf(mimeType.toLowerCase()) > -1;
|
|
41
|
+
}; // BMPT-620: The backend momentarily returns this mimeType for cloud files imported via dt-api-mediapicker
|
|
42
|
+
// Once these cloud files are processed they are receiving a more relevant mimeType
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
exports.isVideoMimeTypeSupportedByServer = isVideoMimeTypeSupportedByServer;
|
|
46
|
+
|
|
47
|
+
var isUnknownMimeTypeSupportedByServer = function isUnknownMimeTypeSupportedByServer(mimeType) {
|
|
48
|
+
return ['binary/octet-stream'].indexOf(mimeType.toLowerCase()) > -1;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports.isUnknownMimeTypeSupportedByServer = isUnknownMimeTypeSupportedByServer;
|
|
52
|
+
|
|
53
|
+
var isMimeTypeSupportedByServer = function isMimeTypeSupportedByServer(mimeType) {
|
|
54
|
+
return isImageMimeTypeSupportedByServer(mimeType) || isDocumentMimeTypeSupportedByServer(mimeType) || isAudioMimeTypeSupportedByServer(mimeType) || isVideoMimeTypeSupportedByServer(mimeType) || isUnknownMimeTypeSupportedByServer(mimeType);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
exports.isMimeTypeSupportedByServer = isMimeTypeSupportedByServer;
|
package/dist/cjs/version.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createRxjsNotice } from './rxjs-notice';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import SectionMessage from '@atlaskit/section-message';
|
|
3
|
+
export function createRxjsNotice(componentName) {
|
|
4
|
+
return /*#__PURE__*/React.createElement(SectionMessage, {
|
|
5
|
+
title: "RxJS compatilbity",
|
|
6
|
+
appearance: "warning"
|
|
7
|
+
}, /*#__PURE__*/React.createElement("p", null, componentName, " currently requires", ' ', /*#__PURE__*/React.createElement("a", {
|
|
8
|
+
href: "https://www.npmjs.com/package/rxjs/v/5.5.12"
|
|
9
|
+
}, "rxjs@^5.5.0"), " as peer dependency."));
|
|
10
|
+
}
|
package/dist/es2019/index.js
CHANGED
|
@@ -6,4 +6,5 @@ export { getMediaFeatureFlag, defaultMediaFeatureFlags } from './mediaFeatureFla
|
|
|
6
6
|
// Analytics context
|
|
7
7
|
export { withMediaAnalyticsContext } from './analytics/withMediaAnalyticsContext'; // Analytics constants
|
|
8
8
|
|
|
9
|
-
export { ANALYTICS_MEDIA_CHANNEL } from './analytics/constants';
|
|
9
|
+
export { ANALYTICS_MEDIA_CHANNEL } from './analytics/constants';
|
|
10
|
+
export { getMediaTypeFromMimeType, isImageMimeTypeSupportedByBrowser, isDocumentMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser, isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer } from './mediaTypeUtils';
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { getLocalMediaFeatureFlag } from './mediaFeatureFlag-local';
|
|
1
|
+
import { getLocalMediaFeatureFlag } from './mediaFeatureFlag-local'; // Media feature flags - type and defaults defined here in one source of truth
|
|
2
|
+
|
|
2
3
|
// default values defined here, not necessary for components to know directly as they should use the function below
|
|
3
4
|
export const defaultMediaFeatureFlags = {
|
|
4
5
|
newCardExperience: false,
|
|
5
6
|
zipPreviews: false,
|
|
6
7
|
captions: false,
|
|
7
8
|
folderUploads: false,
|
|
8
|
-
codeViewer: false
|
|
9
|
-
poll_intervalMs: 3000,
|
|
10
|
-
poll_maxAttempts: 30,
|
|
11
|
-
poll_backoffFactor: 1.25,
|
|
12
|
-
poll_maxIntervalMs: 200000,
|
|
13
|
-
poll_maxGlobalFailures: 10
|
|
9
|
+
codeViewer: false
|
|
14
10
|
};
|
|
15
11
|
/**
|
|
16
12
|
* Public accessor from components to fallback to defaults if flags not passed,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { isArchive } from './isArchive';
|
|
2
|
+
import { isImageMimeTypeSupportedByBrowser, isDocumentMimeTypeSupportedByBrowser, isAudioMimeTypeSupportedByBrowser, isVideoMimeTypeSupportedByBrowser } from './isMimeTypeSupportedByBrowser';
|
|
3
|
+
import { isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer } from './isMimeTypeSupportedByServer';
|
|
4
|
+
export { isImageMimeTypeSupportedByBrowser, isDocumentMimeTypeSupportedByBrowser, isAudioMimeTypeSupportedByBrowser, isVideoMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser } from './isMimeTypeSupportedByBrowser';
|
|
5
|
+
export { isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer } from './isMimeTypeSupportedByServer';
|
|
6
|
+
export const getMediaTypeFromMimeType = mimeType => {
|
|
7
|
+
if (isArchive(mimeType)) {
|
|
8
|
+
return 'archive';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (isImageMimeTypeSupportedByBrowser(mimeType) || isImageMimeTypeSupportedByServer(mimeType)) {
|
|
12
|
+
return 'image';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (isDocumentMimeTypeSupportedByBrowser(mimeType) || isDocumentMimeTypeSupportedByServer(mimeType)) {
|
|
16
|
+
return 'doc';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (isAudioMimeTypeSupportedByBrowser(mimeType) || isAudioMimeTypeSupportedByServer(mimeType)) {
|
|
20
|
+
return 'audio';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (isVideoMimeTypeSupportedByBrowser(mimeType) || isVideoMimeTypeSupportedByServer(mimeType)) {
|
|
24
|
+
return 'video';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return 'unknown';
|
|
28
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Based on https://en.wikipedia.org/wiki/List_of_archive_formats
|
|
2
|
+
export const isArchive = mimeType => ['application/x-archive', 'application/x-cpio', 'application/x-shar', 'application/x-iso9660-image', 'application/x-sbx', 'application/x-tar', 'application/x-bzip2', 'application/gzip', 'application/x-gzip', 'application/x-lzip', 'application/x-lzma', 'application/x-lzop', 'application/x-snappy-framed', 'application/x-xz', 'application/x-compress', 'application/zstd', 'application/x-7z-compressed', 'application/x-ace-compressed', 'application/x-astrotite-afa', 'application/x-alz-compressed', 'application/vnd.android.package-archive', 'application/x-freearc', 'application/x-arj', 'application/x-b1', 'application/vnd.ms-cab-compressed', 'application/x-cfs-compressed', 'application/x-dar', 'application/x-dgc-compressed', 'application/x-apple-diskimage', 'application/x-gca-compressed', 'application/java-archive', 'application/x-lzh', 'application/x-lzx', 'application/x-rar-compressed', 'application/x-stuffit', 'application/x-stuffitx', 'application/x-gtar', 'application/x-ms-wim', 'application/x-xar', 'application/zip', 'application/x-zoo', 'application/x-par2'].indexOf(mimeType.toLowerCase()) > -1;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Based on https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types
|
|
2
|
+
export const isImageMimeTypeSupportedByBrowser = mimeType => ['image/apng', 'image/bmp', 'image/gif', 'image/x-icon', 'image/jpeg', 'image/png', 'image/webp' //'image/svg+xml', // Removed because of https://product-fabric.atlassian.net/browse/BMPT-625
|
|
3
|
+
].indexOf(mimeType.toLowerCase()) > -1;
|
|
4
|
+
export const isDocumentMimeTypeSupportedByBrowser = mimeType => mimeType.toLowerCase() === 'application/pdf';
|
|
5
|
+
export const isAudioMimeTypeSupportedByBrowser = mimeType => ['audio/aac', 'audio/flac', 'audio/mp4', 'audio/mpeg', 'audio/ogg', 'audio/x-ogg', 'audio/wav', 'audio/x-wav'].indexOf(mimeType.toLowerCase()) > -1;
|
|
6
|
+
/**
|
|
7
|
+
* For backward compatilbity, we assume MP4/MOV is natively supported.
|
|
8
|
+
* TODO: Improve detection of supported video formats by the browser.
|
|
9
|
+
*
|
|
10
|
+
* See related tickets:
|
|
11
|
+
* - https://product-fabric.atlassian.net/browse/MPT-477
|
|
12
|
+
* - https://product-fabric.atlassian.net/browse/EDM-634
|
|
13
|
+
* - https://product-fabric.atlassian.net/browse/EDM-426
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export const isVideoMimeTypeSupportedByBrowser = mimeType => ['video/mp4', 'video/quicktime'].indexOf(mimeType.toLowerCase()) > -1;
|
|
17
|
+
export const isMimeTypeSupportedByBrowser = mimeType => isDocumentMimeTypeSupportedByBrowser(mimeType) || isImageMimeTypeSupportedByBrowser(mimeType) || isAudioMimeTypeSupportedByBrowser(mimeType) || isVideoMimeTypeSupportedByBrowser(mimeType);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Based on https://developer.atlassian.com/platform/media/learning/file-previews/
|
|
2
|
+
export const isImageMimeTypeSupportedByServer = mimeType => ['image/bmp', 'image/x-windows-bmp', 'application/dicom', 'image/gif', 'image/jpeg', 'image/jpg', 'image/jp_', 'application/jpg', 'application/x-jpg', 'image/png', 'application/png', 'application/x-png', 'application/vnd.adobe.photoshop', 'image/vnd.adobe.photoshop', 'image/photoshop', 'image/x-photoshop', 'image/psd', 'application/photoshop', 'application/psd', 'zz-application/zz-winassoc-psd', 'image/tiff', 'image/x-tif', 'image/x-tiff', 'application/tif', 'application/x-tif', 'application/tiff', 'application/x-tiff', 'image/svg+xml', 'image/heif', 'image/heif-sequence', 'image/heic', 'image/heic-sequence'].indexOf(mimeType.toLowerCase()) > -1;
|
|
3
|
+
export const isDocumentMimeTypeSupportedByServer = mimeType => [// Adobe PDF
|
|
4
|
+
'application/pdf', 'application/x-pdf', 'application/acrobat', 'applications/vnd.pdf', 'text/pdf', 'text/x-pdf', // Adobe Illustrator
|
|
5
|
+
'application/vnd.adobe.illustrator', // Microsoft Office
|
|
6
|
+
'application/vnd.ms-office', // Microsoft Word
|
|
7
|
+
'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'application/vnd.ms-word.document.macroenabled.12', 'application/vnd.ms-word.template.macroenabled.12', // Microsoft Excel
|
|
8
|
+
'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', 'application/vnd.ms-excel.sheet.macroenabled.12', 'application/vnd.ms-excel.template.macroenabled.12', 'application/vnd.ms-excel.addin.macroenabled.12', 'application/vnd.ms-excel.sheet.macroenabled', 'application/vnd.ms-excel.template.macroenabled', 'application/vnd.ms-excel.addin.macroenabled', // Microsoft Powerpoint
|
|
9
|
+
'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/vnd.openxmlformats-officedocument.presentationml.template', 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'application/vnd.ms-powerpoint.presentation.macroenabled.12', 'application/vnd.ms-powerpoint.template.macroenabled.12', 'application/vnd.ms-powerpoint.slideshow.macroenabled.12', // OpenOffice
|
|
10
|
+
'application/vnd.sun.xml.writer', 'application/vnd.sun.xml.writer.template', // OpenDocument
|
|
11
|
+
'application/vnd.sun.xml.draw', 'application/vnd.sun.xml.draw.template', 'application/vnd.oasis.opendocument.graphics', 'application/vnd.oasis.opendocument.presentation', 'application/x-vnd.oasis.opendocument.presentation', 'application/vnd.sun.xml.calc', 'application/vnd.sun.xml.calc.template', 'application/vnd.oasis.opendocument.spreadsheet', 'application/x-vnd.oasis.opendocument.spreadsheet', 'application/vnd.oasis.opendocument.spreadsheet-template', 'application/vnd.oasis.opendocument.text', 'application/vnd.oasis.opendocument.text-template', 'application/vnd.oasis.opendocument.text-master', 'application/x-vnd.oasis.opendocument.text', 'application/x-vnd.oasis.opendocument.text-template', 'application/x-vnd.oasis.opendocument.text-master', // WordPerfect
|
|
12
|
+
'application/vnd.wordperfect', // Text files
|
|
13
|
+
'text/csv', 'text/x-diff', 'text/x-perl', 'text/x-python', 'text/x-ruby', 'text/rtf', 'text/richtext', 'text/plain', 'application/txt', // Rich text
|
|
14
|
+
'application/rtf', 'application/x-rtf', // PostScript
|
|
15
|
+
'application/postscript'].indexOf(mimeType.toLowerCase()) > -1;
|
|
16
|
+
export const isAudioMimeTypeSupportedByServer = mimeType => ['audio/aac', 'audio/x-hx-aac-adts', 'audio/vnd.dolby.dd-raw', 'audio/aiff', 'audio/x-aiff', 'audio/x-monkeys-audio', 'audio/x-ape', 'audio/basic', 'audio/flac', 'audio/mp4', 'audio/midi', 'audio/x-matroska', 'audio/x-mod', 'audio/mpeg', 'audio/ogg', 'audio/x-ogg', 'audio/x-pn-realaudio', 'audio/wav', 'audio/x-wav', 'audio/x-ms-wma'].indexOf(mimeType.toLowerCase()) > -1;
|
|
17
|
+
export const isVideoMimeTypeSupportedByServer = mimeType => ['video/3gpp', 'video/3gpp2', 'video/x-ms-asf', 'video/avi', 'video/msvideo', 'video/x-msvideo', 'video/x-dv', 'video/x-flv', 'video/m2ts', 'video/x-m4v', 'video/x-matroska', 'video/quicktime', 'video/mp4', 'video/mpeg', 'video/ogg', 'video/x-ogg', 'video/webm', 'video/x-ms-wmv'].indexOf(mimeType.toLowerCase()) > -1; // BMPT-620: The backend momentarily returns this mimeType for cloud files imported via dt-api-mediapicker
|
|
18
|
+
// Once these cloud files are processed they are receiving a more relevant mimeType
|
|
19
|
+
|
|
20
|
+
export const isUnknownMimeTypeSupportedByServer = mimeType => ['binary/octet-stream'].indexOf(mimeType.toLowerCase()) > -1;
|
|
21
|
+
export const isMimeTypeSupportedByServer = mimeType => isImageMimeTypeSupportedByServer(mimeType) || isDocumentMimeTypeSupportedByServer(mimeType) || isAudioMimeTypeSupportedByServer(mimeType) || isVideoMimeTypeSupportedByServer(mimeType) || isUnknownMimeTypeSupportedByServer(mimeType);
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
|
|
4
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
5
5
|
|
|
6
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7
7
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createRxjsNotice } from './rxjs-notice';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import SectionMessage from '@atlaskit/section-message';
|
|
3
|
+
export function createRxjsNotice(componentName) {
|
|
4
|
+
return /*#__PURE__*/React.createElement(SectionMessage, {
|
|
5
|
+
title: "RxJS compatilbity",
|
|
6
|
+
appearance: "warning"
|
|
7
|
+
}, /*#__PURE__*/React.createElement("p", null, componentName, " currently requires", ' ', /*#__PURE__*/React.createElement("a", {
|
|
8
|
+
href: "https://www.npmjs.com/package/rxjs/v/5.5.12"
|
|
9
|
+
}, "rxjs@^5.5.0"), " as peer dependency."));
|
|
10
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -6,4 +6,5 @@ export { getMediaFeatureFlag, defaultMediaFeatureFlags } from './mediaFeatureFla
|
|
|
6
6
|
// Analytics context
|
|
7
7
|
export { withMediaAnalyticsContext } from './analytics/withMediaAnalyticsContext'; // Analytics constants
|
|
8
8
|
|
|
9
|
-
export { ANALYTICS_MEDIA_CHANNEL } from './analytics/constants';
|
|
9
|
+
export { ANALYTICS_MEDIA_CHANNEL } from './analytics/constants';
|
|
10
|
+
export { getMediaTypeFromMimeType, isImageMimeTypeSupportedByBrowser, isDocumentMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser, isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer } from './mediaTypeUtils';
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { getLocalMediaFeatureFlag } from './mediaFeatureFlag-local';
|
|
1
|
+
import { getLocalMediaFeatureFlag } from './mediaFeatureFlag-local'; // Media feature flags - type and defaults defined here in one source of truth
|
|
2
|
+
|
|
2
3
|
// default values defined here, not necessary for components to know directly as they should use the function below
|
|
3
4
|
export var defaultMediaFeatureFlags = {
|
|
4
5
|
newCardExperience: false,
|
|
5
6
|
zipPreviews: false,
|
|
6
7
|
captions: false,
|
|
7
8
|
folderUploads: false,
|
|
8
|
-
codeViewer: false
|
|
9
|
-
poll_intervalMs: 3000,
|
|
10
|
-
poll_maxAttempts: 30,
|
|
11
|
-
poll_backoffFactor: 1.25,
|
|
12
|
-
poll_maxIntervalMs: 200000,
|
|
13
|
-
poll_maxGlobalFailures: 10
|
|
9
|
+
codeViewer: false
|
|
14
10
|
};
|
|
15
11
|
/**
|
|
16
12
|
* Public accessor from components to fallback to defaults if flags not passed,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { isArchive } from './isArchive';
|
|
2
|
+
import { isImageMimeTypeSupportedByBrowser, isDocumentMimeTypeSupportedByBrowser, isAudioMimeTypeSupportedByBrowser, isVideoMimeTypeSupportedByBrowser } from './isMimeTypeSupportedByBrowser';
|
|
3
|
+
import { isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer } from './isMimeTypeSupportedByServer';
|
|
4
|
+
export { isImageMimeTypeSupportedByBrowser, isDocumentMimeTypeSupportedByBrowser, isAudioMimeTypeSupportedByBrowser, isVideoMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser } from './isMimeTypeSupportedByBrowser';
|
|
5
|
+
export { isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer } from './isMimeTypeSupportedByServer';
|
|
6
|
+
export var getMediaTypeFromMimeType = function getMediaTypeFromMimeType(mimeType) {
|
|
7
|
+
if (isArchive(mimeType)) {
|
|
8
|
+
return 'archive';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (isImageMimeTypeSupportedByBrowser(mimeType) || isImageMimeTypeSupportedByServer(mimeType)) {
|
|
12
|
+
return 'image';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (isDocumentMimeTypeSupportedByBrowser(mimeType) || isDocumentMimeTypeSupportedByServer(mimeType)) {
|
|
16
|
+
return 'doc';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (isAudioMimeTypeSupportedByBrowser(mimeType) || isAudioMimeTypeSupportedByServer(mimeType)) {
|
|
20
|
+
return 'audio';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (isVideoMimeTypeSupportedByBrowser(mimeType) || isVideoMimeTypeSupportedByServer(mimeType)) {
|
|
24
|
+
return 'video';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return 'unknown';
|
|
28
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Based on https://en.wikipedia.org/wiki/List_of_archive_formats
|
|
2
|
+
export var isArchive = function isArchive(mimeType) {
|
|
3
|
+
return ['application/x-archive', 'application/x-cpio', 'application/x-shar', 'application/x-iso9660-image', 'application/x-sbx', 'application/x-tar', 'application/x-bzip2', 'application/gzip', 'application/x-gzip', 'application/x-lzip', 'application/x-lzma', 'application/x-lzop', 'application/x-snappy-framed', 'application/x-xz', 'application/x-compress', 'application/zstd', 'application/x-7z-compressed', 'application/x-ace-compressed', 'application/x-astrotite-afa', 'application/x-alz-compressed', 'application/vnd.android.package-archive', 'application/x-freearc', 'application/x-arj', 'application/x-b1', 'application/vnd.ms-cab-compressed', 'application/x-cfs-compressed', 'application/x-dar', 'application/x-dgc-compressed', 'application/x-apple-diskimage', 'application/x-gca-compressed', 'application/java-archive', 'application/x-lzh', 'application/x-lzx', 'application/x-rar-compressed', 'application/x-stuffit', 'application/x-stuffitx', 'application/x-gtar', 'application/x-ms-wim', 'application/x-xar', 'application/zip', 'application/x-zoo', 'application/x-par2'].indexOf(mimeType.toLowerCase()) > -1;
|
|
4
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Based on https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types
|
|
2
|
+
export var isImageMimeTypeSupportedByBrowser = function isImageMimeTypeSupportedByBrowser(mimeType) {
|
|
3
|
+
return ['image/apng', 'image/bmp', 'image/gif', 'image/x-icon', 'image/jpeg', 'image/png', 'image/webp' //'image/svg+xml', // Removed because of https://product-fabric.atlassian.net/browse/BMPT-625
|
|
4
|
+
].indexOf(mimeType.toLowerCase()) > -1;
|
|
5
|
+
};
|
|
6
|
+
export var isDocumentMimeTypeSupportedByBrowser = function isDocumentMimeTypeSupportedByBrowser(mimeType) {
|
|
7
|
+
return mimeType.toLowerCase() === 'application/pdf';
|
|
8
|
+
};
|
|
9
|
+
export var isAudioMimeTypeSupportedByBrowser = function isAudioMimeTypeSupportedByBrowser(mimeType) {
|
|
10
|
+
return ['audio/aac', 'audio/flac', 'audio/mp4', 'audio/mpeg', 'audio/ogg', 'audio/x-ogg', 'audio/wav', 'audio/x-wav'].indexOf(mimeType.toLowerCase()) > -1;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* For backward compatilbity, we assume MP4/MOV is natively supported.
|
|
14
|
+
* TODO: Improve detection of supported video formats by the browser.
|
|
15
|
+
*
|
|
16
|
+
* See related tickets:
|
|
17
|
+
* - https://product-fabric.atlassian.net/browse/MPT-477
|
|
18
|
+
* - https://product-fabric.atlassian.net/browse/EDM-634
|
|
19
|
+
* - https://product-fabric.atlassian.net/browse/EDM-426
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
export var isVideoMimeTypeSupportedByBrowser = function isVideoMimeTypeSupportedByBrowser(mimeType) {
|
|
23
|
+
return ['video/mp4', 'video/quicktime'].indexOf(mimeType.toLowerCase()) > -1;
|
|
24
|
+
};
|
|
25
|
+
export var isMimeTypeSupportedByBrowser = function isMimeTypeSupportedByBrowser(mimeType) {
|
|
26
|
+
return isDocumentMimeTypeSupportedByBrowser(mimeType) || isImageMimeTypeSupportedByBrowser(mimeType) || isAudioMimeTypeSupportedByBrowser(mimeType) || isVideoMimeTypeSupportedByBrowser(mimeType);
|
|
27
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Based on https://developer.atlassian.com/platform/media/learning/file-previews/
|
|
2
|
+
export var isImageMimeTypeSupportedByServer = function isImageMimeTypeSupportedByServer(mimeType) {
|
|
3
|
+
return ['image/bmp', 'image/x-windows-bmp', 'application/dicom', 'image/gif', 'image/jpeg', 'image/jpg', 'image/jp_', 'application/jpg', 'application/x-jpg', 'image/png', 'application/png', 'application/x-png', 'application/vnd.adobe.photoshop', 'image/vnd.adobe.photoshop', 'image/photoshop', 'image/x-photoshop', 'image/psd', 'application/photoshop', 'application/psd', 'zz-application/zz-winassoc-psd', 'image/tiff', 'image/x-tif', 'image/x-tiff', 'application/tif', 'application/x-tif', 'application/tiff', 'application/x-tiff', 'image/svg+xml', 'image/heif', 'image/heif-sequence', 'image/heic', 'image/heic-sequence'].indexOf(mimeType.toLowerCase()) > -1;
|
|
4
|
+
};
|
|
5
|
+
export var isDocumentMimeTypeSupportedByServer = function isDocumentMimeTypeSupportedByServer(mimeType) {
|
|
6
|
+
return [// Adobe PDF
|
|
7
|
+
'application/pdf', 'application/x-pdf', 'application/acrobat', 'applications/vnd.pdf', 'text/pdf', 'text/x-pdf', // Adobe Illustrator
|
|
8
|
+
'application/vnd.adobe.illustrator', // Microsoft Office
|
|
9
|
+
'application/vnd.ms-office', // Microsoft Word
|
|
10
|
+
'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'application/vnd.ms-word.document.macroenabled.12', 'application/vnd.ms-word.template.macroenabled.12', // Microsoft Excel
|
|
11
|
+
'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', 'application/vnd.ms-excel.sheet.macroenabled.12', 'application/vnd.ms-excel.template.macroenabled.12', 'application/vnd.ms-excel.addin.macroenabled.12', 'application/vnd.ms-excel.sheet.macroenabled', 'application/vnd.ms-excel.template.macroenabled', 'application/vnd.ms-excel.addin.macroenabled', // Microsoft Powerpoint
|
|
12
|
+
'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/vnd.openxmlformats-officedocument.presentationml.template', 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'application/vnd.ms-powerpoint.presentation.macroenabled.12', 'application/vnd.ms-powerpoint.template.macroenabled.12', 'application/vnd.ms-powerpoint.slideshow.macroenabled.12', // OpenOffice
|
|
13
|
+
'application/vnd.sun.xml.writer', 'application/vnd.sun.xml.writer.template', // OpenDocument
|
|
14
|
+
'application/vnd.sun.xml.draw', 'application/vnd.sun.xml.draw.template', 'application/vnd.oasis.opendocument.graphics', 'application/vnd.oasis.opendocument.presentation', 'application/x-vnd.oasis.opendocument.presentation', 'application/vnd.sun.xml.calc', 'application/vnd.sun.xml.calc.template', 'application/vnd.oasis.opendocument.spreadsheet', 'application/x-vnd.oasis.opendocument.spreadsheet', 'application/vnd.oasis.opendocument.spreadsheet-template', 'application/vnd.oasis.opendocument.text', 'application/vnd.oasis.opendocument.text-template', 'application/vnd.oasis.opendocument.text-master', 'application/x-vnd.oasis.opendocument.text', 'application/x-vnd.oasis.opendocument.text-template', 'application/x-vnd.oasis.opendocument.text-master', // WordPerfect
|
|
15
|
+
'application/vnd.wordperfect', // Text files
|
|
16
|
+
'text/csv', 'text/x-diff', 'text/x-perl', 'text/x-python', 'text/x-ruby', 'text/rtf', 'text/richtext', 'text/plain', 'application/txt', // Rich text
|
|
17
|
+
'application/rtf', 'application/x-rtf', // PostScript
|
|
18
|
+
'application/postscript'].indexOf(mimeType.toLowerCase()) > -1;
|
|
19
|
+
};
|
|
20
|
+
export var isAudioMimeTypeSupportedByServer = function isAudioMimeTypeSupportedByServer(mimeType) {
|
|
21
|
+
return ['audio/aac', 'audio/x-hx-aac-adts', 'audio/vnd.dolby.dd-raw', 'audio/aiff', 'audio/x-aiff', 'audio/x-monkeys-audio', 'audio/x-ape', 'audio/basic', 'audio/flac', 'audio/mp4', 'audio/midi', 'audio/x-matroska', 'audio/x-mod', 'audio/mpeg', 'audio/ogg', 'audio/x-ogg', 'audio/x-pn-realaudio', 'audio/wav', 'audio/x-wav', 'audio/x-ms-wma'].indexOf(mimeType.toLowerCase()) > -1;
|
|
22
|
+
};
|
|
23
|
+
export var isVideoMimeTypeSupportedByServer = function isVideoMimeTypeSupportedByServer(mimeType) {
|
|
24
|
+
return ['video/3gpp', 'video/3gpp2', 'video/x-ms-asf', 'video/avi', 'video/msvideo', 'video/x-msvideo', 'video/x-dv', 'video/x-flv', 'video/m2ts', 'video/x-m4v', 'video/x-matroska', 'video/quicktime', 'video/mp4', 'video/mpeg', 'video/ogg', 'video/x-ogg', 'video/webm', 'video/x-ms-wmv'].indexOf(mimeType.toLowerCase()) > -1;
|
|
25
|
+
}; // BMPT-620: The backend momentarily returns this mimeType for cloud files imported via dt-api-mediapicker
|
|
26
|
+
// Once these cloud files are processed they are receiving a more relevant mimeType
|
|
27
|
+
|
|
28
|
+
export var isUnknownMimeTypeSupportedByServer = function isUnknownMimeTypeSupportedByServer(mimeType) {
|
|
29
|
+
return ['binary/octet-stream'].indexOf(mimeType.toLowerCase()) > -1;
|
|
30
|
+
};
|
|
31
|
+
export var isMimeTypeSupportedByServer = function isMimeTypeSupportedByServer(mimeType) {
|
|
32
|
+
return isImageMimeTypeSupportedByServer(mimeType) || isDocumentMimeTypeSupportedByServer(mimeType) || isAudioMimeTypeSupportedByServer(mimeType) || isVideoMimeTypeSupportedByServer(mimeType) || isUnknownMimeTypeSupportedByServer(mimeType);
|
|
33
|
+
};
|
package/dist/esm/version.json
CHANGED
|
@@ -19,9 +19,18 @@ export declare type FileAttributes = {
|
|
|
19
19
|
fileSource?: string;
|
|
20
20
|
fileStatus?: FileStatus;
|
|
21
21
|
};
|
|
22
|
+
export declare type PerformanceAttributes = {
|
|
23
|
+
overall: {
|
|
24
|
+
durationSincePageStart: number;
|
|
25
|
+
durationSinceCommenced?: number;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
22
28
|
export declare type WithFileAttributes = {
|
|
23
29
|
fileAttributes: FileAttributes;
|
|
24
30
|
};
|
|
31
|
+
export declare type WithPerformanceAttributes = {
|
|
32
|
+
performanceAttributes?: PerformanceAttributes;
|
|
33
|
+
};
|
|
25
34
|
export declare type SuccessAttributes = {
|
|
26
35
|
status: 'success';
|
|
27
36
|
};
|
|
@@ -32,29 +41,32 @@ export declare type FailureAttributes = {
|
|
|
32
41
|
errorDetail?: string;
|
|
33
42
|
};
|
|
34
43
|
export declare type StatusAttributes = SuccessAttributes | FailureAttributes;
|
|
35
|
-
export declare type OperationalAttributes = BaseAttributes | (BaseAttributes & WithFileAttributes) | (BaseAttributes & WithFileAttributes & StatusAttributes);
|
|
44
|
+
export declare type OperationalAttributes = BaseAttributes | (BaseAttributes & WithFileAttributes) | (BaseAttributes & WithFileAttributes & StatusAttributes) | (BaseAttributes & WithFileAttributes & StatusAttributes & WithPerformanceAttributes);
|
|
36
45
|
export declare type OperationalEventPayload<Attributes extends OperationalAttributes, Action extends string, ActionSubject extends string, ActionSubjectId extends string = string> = BaseEventPayload<Attributes> & {
|
|
37
46
|
eventType: 'operational';
|
|
38
47
|
action: Action;
|
|
39
48
|
actionSubject: ActionSubject;
|
|
40
49
|
actionSubjectId?: ActionSubjectId;
|
|
41
50
|
};
|
|
42
|
-
export declare type UIAttributes = BaseAttributes;
|
|
51
|
+
export declare type UIAttributes = BaseAttributes | (BaseAttributes & WithFileAttributes);
|
|
43
52
|
export declare type UIEventPayload<Attributes extends UIAttributes, Action extends string, ActionSubject extends string> = BaseEventPayload<Attributes> & {
|
|
44
53
|
eventType: 'ui';
|
|
45
54
|
action: Action;
|
|
46
55
|
actionSubject: ActionSubject;
|
|
47
56
|
actionSubjectId?: string;
|
|
48
57
|
};
|
|
49
|
-
export declare type ScreenAttributes = BaseAttributes;
|
|
58
|
+
export declare type ScreenAttributes = BaseAttributes | (BaseAttributes & WithFileAttributes);
|
|
50
59
|
export declare type ScreenEventPayload<Attributes extends ScreenAttributes, ActionSubject extends string> = BaseEventPayload<Attributes> & {
|
|
51
60
|
eventType: 'screen';
|
|
52
61
|
actionSubject: ActionSubject;
|
|
53
62
|
name: ActionSubject;
|
|
54
63
|
};
|
|
55
|
-
export declare type TrackAttributes = BaseAttributes;
|
|
56
|
-
export declare type TrackEventPayload<Attributes extends TrackAttributes> = BaseEventPayload<Attributes> & {
|
|
64
|
+
export declare type TrackAttributes = BaseAttributes | (BaseAttributes & WithFileAttributes);
|
|
65
|
+
export declare type TrackEventPayload<Attributes extends TrackAttributes, Action extends string, ActionSubject extends string, ActionSubjectId extends string = string> = BaseEventPayload<Attributes> & {
|
|
57
66
|
eventType: 'track';
|
|
67
|
+
action: Action;
|
|
68
|
+
actionSubject: ActionSubject;
|
|
69
|
+
actionSubjectId?: ActionSubjectId;
|
|
58
70
|
};
|
|
59
71
|
export declare type ContextPublicAttributes = PackageAttributes;
|
|
60
72
|
export declare type ContextPrivateAttributes = WithMediaFeatureFlags;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createRxjsNotice } from './rxjs-notice';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createRxjsNotice(componentName: string): JSX.Element;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface NumericalCardDimensions {
|
|
|
7
7
|
width: number;
|
|
8
8
|
height: number;
|
|
9
9
|
}
|
|
10
|
-
export type { PackageAttributes, WithFileAttributes, FileAttributes, SuccessAttributes, FailureAttributes, OperationalAttributes, OperationalEventPayload, UIAttributes, UIEventPayload, ScreenAttributes, ScreenEventPayload, TrackAttributes, TrackEventPayload, ContextPublicAttributes, ContextStaticProps, } from './analytics/types';
|
|
10
|
+
export type { PackageAttributes, WithFileAttributes, WithPerformanceAttributes, FileAttributes, PerformanceAttributes, SuccessAttributes, FailureAttributes, OperationalAttributes, OperationalEventPayload, UIAttributes, UIEventPayload, ScreenAttributes, ScreenEventPayload, TrackAttributes, TrackEventPayload, ContextPublicAttributes, ContextStaticProps, } from './analytics/types';
|
|
11
11
|
export { withMediaAnalyticsContext } from './analytics/withMediaAnalyticsContext';
|
|
12
12
|
export { ANALYTICS_MEDIA_CHANNEL } from './analytics/constants';
|
|
13
|
+
export { getMediaTypeFromMimeType, isImageMimeTypeSupportedByBrowser, isDocumentMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser, isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer, } from './mediaTypeUtils';
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
export interface
|
|
2
|
-
poll_intervalMs?: number;
|
|
3
|
-
poll_maxAttempts?: number;
|
|
4
|
-
poll_backoffFactor?: number;
|
|
5
|
-
poll_maxIntervalMs?: number;
|
|
6
|
-
poll_maxGlobalFailures?: number;
|
|
7
|
-
}
|
|
8
|
-
export interface MediaFeatureFlags extends PollingOptions {
|
|
1
|
+
export interface MediaFeatureFlags {
|
|
9
2
|
newCardExperience?: boolean;
|
|
10
3
|
zipPreviews?: boolean;
|
|
11
4
|
captions?: boolean;
|
|
@@ -15,7 +8,7 @@ export interface MediaFeatureFlags extends PollingOptions {
|
|
|
15
8
|
export interface WithMediaFeatureFlags {
|
|
16
9
|
featureFlags?: MediaFeatureFlags;
|
|
17
10
|
}
|
|
18
|
-
export declare const defaultMediaFeatureFlags: MediaFeatureFlags
|
|
11
|
+
export declare const defaultMediaFeatureFlags: Required<MediaFeatureFlags>;
|
|
19
12
|
/**
|
|
20
13
|
* Public accessor from components to fallback to defaults if flags not passed,
|
|
21
14
|
* otherwise whatever product has set will be returned.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MediaType } from '..';
|
|
2
|
+
export { isImageMimeTypeSupportedByBrowser, isDocumentMimeTypeSupportedByBrowser, isAudioMimeTypeSupportedByBrowser, isVideoMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser, } from './isMimeTypeSupportedByBrowser';
|
|
3
|
+
export { isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer, } from './isMimeTypeSupportedByServer';
|
|
4
|
+
export declare const getMediaTypeFromMimeType: (mimeType: string) => MediaType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isArchive: (mimeType: string) => boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const isImageMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
2
|
+
export declare const isDocumentMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
3
|
+
export declare const isAudioMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
4
|
+
/**
|
|
5
|
+
* For backward compatilbity, we assume MP4/MOV is natively supported.
|
|
6
|
+
* TODO: Improve detection of supported video formats by the browser.
|
|
7
|
+
*
|
|
8
|
+
* See related tickets:
|
|
9
|
+
* - https://product-fabric.atlassian.net/browse/MPT-477
|
|
10
|
+
* - https://product-fabric.atlassian.net/browse/EDM-634
|
|
11
|
+
* - https://product-fabric.atlassian.net/browse/EDM-426
|
|
12
|
+
*/
|
|
13
|
+
export declare const isVideoMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
14
|
+
export declare const isMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const isImageMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
2
|
+
export declare const isDocumentMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
3
|
+
export declare const isAudioMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
4
|
+
export declare const isVideoMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
5
|
+
export declare const isUnknownMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
6
|
+
export declare const isMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/media-common/mediaTypeUtils",
|
|
3
|
+
"main": "../dist/cjs/mediaTypeUtils/index.js",
|
|
4
|
+
"module": "../dist/esm/mediaTypeUtils/index.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/mediaTypeUtils/index.js",
|
|
6
|
+
"types": "../dist/types/mediaTypeUtils/index.d.ts"
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-common",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.1",
|
|
4
4
|
"description": "Includes common utilities used by other media packages",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -18,10 +18,12 @@
|
|
|
18
18
|
"./downloadUrl": "./src/downloadUrl.ts",
|
|
19
19
|
"./mediaFeatureFlags": "./src/mediaFeatureFlags.ts",
|
|
20
20
|
"./analytics": "./src/analytics/index.ts",
|
|
21
|
+
"./docs": "./src/docs/index.ts",
|
|
22
|
+
"./mediaTypeUtils": "./src/mediaTypeUtils/index.ts",
|
|
21
23
|
".": "./src/index.ts"
|
|
22
24
|
},
|
|
23
25
|
"atlassian": {
|
|
24
|
-
"team": "Media
|
|
26
|
+
"team": "Media Experience",
|
|
25
27
|
"inPublicMirror": true,
|
|
26
28
|
"releaseModel": "scheduled",
|
|
27
29
|
"website": {
|
|
@@ -33,6 +35,7 @@
|
|
|
33
35
|
"@atlaskit/analytics-gas-types": "^5.0.5",
|
|
34
36
|
"@atlaskit/analytics-namespaced-context": "^6.2.0",
|
|
35
37
|
"@atlaskit/analytics-next": "^8.1.1",
|
|
38
|
+
"@atlaskit/section-message": "^6.0.0",
|
|
36
39
|
"@babel/runtime": "^7.0.0"
|
|
37
40
|
},
|
|
38
41
|
"peerDependencies": {
|
|
@@ -42,12 +45,12 @@
|
|
|
42
45
|
"devDependencies": {
|
|
43
46
|
"@atlaskit/docs": "*",
|
|
44
47
|
"@atlaskit/media-test-helpers": "^28.6.0",
|
|
45
|
-
"@atlassian/atlassian-frontend-prettier-config-1.0.
|
|
48
|
+
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
46
49
|
"enzyme": "^3.10.0",
|
|
47
50
|
"lodash": "^4.17.15",
|
|
48
51
|
"react": "^16.8.0",
|
|
49
52
|
"react-dom": "^16.8.0",
|
|
50
53
|
"typescript": "3.9.6"
|
|
51
54
|
},
|
|
52
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.
|
|
55
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
53
56
|
}
|