@atlaskit/media-common 4.1.1 → 5.0.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/mediaFeatureFlags/mediaFeatureFlags.js +2 -4
  3. package/dist/cjs/mediaFeatureFlags/productKeys.js +5 -4
  4. package/dist/cjs/version.json +1 -1
  5. package/dist/es2019/mediaFeatureFlags/mediaFeatureFlags.js +2 -4
  6. package/dist/es2019/mediaFeatureFlags/productKeys.js +5 -4
  7. package/dist/es2019/version.json +1 -1
  8. package/dist/esm/mediaFeatureFlags/mediaFeatureFlags.js +2 -4
  9. package/dist/esm/mediaFeatureFlags/productKeys.js +5 -4
  10. package/dist/esm/version.json +1 -1
  11. package/dist/types/mediaFeatureFlags/types.d.ts +0 -1
  12. package/dist/types-ts4.5/analytics/constants.d.ts +1 -0
  13. package/dist/types-ts4.5/analytics/index.d.ts +3 -0
  14. package/dist/types-ts4.5/analytics/types.d.ts +81 -0
  15. package/dist/types-ts4.5/analytics/withMediaAnalyticsContext.d.ts +15 -0
  16. package/dist/types-ts4.5/docs/index.d.ts +2 -0
  17. package/dist/types-ts4.5/docs/media-use-only.d.ts +5 -0
  18. package/dist/types-ts4.5/docs/rxjs-notice.d.ts +2 -0
  19. package/dist/types-ts4.5/downloadUrl.d.ts +4 -0
  20. package/dist/types-ts4.5/index.d.ts +19 -0
  21. package/dist/types-ts4.5/mediaFeatureFlag-local.d.ts +1 -0
  22. package/dist/types-ts4.5/mediaFeatureFlags/genericFeatureFlag.d.ts +7 -0
  23. package/dist/types-ts4.5/mediaFeatureFlags/index.d.ts +2 -0
  24. package/dist/types-ts4.5/mediaFeatureFlags/mediaFeatureFlags.d.ts +32 -0
  25. package/dist/types-ts4.5/mediaFeatureFlags/productKeys.d.ts +2 -0
  26. package/dist/types-ts4.5/mediaFeatureFlags/types.d.ts +20 -0
  27. package/dist/types-ts4.5/mediaTypeUtils/index.d.ts +4 -0
  28. package/dist/types-ts4.5/mediaTypeUtils/isArchive.d.ts +1 -0
  29. package/dist/types-ts4.5/mediaTypeUtils/isMimeTypeSupportedByBrowser.d.ts +14 -0
  30. package/dist/types-ts4.5/mediaTypeUtils/isMimeTypeSupportedByServer.d.ts +6 -0
  31. package/dist/types-ts4.5/utils/helpers.d.ts +10 -0
  32. package/package.json +1 -1
  33. package/report.api.md +5 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/media-common
2
2
 
3
+ ## 5.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`e725edbb0d9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e725edbb0d9) - Removed feature flag fetchFileStateAfterUpload
8
+
9
+ ## 4.1.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
14
+
3
15
  ## 4.1.1
4
16
 
5
17
  ### Patch Changes
@@ -27,8 +27,7 @@ var areEqualFeatureFlags = function areEqualFeatureFlags(ffA, ffB) {
27
27
  folderUploads: ffA.folderUploads === ffB.folderUploads,
28
28
  observedWidth: ffA.observedWidth === ffB.observedWidth,
29
29
  timestampOnVideo: ffA.timestampOnVideo === ffB.timestampOnVideo,
30
- memoryCacheLogging: ffA.memoryCacheLogging === ffB.memoryCacheLogging,
31
- fetchFileStateAfterUpload: ffA.fetchFileStateAfterUpload === ffB.fetchFileStateAfterUpload
30
+ memoryCacheLogging: ffA.memoryCacheLogging === ffB.memoryCacheLogging
32
31
  };
