@atlaskit/media-common 2.16.2 → 2.16.4
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 +13 -0
- package/analytics/package.json +8 -1
- package/dist/cjs/mediaFeatureFlags/mediaFeatureFlags.js +3 -2
- package/dist/cjs/utils/helpers.js +13 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/mediaFeatureFlags/mediaFeatureFlags.js +2 -2
- package/dist/es2019/utils/helpers.js +7 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/mediaFeatureFlags/mediaFeatureFlags.js +2 -2
- package/dist/esm/utils/helpers.js +8 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/utils/helpers.d.ts +5 -0
- package/dist/types-ts4.0/analytics/constants.d.ts +1 -0
- package/dist/types-ts4.0/analytics/index.d.ts +3 -0
- package/dist/types-ts4.0/analytics/types.d.ts +77 -0
- package/dist/types-ts4.0/analytics/withMediaAnalyticsContext.d.ts +18 -0
- package/dist/types-ts4.0/docs/index.d.ts +1 -0
- package/dist/types-ts4.0/docs/rxjs-notice.d.ts +2 -0
- package/dist/types-ts4.0/downloadUrl.d.ts +4 -0
- package/dist/types-ts4.0/index.d.ts +15 -0
- package/dist/types-ts4.0/mediaFeatureFlag-local.d.ts +1 -0
- package/dist/types-ts4.0/mediaFeatureFlags/index.d.ts +2 -0
- package/dist/types-ts4.0/mediaFeatureFlags/mediaFeatureFlags.d.ts +26 -0
- package/dist/types-ts4.0/mediaFeatureFlags/productKeys.d.ts +2 -0
- package/dist/types-ts4.0/mediaFeatureFlags/types.d.ts +21 -0
- package/dist/types-ts4.0/mediaTypeUtils/index.d.ts +4 -0
- package/dist/types-ts4.0/mediaTypeUtils/isArchive.d.ts +1 -0
- package/dist/types-ts4.0/mediaTypeUtils/isMimeTypeSupportedByBrowser.d.ts +14 -0
- package/dist/types-ts4.0/mediaTypeUtils/isMimeTypeSupportedByServer.d.ts +6 -0
- package/dist/types-ts4.0/utils/helpers.d.ts +14 -0
- package/downloadUrl/package.json +8 -1
- package/mediaFeatureFlags/package.json +8 -1
- package/mediaTypeUtils/package.json +8 -1
- package/package.json +10 -3
- package/report.api.md +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/media-common
|
|
2
2
|
|
|
3
|
+
## 2.16.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`42116304154`](https://bitbucket.org/atlassian/atlassian-frontend/commits/42116304154) - Mocks console when it's not available
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 2.16.3
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
|
|
15
|
+
|
|
3
16
|
## 2.16.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/analytics/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/analytics/index.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/analytics/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/analytics/index.d.ts"
|
|
7
|
+
"types": "../dist/types/analytics/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/analytics/index.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
|
@@ -19,6 +19,8 @@ var _types = require("./types");
|
|
|
19
19
|
|
|
20
20
|
var _productKeys = require("./productKeys");
|
|
21
21
|
|
|
22
|
+
var _helpers = require("../utils/helpers");
|
|
23
|
+
|
|
22
24
|
var areEqualFeatureFlags = function areEqualFeatureFlags(ffA, ffB) {
|
|
23
25
|
if (!ffA && !ffB) {
|
|
24
26
|
return true;
|
|
@@ -147,8 +149,7 @@ Object.keys(defaultMediaFeatureFlags).forEach(function (flagName) {
|
|
|
147
149
|
var localOverride = (0, _mediaFeatureFlagLocal.getLocalMediaFeatureFlag)(flagName);
|
|
148
150
|
|
|
149
151
|
if (localOverride !== null) {
|
|
150
|
-
|
|
151
|
-
console.info("%c* LOCAL * MediaFeatureFlag.".concat(flagName, " = ").concat(localOverride), 'font-weight:bold;color:cyan');
|
|
152
|
+
(0, _helpers.getConsole)().info("%c* LOCAL * MediaFeatureFlag.".concat(flagName, " = ").concat(localOverride), 'font-weight:bold;color:cyan');
|
|
152
153
|
}
|
|
153
154
|
});
|
|
154
155
|
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.pick = exports.omitBy = exports.matches = exports.isUndefined = exports.debounce = void 0;
|
|
8
|
+
exports.pick = exports.omitBy = exports.matches = exports.isUndefined = exports.getConsole = exports.debounce = void 0;
|
|
9
9
|
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
|
|
@@ -74,4 +74,15 @@ var matches = function matches(srcObj) {
|
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
exports.matches = matches;
|
|
77
|
+
exports.matches = matches;
|
|
78
|
+
var fakeConsole = {
|
|
79
|
+
info: function info() {},
|
|
80
|
+
log: function log() {},
|
|
81
|
+
error: function error() {}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
var getConsole = function getConsole() {
|
|
85
|
+
return typeof console !== 'undefined' ? console : fakeConsole;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
exports.getConsole = getConsole;
|
package/dist/cjs/version.json
CHANGED
|
@@ -2,6 +2,7 @@ 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';
|
|
5
6
|
export const areEqualFeatureFlags = (ffA, ffB) => {
|
|
6
7
|
if (!ffA && !ffB) {
|
|
7
8
|
return true;
|
|
@@ -95,8 +96,7 @@ Object.keys(defaultMediaFeatureFlags).forEach(flagName => {
|
|
|
95
96
|
const localOverride = getLocalMediaFeatureFlag(flagName);
|
|
96
97
|
|
|
97
98
|
if (localOverride !== null) {
|
|
98
|
-
|
|
99
|
-
console.info(`%c* LOCAL * MediaFeatureFlag.${flagName} = ${localOverride}`, 'font-weight:bold;color:cyan');
|
|
99
|
+
getConsole().info(`%c* LOCAL * MediaFeatureFlag.${flagName} = ${localOverride}`, 'font-weight:bold;color:cyan');
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
export const useMemoizeFeatureFlags = featureFlags => {
|
package/dist/es2019/version.json
CHANGED
|
@@ -3,6 +3,7 @@ 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';
|
|
6
7
|
export var areEqualFeatureFlags = function areEqualFeatureFlags(ffA, ffB) {
|
|
7
8
|
if (!ffA && !ffB) {
|
|
8
9
|
return true;
|
|
@@ -117,8 +118,7 @@ Object.keys(defaultMediaFeatureFlags).forEach(function (flagName) {
|
|
|
117
118
|
var localOverride = getLocalMediaFeatureFlag(flagName);
|
|
118
119
|
|
|
119
120
|
if (localOverride !== null) {
|
|
120
|
-
|
|
121
|
-
console.info("%c* LOCAL * MediaFeatureFlag.".concat(flagName, " = ").concat(localOverride), 'font-weight:bold;color:cyan');
|
|
121
|
+
getConsole().info("%c* LOCAL * MediaFeatureFlag.".concat(flagName, " = ").concat(localOverride), 'font-weight:bold;color:cyan');
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
export var useMemoizeFeatureFlags = function useMemoizeFeatureFlags(featureFlags) {
|
|
@@ -50,4 +50,12 @@ export var matches = function matches(srcObj) {
|
|
|
50
50
|
|
|
51
51
|
return true;
|
|
52
52
|
};
|
|
53
|
+
};
|
|
54
|
+
var fakeConsole = {
|
|
55
|
+
info: function info() {},
|
|
56
|
+
log: function log() {},
|
|
57
|
+
error: function error() {}
|
|
58
|
+
};
|
|
59
|
+
export var getConsole = function getConsole() {
|
|
60
|
+
return typeof console !== 'undefined' ? console : fakeConsole;
|
|
53
61
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -7,3 +7,8 @@ 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 const getConsole: () => {
|
|
11
|
+
info: () => void;
|
|
12
|
+
log: () => void;
|
|
13
|
+
error: () => void;
|
|
14
|
+
} | Console;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ANALYTICS_MEDIA_CHANNEL = "media";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { PackageAttributes, WithFileAttributes, FileAttributes, SuccessAttributes, FailureAttributes, OperationalAttributes, OperationalEventPayload, UIAttributes, UIEventPayload, ScreenAttributes, ScreenEventPayload, TrackAttributes, TrackEventPayload, ContextPublicAttributes, ContextStaticProps, } from './types';
|
|
2
|
+
export { withMediaAnalyticsContext } from './withMediaAnalyticsContext';
|
|
3
|
+
export { ANALYTICS_MEDIA_CHANNEL } from './constants';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { GasCorePayload } from '@atlaskit/analytics-gas-types';
|
|
2
|
+
import { MEDIA_CONTEXT } from '@atlaskit/analytics-namespaced-context/MediaAnalyticsContext';
|
|
3
|
+
import { MediaType, FileStatus, WithMediaFeatureFlags } from '..';
|
|
4
|
+
export declare type BaseAttributes = {};
|
|
5
|
+
export declare type PackageAttributes = {
|
|
6
|
+
packageName: string;
|
|
7
|
+
packageVersion: string;
|
|
8
|
+
componentName: string;
|
|
9
|
+
component: string;
|
|
10
|
+
};
|
|
11
|
+
export declare type BaseEventPayload<Attributes extends BaseAttributes> = Omit<GasCorePayload, 'attributes'> & {
|
|
12
|
+
attributes: Attributes;
|
|
13
|
+
};
|
|
14
|
+
export declare type FileAttributes = {
|
|
15
|
+
fileId: string;
|
|
16
|
+
fileSize?: number;
|
|
17
|
+
fileMediatype?: MediaType;
|
|
18
|
+
fileMimetype?: string;
|
|
19
|
+
fileSource?: string;
|
|
20
|
+
fileStatus?: FileStatus;
|
|
21
|
+
};
|
|
22
|
+
export declare type PerformanceAttributes = {
|
|
23
|
+
overall: {
|
|
24
|
+
durationSincePageStart: number;
|
|
25
|
+
durationSinceCommenced?: number;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export declare type WithFileAttributes = {
|
|
29
|
+
fileAttributes: FileAttributes;
|
|
30
|
+
};
|
|
31
|
+
export declare type WithPerformanceAttributes = {
|
|
32
|
+
performanceAttributes?: PerformanceAttributes;
|
|
33
|
+
};
|
|
34
|
+
export declare type SuccessAttributes = {
|
|
35
|
+
status: 'success';
|
|
36
|
+
fileMediatype?: MediaType;
|
|
37
|
+
};
|
|
38
|
+
export declare type FailureAttributes = {
|
|
39
|
+
status: 'fail';
|
|
40
|
+
failReason: string;
|
|
41
|
+
error?: string;
|
|
42
|
+
errorDetail?: string;
|
|
43
|
+
};
|
|
44
|
+
export declare type StatusAttributes = SuccessAttributes | FailureAttributes;
|
|
45
|
+
export declare type OperationalAttributes = BaseAttributes | (BaseAttributes & WithFileAttributes) | (BaseAttributes & WithFileAttributes & StatusAttributes) | (BaseAttributes & WithFileAttributes & StatusAttributes & WithPerformanceAttributes);
|
|
46
|
+
export declare type OperationalEventPayload<Attributes extends OperationalAttributes, Action extends string, ActionSubject extends string, ActionSubjectId extends string = string> = BaseEventPayload<Attributes> & {
|
|
47
|
+
eventType: 'operational';
|
|
48
|
+
action: Action;
|
|
49
|
+
actionSubject: ActionSubject;
|
|
50
|
+
actionSubjectId?: ActionSubjectId;
|
|
51
|
+
};
|
|
52
|
+
export declare type UIAttributes = BaseAttributes | (BaseAttributes & WithFileAttributes);
|
|
53
|
+
export declare type UIEventPayload<Attributes extends UIAttributes, Action extends string, ActionSubject extends string> = BaseEventPayload<Attributes> & {
|
|
54
|
+
eventType: 'ui';
|
|
55
|
+
action: Action;
|
|
56
|
+
actionSubject: ActionSubject;
|
|
57
|
+
actionSubjectId?: string;
|
|
58
|
+
};
|
|
59
|
+
export declare type ScreenAttributes = BaseAttributes | (BaseAttributes & WithFileAttributes);
|
|
60
|
+
export declare type ScreenEventPayload<Attributes extends ScreenAttributes, ActionSubject extends string> = BaseEventPayload<Attributes> & {
|
|
61
|
+
eventType: 'screen';
|
|
62
|
+
actionSubject: ActionSubject;
|
|
63
|
+
name: ActionSubject;
|
|
64
|
+
};
|
|
65
|
+
export declare type TrackAttributes = BaseAttributes | (BaseAttributes & WithFileAttributes);
|
|
66
|
+
export declare type TrackEventPayload<Attributes extends TrackAttributes, Action extends string, ActionSubject extends string, ActionSubjectId extends string = string> = BaseEventPayload<Attributes> & {
|
|
67
|
+
eventType: 'track';
|
|
68
|
+
action: Action;
|
|
69
|
+
actionSubject: ActionSubject;
|
|
70
|
+
actionSubjectId?: ActionSubjectId;
|
|
71
|
+
};
|
|
72
|
+
export declare type ContextPublicAttributes = PackageAttributes;
|
|
73
|
+
export declare type ContextPrivateAttributes = WithMediaFeatureFlags;
|
|
74
|
+
export declare type ContextStaticProps = WithMediaFeatureFlags;
|
|
75
|
+
export declare type ContextData = ContextPublicAttributes & {
|
|
76
|
+
[MEDIA_CONTEXT]: ContextPrivateAttributes;
|
|
77
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MediaFeatureFlags } from '../mediaFeatureFlags';
|
|
3
|
+
import { ContextPublicAttributes } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* HOC for attaching MediaAnalyticsContext to a top-level React Component.
|
|
6
|
+
*
|
|
7
|
+
* Similar than "packages/analytics/analytics-next/src/hocs/withAnalyticsContext.tsx",
|
|
8
|
+
* except that we restrict attributes put in this context using ContextPublicAttributes and ContextPrivateAttributes.
|
|
9
|
+
*
|
|
10
|
+
* As a constraint, the wrapped React Component's props must extend ContextStaticProps.
|
|
11
|
+
*
|
|
12
|
+
* @param {ContextPublicAttributes} attributes public attributes to put in context
|
|
13
|
+
*
|
|
14
|
+
* @see packages/analytics/analytics-next/src/hocs/withAnalyticsContext.tsx
|
|
15
|
+
*/
|
|
16
|
+
export declare const withMediaAnalyticsContext: (contextPublicAttributes: ContextPublicAttributes, options?: {
|
|
17
|
+
filterFeatureFlags?: Array<keyof MediaFeatureFlags>;
|
|
18
|
+
}) => <Props extends import("../mediaFeatureFlags").WithMediaFeatureFlags, Component extends React.ComponentType<Props>>(WrappedComponent: React.JSXElementConstructor<Props> & Component) => React.ForwardRefExoticComponent<React.PropsWithoutRef<JSX.LibraryManagedAttributes<Component, Props>> & React.RefAttributes<any>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createRxjsNotice } from './rxjs-notice';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { downloadUrl } from './downloadUrl';
|
|
2
|
+
export declare type MediaType = 'doc' | 'audio' | 'video' | 'image' | 'archive' | 'unknown';
|
|
3
|
+
export declare type FileStatus = 'uploading' | 'processing' | 'processed' | 'error' | 'failed-processing';
|
|
4
|
+
export { getMediaFeatureFlag, defaultMediaFeatureFlags, areEqualFeatureFlags, useMemoizeFeatureFlags, filterFeatureFlagNames, filterFeatureFlagKeysAllProducts, } from './mediaFeatureFlags';
|
|
5
|
+
export type { MediaFeatureFlags, WithMediaFeatureFlags, } from './mediaFeatureFlags';
|
|
6
|
+
export interface NumericalCardDimensions {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
export type { PackageAttributes, WithFileAttributes, WithPerformanceAttributes, FileAttributes, PerformanceAttributes, SuccessAttributes, FailureAttributes, OperationalAttributes, OperationalEventPayload, UIAttributes, UIEventPayload, ScreenAttributes, ScreenEventPayload, TrackAttributes, TrackEventPayload, ContextPublicAttributes, ContextStaticProps, } from './analytics/types';
|
|
11
|
+
export { withMediaAnalyticsContext } from './analytics/withMediaAnalyticsContext';
|
|
12
|
+
export { ANALYTICS_MEDIA_CHANNEL } from './analytics/constants';
|
|
13
|
+
export { getMediaTypeFromMimeType, isImageMimeTypeSupportedByBrowser, isDocumentMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser, isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer, } from './mediaTypeUtils';
|
|
14
|
+
export declare type SSR = 'client' | 'server';
|
|
15
|
+
export { isUndefined, pick, omitBy, debounce, matches } from './utils/helpers';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getLocalMediaFeatureFlag: (key: string) => string | null;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { getMediaFeatureFlag, useMemoizeFeatureFlags, defaultMediaFeatureFlags, areEqualFeatureFlags, filterFeatureFlagNames, filterFeatureFlagKeysAllProducts, } from './mediaFeatureFlags';
|
|
2
|
+
export type { MediaFeatureFlags, WithMediaFeatureFlags, SupportedProduct, } from './types';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { RequiredMediaFeatureFlags, MediaFeatureFlags, SupportedProduct } from './types';
|
|
2
|
+
export declare const areEqualFeatureFlags: (ffA?: MediaFeatureFlags | undefined, ffB?: MediaFeatureFlags | undefined) => boolean;
|
|
3
|
+
export declare const filterFeatureFlagNames: (flags: RequiredMediaFeatureFlags) => Array<keyof MediaFeatureFlags>;
|
|
4
|
+
/**
|
|
5
|
+
* Takes a record of {Media Feature Flag Names → boolean} and a supported product name.
|
|
6
|
+
* Returns the corresponding product’s Launch Darkly Keys for each of the flags set as true in the input record.
|
|
7
|
+
* */
|
|
8
|
+
export declare const mapAndFilterFeatureFlagNames: (flags: RequiredMediaFeatureFlags, product: SupportedProduct) => Array<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Takes a record of {Media Feature Flag Names → boolean}.
|
|
11
|
+
* Returns the Launch Darkly Keys from all products for each of the flags set as true in the input record.
|
|
12
|
+
* */
|
|
13
|
+
export declare const filterFeatureFlagKeysAllProducts: (flags: RequiredMediaFeatureFlags) => Array<string>;
|
|
14
|
+
export declare const defaultMediaFeatureFlags: Required<MediaFeatureFlags>;
|
|
15
|
+
/**
|
|
16
|
+
* Public accessor from components to fallback to defaults if flags not passed,
|
|
17
|
+
* otherwise whatever product has set will be returned.
|
|
18
|
+
*
|
|
19
|
+
* To override locally for testing:
|
|
20
|
+
* - `localStorage[flagName] = true` to enable locally,
|
|
21
|
+
* - `delete localStorage[flagName]` to remove.
|
|
22
|
+
*
|
|
23
|
+
* (you will see a warning in console if override used)
|
|
24
|
+
* */
|
|
25
|
+
export declare function getMediaFeatureFlag<T = boolean>(flagName: keyof MediaFeatureFlags, featureFlags?: MediaFeatureFlags): T;
|
|
26
|
+
export declare const useMemoizeFeatureFlags: (featureFlags?: MediaFeatureFlags | undefined) => MediaFeatureFlags | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface MediaFeatureFlags {
|
|
2
|
+
newCardExperience?: boolean;
|
|
3
|
+
captions?: boolean;
|
|
4
|
+
mediaInline?: boolean;
|
|
5
|
+
folderUploads?: boolean;
|
|
6
|
+
observedWidth?: boolean;
|
|
7
|
+
timestampOnVideo?: boolean;
|
|
8
|
+
mediaUploadApiV2?: boolean;
|
|
9
|
+
memoryCacheLogging?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface WithMediaFeatureFlags {
|
|
12
|
+
featureFlags?: MediaFeatureFlags;
|
|
13
|
+
}
|
|
14
|
+
export declare type RequiredMediaFeatureFlags = Record<keyof Required<MediaFeatureFlags>, boolean>;
|
|
15
|
+
export declare type MediaFeatureFlagsMap = Record<keyof Required<MediaFeatureFlags>, string>;
|
|
16
|
+
export declare const supportedProducts: readonly [
|
|
17
|
+
"confluence",
|
|
18
|
+
"jira"
|
|
19
|
+
];
|
|
20
|
+
export declare type SupportedProduct = typeof supportedProducts[number];
|
|
21
|
+
export declare type ProductKeys = Record<SupportedProduct, MediaFeatureFlagsMap>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MediaType } from '..';
|
|
2
|
+
export { isImageMimeTypeSupportedByBrowser, isDocumentMimeTypeSupportedByBrowser, isAudioMimeTypeSupportedByBrowser, isVideoMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser, } from './isMimeTypeSupportedByBrowser';
|
|
3
|
+
export { isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer, } from './isMimeTypeSupportedByServer';
|
|
4
|
+
export declare const getMediaTypeFromMimeType: (mimeType: string) => MediaType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isArchive: (mimeType: string) => boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const isImageMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
2
|
+
export declare const isDocumentMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
3
|
+
export declare const isAudioMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
4
|
+
/**
|
|
5
|
+
* For backward compatilbity, we assume MP4/MOV is natively supported.
|
|
6
|
+
* TODO: Improve detection of supported video formats by the browser.
|
|
7
|
+
*
|
|
8
|
+
* See related tickets:
|
|
9
|
+
* - https://product-fabric.atlassian.net/browse/MPT-477
|
|
10
|
+
* - https://product-fabric.atlassian.net/browse/EDM-634
|
|
11
|
+
* - https://product-fabric.atlassian.net/browse/EDM-426
|
|
12
|
+
*/
|
|
13
|
+
export declare const isVideoMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
14
|
+
export declare const isMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const isImageMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
2
|
+
export declare const isDocumentMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
3
|
+
export declare const isAudioMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
4
|
+
export declare const isVideoMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
5
|
+
export declare const isUnknownMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
6
|
+
export declare const isMimeTypeSupportedByServer: (mimeType: string) => boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const isUndefined: (value: any) => boolean;
|
|
2
|
+
export declare const pick: (obj?: Object | undefined, keys?: Array<String>) => {
|
|
3
|
+
[k: string]: any;
|
|
4
|
+
};
|
|
5
|
+
export declare const omitBy: (obj: Object, predicate: Function) => {
|
|
6
|
+
[k: string]: any;
|
|
7
|
+
};
|
|
8
|
+
export declare const debounce: (func: Function, wait: number) => (...args: any[]) => void;
|
|
9
|
+
export declare const matches: (srcObj: Object) => (obj: Object) => boolean;
|
|
10
|
+
export declare const getConsole: () => {
|
|
11
|
+
info: () => void;
|
|
12
|
+
log: () => void;
|
|
13
|
+
error: () => void;
|
|
14
|
+
} | Console;
|
package/downloadUrl/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/downloadUrl.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/downloadUrl.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/downloadUrl.d.ts"
|
|
7
|
+
"types": "../dist/types/downloadUrl.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/downloadUrl.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/mediaFeatureFlags/index.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/mediaFeatureFlags/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/mediaFeatureFlags/index.d.ts"
|
|
7
|
+
"types": "../dist/types/mediaFeatureFlags/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/mediaFeatureFlags/index.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/mediaTypeUtils/index.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/mediaTypeUtils/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/mediaTypeUtils/index.d.ts"
|
|
7
|
+
"types": "../dist/types/mediaTypeUtils/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/mediaTypeUtils/index.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-common",
|
|
3
|
-
"version": "2.16.
|
|
3
|
+
"version": "2.16.4",
|
|
4
4
|
"description": "Includes common utilities used by other media packages",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -12,6 +12,13 @@
|
|
|
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
|
+
},
|
|
15
22
|
"sideEffects": false,
|
|
16
23
|
"atlaskit:src": "src/index.ts",
|
|
17
24
|
"af:exports": {
|
|
@@ -35,7 +42,7 @@
|
|
|
35
42
|
"@atlaskit/analytics-gas-types": "^5.0.5",
|
|
36
43
|
"@atlaskit/analytics-namespaced-context": "^6.5.0",
|
|
37
44
|
"@atlaskit/analytics-next": "^8.1.1",
|
|
38
|
-
"@atlaskit/section-message": "^6.
|
|
45
|
+
"@atlaskit/section-message": "^6.3.0",
|
|
39
46
|
"@babel/runtime": "^7.0.0"
|
|
40
47
|
},
|
|
41
48
|
"peerDependencies": {
|
|
@@ -49,7 +56,7 @@
|
|
|
49
56
|
"enzyme": "^3.10.0",
|
|
50
57
|
"react": "^16.8.0",
|
|
51
58
|
"react-dom": "^16.8.0",
|
|
52
|
-
"typescript": "4.
|
|
59
|
+
"typescript": "4.5.5"
|
|
53
60
|
},
|
|
54
61
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|
|
55
62
|
}
|
package/report.api.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
## API Report File for "@atlaskit/media-common"
|
|
1
|
+
## API Report File for "@atlaskit/media-common".
|
|
2
2
|
|
|
3
|
-
> Do not edit this file.
|
|
3
|
+
> Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
[Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
4
6
|
|
|
5
7
|
```ts
|
|
6
8
|
import { GasCorePayload } from '@atlaskit/analytics-gas-types';
|
|
@@ -140,6 +142,7 @@ export declare interface MediaFeatureFlags {
|
|
|
140
142
|
observedWidth?: boolean;
|
|
141
143
|
timestampOnVideo?: boolean;
|
|
142
144
|
mediaUploadApiV2?: boolean;
|
|
145
|
+
memoryCacheLogging?: boolean;
|
|
143
146
|
}
|
|
144
147
|
|
|
145
148
|
export declare type MediaType =
|
|
@@ -228,6 +231,7 @@ declare type StatusAttributes = SuccessAttributes | FailureAttributes;
|
|
|
228
231
|
|
|
229
232
|
export declare type SuccessAttributes = {
|
|
230
233
|
status: 'success';
|
|
234
|
+
fileMediatype?: MediaType;
|
|
231
235
|
};
|
|
232
236
|
|
|
233
237
|
export declare type TrackAttributes =
|