@atlaskit/media-common 2.8.0 → 2.10.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 +38 -0
- package/dist/cjs/analytics/index.js +4 -4
- package/dist/cjs/index.js +32 -20
- package/dist/cjs/mediaFeatureFlags.js +44 -9
- package/dist/cjs/mediaTypeUtils/index.js +21 -21
- package/dist/cjs/mediaTypeUtils/isMimeTypeSupportedByBrowser.js +1 -1
- package/dist/cjs/mediaTypeUtils/isMimeTypeSupportedByServer.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/mediaFeatureFlags.js +35 -9
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/mediaFeatureFlags.js +37 -9
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/types.d.ts +17 -5
- package/dist/types/docs/rxjs-notice.d.ts +1 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/mediaFeatureFlags.d.ts +4 -9
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @atlaskit/media-common
|
|
2
2
|
|
|
3
|
+
## 2.10.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`c55c736ecea`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c55c736ecea) - Patch VULN AFP-3486 AFP-3487 AFP-3488 AFP-3489
|
|
8
|
+
|
|
9
|
+
## 2.10.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`f461edcfd05`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f461edcfd05) - Added a comparer helper for Media Feature Flags objects
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`fc70978492a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fc70978492a) - Using type for SSR prop to reduce dependency on media-common
|
|
18
|
+
- [`2b24fcc59f2`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2b24fcc59f2) - Removed Code Viewer and Zip Previews Feature Flags
|
|
19
|
+
- [`f461edcfd05`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f461edcfd05) - Update CardLoader to use react-loadable
|
|
20
|
+
Add SSR feature prop to be passed in renderer and media card
|
|
21
|
+
- [`01a41e75803`](https://bitbucket.org/atlassian/atlassian-frontend/commits/01a41e75803) - Removes `allowMediaInline` media prop and replaces with Inline Files feature flag for editor and mobile bridge
|
|
22
|
+
|
|
23
|
+
## 2.9.1
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- [`fe9ced0cd70`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fe9ced0cd70) - Removed feature flags for polling settings
|
|
28
|
+
|
|
29
|
+
## 2.9.0
|
|
30
|
+
|
|
31
|
+
### Minor Changes
|
|
32
|
+
|
|
33
|
+
- [`46d9d2872b4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/46d9d2872b4) - Video Analytics - Add UI events for CustomMediaPlayer
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- [`4777a174e6d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4777a174e6d) - Added analytics support for customMediaPlayer + screen event + entrypoint for locales
|
|
38
|
+
- [`b77bfe8e99c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b77bfe8e99c) - Add performance attributes to Commenced, Succeeded, Failed events for media card
|
|
39
|
+
- [`35d85025b4d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/35d85025b4d) - MEX-860 Changed base track events payload + added CustomMediaPlayerType
|
|
40
|
+
|
|
3
41
|
## 2.8.0
|
|
4
42
|
|
|
5
43
|
### Minor Changes
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "ANALYTICS_MEDIA_CHANNEL", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
|
-
return
|
|
9
|
+
return _constants.ANALYTICS_MEDIA_CHANNEL;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "withMediaAnalyticsContext", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function get() {
|
|
15
|
-
return
|
|
15
|
+
return _withMediaAnalyticsContext.withMediaAnalyticsContext;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "ANALYTICS_MEDIA_CHANNEL", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
|
-
return
|
|
9
|
+
return _constants.ANALYTICS_MEDIA_CHANNEL;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "areEqualFeatureFlags", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function get() {
|
|
15
|
-
return _mediaFeatureFlags.
|
|
15
|
+
return _mediaFeatureFlags.areEqualFeatureFlags;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "defaultMediaFeatureFlags", {
|
|
@@ -21,16 +21,16 @@ Object.defineProperty(exports, "defaultMediaFeatureFlags", {
|
|
|
21
21
|
return _mediaFeatureFlags.defaultMediaFeatureFlags;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
24
|
+
Object.defineProperty(exports, "downloadUrl", {
|
|
25
25
|
enumerable: true,
|
|
26
26
|
get: function get() {
|
|
27
|
-
return
|
|
27
|
+
return _downloadUrl.downloadUrl;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
Object.defineProperty(exports, "
|
|
30
|
+
Object.defineProperty(exports, "getMediaFeatureFlag", {
|
|
31
31
|
enumerable: true,
|
|
32
32
|
get: function get() {
|
|
33
|
-
return
|
|
33
|
+
return _mediaFeatureFlags.getMediaFeatureFlag;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "getMediaTypeFromMimeType", {
|
|
@@ -39,10 +39,10 @@ Object.defineProperty(exports, "getMediaTypeFromMimeType", {
|
|
|
39
39
|
return _mediaTypeUtils.getMediaTypeFromMimeType;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
-
Object.defineProperty(exports, "
|
|
42
|
+
Object.defineProperty(exports, "isAudioMimeTypeSupportedByServer", {
|
|
43
43
|
enumerable: true,
|
|
44
44
|
get: function get() {
|
|
45
|
-
return _mediaTypeUtils.
|
|
45
|
+
return _mediaTypeUtils.isAudioMimeTypeSupportedByServer;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "isDocumentMimeTypeSupportedByBrowser", {
|
|
@@ -51,10 +51,16 @@ Object.defineProperty(exports, "isDocumentMimeTypeSupportedByBrowser", {
|
|
|
51
51
|
return _mediaTypeUtils.isDocumentMimeTypeSupportedByBrowser;
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
-
Object.defineProperty(exports, "
|
|
54
|
+
Object.defineProperty(exports, "isDocumentMimeTypeSupportedByServer", {
|
|
55
55
|
enumerable: true,
|
|
56
56
|
get: function get() {
|
|
57
|
-
return _mediaTypeUtils.
|
|
57
|
+
return _mediaTypeUtils.isDocumentMimeTypeSupportedByServer;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "isImageMimeTypeSupportedByBrowser", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function get() {
|
|
63
|
+
return _mediaTypeUtils.isImageMimeTypeSupportedByBrowser;
|
|
58
64
|
}
|
|
59
65
|
});
|
|
60
66
|
Object.defineProperty(exports, "isImageMimeTypeSupportedByServer", {
|
|
@@ -63,16 +69,22 @@ Object.defineProperty(exports, "isImageMimeTypeSupportedByServer", {
|
|
|
63
69
|
return _mediaTypeUtils.isImageMimeTypeSupportedByServer;
|
|
64
70
|
}
|
|
65
71
|
});
|
|
66
|
-
Object.defineProperty(exports, "
|
|
72
|
+
Object.defineProperty(exports, "isMimeTypeSupportedByBrowser", {
|
|
67
73
|
enumerable: true,
|
|
68
74
|
get: function get() {
|
|
69
|
-
return _mediaTypeUtils.
|
|
75
|
+
return _mediaTypeUtils.isMimeTypeSupportedByBrowser;
|
|
70
76
|
}
|
|
71
77
|
});
|
|
72
|
-
Object.defineProperty(exports, "
|
|
78
|
+
Object.defineProperty(exports, "isMimeTypeSupportedByServer", {
|
|
73
79
|
enumerable: true,
|
|
74
80
|
get: function get() {
|
|
75
|
-
return _mediaTypeUtils.
|
|
81
|
+
return _mediaTypeUtils.isMimeTypeSupportedByServer;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "isUnknownMimeTypeSupportedByServer", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function get() {
|
|
87
|
+
return _mediaTypeUtils.isUnknownMimeTypeSupportedByServer;
|
|
76
88
|
}
|
|
77
89
|
});
|
|
78
90
|
Object.defineProperty(exports, "isVideoMimeTypeSupportedByServer", {
|
|
@@ -81,16 +93,16 @@ Object.defineProperty(exports, "isVideoMimeTypeSupportedByServer", {
|
|
|
81
93
|
return _mediaTypeUtils.isVideoMimeTypeSupportedByServer;
|
|
82
94
|
}
|
|
83
95
|
});
|
|
84
|
-
Object.defineProperty(exports, "
|
|
96
|
+
Object.defineProperty(exports, "useMemoizeFeatureFlags", {
|
|
85
97
|
enumerable: true,
|
|
86
98
|
get: function get() {
|
|
87
|
-
return
|
|
99
|
+
return _mediaFeatureFlags.useMemoizeFeatureFlags;
|
|
88
100
|
}
|
|
89
101
|
});
|
|
90
|
-
Object.defineProperty(exports, "
|
|
102
|
+
Object.defineProperty(exports, "withMediaAnalyticsContext", {
|
|
91
103
|
enumerable: true,
|
|
92
104
|
get: function get() {
|
|
93
|
-
return
|
|
105
|
+
return _withMediaAnalyticsContext.withMediaAnalyticsContext;
|
|
94
106
|
}
|
|
95
107
|
});
|
|
96
108
|
|
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.defaultMediaFeatureFlags = exports.areEqualFeatureFlags = void 0;
|
|
6
7
|
exports.getMediaFeatureFlag = getMediaFeatureFlag;
|
|
7
|
-
exports.
|
|
8
|
+
exports.useMemoizeFeatureFlags = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = require("react");
|
|
8
11
|
|
|
9
12
|
var _mediaFeatureFlagLocal = require("./mediaFeatureFlag-local");
|
|
10
13
|
|
|
11
14
|
// default values defined here, not necessary for components to know directly as they should use the function below
|
|
12
15
|
var defaultMediaFeatureFlags = {
|
|
13
16
|
newCardExperience: false,
|
|
14
|
-
zipPreviews: false,
|
|
15
17
|
captions: false,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
poll_backoffFactor: 1.25,
|
|
21
|
-
poll_maxIntervalMs: 200000
|
|
18
|
+
mediaInline: false,
|
|
19
|
+
// We can't yet switch this feature on
|
|
20
|
+
// TODO https://product-fabric.atlassian.net/browse/MEX-104
|
|
21
|
+
folderUploads: false
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
24
|
* Public accessor from components to fallback to defaults if flags not passed,
|
|
@@ -60,4 +60,39 @@ Object.keys(defaultMediaFeatureFlags).forEach(function (flagName) {
|
|
|
60
60
|
// eslint-disable-next-line no-console
|
|
61
61
|
console.info("%c* LOCAL * MediaFeatureFlag.".concat(flagName, " = ").concat(localOverride), 'font-weight:bold;color:cyan');
|
|
62
62
|
}
|
|
63
|
-
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
var areEqualFeatureFlags = function areEqualFeatureFlags(ffA, ffB) {
|
|
66
|
+
if (!ffA && !ffB) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (!ffA || !ffB) {
|
|
71
|
+
return false;
|
|
72
|
+
} // With this type we ensure this object will compare all the flags
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
var results = {
|
|
76
|
+
newCardExperience: ffA.newCardExperience === ffB.newCardExperience,
|
|
77
|
+
captions: ffA.captions === ffB.captions,
|
|
78
|
+
mediaInline: ffA.mediaInline === ffB.mediaInline,
|
|
79
|
+
folderUploads: ffA.folderUploads === ffB.folderUploads
|
|
80
|
+
};
|
|
81
|
+
return Object.values(results).every(function (result) {
|
|
82
|
+
return result;
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
exports.areEqualFeatureFlags = areEqualFeatureFlags;
|
|
87
|
+
|
|
88
|
+
var useMemoizeFeatureFlags = function useMemoizeFeatureFlags(featureFlags) {
|
|
89
|
+
var ref = (0, _react.useRef)();
|
|
90
|
+
|
|
91
|
+
if (!areEqualFeatureFlags(featureFlags, ref.current)) {
|
|
92
|
+
ref.current = featureFlags;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return ref.current;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
exports.useMemoizeFeatureFlags = useMemoizeFeatureFlags;
|
|
@@ -3,34 +3,35 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
6
|
+
exports.getMediaTypeFromMimeType = void 0;
|
|
7
|
+
Object.defineProperty(exports, "isAudioMimeTypeSupportedByBrowser", {
|
|
7
8
|
enumerable: true,
|
|
8
9
|
get: function get() {
|
|
9
|
-
return _isMimeTypeSupportedByBrowser.
|
|
10
|
+
return _isMimeTypeSupportedByBrowser.isAudioMimeTypeSupportedByBrowser;
|
|
10
11
|
}
|
|
11
12
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
13
|
+
Object.defineProperty(exports, "isAudioMimeTypeSupportedByServer", {
|
|
13
14
|
enumerable: true,
|
|
14
15
|
get: function get() {
|
|
15
|
-
return
|
|
16
|
+
return _isMimeTypeSupportedByServer.isAudioMimeTypeSupportedByServer;
|
|
16
17
|
}
|
|
17
18
|
});
|
|
18
|
-
Object.defineProperty(exports, "
|
|
19
|
+
Object.defineProperty(exports, "isDocumentMimeTypeSupportedByBrowser", {
|
|
19
20
|
enumerable: true,
|
|
20
21
|
get: function get() {
|
|
21
|
-
return _isMimeTypeSupportedByBrowser.
|
|
22
|
+
return _isMimeTypeSupportedByBrowser.isDocumentMimeTypeSupportedByBrowser;
|
|
22
23
|
}
|
|
23
24
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
25
|
+
Object.defineProperty(exports, "isDocumentMimeTypeSupportedByServer", {
|
|
25
26
|
enumerable: true,
|
|
26
27
|
get: function get() {
|
|
27
|
-
return
|
|
28
|
+
return _isMimeTypeSupportedByServer.isDocumentMimeTypeSupportedByServer;
|
|
28
29
|
}
|
|
29
30
|
});
|
|
30
|
-
Object.defineProperty(exports, "
|
|
31
|
+
Object.defineProperty(exports, "isImageMimeTypeSupportedByBrowser", {
|
|
31
32
|
enumerable: true,
|
|
32
33
|
get: function get() {
|
|
33
|
-
return _isMimeTypeSupportedByBrowser.
|
|
34
|
+
return _isMimeTypeSupportedByBrowser.isImageMimeTypeSupportedByBrowser;
|
|
34
35
|
}
|
|
35
36
|
});
|
|
36
37
|
Object.defineProperty(exports, "isImageMimeTypeSupportedByServer", {
|
|
@@ -39,37 +40,36 @@ Object.defineProperty(exports, "isImageMimeTypeSupportedByServer", {
|
|
|
39
40
|
return _isMimeTypeSupportedByServer.isImageMimeTypeSupportedByServer;
|
|
40
41
|
}
|
|
41
42
|
});
|
|
42
|
-
Object.defineProperty(exports, "
|
|
43
|
+
Object.defineProperty(exports, "isMimeTypeSupportedByBrowser", {
|
|
43
44
|
enumerable: true,
|
|
44
45
|
get: function get() {
|
|
45
|
-
return
|
|
46
|
+
return _isMimeTypeSupportedByBrowser.isMimeTypeSupportedByBrowser;
|
|
46
47
|
}
|
|
47
48
|
});
|
|
48
|
-
Object.defineProperty(exports, "
|
|
49
|
+
Object.defineProperty(exports, "isMimeTypeSupportedByServer", {
|
|
49
50
|
enumerable: true,
|
|
50
51
|
get: function get() {
|
|
51
|
-
return _isMimeTypeSupportedByServer.
|
|
52
|
+
return _isMimeTypeSupportedByServer.isMimeTypeSupportedByServer;
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
|
-
Object.defineProperty(exports, "
|
|
55
|
+
Object.defineProperty(exports, "isUnknownMimeTypeSupportedByServer", {
|
|
55
56
|
enumerable: true,
|
|
56
57
|
get: function get() {
|
|
57
|
-
return _isMimeTypeSupportedByServer.
|
|
58
|
+
return _isMimeTypeSupportedByServer.isUnknownMimeTypeSupportedByServer;
|
|
58
59
|
}
|
|
59
60
|
});
|
|
60
|
-
Object.defineProperty(exports, "
|
|
61
|
+
Object.defineProperty(exports, "isVideoMimeTypeSupportedByBrowser", {
|
|
61
62
|
enumerable: true,
|
|
62
63
|
get: function get() {
|
|
63
|
-
return
|
|
64
|
+
return _isMimeTypeSupportedByBrowser.isVideoMimeTypeSupportedByBrowser;
|
|
64
65
|
}
|
|
65
66
|
});
|
|
66
|
-
Object.defineProperty(exports, "
|
|
67
|
+
Object.defineProperty(exports, "isVideoMimeTypeSupportedByServer", {
|
|
67
68
|
enumerable: true,
|
|
68
69
|
get: function get() {
|
|
69
|
-
return _isMimeTypeSupportedByServer.
|
|
70
|
+
return _isMimeTypeSupportedByServer.isVideoMimeTypeSupportedByServer;
|
|
70
71
|
}
|
|
71
72
|
});
|
|
72
|
-
exports.getMediaTypeFromMimeType = void 0;
|
|
73
73
|
|
|
74
74
|
var _isArchive = require("./isArchive");
|
|
75
75
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.isVideoMimeTypeSupportedByBrowser = exports.isMimeTypeSupportedByBrowser = exports.isImageMimeTypeSupportedByBrowser = exports.isDocumentMimeTypeSupportedByBrowser = exports.isAudioMimeTypeSupportedByBrowser = void 0;
|
|
7
7
|
|
|
8
8
|
// Based on https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types
|
|
9
9
|
var isImageMimeTypeSupportedByBrowser = function isImageMimeTypeSupportedByBrowser(mimeType) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.isVideoMimeTypeSupportedByServer = exports.isUnknownMimeTypeSupportedByServer = exports.isMimeTypeSupportedByServer = exports.isImageMimeTypeSupportedByServer = exports.isDocumentMimeTypeSupportedByServer = exports.isAudioMimeTypeSupportedByServer = void 0;
|
|
7
7
|
|
|
8
8
|
// Based on https://developer.atlassian.com/platform/media/learning/file-previews/
|
|
9
9
|
var isImageMimeTypeSupportedByServer = function isImageMimeTypeSupportedByServer(mimeType) {
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { downloadUrl } from './downloadUrl'; // Warning! You can't add new media
|
|
|
2
2
|
// See packages/media/media-core/src/__tests__/cache-backward-compatibility.spec.ts
|
|
3
3
|
|
|
4
4
|
// Media Feature Flags
|
|
5
|
-
export { getMediaFeatureFlag, defaultMediaFeatureFlags } from './mediaFeatureFlags';
|
|
5
|
+
export { getMediaFeatureFlag, defaultMediaFeatureFlags, areEqualFeatureFlags, useMemoizeFeatureFlags } from './mediaFeatureFlags';
|
|
6
6
|
// Analytics context
|
|
7
7
|
export { withMediaAnalyticsContext } from './analytics/withMediaAnalyticsContext'; // Analytics constants
|
|
8
8
|
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
import { getLocalMediaFeatureFlag } from './mediaFeatureFlag-local'; // Media feature flags - type and defaults defined here in one source of truth
|
|
3
|
+
|
|
2
4
|
// default values defined here, not necessary for components to know directly as they should use the function below
|
|
3
5
|
export const defaultMediaFeatureFlags = {
|
|
4
6
|
newCardExperience: false,
|
|
5
|
-
zipPreviews: false,
|
|
6
7
|
captions: false,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
poll_backoffFactor: 1.25,
|
|
12
|
-
poll_maxIntervalMs: 200000
|
|
8
|
+
mediaInline: false,
|
|
9
|
+
// We can't yet switch this feature on
|
|
10
|
+
// TODO https://product-fabric.atlassian.net/browse/MEX-104
|
|
11
|
+
folderUploads: false
|
|
13
12
|
};
|
|
14
13
|
/**
|
|
15
14
|
* Public accessor from components to fallback to defaults if flags not passed,
|
|
@@ -48,4 +47,31 @@ Object.keys(defaultMediaFeatureFlags).forEach(flagName => {
|
|
|
48
47
|
// eslint-disable-next-line no-console
|
|
49
48
|
console.info(`%c* LOCAL * MediaFeatureFlag.${flagName} = ${localOverride}`, 'font-weight:bold;color:cyan');
|
|
50
49
|
}
|
|
51
|
-
});
|
|
50
|
+
});
|
|
51
|
+
export const areEqualFeatureFlags = (ffA, ffB) => {
|
|
52
|
+
if (!ffA && !ffB) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!ffA || !ffB) {
|
|
57
|
+
return false;
|
|
58
|
+
} // With this type we ensure this object will compare all the flags
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
const results = {
|
|
62
|
+
newCardExperience: ffA.newCardExperience === ffB.newCardExperience,
|
|
63
|
+
captions: ffA.captions === ffB.captions,
|
|
64
|
+
mediaInline: ffA.mediaInline === ffB.mediaInline,
|
|
65
|
+
folderUploads: ffA.folderUploads === ffB.folderUploads
|
|
66
|
+
};
|
|
67
|
+
return Object.values(results).every(result => result);
|
|
68
|
+
};
|
|
69
|
+
export const useMemoizeFeatureFlags = featureFlags => {
|
|
70
|
+
const ref = useRef();
|
|
71
|
+
|
|
72
|
+
if (!areEqualFeatureFlags(featureFlags, ref.current)) {
|
|
73
|
+
ref.current = featureFlags;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return ref.current;
|
|
77
|
+
};
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { downloadUrl } from './downloadUrl'; // Warning! You can't add new media
|
|
|
2
2
|
// See packages/media/media-core/src/__tests__/cache-backward-compatibility.spec.ts
|
|
3
3
|
|
|
4
4
|
// Media Feature Flags
|
|
5
|
-
export { getMediaFeatureFlag, defaultMediaFeatureFlags } from './mediaFeatureFlags';
|
|
5
|
+
export { getMediaFeatureFlag, defaultMediaFeatureFlags, areEqualFeatureFlags, useMemoizeFeatureFlags } from './mediaFeatureFlags';
|
|
6
6
|
// Analytics context
|
|
7
7
|
export { withMediaAnalyticsContext } from './analytics/withMediaAnalyticsContext'; // Analytics constants
|
|
8
8
|
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
import { getLocalMediaFeatureFlag } from './mediaFeatureFlag-local'; // Media feature flags - type and defaults defined here in one source of truth
|
|
3
|
+
|
|
2
4
|
// default values defined here, not necessary for components to know directly as they should use the function below
|
|
3
5
|
export var defaultMediaFeatureFlags = {
|
|
4
6
|
newCardExperience: false,
|
|
5
|
-
zipPreviews: false,
|
|
6
7
|
captions: false,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
poll_backoffFactor: 1.25,
|
|
12
|
-
poll_maxIntervalMs: 200000
|
|
8
|
+
mediaInline: false,
|
|
9
|
+
// We can't yet switch this feature on
|
|
10
|
+
// TODO https://product-fabric.atlassian.net/browse/MEX-104
|
|
11
|
+
folderUploads: false
|
|
13
12
|
};
|
|
14
13
|
/**
|
|
15
14
|
* Public accessor from components to fallback to defaults if flags not passed,
|
|
@@ -48,4 +47,33 @@ Object.keys(defaultMediaFeatureFlags).forEach(function (flagName) {
|
|
|
48
47
|
// eslint-disable-next-line no-console
|
|
49
48
|
console.info("%c* LOCAL * MediaFeatureFlag.".concat(flagName, " = ").concat(localOverride), 'font-weight:bold;color:cyan');
|
|
50
49
|
}
|
|
51
|
-
});
|
|
50
|
+
});
|
|
51
|
+
export var areEqualFeatureFlags = function areEqualFeatureFlags(ffA, ffB) {
|
|
52
|
+
if (!ffA && !ffB) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!ffA || !ffB) {
|
|
57
|
+
return false;
|
|
58
|
+
} // With this type we ensure this object will compare all the flags
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
var results = {
|
|
62
|
+
newCardExperience: ffA.newCardExperience === ffB.newCardExperience,
|
|
63
|
+
captions: ffA.captions === ffB.captions,
|
|
64
|
+
mediaInline: ffA.mediaInline === ffB.mediaInline,
|
|
65
|
+
folderUploads: ffA.folderUploads === ffB.folderUploads
|
|
66
|
+
};
|
|
67
|
+
return Object.values(results).every(function (result) {
|
|
68
|
+
return result;
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
export var useMemoizeFeatureFlags = function useMemoizeFeatureFlags(featureFlags) {
|
|
72
|
+
var ref = useRef();
|
|
73
|
+
|
|
74
|
+
if (!areEqualFeatureFlags(featureFlags, ref.current)) {
|
|
75
|
+
ref.current = featureFlags;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return ref.current;
|
|
79
|
+
};
|
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;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
export { downloadUrl } from './downloadUrl';
|
|
2
2
|
export declare type MediaType = 'doc' | 'audio' | 'video' | 'image' | 'archive' | 'unknown';
|
|
3
3
|
export declare type FileStatus = 'uploading' | 'processing' | 'processed' | 'error' | 'failed-processing';
|
|
4
|
-
export { getMediaFeatureFlag, defaultMediaFeatureFlags, } from './mediaFeatureFlags';
|
|
4
|
+
export { getMediaFeatureFlag, defaultMediaFeatureFlags, areEqualFeatureFlags, useMemoizeFeatureFlags, } from './mediaFeatureFlags';
|
|
5
5
|
export type { MediaFeatureFlags, WithMediaFeatureFlags, } from './mediaFeatureFlags';
|
|
6
6
|
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
13
|
export { getMediaTypeFromMimeType, isImageMimeTypeSupportedByBrowser, isDocumentMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser, isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer, } from './mediaTypeUtils';
|
|
14
|
+
export declare type SSR = 'client' | 'server';
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
export interface
|
|
2
|
-
poll_intervalMs?: number;
|
|
3
|
-
poll_maxAttempts?: number;
|
|
4
|
-
poll_backoffFactor?: number;
|
|
5
|
-
poll_maxIntervalMs?: number;
|
|
6
|
-
}
|
|
7
|
-
export interface MediaFeatureFlags extends PollingOptions {
|
|
1
|
+
export interface MediaFeatureFlags {
|
|
8
2
|
newCardExperience?: boolean;
|
|
9
|
-
zipPreviews?: boolean;
|
|
10
3
|
captions?: boolean;
|
|
4
|
+
mediaInline?: boolean;
|
|
11
5
|
folderUploads?: boolean;
|
|
12
|
-
codeViewer?: boolean;
|
|
13
6
|
}
|
|
14
7
|
export interface WithMediaFeatureFlags {
|
|
15
8
|
featureFlags?: MediaFeatureFlags;
|
|
@@ -26,3 +19,5 @@ export declare const defaultMediaFeatureFlags: Required<MediaFeatureFlags>;
|
|
|
26
19
|
* (you will see a warning in console if override used)
|
|
27
20
|
* */
|
|
28
21
|
export declare function getMediaFeatureFlag<T = boolean>(flagName: keyof MediaFeatureFlags, featureFlags?: MediaFeatureFlags): T;
|
|
22
|
+
export declare const areEqualFeatureFlags: (ffA?: MediaFeatureFlags | undefined, ffB?: MediaFeatureFlags | undefined) => boolean;
|
|
23
|
+
export declare const useMemoizeFeatureFlags: (featureFlags?: MediaFeatureFlags | undefined) => MediaFeatureFlags | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-common",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.1",
|
|
4
4
|
"description": "Includes common utilities used by other media packages",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
".": "./src/index.ts"
|
|
24
24
|
},
|
|
25
25
|
"atlassian": {
|
|
26
|
-
"team": "Media
|
|
26
|
+
"team": "Media Experience",
|
|
27
27
|
"inPublicMirror": true,
|
|
28
28
|
"releaseModel": "scheduled",
|
|
29
29
|
"website": {
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@atlaskit/docs": "*",
|
|
47
|
-
"@atlaskit/media-test-helpers": "^
|
|
47
|
+
"@atlaskit/media-test-helpers": "^29.0.0",
|
|
48
48
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
49
49
|
"enzyme": "^3.10.0",
|
|
50
|
-
"lodash": "^4.17.
|
|
50
|
+
"lodash": "^4.17.21",
|
|
51
51
|
"react": "^16.8.0",
|
|
52
52
|
"react-dom": "^16.8.0",
|
|
53
53
|
"typescript": "3.9.6"
|