33
32
  return Object.values(results).every(function (result) {
34
33
  return result;
@@ -87,8 +86,7 @@ var defaultMediaFeatureFlags = {
87
86
  folderUploads: false,
88
87
  observedWidth: false,
89
88
  timestampOnVideo: false,
90
- memoryCacheLogging: false,
91
- fetchFileStateAfterUpload: false
89
+ memoryCacheLogging: false
92
90
  };
93
91
 
94
92
  /**
@@ -6,6 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getProductKeys = void 0;
7
7
  var productKeys = {
8
8
  confluence: {
9
+ /**
10
+ * Note: Confluence Flags must be prefixed with "confluence.frontend" in order to integrate properly with the product
11
+ */
9
12
  newCardExperience: 'confluence.frontend.media.cards.new.experience',
10
13
  captions: 'confluence.frontend.fabric.editor.media.captions',
11
14
  mediaInline: 'confluence.frontend.fabric.editor.media.inline',
@@ -13,8 +16,7 @@ var productKeys = {
13
16
  //TODO fill the value after https://product-fabric.atlassian.net/browse/MEX-1593
14
17
  observedWidth: '',
15
18
  timestampOnVideo: 'confluence.frontend.media.timestamp.on.video',
16
- memoryCacheLogging: 'confluence-frontend-media-card-memory-cache-logging',
17
- fetchFileStateAfterUpload: 'confluence-frontend-media-client-fetch-file-state-after-upload'
19
+ memoryCacheLogging: 'confluence-frontend-media-card-memory-cache-logging'
18
20
  },
19
21
  jira: {
20
22
  newCardExperience: 'issue.details.media-cards-new-experience',
@@ -25,8 +27,7 @@ var productKeys = {
25
27
  //TODO fill the value after https://product-fabric.atlassian.net/browse/MEX-1593
26
28
  observedWidth: '',
27
29
  timestampOnVideo: 'issue.details.media-cards-timestamp-on-video',
28
- memoryCacheLogging: 'jira-frontend-media-card-memory-cache-logging',
29
- fetchFileStateAfterUpload: 'jira-frontend-media-client-fetch-file-state-after-upload'
30
+ memoryCacheLogging: 'jira-frontend-media-card-memory-cache-logging'
30
31
  }
31
32
  };
32
33
  var getProductKeys = function getProductKeys() {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-common",
3
- "version": "4.1.1",
3
+ "version": "5.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -16,8 +16,7 @@ export const areEqualFeatureFlags = (ffA, ffB) => {
16
16
  folderUploads: ffA.folderUploads === ffB.folderUploads,
17
17
  observedWidth: ffA.observedWidth === ffB.observedWidth,
18
18
  timestampOnVideo: ffA.timestampOnVideo === ffB.timestampOnVideo,
19
- memoryCacheLogging: ffA.memoryCacheLogging === ffB.memoryCacheLogging,
20
- fetchFileStateAfterUpload: ffA.fetchFileStateAfterUpload === ffB.fetchFileStateAfterUpload
19
+ memoryCacheLogging: ffA.memoryCacheLogging === ffB.memoryCacheLogging
21
20
  };
22
21
  return Object.values(results).every(result => result);
23
22
  };
@@ -60,8 +59,7 @@ export const defaultMediaFeatureFlags = {
60
59
  folderUploads: false,
61
60
  observedWidth: false,
62
61
  timestampOnVideo: false,
63
- memoryCacheLogging: false,
64
- fetchFileStateAfterUpload: false
62
+ memoryCacheLogging: false
65
63
  };
66
64
 
67
65
  /**
@@ -1,5 +1,8 @@
1
1
  const productKeys = {
2
2
  confluence: {
3
+ /**
4
+ * Note: Confluence Flags must be prefixed with "confluence.frontend" in order to integrate properly with the product
5
+ */
3
6
  newCardExperience: 'confluence.frontend.media.cards.new.experience',
4
7
  captions: 'confluence.frontend.fabric.editor.media.captions',
5
8
  mediaInline: 'confluence.frontend.fabric.editor.media.inline',
@@ -7,8 +10,7 @@ const productKeys = {
7
10
  //TODO fill the value after https://product-fabric.atlassian.net/browse/MEX-1593
8
11
  observedWidth: '',
9
12
  timestampOnVideo: 'confluence.frontend.media.timestamp.on.video',
10
- memoryCacheLogging: 'confluence-frontend-media-card-memory-cache-logging',
11
- fetchFileStateAfterUpload: 'confluence-frontend-media-client-fetch-file-state-after-upload'
13
+ memoryCacheLogging: 'confluence-frontend-media-card-memory-cache-logging'
12
14
  },
13
15
  jira: {
14
16
  newCardExperience: 'issue.details.media-cards-new-experience',
@@ -19,8 +21,7 @@ const productKeys = {
19
21
  //TODO fill the value after https://product-fabric.atlassian.net/browse/MEX-1593
20
22
  observedWidth: '',
21
23
  timestampOnVideo: 'issue.details.media-cards-timestamp-on-video',
22
- memoryCacheLogging: 'jira-frontend-media-card-memory-cache-logging',
23
- fetchFileStateAfterUpload: 'jira-frontend-media-client-fetch-file-state-after-upload'
24
+ memoryCacheLogging: 'jira-frontend-media-card-memory-cache-logging'
24
25
  }
25
26
  };
26
27
  export const getProductKeys = () => productKeys;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-common",
3
- "version": "4.1.1",
3
+ "version": "5.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -18,8 +18,7 @@ export var areEqualFeatureFlags = function areEqualFeatureFlags(ffA, ffB) {
18
18
  folderUploads: ffA.folderUploads === ffB.folderUploads,
19
19
  observedWidth: ffA.observedWidth === ffB.observedWidth,
20
20
  timestampOnVideo: ffA.timestampOnVideo === ffB.timestampOnVideo,
21
- memoryCacheLogging: ffA.memoryCacheLogging === ffB.memoryCacheLogging,
22
- fetchFileStateAfterUpload: ffA.fetchFileStateAfterUpload === ffB.fetchFileStateAfterUpload
21
+ memoryCacheLogging: ffA.memoryCacheLogging === ffB.memoryCacheLogging
23
22
  };
