@atlaskit/media-common 2.16.4 → 2.18.0
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 +23 -0
- package/dist/cjs/docs/index.js +9 -1
- package/dist/cjs/docs/media-use-only.js +41 -0
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/mediaFeatureFlags/mediaFeatureFlags.js +0 -16
- package/dist/cjs/mediaFeatureFlags/productKeys.js +0 -2
- package/dist/cjs/utils/helpers.js +29 -10
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/docs/index.js +2 -1
- package/dist/es2019/docs/media-use-only.js +29 -0
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/mediaFeatureFlags/mediaFeatureFlags.js +0 -14
- package/dist/es2019/mediaFeatureFlags/productKeys.js +0 -2
- package/dist/es2019/utils/helpers.js +22 -6
- package/dist/es2019/version.json +1 -1
- package/dist/esm/docs/index.js +2 -1
- package/dist/esm/docs/media-use-only.js +31 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/mediaFeatureFlags/mediaFeatureFlags.js +0 -14
- package/dist/esm/mediaFeatureFlags/productKeys.js +0 -2
- package/dist/esm/utils/helpers.js +27 -8
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/types.d.ts +6 -2
- package/dist/types/docs/index.d.ts +1 -0
- package/dist/types/docs/media-use-only.d.ts +5 -0
- package/dist/types/index.d.ts +6 -2
- package/dist/types/mediaFeatureFlags/types.d.ts +0 -1
- package/dist/types/utils/helpers.d.ts +1 -5
- package/package.json +2 -9
- package/report.api.md +173 -124
- package/dist/types-ts4.0/analytics/constants.d.ts +0 -1
- package/dist/types-ts4.0/analytics/index.d.ts +0 -3
- package/dist/types-ts4.0/analytics/types.d.ts +0 -77
- package/dist/types-ts4.0/analytics/withMediaAnalyticsContext.d.ts +0 -18
- package/dist/types-ts4.0/docs/index.d.ts +0 -1
- package/dist/types-ts4.0/docs/rxjs-notice.d.ts +0 -2
- package/dist/types-ts4.0/downloadUrl.d.ts +0 -4
- package/dist/types-ts4.0/index.d.ts +0 -15
- package/dist/types-ts4.0/mediaFeatureFlag-local.d.ts +0 -1
- package/dist/types-ts4.0/mediaFeatureFlags/index.d.ts +0 -2
- package/dist/types-ts4.0/mediaFeatureFlags/mediaFeatureFlags.d.ts +0 -26
- package/dist/types-ts4.0/mediaFeatureFlags/productKeys.d.ts +0 -2
- package/dist/types-ts4.0/mediaFeatureFlags/types.d.ts +0 -21
- package/dist/types-ts4.0/mediaTypeUtils/index.d.ts +0 -4
- package/dist/types-ts4.0/mediaTypeUtils/isArchive.d.ts +0 -1
- package/dist/types-ts4.0/mediaTypeUtils/isMimeTypeSupportedByBrowser.d.ts +0 -14
- package/dist/types-ts4.0/mediaTypeUtils/isMimeTypeSupportedByServer.d.ts +0 -6
- package/dist/types-ts4.0/utils/helpers.d.ts +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/media-common
|
|
2
2
|
|
|
3
|
+
## 2.18.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`81573c1dfa7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/81573c1dfa7) - Items call creates a batched metadata trace Id
|
|
8
|
+
- [`0bccac57db6`](https://bitbucket.org/atlassian/atlassian-frontend/commits/0bccac57db6) - remove mediaUploadApiV2 Feature flag
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- [`a8eeb045e3a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a8eeb045e3a) - adding media only callouts to docs
|
|
13
|
+
- [`3d40d5e9b37`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3d40d5e9b37) - Refactor traceId generator getRandomHex function to avoid id collision
|
|
14
|
+
- [`10480433c71`](https://bitbucket.org/atlassian/atlassian-frontend/commits/10480433c71) - Fix getRandomHex function to mitigate the issue of lacking digits in hex value.
|
|
15
|
+
|
|
16
|
+
## 2.17.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- [`2c402e87213`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2c402e87213) - [Experimental] Add traceId in media card get image request.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [`19141d537a4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/19141d537a4) - Removes use of console.info in runtime
|
|
25
|
+
|
|
3
26
|
## 2.16.4
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/dist/cjs/docs/index.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "createMediaUseOnlyNotice", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _mediaUseOnly.createMediaUseOnlyNotice;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "createRxjsNotice", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function get() {
|
|
@@ -10,4 +16,6 @@ Object.defineProperty(exports, "createRxjsNotice", {
|
|
|
10
16
|
}
|
|
11
17
|
});
|
|
12
18
|
|
|
13
|
-
var _rxjsNotice = require("./rxjs-notice");
|
|
19
|
+
var _rxjsNotice = require("./rxjs-notice");
|
|
20
|
+
|
|
21
|
+
var _mediaUseOnly = require("./media-use-only");
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createMediaUseOnlyNotice = createMediaUseOnlyNotice;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _sectionMessage = _interopRequireDefault(require("@atlaskit/section-message"));
|
|
13
|
+
|
|
14
|
+
function AlternativePackagesMessage(_ref) {
|
|
15
|
+
var alternatePackages = _ref.alternatePackages;
|
|
16
|
+
|
|
17
|
+
if (!alternatePackages) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (alternatePackages.length === 1) {
|
|
22
|
+
return /*#__PURE__*/_react.default.createElement("p", null, "Consider using", ' ', /*#__PURE__*/_react.default.createElement("a", {
|
|
23
|
+
href: alternatePackages[0].link
|
|
24
|
+
}, alternatePackages[0].name), ' ', "instead.");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement("p", null, "Consider using one of these packages instead:", /*#__PURE__*/_react.default.createElement("ul", null, alternatePackages.map(function (p) {
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement("li", null, /*#__PURE__*/_react.default.createElement("a", {
|
|
29
|
+
href: p.link
|
|
30
|
+
}, p.name));
|
|
31
|
+
})));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function createMediaUseOnlyNotice(componentName, alternatePackages) {
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_sectionMessage.default, {
|
|
36
|
+
title: "Internal Media Use Only",
|
|
37
|
+
appearance: "error"
|
|
38
|
+
}, /*#__PURE__*/_react.default.createElement("p", null, componentName, " is intended for internal use by the Media Platform and as a transitive dependency of a media package within your product."), /*#__PURE__*/_react.default.createElement("p", null, "Direct use of this component is not supported."), /*#__PURE__*/_react.default.createElement(AlternativePackagesMessage, {
|
|
39
|
+
alternatePackages: alternatePackages
|
|
40
|
+
}));
|
|
41
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -57,6 +57,12 @@ Object.defineProperty(exports, "getMediaTypeFromMimeType", {
|
|
|
57
57
|
return _mediaTypeUtils.getMediaTypeFromMimeType;
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
+
Object.defineProperty(exports, "getRandomHex", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function get() {
|
|
63
|
+
return _helpers.getRandomHex;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
60
66
|
Object.defineProperty(exports, "isAudioMimeTypeSupportedByServer", {
|
|
61
67
|
enumerable: true,
|
|
62
68
|
get: function get() {
|
|
@@ -19,8 +19,6 @@ var _types = require("./types");
|
|
|
19
19
|
|
|
20
20
|
var _productKeys = require("./productKeys");
|
|
21
21
|
|
|
22
|
-
var _helpers = require("../utils/helpers");
|
|
23
|
-
|
|
24
22
|
var areEqualFeatureFlags = function areEqualFeatureFlags(ffA, ffB) {
|
|
25
23
|
if (!ffA && !ffB) {
|
|
26
24
|
return true;
|
|
@@ -37,7 +35,6 @@ var areEqualFeatureFlags = function areEqualFeatureFlags(ffA, ffB) {
|
|
|
37
35
|
folderUploads: ffA.folderUploads === ffB.folderUploads,
|
|
38
36
|
observedWidth: ffA.observedWidth === ffB.observedWidth,
|
|
39
37
|
timestampOnVideo: ffA.timestampOnVideo === ffB.timestampOnVideo,
|
|
40
|
-
mediaUploadApiV2: ffA.mediaUploadApiV2 === ffB.mediaUploadApiV2,
|
|
41
38
|
memoryCacheLogging: ffA.memoryCacheLogging === ffB.memoryCacheLogging
|
|
42
39
|
};
|
|
43
40
|
return Object.values(results).every(function (result) {
|
|
@@ -109,7 +106,6 @@ var defaultMediaFeatureFlags = {
|
|
|
109
106
|
folderUploads: false,
|
|
110
107
|
observedWidth: false,
|
|
111
108
|
timestampOnVideo: false,
|
|
112
|
-
mediaUploadApiV2: true,
|
|
113
109
|
memoryCacheLogging: false
|
|
114
110
|
};
|
|
115
111
|
/**
|
|
@@ -140,18 +136,6 @@ function getMediaFeatureFlag(flagName, featureFlags) {
|
|
|
140
136
|
|
|
141
137
|
return defaultMediaFeatureFlags[flagName];
|
|
142
138
|
}
|
|
143
|
-
/**
|
|
144
|
-
* do a check for any localStorage overrides, warn user once only
|
|
145
|
-
*/
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
Object.keys(defaultMediaFeatureFlags).forEach(function (flagName) {
|
|
149
|
-
var localOverride = (0, _mediaFeatureFlagLocal.getLocalMediaFeatureFlag)(flagName);
|
|
150
|
-
|
|
151
|
-
if (localOverride !== null) {
|
|
152
|
-
(0, _helpers.getConsole)().info("%c* LOCAL * MediaFeatureFlag.".concat(flagName, " = ").concat(localOverride), 'font-weight:bold;color:cyan');
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
139
|
|
|
156
140
|
var useMemoizeFeatureFlags = function useMemoizeFeatureFlags(featureFlags) {
|
|
157
141
|
var ref = (0, _react.useRef)();
|
|
@@ -14,7 +14,6 @@ var productKeys = {
|
|
|
14
14
|
observedWidth: '',
|
|
15
15
|
// TODO https://product-fabric.atlassian.net/browse/MEX-1620
|
|
16
16
|
timestampOnVideo: '',
|
|
17
|
-
mediaUploadApiV2: 'confluence.enable.media.upload.api.v2',
|
|
18
17
|
memoryCacheLogging: 'confluence-frontend-media-card-memory-cache-logging'
|
|
19
18
|
},
|
|
20
19
|
jira: {
|
|
@@ -27,7 +26,6 @@ var productKeys = {
|
|
|
27
26
|
observedWidth: '',
|
|
28
27
|
// TODO https://product-fabric.atlassian.net/browse/MEX-1620
|
|
29
28
|
timestampOnVideo: '',
|
|
30
|
-
mediaUploadApiV2: 'issue.details.enable-media-upload-api-version-2',
|
|
31
29
|
memoryCacheLogging: 'jira-frontend-media-card-memory-cache-logging'
|
|
32
30
|
}
|
|
33
31
|
};
|
|
@@ -5,7 +5,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.debounce = void 0;
|
|
9
|
+
exports.getRandomHex = getRandomHex;
|
|
10
|
+
exports.pick = exports.omitBy = exports.matches = exports.isUndefined = void 0;
|
|
11
|
+
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
13
|
|
|
10
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
15
|
|
|
@@ -75,14 +79,29 @@ var matches = function matches(srcObj) {
|
|
|
75
79
|
};
|
|
76
80
|
|
|
77
81
|
exports.matches = matches;
|
|
78
|
-
var fakeConsole = {
|
|
79
|
-
info: function info() {},
|
|
80
|
-
log: function log() {},
|
|
81
|
-
error: function error() {}
|
|
82
|
-
};
|
|
83
82
|
|
|
84
|
-
|
|
85
|
-
return
|
|
86
|
-
|
|
83
|
+
function getRandomHexValues(byte) {
|
|
84
|
+
return (0, _toConsumableArray2.default)(Array(byte * 2)).map(function () {
|
|
85
|
+
return Math.floor(Math.random() * 16).toString(16);
|
|
86
|
+
}).join('');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function getRandomHex(byte) {
|
|
90
|
+
var _window;
|
|
91
|
+
|
|
92
|
+
var randomHex;
|
|
93
|
+
|
|
94
|
+
if ((_window = window) !== null && _window !== void 0 && _window.crypto) {
|
|
95
|
+
try {
|
|
96
|
+
randomHex = Array.from(window.crypto.getRandomValues(new Uint8Array(byte))).map(function (b) {
|
|
97
|
+
return b.toString(16).padStart(2, '0');
|
|
98
|
+
}).join('');
|
|
99
|
+
} catch (e) {
|
|
100
|
+
randomHex = getRandomHexValues(byte);
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
randomHex = getRandomHexValues(byte);
|
|
104
|
+
}
|
|
87
105
|
|
|
88
|
-
|
|
106
|
+
return randomHex;
|
|
107
|
+
}
|
package/dist/cjs/version.json
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { createRxjsNotice } from './rxjs-notice';
|
|
1
|
+
export { createRxjsNotice } from './rxjs-notice';
|
|
2
|
+
export { createMediaUseOnlyNotice } from './media-use-only';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import SectionMessage from '@atlaskit/section-message';
|
|
3
|
+
|
|
4
|
+
function AlternativePackagesMessage({
|
|
5
|
+
alternatePackages
|
|
6
|
+
}) {
|
|
7
|
+
if (!alternatePackages) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (alternatePackages.length === 1) {
|
|
12
|
+
return /*#__PURE__*/React.createElement("p", null, "Consider using", ' ', /*#__PURE__*/React.createElement("a", {
|
|
13
|
+
href: alternatePackages[0].link
|
|
14
|
+
}, alternatePackages[0].name), ' ', "instead.");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return /*#__PURE__*/React.createElement("p", null, "Consider using one of these packages instead:", /*#__PURE__*/React.createElement("ul", null, alternatePackages.map(p => /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("a", {
|
|
18
|
+
href: p.link
|
|
19
|
+
}, p.name)))));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function createMediaUseOnlyNotice(componentName, alternatePackages) {
|
|
23
|
+
return /*#__PURE__*/React.createElement(SectionMessage, {
|
|
24
|
+
title: "Internal Media Use Only",
|
|
25
|
+
appearance: "error"
|
|
26
|
+
}, /*#__PURE__*/React.createElement("p", null, componentName, " is intended for internal use by the Media Platform and as a transitive dependency of a media package within your product."), /*#__PURE__*/React.createElement("p", null, "Direct use of this component is not supported."), /*#__PURE__*/React.createElement(AlternativePackagesMessage, {
|
|
27
|
+
alternatePackages: alternatePackages
|
|
28
|
+
}));
|
|
29
|
+
}
|
package/dist/es2019/index.js
CHANGED
|
@@ -8,4 +8,4 @@ export { withMediaAnalyticsContext } from './analytics/withMediaAnalyticsContext
|
|
|
8
8
|
|
|
9
9
|
export { ANALYTICS_MEDIA_CHANNEL } from './analytics/constants';
|
|
10
10
|
export { getMediaTypeFromMimeType, isImageMimeTypeSupportedByBrowser, isDocumentMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser, isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer } from './mediaTypeUtils';
|
|
11
|
-
export { isUndefined, pick, omitBy, debounce, matches } from './utils/helpers';
|
|
11
|
+
export { isUndefined, pick, omitBy, debounce, matches, getRandomHex } from './utils/helpers';
|
|
@@ -2,7 +2,6 @@ import { useRef } from 'react';
|
|
|
2
2
|
import { getLocalMediaFeatureFlag } from '../mediaFeatureFlag-local';
|
|
3
3
|
import { supportedProducts } from './types';
|
|
4
4
|
import { getProductKeys } from './productKeys';
|
|
5
|
-
import { getConsole } from '../utils/helpers';
|
|
6
5
|
export const areEqualFeatureFlags = (ffA, ffB) => {
|
|
7
6
|
if (!ffA && !ffB) {
|
|
8
7
|
return true;
|
|
@@ -19,7 +18,6 @@ export const areEqualFeatureFlags = (ffA, ffB) => {
|
|
|
19
18
|
folderUploads: ffA.folderUploads === ffB.folderUploads,
|
|
20
19
|
observedWidth: ffA.observedWidth === ffB.observedWidth,
|
|
21
20
|
timestampOnVideo: ffA.timestampOnVideo === ffB.timestampOnVideo,
|
|
22
|
-
mediaUploadApiV2: ffA.mediaUploadApiV2 === ffB.mediaUploadApiV2,
|
|
23
21
|
memoryCacheLogging: ffA.memoryCacheLogging === ffB.memoryCacheLogging
|
|
24
22
|
};
|
|
25
23
|
return Object.values(results).every(result => result);
|
|
@@ -59,7 +57,6 @@ export const defaultMediaFeatureFlags = {
|
|
|
59
57
|
folderUploads: false,
|
|
60
58
|
observedWidth: false,
|
|
61
59
|
timestampOnVideo: false,
|
|
62
|
-
mediaUploadApiV2: true,
|
|
63
60
|
memoryCacheLogging: false
|
|
64
61
|
};
|
|
65
62
|
/**
|
|
@@ -88,17 +85,6 @@ export function getMediaFeatureFlag(flagName, featureFlags) {
|
|
|
88
85
|
|
|
89
86
|
return defaultMediaFeatureFlags[flagName];
|
|
90
87
|
}
|
|
91
|
-
/**
|
|
92
|
-
* do a check for any localStorage overrides, warn user once only
|
|
93
|
-
*/
|
|
94
|
-
|
|
95
|
-
Object.keys(defaultMediaFeatureFlags).forEach(flagName => {
|
|
96
|
-
const localOverride = getLocalMediaFeatureFlag(flagName);
|
|
97
|
-
|
|
98
|
-
if (localOverride !== null) {
|
|
99
|
-
getConsole().info(`%c* LOCAL * MediaFeatureFlag.${flagName} = ${localOverride}`, 'font-weight:bold;color:cyan');
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
88
|
export const useMemoizeFeatureFlags = featureFlags => {
|
|
103
89
|
const ref = useRef();
|
|
104
90
|
|
|
@@ -8,7 +8,6 @@ const productKeys = {
|
|
|
8
8
|
observedWidth: '',
|
|
9
9
|
// TODO https://product-fabric.atlassian.net/browse/MEX-1620
|
|
10
10
|
timestampOnVideo: '',
|
|
11
|
-
mediaUploadApiV2: 'confluence.enable.media.upload.api.v2',
|
|
12
11
|
memoryCacheLogging: 'confluence-frontend-media-card-memory-cache-logging'
|
|
13
12
|
},
|
|
14
13
|
jira: {
|
|
@@ -21,7 +20,6 @@ const productKeys = {
|
|
|
21
20
|
observedWidth: '',
|
|
22
21
|
// TODO https://product-fabric.atlassian.net/browse/MEX-1620
|
|
23
22
|
timestampOnVideo: '',
|
|
24
|
-
mediaUploadApiV2: 'issue.details.enable-media-upload-api-version-2',
|
|
25
23
|
memoryCacheLogging: 'jira-frontend-media-card-memory-cache-logging'
|
|
26
24
|
}
|
|
27
25
|
};
|
|
@@ -27,9 +27,25 @@ export const matches = srcObj => {
|
|
|
27
27
|
return true;
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export
|
|
30
|
+
|
|
31
|
+
function getRandomHexValues(byte) {
|
|
32
|
+
return [...Array(byte * 2)].map(() => Math.floor(Math.random() * 16).toString(16)).join('');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function getRandomHex(byte) {
|
|
36
|
+
var _window;
|
|
37
|
+
|
|
38
|
+
let randomHex;
|
|
39
|
+
|
|
40
|
+
if ((_window = window) !== null && _window !== void 0 && _window.crypto) {
|
|
41
|
+
try {
|
|
42
|
+
randomHex = Array.from(window.crypto.getRandomValues(new Uint8Array(byte))).map(b => b.toString(16).padStart(2, '0')).join('');
|
|
43
|
+
} catch (e) {
|
|
44
|
+
randomHex = getRandomHexValues(byte);
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
randomHex = getRandomHexValues(byte);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return randomHex;
|
|
51
|
+
}
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/docs/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { createRxjsNotice } from './rxjs-notice';
|
|
1
|
+
export { createRxjsNotice } from './rxjs-notice';
|
|
2
|
+
export { createMediaUseOnlyNotice } from './media-use-only';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import SectionMessage from '@atlaskit/section-message';
|
|
3
|
+
|
|
4
|
+
function AlternativePackagesMessage(_ref) {
|
|
5
|
+
var alternatePackages = _ref.alternatePackages;
|
|
6
|
+
|
|
7
|
+
if (!alternatePackages) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (alternatePackages.length === 1) {
|
|
12
|
+
return /*#__PURE__*/React.createElement("p", null, "Consider using", ' ', /*#__PURE__*/React.createElement("a", {
|
|
13
|
+
href: alternatePackages[0].link
|
|
14
|
+
}, alternatePackages[0].name), ' ', "instead.");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return /*#__PURE__*/React.createElement("p", null, "Consider using one of these packages instead:", /*#__PURE__*/React.createElement("ul", null, alternatePackages.map(function (p) {
|
|
18
|
+
return /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("a", {
|
|
19
|
+
href: p.link
|
|
20
|
+
}, p.name));
|
|
21
|
+
})));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function createMediaUseOnlyNotice(componentName, alternatePackages) {
|
|
25
|
+
return /*#__PURE__*/React.createElement(SectionMessage, {
|
|
26
|
+
title: "Internal Media Use Only",
|
|
27
|
+
appearance: "error"
|
|
28
|
+
}, /*#__PURE__*/React.createElement("p", null, componentName, " is intended for internal use by the Media Platform and as a transitive dependency of a media package within your product."), /*#__PURE__*/React.createElement("p", null, "Direct use of this component is not supported."), /*#__PURE__*/React.createElement(AlternativePackagesMessage, {
|
|
29
|
+
alternatePackages: alternatePackages
|
|
30
|
+
}));
|
|
31
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -8,4 +8,4 @@ export { withMediaAnalyticsContext } from './analytics/withMediaAnalyticsContext
|
|
|
8
8
|
|
|
9
9
|
export { ANALYTICS_MEDIA_CHANNEL } from './analytics/constants';
|
|
10
10
|
export { getMediaTypeFromMimeType, isImageMimeTypeSupportedByBrowser, isDocumentMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser, isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer } from './mediaTypeUtils';
|
|
11
|
-
export { isUndefined, pick, omitBy, debounce, matches } from './utils/helpers';
|
|
11
|
+
export { isUndefined, pick, omitBy, debounce, matches, getRandomHex } from './utils/helpers';
|
|
@@ -3,7 +3,6 @@ import { useRef } from 'react';
|
|
|
3
3
|
import { getLocalMediaFeatureFlag } from '../mediaFeatureFlag-local';
|
|
4
4
|
import { supportedProducts } from './types';
|
|
5
5
|
import { getProductKeys } from './productKeys';
|
|
6
|
-
import { getConsole } from '../utils/helpers';
|
|
7
6
|
export var areEqualFeatureFlags = function areEqualFeatureFlags(ffA, ffB) {
|
|
8
7
|
if (!ffA && !ffB) {
|
|
9
8
|
return true;
|
|
@@ -20,7 +19,6 @@ export var areEqualFeatureFlags = function areEqualFeatureFlags(ffA, ffB) {
|
|
|
20
19
|
folderUploads: ffA.folderUploads === ffB.folderUploads,
|
|
21
20
|
observedWidth: ffA.observedWidth === ffB.observedWidth,
|
|
22
21
|
timestampOnVideo: ffA.timestampOnVideo === ffB.timestampOnVideo,
|
|
23
|
-
mediaUploadApiV2: ffA.mediaUploadApiV2 === ffB.mediaUploadApiV2,
|
|
24
22
|
memoryCacheLogging: ffA.memoryCacheLogging === ffB.memoryCacheLogging
|
|
25
23
|
};
|
|
26
24
|
return Object.values(results).every(function (result) {
|
|
@@ -81,7 +79,6 @@ export var defaultMediaFeatureFlags = {
|
|
|
81
79
|
folderUploads: false,
|
|
82
80
|
observedWidth: false,
|
|
83
81
|
timestampOnVideo: false,
|
|
84
|
-
mediaUploadApiV2: true,
|
|
85
82
|
memoryCacheLogging: false
|
|
86
83
|
};
|
|
87
84
|
/**
|
|
@@ -110,17 +107,6 @@ export function getMediaFeatureFlag(flagName, featureFlags) {
|
|
|
110
107
|
|
|
111
108
|
return defaultMediaFeatureFlags[flagName];
|
|
112
109
|
}
|
|
113
|
-
/**
|
|
114
|
-
* do a check for any localStorage overrides, warn user once only
|
|
115
|
-
*/
|
|
116
|
-
|
|
117
|
-
Object.keys(defaultMediaFeatureFlags).forEach(function (flagName) {
|
|
118
|
-
var localOverride = getLocalMediaFeatureFlag(flagName);
|
|
119
|
-
|
|
120
|
-
if (localOverride !== null) {
|
|
121
|
-
getConsole().info("%c* LOCAL * MediaFeatureFlag.".concat(flagName, " = ").concat(localOverride), 'font-weight:bold;color:cyan');
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
110
|
export var useMemoizeFeatureFlags = function useMemoizeFeatureFlags(featureFlags) {
|
|
125
111
|
var ref = useRef();
|
|
126
112
|
|
|
@@ -8,7 +8,6 @@ var productKeys = {
|
|
|
8
8
|
observedWidth: '',
|
|
9
9
|
// TODO https://product-fabric.atlassian.net/browse/MEX-1620
|
|
10
10
|
timestampOnVideo: '',
|
|
11
|
-
mediaUploadApiV2: 'confluence.enable.media.upload.api.v2',
|
|
12
11
|
memoryCacheLogging: 'confluence-frontend-media-card-memory-cache-logging'
|
|
13
12
|
},
|
|
14
13
|
jira: {
|
|
@@ -21,7 +20,6 @@ var productKeys = {
|
|
|
21
20
|
observedWidth: '',
|
|
22
21
|
// TODO https://product-fabric.atlassian.net/browse/MEX-1620
|
|
23
22
|
timestampOnVideo: '',
|
|
24
|
-
mediaUploadApiV2: 'issue.details.enable-media-upload-api-version-2',
|
|
25
23
|
memoryCacheLogging: 'jira-frontend-media-card-memory-cache-logging'
|
|
26
24
|
}
|
|
27
25
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
export var isUndefined = function isUndefined(value) {
|
|
3
4
|
return value === undefined;
|
|
@@ -51,11 +52,29 @@ export var matches = function matches(srcObj) {
|
|
|
51
52
|
return true;
|
|
52
53
|
};
|
|
53
54
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
|
|
56
|
+
function getRandomHexValues(byte) {
|
|
57
|
+
return _toConsumableArray(Array(byte * 2)).map(function () {
|
|
58
|
+
return Math.floor(Math.random() * 16).toString(16);
|
|
59
|
+
}).join('');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function getRandomHex(byte) {
|
|
63
|
+
var _window;
|
|
64
|
+
|
|
65
|
+
var randomHex;
|
|
66
|
+
|
|
67
|
+
if ((_window = window) !== null && _window !== void 0 && _window.crypto) {
|
|
68
|
+
try {
|
|
69
|
+
randomHex = Array.from(window.crypto.getRandomValues(new Uint8Array(byte))).map(function (b) {
|
|
70
|
+
return b.toString(16).padStart(2, '0');
|
|
71
|
+
}).join('');
|
|
72
|
+
} catch (e) {
|
|
73
|
+
randomHex = getRandomHexValues(byte);
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
randomHex = getRandomHexValues(byte);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return randomHex;
|
|
80
|
+
}
|
package/dist/esm/version.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GasCorePayload } from '@atlaskit/analytics-gas-types';
|
|
2
2
|
import { MEDIA_CONTEXT } from '@atlaskit/analytics-namespaced-context/MediaAnalyticsContext';
|
|
3
|
-
import { MediaType, FileStatus, WithMediaFeatureFlags } from '..';
|
|
3
|
+
import { MediaType, FileStatus, WithMediaFeatureFlags, MediaTraceContext } from '..';
|
|
4
4
|
export declare type BaseAttributes = {};
|
|
5
5
|
export declare type PackageAttributes = {
|
|
6
6
|
packageName: string;
|
|
@@ -31,6 +31,10 @@ export declare type WithFileAttributes = {
|
|
|
31
31
|
export declare type WithPerformanceAttributes = {
|
|
32
32
|
performanceAttributes?: PerformanceAttributes;
|
|
33
33
|
};
|
|
34
|
+
export declare type WithTraceContext = {
|
|
35
|
+
traceContext?: MediaTraceContext;
|
|
36
|
+
metadataTraceContext?: MediaTraceContext;
|
|
37
|
+
};
|
|
34
38
|
export declare type SuccessAttributes = {
|
|
35
39
|
status: 'success';
|
|
36
40
|
fileMediatype?: MediaType;
|
|
@@ -42,7 +46,7 @@ export declare type FailureAttributes = {
|
|
|
42
46
|
errorDetail?: string;
|
|
43
47
|
};
|
|
44
48
|
export declare type StatusAttributes = SuccessAttributes | FailureAttributes;
|
|
45
|
-
export declare type OperationalAttributes = BaseAttributes | (BaseAttributes & WithFileAttributes) | (BaseAttributes & WithFileAttributes & StatusAttributes) | (BaseAttributes & WithFileAttributes & StatusAttributes & WithPerformanceAttributes);
|
|
49
|
+
export declare type OperationalAttributes = BaseAttributes | (BaseAttributes & WithFileAttributes) | (BaseAttributes & WithFileAttributes & StatusAttributes) | (BaseAttributes & WithFileAttributes & StatusAttributes & WithPerformanceAttributes & WithTraceContext);
|
|
46
50
|
export declare type OperationalEventPayload<Attributes extends OperationalAttributes, Action extends string, ActionSubject extends string, ActionSubjectId extends string = string> = BaseEventPayload<Attributes> & {
|
|
47
51
|
eventType: 'operational';
|
|
48
52
|
action: Action;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,9 +7,13 @@ export interface NumericalCardDimensions {
|
|
|
7
7
|
width: number;
|
|
8
8
|
height: number;
|
|
9
9
|
}
|
|
10
|
-
export type { PackageAttributes, WithFileAttributes, WithPerformanceAttributes, FileAttributes, PerformanceAttributes, SuccessAttributes, FailureAttributes, OperationalAttributes, OperationalEventPayload, UIAttributes, UIEventPayload, ScreenAttributes, ScreenEventPayload, TrackAttributes, TrackEventPayload, ContextPublicAttributes, ContextStaticProps, } from './analytics/types';
|
|
10
|
+
export type { PackageAttributes, WithFileAttributes, WithPerformanceAttributes, WithTraceContext, 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
14
|
export declare type SSR = 'client' | 'server';
|
|
15
|
-
export { isUndefined, pick, omitBy, debounce, matches } from './utils/helpers';
|
|
15
|
+
export { isUndefined, pick, omitBy, debounce, matches, getRandomHex, } from './utils/helpers';
|
|
16
|
+
export declare type MediaTraceContext = {
|
|
17
|
+
traceId: string;
|
|
18
|
+
spanId?: string;
|
|
19
|
+
};
|
|
@@ -7,8 +7,4 @@ export declare const omitBy: (obj: Object, predicate: Function) => {
|
|
|
7
7
|
};
|
|
8
8
|
export declare const debounce: (func: Function, wait: number) => (...args: any[]) => void;
|
|
9
9
|
export declare const matches: (srcObj: Object) => (obj: Object) => boolean;
|
|
10
|
-
export declare
|
|
11
|
-
info: () => void;
|
|
12
|
-
log: () => void;
|
|
13
|
-
error: () => void;
|
|
14
|
-
} | Console;
|
|
10
|
+
export declare function getRandomHex(byte: number): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-common",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0",
|
|
4
4
|
"description": "Includes common utilities used by other media packages",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -12,13 +12,6 @@
|
|
|
12
12
|
"module": "dist/esm/index.js",
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
|
-
"typesVersions": {
|
|
16
|
-
">=4.0 <4.5": {
|
|
17
|
-
"*": [
|
|
18
|
-
"dist/types-ts4.0/*"
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
15
|
"sideEffects": false,
|
|
23
16
|
"atlaskit:src": "src/index.ts",
|
|
24
17
|
"af:exports": {
|
|
@@ -51,7 +44,7 @@
|
|
|
51
44
|
},
|
|
52
45
|
"devDependencies": {
|
|
53
46
|
"@atlaskit/docs": "*",
|
|
54
|
-
"@atlaskit/media-test-helpers": "^30.
|
|
47
|
+
"@atlaskit/media-test-helpers": "^30.1.0",
|
|
55
48
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
56
49
|
"enzyme": "^3.10.0",
|
|
57
50
|
"react": "^16.8.0",
|