@atlaskit/media-common 11.0.0 → 11.1.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 +12 -0
- package/analytics/package.json +1 -1
- package/dist/cjs/analytics/index.js +8 -1
- package/dist/cjs/analytics/sanitisePayload.js +20 -0
- package/dist/cjs/analytics/withMediaAnalyticsContext.js +2 -2
- package/dist/cjs/docs/singleton-notice.js +1 -1
- package/dist/es2019/analytics/index.js +2 -1
- package/dist/es2019/analytics/sanitisePayload.js +10 -0
- package/dist/es2019/analytics/types.js +4 -0
- package/dist/es2019/docs/singleton-notice.js +1 -1
- package/dist/es2019/index.js +1 -0
- package/dist/esm/analytics/index.js +2 -1
- package/dist/esm/analytics/sanitisePayload.js +13 -0
- package/dist/esm/analytics/types.js +4 -0
- package/dist/esm/docs/singleton-notice.js +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/types/analytics/index.d.ts +2 -1
- package/dist/types/analytics/sanitisePayload.d.ts +1 -0
- package/dist/types/analytics/types.d.ts +5 -1
- package/dist/types/index.d.ts +1 -5
- package/dist/types-ts4.5/analytics/index.d.ts +2 -1
- package/dist/types-ts4.5/analytics/sanitisePayload.d.ts +1 -0
- package/dist/types-ts4.5/analytics/types.d.ts +5 -1
- package/dist/types-ts4.5/index.d.ts +1 -5
- package/downloadUrl/package.json +1 -1
- package/mediaFeatureFlags/package.json +1 -1
- package/mediaTypeUtils/package.json +1 -1
- package/package.json +10 -9
- package/test-helpers/package.json +1 -1
- package/tmp/api-report-tmp.d.ts +0 -250
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/media-common
|
|
2
2
|
|
|
3
|
+
## 11.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#83116](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83116) [`8d4e99057fe0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d4e99057fe0) - Upgrade Typescript from `4.9.5` to `5.4.2`
|
|
8
|
+
|
|
9
|
+
## 11.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#80866](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80866) [`4ecbec4ed2f1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4ecbec4ed2f1) - Exposes utility to sanitise event log payloads
|
|
14
|
+
|
|
3
15
|
## 11.0.0
|
|
4
16
|
|
|
5
17
|
### Major Changes
|
package/analytics/package.json
CHANGED
|
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "ANALYTICS_MEDIA_CHANNEL", {
|
|
|
9
9
|
return _constants.ANALYTICS_MEDIA_CHANNEL;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "sanitiseAnalyticsPayload", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _sanitisePayload.sanitiseAnalyticsPayload;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
12
18
|
Object.defineProperty(exports, "withMediaAnalyticsContext", {
|
|
13
19
|
enumerable: true,
|
|
14
20
|
get: function get() {
|
|
@@ -16,4 +22,5 @@ Object.defineProperty(exports, "withMediaAnalyticsContext", {
|
|
|
16
22
|
}
|
|
17
23
|
});
|
|
18
24
|
var _withMediaAnalyticsContext = require("./withMediaAnalyticsContext");
|
|
19
|
-
var _constants = require("./constants");
|
|
25
|
+
var _constants = require("./constants");
|
|
26
|
+
var _sanitisePayload = require("./sanitisePayload");
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.sanitiseAnalyticsPayload = void 0;
|
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
+
var _uuidValidate = _interopRequireDefault(require("uuid-validate"));
|
|
10
|
+
var _immer = require("immer");
|
|
11
|
+
var sanitiseFileId = function sanitiseFileId(draft) {
|
|
12
|
+
var fileId = draft.attributes.fileAttributes.fileId;
|
|
13
|
+
draft.attributes.fileAttributes.fileId = (0, _uuidValidate.default)(fileId) ? fileId : 'INVALID_FILE_ID';
|
|
14
|
+
};
|
|
15
|
+
var hasFileAttributesWithFileId = function hasFileAttributesWithFileId(payload) {
|
|
16
|
+
return 'attributes' in payload && !!payload.attributes && (0, _typeof2.default)(payload.attributes) === 'object' && 'fileAttributes' in payload.attributes && !!payload.attributes.fileAttributes && (0, _typeof2.default)(payload.attributes.fileAttributes) === 'object' && 'fileId' in payload.attributes.fileAttributes && typeof payload.attributes.fileAttributes.fileId === 'string';
|
|
17
|
+
};
|
|
18
|
+
var sanitiseAnalyticsPayload = exports.sanitiseAnalyticsPayload = function sanitiseAnalyticsPayload(payload) {
|
|
19
|
+
return hasFileAttributesWithFileId(payload) ? (0, _immer.produce)(payload, sanitiseFileId) : payload;
|
|
20
|
+
};
|
|
@@ -11,8 +11,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
13
13
|
var _MediaAnalyticsContext = require("@atlaskit/analytics-namespaced-context/MediaAnalyticsContext");
|
|
14
|
-
function _getRequireWildcardCache(
|
|
15
|
-
function _interopRequireWildcard(
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
18
|
/**
|
|
@@ -15,5 +15,5 @@ function createSingletonNotice(componentName) {
|
|
|
15
15
|
}, /*#__PURE__*/_react.default.createElement("p", null, "Having multiple versions of ", componentName, " installed can result in potential issues, such as media preview failures."), /*#__PURE__*/_react.default.createElement("p", null, "You must ensure that your application dependencies only resolve to a unique package version, if you are:", /*#__PURE__*/_react.default.createElement("ul", null, /*#__PURE__*/_react.default.createElement("li", null, /*#__PURE__*/_react.default.createElement("b", null, "A platform consumer"), " \u2014 i.e. you are using ", componentName, ' ', "directly in a npm package, for instance in a monorepository. Define", ' ', componentName, " in your package.json file as a", ' ', /*#__PURE__*/_react.default.createElement("code", null, "peerDependency"), " and ", /*#__PURE__*/_react.default.createElement("code", null, "devDependency"), " (for local testing)."), /*#__PURE__*/_react.default.createElement("li", null, /*#__PURE__*/_react.default.createElement("b", null, "A product consumer"), " \u2014 i.e. you are working directly into your application. Define ", componentName, " in your package.json file as a direct dependency."))), /*#__PURE__*/_react.default.createElement("p", null, "If you have any questions or need assistance in consuming this package correctly, please reach out to the", ' ', /*#__PURE__*/_react.default.createElement("a", {
|
|
16
16
|
href: "https://atlassian.slack.com/archives/C020CGJDJ3A",
|
|
17
17
|
target: "_blank"
|
|
18
|
-
}, "#help-media-
|
|
18
|
+
}, "#help-media-platform"), ' ', "channel."));
|
|
19
19
|
}
|
|
@@ -4,4 +4,5 @@
|
|
|
4
4
|
export { withMediaAnalyticsContext } from './withMediaAnalyticsContext';
|
|
5
5
|
|
|
6
6
|
// Analytics constants
|
|
7
|
-
export { ANALYTICS_MEDIA_CHANNEL } from './constants';
|
|
7
|
+
export { ANALYTICS_MEDIA_CHANNEL } from './constants';
|
|
8
|
+
export { sanitiseAnalyticsPayload } from './sanitisePayload';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import isValidId from 'uuid-validate';
|
|
2
|
+
import { produce } from 'immer';
|
|
3
|
+
const sanitiseFileId = draft => {
|
|
4
|
+
const {
|
|
5
|
+
fileId
|
|
6
|
+
} = draft.attributes.fileAttributes;
|
|
7
|
+
draft.attributes.fileAttributes.fileId = isValidId(fileId) ? fileId : 'INVALID_FILE_ID';
|
|
8
|
+
};
|
|
9
|
+
const hasFileAttributesWithFileId = payload => 'attributes' in payload && !!payload.attributes && typeof payload.attributes === 'object' && 'fileAttributes' in payload.attributes && !!payload.attributes.fileAttributes && typeof payload.attributes.fileAttributes === 'object' && 'fileId' in payload.attributes.fileAttributes && typeof payload.attributes.fileAttributes.fileId === 'string';
|
|
10
|
+
export const sanitiseAnalyticsPayload = payload => hasFileAttributesWithFileId(payload) ? produce(payload, sanitiseFileId) : payload;
|
|
@@ -6,10 +6,14 @@ import { MEDIA_CONTEXT } from '@atlaskit/analytics-namespaced-context/MediaAnaly
|
|
|
6
6
|
|
|
7
7
|
// Operational Events ...
|
|
8
8
|
// https://hello.atlassian.net/wiki/spaces/MEASURE/pages/134329315/Operational+Events
|
|
9
|
+
|
|
9
10
|
// UI Events ...
|
|
10
11
|
// https://hello.atlassian.net/wiki/spaces/MEASURE/pages/134329336/UI+Events
|
|
12
|
+
|
|
11
13
|
// Screen Events ...
|
|
12
14
|
// https://hello.atlassian.net/wiki/spaces/MEASURE/pages/134329341/Screen+Events
|
|
15
|
+
|
|
13
16
|
// Track Events ...
|
|
14
17
|
// https://hello.atlassian.net/wiki/spaces/MEASURE/pages/134329319/Track+Events
|
|
18
|
+
|
|
15
19
|
// Media Analytics Context Types
|
|
@@ -8,5 +8,5 @@ export function createSingletonNotice(componentName) {
|
|
|
8
8
|
}, /*#__PURE__*/React.createElement("p", null, "Having multiple versions of ", componentName, " installed can result in potential issues, such as media preview failures."), /*#__PURE__*/React.createElement("p", null, "You must ensure that your application dependencies only resolve to a unique package version, if you are:", /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("b", null, "A platform consumer"), " \u2014 i.e. you are using ", componentName, ' ', "directly in a npm package, for instance in a monorepository. Define", ' ', componentName, " in your package.json file as a", ' ', /*#__PURE__*/React.createElement("code", null, "peerDependency"), " and ", /*#__PURE__*/React.createElement("code", null, "devDependency"), " (for local testing)."), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("b", null, "A product consumer"), " \u2014 i.e. you are working directly into your application. Define ", componentName, " in your package.json file as a direct dependency."))), /*#__PURE__*/React.createElement("p", null, "If you have any questions or need assistance in consuming this package correctly, please reach out to the", ' ', /*#__PURE__*/React.createElement("a", {
|
|
9
9
|
href: "https://atlassian.slack.com/archives/C020CGJDJ3A",
|
|
10
10
|
target: "_blank"
|
|
11
|
-
}, "#help-media-
|
|
11
|
+
}, "#help-media-platform"), ' ', "channel."));
|
|
12
12
|
}
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { downloadUrl } from './downloadUrl';
|
|
2
2
|
// Warning! You can't add new media types!
|
|
3
3
|
// See packages/media/media-core/src/__tests__/cache-backward-compatibility.spec.ts
|
|
4
|
+
|
|
4
5
|
// Media Feature Flags
|
|
5
6
|
export { getMediaFeatureFlag, defaultMediaFeatureFlags, filterFeatureFlagNames, getFeatureFlagKeysAllProducts } from './mediaFeatureFlags';
|
|
6
7
|
|
|
@@ -4,4 +4,5 @@
|
|
|
4
4
|
export { withMediaAnalyticsContext } from './withMediaAnalyticsContext';
|
|
5
5
|
|
|
6
6
|
// Analytics constants
|
|
7
|
-
export { ANALYTICS_MEDIA_CHANNEL } from './constants';
|
|
7
|
+
export { ANALYTICS_MEDIA_CHANNEL } from './constants';
|
|
8
|
+
export { sanitiseAnalyticsPayload } from './sanitisePayload';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
import isValidId from 'uuid-validate';
|
|
3
|
+
import { produce } from 'immer';
|
|
4
|
+
var sanitiseFileId = function sanitiseFileId(draft) {
|
|
5
|
+
var fileId = draft.attributes.fileAttributes.fileId;
|
|
6
|
+
draft.attributes.fileAttributes.fileId = isValidId(fileId) ? fileId : 'INVALID_FILE_ID';
|
|
7
|
+
};
|
|
8
|
+
var hasFileAttributesWithFileId = function hasFileAttributesWithFileId(payload) {
|
|
9
|
+
return 'attributes' in payload && !!payload.attributes && _typeof(payload.attributes) === 'object' && 'fileAttributes' in payload.attributes && !!payload.attributes.fileAttributes && _typeof(payload.attributes.fileAttributes) === 'object' && 'fileId' in payload.attributes.fileAttributes && typeof payload.attributes.fileAttributes.fileId === 'string';
|
|
10
|
+
};
|
|
11
|
+
export var sanitiseAnalyticsPayload = function sanitiseAnalyticsPayload(payload) {
|
|
12
|
+
return hasFileAttributesWithFileId(payload) ? produce(payload, sanitiseFileId) : payload;
|
|
13
|
+
};
|
|
@@ -6,10 +6,14 @@ import { MEDIA_CONTEXT } from '@atlaskit/analytics-namespaced-context/MediaAnaly
|
|
|
6
6
|
|
|
7
7
|
// Operational Events ...
|
|
8
8
|
// https://hello.atlassian.net/wiki/spaces/MEASURE/pages/134329315/Operational+Events
|
|
9
|
+
|
|
9
10
|
// UI Events ...
|
|
10
11
|
// https://hello.atlassian.net/wiki/spaces/MEASURE/pages/134329336/UI+Events
|
|
12
|
+
|
|
11
13
|
// Screen Events ...
|
|
12
14
|
// https://hello.atlassian.net/wiki/spaces/MEASURE/pages/134329341/Screen+Events
|
|
15
|
+
|
|
13
16
|
// Track Events ...
|
|
14
17
|
// https://hello.atlassian.net/wiki/spaces/MEASURE/pages/134329319/Track+Events
|
|
18
|
+
|
|
15
19
|
// Media Analytics Context Types
|
|
@@ -8,5 +8,5 @@ export function createSingletonNotice(componentName) {
|
|
|
8
8
|
}, /*#__PURE__*/React.createElement("p", null, "Having multiple versions of ", componentName, " installed can result in potential issues, such as media preview failures."), /*#__PURE__*/React.createElement("p", null, "You must ensure that your application dependencies only resolve to a unique package version, if you are:", /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("b", null, "A platform consumer"), " \u2014 i.e. you are using ", componentName, ' ', "directly in a npm package, for instance in a monorepository. Define", ' ', componentName, " in your package.json file as a", ' ', /*#__PURE__*/React.createElement("code", null, "peerDependency"), " and ", /*#__PURE__*/React.createElement("code", null, "devDependency"), " (for local testing)."), /*#__PURE__*/React.createElement("li", null, /*#__PURE__*/React.createElement("b", null, "A product consumer"), " \u2014 i.e. you are working directly into your application. Define ", componentName, " in your package.json file as a direct dependency."))), /*#__PURE__*/React.createElement("p", null, "If you have any questions or need assistance in consuming this package correctly, please reach out to the", ' ', /*#__PURE__*/React.createElement("a", {
|
|
9
9
|
href: "https://atlassian.slack.com/archives/C020CGJDJ3A",
|
|
10
10
|
target: "_blank"
|
|
11
|
-
}, "#help-media-
|
|
11
|
+
}, "#help-media-platform"), ' ', "channel."));
|
|
12
12
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { downloadUrl } from './downloadUrl';
|
|
2
2
|
// Warning! You can't add new media types!
|
|
3
3
|
// See packages/media/media-core/src/__tests__/cache-backward-compatibility.spec.ts
|
|
4
|
+
|
|
4
5
|
// Media Feature Flags
|
|
5
6
|
export { getMediaFeatureFlag, defaultMediaFeatureFlags, filterFeatureFlagNames, getFeatureFlagKeysAllProducts } from './mediaFeatureFlags';
|
|
6
7
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export type { PackageAttributes, WithFileAttributes, FileAttributes, SuccessAttributes, FailureAttributes, OperationalAttributes, OperationalEventPayload, UIAttributes, UIEventPayload, ScreenAttributes, ScreenEventPayload, TrackAttributes, TrackEventPayload, ContextPublicAttributes, ContextStaticProps, } from './types';
|
|
1
|
+
export type { PackageAttributes, WithFileAttributes, FileAttributes, SuccessAttributes, FailureAttributes, OperationalAttributes, OperationalEventPayload, UIAttributes, UIEventPayload, ScreenAttributes, ScreenEventPayload, TrackAttributes, TrackEventPayload, ContextPublicAttributes, ContextStaticProps, WithTraceContext, PerformanceAttributes, WithPerformanceAttributes, MediaTraceContext, } from './types';
|
|
2
2
|
export { withMediaAnalyticsContext } from './withMediaAnalyticsContext';
|
|
3
3
|
export { ANALYTICS_MEDIA_CHANNEL } from './constants';
|
|
4
|
+
export { sanitiseAnalyticsPayload } from './sanitisePayload';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sanitiseAnalyticsPayload: (payload: Object) => Object;
|
|
@@ -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
|
|
3
|
+
import { MediaType, FileStatus, WithMediaFeatureFlags } from '..';
|
|
4
4
|
export type BaseAttributes = {};
|
|
5
5
|
export type PackageAttributes = {
|
|
6
6
|
packageName: string;
|
|
@@ -31,6 +31,10 @@ export type WithFileAttributes = {
|
|
|
31
31
|
export type WithPerformanceAttributes = {
|
|
32
32
|
performanceAttributes?: PerformanceAttributes;
|
|
33
33
|
};
|
|
34
|
+
export type MediaTraceContext = {
|
|
35
|
+
traceId: string;
|
|
36
|
+
spanId?: string;
|
|
37
|
+
};
|
|
34
38
|
export type WithTraceContext = {
|
|
35
39
|
traceContext?: MediaTraceContext;
|
|
36
40
|
metadataTraceContext?: MediaTraceContext;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,13 +7,9 @@ export interface NumericalCardDimensions {
|
|
|
7
7
|
width: number;
|
|
8
8
|
height: number;
|
|
9
9
|
}
|
|
10
|
-
export type { PackageAttributes, WithFileAttributes, WithPerformanceAttributes, WithTraceContext, 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, MediaTraceContext, } 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, isVideoMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser, isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer, } from './mediaTypeUtils';
|
|
14
14
|
export type SSR = 'client' | 'server';
|
|
15
15
|
export { isUndefined, pick, omitBy, debounce, matches, getRandomHex, } from './utils/helpers';
|
|
16
|
-
export type MediaTraceContext = {
|
|
17
|
-
traceId: string;
|
|
18
|
-
spanId?: string;
|
|
19
|
-
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export type { PackageAttributes, WithFileAttributes, FileAttributes, SuccessAttributes, FailureAttributes, OperationalAttributes, OperationalEventPayload, UIAttributes, UIEventPayload, ScreenAttributes, ScreenEventPayload, TrackAttributes, TrackEventPayload, ContextPublicAttributes, ContextStaticProps, } from './types';
|
|
1
|
+
export type { PackageAttributes, WithFileAttributes, FileAttributes, SuccessAttributes, FailureAttributes, OperationalAttributes, OperationalEventPayload, UIAttributes, UIEventPayload, ScreenAttributes, ScreenEventPayload, TrackAttributes, TrackEventPayload, ContextPublicAttributes, ContextStaticProps, WithTraceContext, PerformanceAttributes, WithPerformanceAttributes, MediaTraceContext, } from './types';
|
|
2
2
|
export { withMediaAnalyticsContext } from './withMediaAnalyticsContext';
|
|
3
3
|
export { ANALYTICS_MEDIA_CHANNEL } from './constants';
|
|
4
|
+
export { sanitiseAnalyticsPayload } from './sanitisePayload';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sanitiseAnalyticsPayload: (payload: Object) => Object;
|
|
@@ -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
|
|
3
|
+
import { MediaType, FileStatus, WithMediaFeatureFlags } from '..';
|
|
4
4
|
export type BaseAttributes = {};
|
|
5
5
|
export type PackageAttributes = {
|
|
6
6
|
packageName: string;
|
|
@@ -31,6 +31,10 @@ export type WithFileAttributes = {
|
|
|
31
31
|
export type WithPerformanceAttributes = {
|
|
32
32
|
performanceAttributes?: PerformanceAttributes;
|
|
33
33
|
};
|
|
34
|
+
export type MediaTraceContext = {
|
|
35
|
+
traceId: string;
|
|
36
|
+
spanId?: string;
|
|
37
|
+
};
|
|
34
38
|
export type WithTraceContext = {
|
|
35
39
|
traceContext?: MediaTraceContext;
|
|
36
40
|
metadataTraceContext?: MediaTraceContext;
|
|
@@ -7,13 +7,9 @@ export interface NumericalCardDimensions {
|
|
|
7
7
|
width: number;
|
|
8
8
|
height: number;
|
|
9
9
|
}
|
|
10
|
-
export type { PackageAttributes, WithFileAttributes, WithPerformanceAttributes, WithTraceContext, 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, MediaTraceContext, } 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, isVideoMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser, isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer, } from './mediaTypeUtils';
|
|
14
14
|
export type SSR = 'client' | 'server';
|
|
15
15
|
export { isUndefined, pick, omitBy, debounce, matches, getRandomHex, } from './utils/helpers';
|
|
16
|
-
export type MediaTraceContext = {
|
|
17
|
-
traceId: string;
|
|
18
|
-
spanId?: string;
|
|
19
|
-
};
|
package/downloadUrl/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-common",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.1.1",
|
|
4
4
|
"description": "Includes common utilities used by other media packages",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
7
7
|
},
|
|
8
|
-
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
8
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
9
9
|
"author": "Atlassian Pty Ltd",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "dist/cjs/index.js",
|
|
@@ -42,10 +42,12 @@
|
|
|
42
42
|
"scripts": {},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
45
|
-
"@atlaskit/analytics-namespaced-context": "^6.
|
|
46
|
-
"@atlaskit/analytics-next": "^9.
|
|
45
|
+
"@atlaskit/analytics-namespaced-context": "^6.9.0",
|
|
46
|
+
"@atlaskit/analytics-next": "^9.2.0",
|
|
47
47
|
"@atlaskit/section-message": "^6.4.0",
|
|
48
|
-
"@babel/runtime": "^7.0.0"
|
|
48
|
+
"@babel/runtime": "^7.0.0",
|
|
49
|
+
"immer": "^9.0.12",
|
|
50
|
+
"uuid-validate": "^0.0.3"
|
|
49
51
|
},
|
|
50
52
|
"peerDependencies": {
|
|
51
53
|
"enzyme": ">=3.10.0",
|
|
@@ -54,8 +56,7 @@
|
|
|
54
56
|
},
|
|
55
57
|
"peerDependenciesMeta": {
|
|
56
58
|
"enzyme": {
|
|
57
|
-
"optional": true
|
|
58
|
-
"dev": true
|
|
59
|
+
"optional": true
|
|
59
60
|
}
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
@@ -63,7 +64,7 @@
|
|
|
63
64
|
"enzyme": "^3.10.0",
|
|
64
65
|
"react": "^16.8.0",
|
|
65
66
|
"react-dom": "^16.8.0",
|
|
66
|
-
"typescript": "~4.
|
|
67
|
+
"typescript": "~5.4.2"
|
|
67
68
|
},
|
|
68
69
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
69
|
-
}
|
|
70
|
+
}
|
package/tmp/api-report-tmp.d.ts
DELETED
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
## API Report File for "@atlaskit/media-common"
|
|
2
|
-
|
|
3
|
-
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
-
|
|
5
|
-
```ts
|
|
6
|
-
|
|
7
|
-
import { GasCorePayload } from '@atlaskit/analytics-gas-types';
|
|
8
|
-
import { default as React_2 } from 'react';
|
|
9
|
-
|
|
10
|
-
// @public (undocumented)
|
|
11
|
-
export const ANALYTICS_MEDIA_CHANNEL = "media";
|
|
12
|
-
|
|
13
|
-
// @public (undocumented)
|
|
14
|
-
type BaseAttributes = {};
|
|
15
|
-
|
|
16
|
-
// @public (undocumented)
|
|
17
|
-
type BaseEventPayload<Attributes extends BaseAttributes> = Omit<GasCorePayload, 'attributes'> & {
|
|
18
|
-
attributes: Attributes;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// @public (undocumented)
|
|
22
|
-
export type ContextPublicAttributes = PackageAttributes;
|
|
23
|
-
|
|
24
|
-
// @public (undocumented)
|
|
25
|
-
export type ContextStaticProps = WithMediaFeatureFlags;
|
|
26
|
-
|
|
27
|
-
// @public (undocumented)
|
|
28
|
-
export const debounce: (func: Function, wait: number) => (...args: any[]) => void;
|
|
29
|
-
|
|
30
|
-
// @public
|
|
31
|
-
export const defaultMediaFeatureFlags: Required<MediaFeatureFlags>;
|
|
32
|
-
|
|
33
|
-
// @public (undocumented)
|
|
34
|
-
export const downloadUrl: (url: string, options?: DownloadUrlOptions) => void;
|
|
35
|
-
|
|
36
|
-
// @public (undocumented)
|
|
37
|
-
interface DownloadUrlOptions {
|
|
38
|
-
// (undocumented)
|
|
39
|
-
name?: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// @public (undocumented)
|
|
43
|
-
export type FailureAttributes = {
|
|
44
|
-
status: 'fail';
|
|
45
|
-
failReason: string;
|
|
46
|
-
error?: string;
|
|
47
|
-
errorDetail?: string;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
// @public (undocumented)
|
|
51
|
-
export type FileAttributes = {
|
|
52
|
-
fileId: string;
|
|
53
|
-
fileSize?: number;
|
|
54
|
-
fileMediatype?: MediaType;
|
|
55
|
-
fileMimetype?: string;
|
|
56
|
-
fileSource?: string;
|
|
57
|
-
fileStatus?: FileStatus;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
// @public (undocumented)
|
|
61
|
-
export type FileStatus = 'error' | 'failed-processing' | 'processed' | 'processing' | 'uploading';
|
|
62
|
-
|
|
63
|
-
// @public (undocumented)
|
|
64
|
-
export const filterFeatureFlagNames: (flags: RequiredMediaFeatureFlags) => Array<keyof MediaFeatureFlags>;
|
|
65
|
-
|
|
66
|
-
// @public
|
|
67
|
-
export const getFeatureFlagKeysAllProducts: () => Array<string>;
|
|
68
|
-
|
|
69
|
-
// @public
|
|
70
|
-
export function getMediaFeatureFlag<T = boolean>(flagName: keyof MediaFeatureFlags, featureFlags?: MediaFeatureFlags): T;
|
|
71
|
-
|
|
72
|
-
// @public (undocumented)
|
|
73
|
-
export const getMediaTypeFromMimeType: (mimeType: string) => MediaType;
|
|
74
|
-
|
|
75
|
-
// @public (undocumented)
|
|
76
|
-
export function getRandomHex(byte: number): string;
|
|
77
|
-
|
|
78
|
-
// @public (undocumented)
|
|
79
|
-
export const isAudioMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
80
|
-
|
|
81
|
-
// @public (undocumented)
|
|
82
|
-
export const isDocumentMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
83
|
-
|
|
84
|
-
// @public (undocumented)
|
|
85
|
-
export const isDocumentMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
86
|
-
|
|
87
|
-
// @public (undocumented)
|
|
88
|
-
export const isImageMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
89
|
-
|
|
90
|
-
// @public (undocumented)
|
|
91
|
-
export const isImageMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
92
|
-
|
|
93
|
-
// @public (undocumented)
|
|
94
|
-
export const isMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
95
|
-
|
|
96
|
-
// @public (undocumented)
|
|
97
|
-
export const isMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
98
|
-
|
|
99
|
-
// @public (undocumented)
|
|
100
|
-
export const isUndefined: (value: any) => boolean;
|
|
101
|
-
|
|
102
|
-
// @public (undocumented)
|
|
103
|
-
export const isUnknownMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
104
|
-
|
|
105
|
-
// @public
|
|
106
|
-
export const isVideoMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
107
|
-
|
|
108
|
-
// @public (undocumented)
|
|
109
|
-
export const isVideoMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
110
|
-
|
|
111
|
-
// @public (undocumented)
|
|
112
|
-
export const matches: (srcObj: Object) => (obj: Object) => boolean;
|
|
113
|
-
|
|
114
|
-
// @public (undocumented)
|
|
115
|
-
export interface MediaFeatureFlags {
|
|
116
|
-
// (undocumented)
|
|
117
|
-
folderUploads?: boolean;
|
|
118
|
-
// (undocumented)
|
|
119
|
-
mediaInline?: boolean;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// @public (undocumented)
|
|
123
|
-
export type MediaTraceContext = {
|
|
124
|
-
traceId: string;
|
|
125
|
-
spanId?: string;
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
// @public (undocumented)
|
|
129
|
-
export type MediaType = 'archive' | 'audio' | 'doc' | 'image' | 'unknown' | 'video';
|
|
130
|
-
|
|
131
|
-
// @public (undocumented)
|
|
132
|
-
export interface NumericalCardDimensions {
|
|
133
|
-
// (undocumented)
|
|
134
|
-
height: number;
|
|
135
|
-
// (undocumented)
|
|
136
|
-
width: number;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// @public (undocumented)
|
|
140
|
-
export const omitBy: (obj: Object, predicate: Function) => {
|
|
141
|
-
[k: string]: any;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
// @public (undocumented)
|
|
145
|
-
export type OperationalAttributes = (BaseAttributes & WithFileAttributes & StatusAttributes & WithPerformanceAttributes & WithTraceContext) | (BaseAttributes & WithFileAttributes & StatusAttributes) | (BaseAttributes & WithFileAttributes) | BaseAttributes;
|
|
146
|
-
|
|
147
|
-
// @public (undocumented)
|
|
148
|
-
export type OperationalEventPayload<Attributes extends OperationalAttributes, Action extends string, ActionSubject extends string, ActionSubjectId extends string = string> = BaseEventPayload<Attributes> & {
|
|
149
|
-
eventType: 'operational';
|
|
150
|
-
action: Action;
|
|
151
|
-
actionSubject: ActionSubject;
|
|
152
|
-
actionSubjectId?: ActionSubjectId;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
// @public (undocumented)
|
|
156
|
-
export type PackageAttributes = {
|
|
157
|
-
packageName: string;
|
|
158
|
-
packageVersion: string;
|
|
159
|
-
componentName: string;
|
|
160
|
-
component: string;
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
// @public (undocumented)
|
|
164
|
-
export type PerformanceAttributes = {
|
|
165
|
-
overall: {
|
|
166
|
-
durationSincePageStart: number;
|
|
167
|
-
durationSinceCommenced?: number;
|
|
168
|
-
};
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
// @public (undocumented)
|
|
172
|
-
export const pick: (obj?: Object, keys?: Array<String>) => {
|
|
173
|
-
[k: string]: any;
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
// @public (undocumented)
|
|
177
|
-
type RequiredMediaFeatureFlags = Record<keyof Required<MediaFeatureFlags>, boolean>;
|
|
178
|
-
|
|
179
|
-
// @public (undocumented)
|
|
180
|
-
export type ScreenAttributes = (BaseAttributes & WithFileAttributes) | BaseAttributes;
|
|
181
|
-
|
|
182
|
-
// @public (undocumented)
|
|
183
|
-
export type ScreenEventPayload<Attributes extends ScreenAttributes, ActionSubject extends string> = BaseEventPayload<Attributes> & {
|
|
184
|
-
eventType: 'screen';
|
|
185
|
-
actionSubject: ActionSubject;
|
|
186
|
-
name: ActionSubject;
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
// @public (undocumented)
|
|
190
|
-
export type SSR = 'client' | 'server';
|
|
191
|
-
|
|
192
|
-
// @public (undocumented)
|
|
193
|
-
type StatusAttributes = FailureAttributes | SuccessAttributes;
|
|
194
|
-
|
|
195
|
-
// @public (undocumented)
|
|
196
|
-
export type SuccessAttributes = {
|
|
197
|
-
status: 'success';
|
|
198
|
-
fileMediatype?: MediaType;
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
// @public (undocumented)
|
|
202
|
-
export type TrackAttributes = (BaseAttributes & WithFileAttributes) | BaseAttributes;
|
|
203
|
-
|
|
204
|
-
// @public (undocumented)
|
|
205
|
-
export type TrackEventPayload<Attributes extends TrackAttributes, Action extends string, ActionSubject extends string, ActionSubjectId extends string = string> = BaseEventPayload<Attributes> & {
|
|
206
|
-
eventType: 'track';
|
|
207
|
-
action: Action;
|
|
208
|
-
actionSubject: ActionSubject;
|
|
209
|
-
actionSubjectId?: ActionSubjectId;
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
// @public (undocumented)
|
|
213
|
-
export type UIAttributes = (BaseAttributes & WithFileAttributes) | BaseAttributes;
|
|
214
|
-
|
|
215
|
-
// @public (undocumented)
|
|
216
|
-
export type UIEventPayload<Attributes extends UIAttributes, Action extends string, ActionSubject extends string> = BaseEventPayload<Attributes> & {
|
|
217
|
-
eventType: 'ui';
|
|
218
|
-
action: Action;
|
|
219
|
-
actionSubject: ActionSubject;
|
|
220
|
-
actionSubjectId?: string;
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
// @public (undocumented)
|
|
224
|
-
export type WithFileAttributes = {
|
|
225
|
-
fileAttributes: FileAttributes;
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
// @public
|
|
229
|
-
export const withMediaAnalyticsContext: (contextPublicAttributes: ContextPublicAttributes) => <Props extends WithMediaFeatureFlags, Component extends React_2.ComponentType<Props>>(WrappedComponent: React_2.JSXElementConstructor<Props> & Component) => React_2.ForwardRefExoticComponent<React_2.PropsWithoutRef<JSX.LibraryManagedAttributes<Component, Props>> & React_2.RefAttributes<any>>;
|
|
230
|
-
|
|
231
|
-
// @public (undocumented)
|
|
232
|
-
export interface WithMediaFeatureFlags {
|
|
233
|
-
// (undocumented)
|
|
234
|
-
featureFlags?: MediaFeatureFlags;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// @public (undocumented)
|
|
238
|
-
export type WithPerformanceAttributes = {
|
|
239
|
-
performanceAttributes?: PerformanceAttributes;
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
// @public (undocumented)
|
|
243
|
-
export type WithTraceContext = {
|
|
244
|
-
traceContext?: MediaTraceContext;
|
|
245
|
-
metadataTraceContext?: MediaTraceContext;
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
// (No @packageDocumentation comment for this package)
|
|
249
|
-
|
|
250
|
-
```
|