24
23
  return Object.values(results).every(function (result) {
25
24
  return result;
@@ -75,8 +74,7 @@ export var defaultMediaFeatureFlags = {
75
74
  folderUploads: false,
76
75
  observedWidth: false,
77
76
  timestampOnVideo: false,
78
- memoryCacheLogging: false,
79
- fetchFileStateAfterUpload: false
77
+ memoryCacheLogging: false
80
78
  };
81
79
 
82
80
  /**
@@ -1,5 +1,8 @@
1
1
  var productKeys = {
2
2
  confluence: {
3
+ /**
4
+ * Note: Confluence Flags must be prefixed with "confluence.frontend" in order to integrate properly with the product
5
+ */
3
6
  newCardExperience: 'confluence.frontend.media.cards.new.experience',
4
7
  captions: 'confluence.frontend.fabric.editor.media.captions',
5
8
  mediaInline: 'confluence.frontend.fabric.editor.media.inline',
@@ -7,8 +10,7 @@ var productKeys = {
7
10
  //TODO fill the value after https://product-fabric.atlassian.net/browse/MEX-1593
8
11
  observedWidth: '',
9
12
  timestampOnVideo: 'confluence.frontend.media.timestamp.on.video',
10
- memoryCacheLogging: 'confluence-frontend-media-card-memory-cache-logging',
11
- fetchFileStateAfterUpload: 'confluence-frontend-media-client-fetch-file-state-after-upload'
13
+ memoryCacheLogging: 'confluence-frontend-media-card-memory-cache-logging'
12
14
  },
13
15
  jira: {
14
16
  newCardExperience: 'issue.details.media-cards-new-experience',
@@ -19,8 +21,7 @@ var productKeys = {
19
21
  //TODO fill the value after https://product-fabric.atlassian.net/browse/MEX-1593
20
22
  observedWidth: '',
21
23
  timestampOnVideo: 'issue.details.media-cards-timestamp-on-video',
22
- memoryCacheLogging: 'jira-frontend-media-card-memory-cache-logging',
23
- fetchFileStateAfterUpload: 'jira-frontend-media-client-fetch-file-state-after-upload'
24
+ memoryCacheLogging: 'jira-frontend-media-card-memory-cache-logging'
24
25
  }
25
26
  };
26
27
  export var getProductKeys = function getProductKeys() {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-common",
3
- "version": "4.1.1",
3
+ "version": "5.0.0",
4
4
  "sideEffects": false
5
5
  }
@@ -6,7 +6,6 @@ export interface MediaFeatureFlags {
6
6
  observedWidth?: boolean;
7
7
  timestampOnVideo?: boolean;
8
8
  memoryCacheLogging?: boolean;
9
- fetchFileStateAfterUpload?: boolean;
10
9
  }
11
10
  export interface WithMediaFeatureFlags {
12
11
  featureFlags?: MediaFeatureFlags;
@@ -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,81 @@
1
+ import { GasCorePayload } from '@atlaskit/analytics-gas-types';
2
+ import { MEDIA_CONTEXT } from '@atlaskit/analytics-namespaced-context/MediaAnalyticsContext';
3
+ import { MediaType, FileStatus, WithMediaFeatureFlags, MediaTraceContext } from '..';
4
+ export type BaseAttributes = {};
5
+ export type PackageAttributes = {
6
+ packageName: string;
7
+ packageVersion: string;
8
+ componentName: string;
9
+ component: string;
10
+ };
11
+ export type BaseEventPayload<Attributes extends BaseAttributes> = Omit<GasCorePayload, 'attributes'> & {
12
+ attributes: Attributes;
13
+ };
14
+ export type FileAttributes = {
15
+ fileId: string;
16
+ fileSize?: number;
17
+ fileMediatype?: MediaType;
18
+ fileMimetype?: string;
19
+ fileSource?: string;
20
+ fileStatus?: FileStatus;
21
+ };
22
+ export type PerformanceAttributes = {
23
+ overall: {
24
+ durationSincePageStart: number;
25
+ durationSinceCommenced?: number;
26
+ };
27
+ };
28
+ export type WithFileAttributes = {
29
+ fileAttributes: FileAttributes;
30
+ };
31
+ export type WithPerformanceAttributes = {
32
+ performanceAttributes?: PerformanceAttributes;
33
+ };
34
+ export type WithTraceContext = {
35
+ traceContext?: MediaTraceContext;
36
+ metadataTraceContext?: MediaTraceContext;
37
+ };
38
+ export type SuccessAttributes = {
39
+ status: 'success';
40
+ fileMediatype?: MediaType;
41
+ };
42
+ export type FailureAttributes = {
43
+ status: 'fail';
44
+ failReason: string;
45
+ error?: string;
46
+ errorDetail?: string;
47
+ };
48
+ export type StatusAttributes = SuccessAttributes | FailureAttributes;
49
+ export type OperationalAttributes = BaseAttributes | (BaseAttributes & WithFileAttributes) | (BaseAttributes & WithFileAttributes & StatusAttributes) | (BaseAttributes & WithFileAttributes & StatusAttributes & WithPerformanceAttributes & WithTraceContext);
50
+ export type OperationalEventPayload<Attributes extends OperationalAttributes, Action extends string, ActionSubject extends string, ActionSubjectId extends string = string> = BaseEventPayload<Attributes> & {
51
+ eventType: 'operational';
52
+ action: Action;
53
+ actionSubject: ActionSubject;
54
+ actionSubjectId?: ActionSubjectId;
55
+ };
56
+ export type UIAttributes = BaseAttributes | (BaseAttributes & WithFileAttributes);
57
+ export type UIEventPayload<Attributes extends UIAttributes, Action extends string, ActionSubject extends string> = BaseEventPayload<Attributes> & {
58
+ eventType: 'ui';
59
+ action: Action;
60
+ actionSubject: ActionSubject;
61
+ actionSubjectId?: string;
62
+ };
63
+ export type ScreenAttributes = BaseAttributes | (BaseAttributes & WithFileAttributes);
64
+ export type ScreenEventPayload<Attributes extends ScreenAttributes, ActionSubject extends string> = BaseEventPayload<Attributes> & {
65
+ eventType: 'screen';
66
+ actionSubject: ActionSubject;
67
+ name: ActionSubject;
68
+ };
69
+ export type TrackAttributes = BaseAttributes | (BaseAttributes & WithFileAttributes);
70
+ export type TrackEventPayload<Attributes extends TrackAttributes, Action extends string, ActionSubject extends string, ActionSubjectId extends string = string> = BaseEventPayload<Attributes> & {
71
+ eventType: 'track';
72
+ action: Action;
73
+ actionSubject: ActionSubject;
74
+ actionSubjectId?: ActionSubjectId;
75
+ };
76
+ export type ContextPublicAttributes = PackageAttributes;
77
+ export type ContextPrivateAttributes = WithMediaFeatureFlags;
78
+ export type ContextStaticProps = WithMediaFeatureFlags;
79
+ export type ContextData = ContextPublicAttributes & {
80
+ [MEDIA_CONTEXT]: ContextPrivateAttributes;
81
+ };
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { ContextPublicAttributes } from './types';
3
+ /**
4
+ * HOC for attaching MediaAnalyticsContext to a top-level React Component.
5
+ *
6
+ * Similar than "packages/analytics/analytics-next/src/hocs/withAnalyticsContext.tsx",
7
+ * except that we restrict attributes put in this context using ContextPublicAttributes and ContextPrivateAttributes.
8
+ *
9
+ * As a constraint, the wrapped React Component's props must extend ContextStaticProps.
10
+ *
11
+ * @param {ContextPublicAttributes} attributes public attributes to put in context
12
+ *
13
+ * @see packages/analytics/analytics-next/src/hocs/withAnalyticsContext.tsx
14
+ */
15
+ export declare const withMediaAnalyticsContext: (contextPublicAttributes: ContextPublicAttributes) => <Props extends import("..").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,2 @@
1
+ export { createRxjsNotice } from './rxjs-notice';
2
+ export { createMediaUseOnlyNotice } from './media-use-only';
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare function createMediaUseOnlyNotice(componentName: string, alternatePackages?: {
3
+ name: string;
4
+ link: string;
5
+ }[]): JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function createRxjsNotice(componentName: string): JSX.Element;
@@ -0,0 +1,4 @@
1
+ export interface DownloadUrlOptions {
2
+ name?: string;
3
+ }
4
+ export declare const downloadUrl: (url: string, options?: DownloadUrlOptions) => void;
@@ -0,0 +1,19 @@
1
+ export { downloadUrl } from './downloadUrl';
2
+ export type MediaType = 'doc' | 'audio' | 'video' | 'image' | 'archive' | 'unknown';
3
+ export type FileStatus = 'uploading' | 'processing' | 'processed' | 'error' | 'failed-processing';
4
+ export { getMediaFeatureFlag, defaultMediaFeatureFlags, areEqualFeatureFlags, useMemoizeFeatureFlags, filterFeatureFlagNames, getFeatureFlagKeysAllProducts, } 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, WithTraceContext, 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, isVideoMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser, isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer, } from './mediaTypeUtils';
14
+ export type SSR = 'client' | 'server';
15
+ export { isUndefined, pick, omitBy, debounce, matches, getRandomHex, } from './utils/helpers';
16
+ export type MediaTraceContext = {
17
+ traceId: string;
18
+ spanId?: string;
19
+ };
@@ -0,0 +1 @@
1
+ export declare const getLocalMediaFeatureFlag: (key: string) => string | null;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns the first value for the flagName found in this priority
3
+ * 1: local storage
4
+ * 2: featureFlags parameter
5
+ * 3: defaults parameter
6
+ */
7
+ export declare function getGenericFeatureFlag<T, K extends string, M extends Record<K, any>>(flagName: K, defaults: M, featureFlags?: Partial<M>): T;
@@ -0,0 +1,2 @@
1
+ export { getMediaFeatureFlag, useMemoizeFeatureFlags, defaultMediaFeatureFlags, areEqualFeatureFlags, filterFeatureFlagNames, getFeatureFlagKeysAllProducts, } from './mediaFeatureFlags';
2
+ export type { MediaFeatureFlags, WithMediaFeatureFlags, SupportedProduct, } from './types';
@@ -0,0 +1,32 @@
1
+ import { RequiredMediaFeatureFlags, MediaFeatureFlags } from './types';
2
+ export declare const areEqualFeatureFlags: (ffA?: MediaFeatureFlags, ffB?: MediaFeatureFlags) => boolean;
3
+ export declare const filterFeatureFlagNames: (flags: RequiredMediaFeatureFlags) => Array<keyof MediaFeatureFlags>;
4
+ /**
5
+ * Takes a record of {Media Feature Flag Names → boolean}.
6
+ * Returns the Launch Darkly Keys from all products for each of the flags set as true in the input record.
7
+ * */
8
+ export declare const getFeatureFlagKeysAllProducts: () => Array<string>;
9
+ /**
10
+ * defaultMediaFeatureFlags set default values used by the getter function getMediaFeatureFlag
11
+ *
12
+ * *************************************
13
+ * ************* IMPORTANT *************
14
+ * *************************************
15
+ * Only in exceptional cases a FF should be 'true' by default.
16
+ * Making a flag default to 'true' can lead to confusing and unexpected scenarios.
17
+ * If you must set a flag default = true, whenever you remove that flag
18
+ * that change should be released as a MAJOR, because it's a breaking change.
19
+ */
20
+ export declare const defaultMediaFeatureFlags: Required<MediaFeatureFlags>;
21
+ /**
22
+ * Public accessor from components to fallback to defaults if flags not passed,
23
+ * otherwise whatever product has set will be returned.
24
+ *
25
+ * To override locally for testing:
26
+ * - `localStorage[flagName] = true` to enable locally,
27
+ * - `delete localStorage[flagName]` to remove.
28
+ *
29
+ * (you will see a warning in console if override used)
30
+ * */
31
+ export declare function getMediaFeatureFlag<T = boolean>(flagName: keyof MediaFeatureFlags, featureFlags?: MediaFeatureFlags): T;
32
+ export declare const useMemoizeFeatureFlags: (featureFlags?: MediaFeatureFlags) => MediaFeatureFlags | undefined;
@@ -0,0 +1,2 @@
1
+ import { ProductKeys } from './types';
2
+ export declare const getProductKeys: () => ProductKeys;
@@ -0,0 +1,20 @@
1
+ export interface MediaFeatureFlags {
2
+ newCardExperience?: boolean;
3
+ captions?: boolean;
4
+ mediaInline?: boolean;
5
+ folderUploads?: boolean;
6
+ observedWidth?: boolean;
7
+ timestampOnVideo?: boolean;
8
+ memoryCacheLogging?: boolean;
9
+ }
10
+ export interface WithMediaFeatureFlags {
11
+ featureFlags?: MediaFeatureFlags;
12
+ }
13
+ export type RequiredMediaFeatureFlags = Record<keyof Required<MediaFeatureFlags>, boolean>;
14
+ export type MediaFeatureFlagsMap = Record<keyof Required<MediaFeatureFlags>, string>;
15
+ export declare const supportedProducts: readonly [
16
+ "confluence",
17
+ "jira"
18
+ ];
19
+ export type SupportedProduct = (typeof supportedProducts)[number];
20
+ export 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,10 @@
1
+ export declare const isUndefined: (value: any) => boolean;
2
+ export declare const pick: (obj?: Object, 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 function getRandomHex(byte: number): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-common",
3
- "version": "4.1.1",
3
+ "version": "5.0.0",
4
4
  "description": "Includes common utilities used by other media packages",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
package/report.api.md CHANGED
@@ -23,8 +23,8 @@ export const ANALYTICS_MEDIA_CHANNEL = 'media';
23
23
 
24
24
  // @public (undocumented)
25
25
  export const areEqualFeatureFlags: (
26
- ffA?: MediaFeatureFlags | undefined,
27
- ffB?: MediaFeatureFlags | undefined,
26
+ ffA?: MediaFeatureFlags,
27
+ ffB?: MediaFeatureFlags,
28
28
  ) => boolean;
29
29
 
30
30
  // @public (undocumented)
@@ -54,10 +54,7 @@ export const debounce: (
54
54
  export const defaultMediaFeatureFlags: Required<MediaFeatureFlags>;
55
55
 
56
56
  // @public (undocumented)
57
- export const downloadUrl: (
58
- url: string,
59
- options?: DownloadUrlOptions | undefined,
60
- ) => void;
57
+ export const downloadUrl: (url: string, options?: DownloadUrlOptions) => void;
61
58
 
62
59
  // @public (undocumented)
63
60
  interface DownloadUrlOptions {
@@ -154,8 +151,6 @@ export interface MediaFeatureFlags {
154
151
  // (undocumented)
155
152
  captions?: boolean;
156
153
  // (undocumented)
157
- fetchFileStateAfterUpload?: boolean;
158
- // (undocumented)
159
154
  folderUploads?: boolean;
160
155
  // (undocumented)
161
156
  mediaInline?: boolean;
@@ -242,7 +237,7 @@ export type PerformanceAttributes = {
242
237
 
243
238
  // @public (undocumented)
244
239
  export const pick: (
245
- obj?: Object | undefined,
240
+ obj?: Object,
246
241
  keys?: Array<String>,
247
242
  ) => {
248
243
  [k: string]: any;
@@ -318,7 +313,7 @@ export type UIEventPayload<
318
313
 
319
314
  // @public (undocumented)
320
315
  export const useMemoizeFeatureFlags: (
321
- featureFlags?: MediaFeatureFlags | undefined,
316
+ featureFlags?: MediaFeatureFlags,
322
317
  ) => MediaFeatureFlags | undefined;
323
318
 
324
319
  // @public (undocumented)