@atlaskit/media-common 2.15.0 → 2.16.2

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 CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/media-common
2
2
 
3
+ ## 2.16.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c81ee725277`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c81ee725277) - Add attribute fileMediaType into media viewer loadSucceeded event
8
+ - Updated dependencies
9
+
10
+ ## 2.16.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
15
+
16
+ ## 2.16.0
17
+
18
+ ### Minor Changes
19
+
20
+ - [`a332288b5ea`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a332288b5ea) - Added analytics for media-card memoryCacheLogging and added relevant featureFlag keys for media-common package.
21
+
3
22
  ## 2.15.0
4
23
 
5
24
  ### Minor Changes
@@ -35,7 +35,8 @@ var areEqualFeatureFlags = function areEqualFeatureFlags(ffA, ffB) {
35
35
  folderUploads: ffA.folderUploads === ffB.folderUploads,
36
36
  observedWidth: ffA.observedWidth === ffB.observedWidth,
37
37
  timestampOnVideo: ffA.timestampOnVideo === ffB.timestampOnVideo,
38
- mediaUploadApiV2: ffA.mediaUploadApiV2 === ffB.mediaUploadApiV2
38
+ mediaUploadApiV2: ffA.mediaUploadApiV2 === ffB.mediaUploadApiV2,
39
+ memoryCacheLogging: ffA.memoryCacheLogging === ffB.memoryCacheLogging
39
40
  };
40
41
  return Object.values(results).every(function (result) {
41
42
  return result;
@@ -106,7 +107,8 @@ var defaultMediaFeatureFlags = {
106
107
  folderUploads: false,
107
108
  observedWidth: false,
108
109
  timestampOnVideo: false,
109
- mediaUploadApiV2: true
110
+ mediaUploadApiV2: true,
111
+ memoryCacheLogging: false
110
112
  };
111
113
  /**
112
114
  * Public accessor from components to fallback to defaults if flags not passed,
@@ -14,7 +14,8 @@ 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'
17
+ mediaUploadApiV2: 'confluence.enable.media.upload.api.v2',
18
+ memoryCacheLogging: 'confluence-frontend-media-card-memory-cache-logging'
18
19
  },
19
20
  jira: {
20
21
  newCardExperience: 'issue.details.media-cards-new-experience',
@@ -26,7 +27,8 @@ var productKeys = {
26
27
  observedWidth: '',
27
28
  // TODO https://product-fabric.atlassian.net/browse/MEX-1620
28
29
  timestampOnVideo: '',
29
- mediaUploadApiV2: 'issue.details.enable-media-upload-api-version-2'
30
+ mediaUploadApiV2: 'issue.details.enable-media-upload-api-version-2',
31
+ memoryCacheLogging: 'jira-frontend-media-card-memory-cache-logging'
30
32
  }
31
33
  };
32
34
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-common",
3
- "version": "2.15.0",
3
+ "version": "2.16.2",
4
4
  "sideEffects": false
5
5
  }
@@ -18,7 +18,8 @@ export const 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
- mediaUploadApiV2: ffA.mediaUploadApiV2 === ffB.mediaUploadApiV2
21
+ mediaUploadApiV2: ffA.mediaUploadApiV2 === ffB.mediaUploadApiV2,
22
+ memoryCacheLogging: ffA.memoryCacheLogging === ffB.memoryCacheLogging
22
23
  };
23
24
  return Object.values(results).every(result => result);
24
25
  };
@@ -57,7 +58,8 @@ export const defaultMediaFeatureFlags = {
57
58
  folderUploads: false,
58
59
  observedWidth: false,
59
60
  timestampOnVideo: false,
60
- mediaUploadApiV2: true
61
+ mediaUploadApiV2: true,
62
+ memoryCacheLogging: false
61
63
  };
62
64
  /**
63
65
  * Public accessor from components to fallback to defaults if flags not passed,
@@ -8,7 +8,8 @@ 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'
11
+ mediaUploadApiV2: 'confluence.enable.media.upload.api.v2',
12
+ memoryCacheLogging: 'confluence-frontend-media-card-memory-cache-logging'
12
13
  },
13
14
  jira: {
14
15
  newCardExperience: 'issue.details.media-cards-new-experience',
@@ -20,7 +21,8 @@ const productKeys = {
20
21
  observedWidth: '',
21
22
  // TODO https://product-fabric.atlassian.net/browse/MEX-1620
22
23
  timestampOnVideo: '',
23
- mediaUploadApiV2: 'issue.details.enable-media-upload-api-version-2'
24
+ mediaUploadApiV2: 'issue.details.enable-media-upload-api-version-2',
25
+ memoryCacheLogging: 'jira-frontend-media-card-memory-cache-logging'
24
26
  }
25
27
  };
26
28
  export const getProductKeys = () => productKeys;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-common",
3
- "version": "2.15.0",
3
+ "version": "2.16.2",
4
4
  "sideEffects": false
5
5
  }
@@ -19,7 +19,8 @@ export var areEqualFeatureFlags = function areEqualFeatureFlags(ffA, ffB) {
19
19
  folderUploads: ffA.folderUploads === ffB.folderUploads,
20
20
  observedWidth: ffA.observedWidth === ffB.observedWidth,
21
21
  timestampOnVideo: ffA.timestampOnVideo === ffB.timestampOnVideo,
22
- mediaUploadApiV2: ffA.mediaUploadApiV2 === ffB.mediaUploadApiV2
22
+ mediaUploadApiV2: ffA.mediaUploadApiV2 === ffB.mediaUploadApiV2,
23
+ memoryCacheLogging: ffA.memoryCacheLogging === ffB.memoryCacheLogging
23
24
  };
24
25
  return Object.values(results).every(function (result) {
25
26
  return result;
@@ -79,7 +80,8 @@ export var defaultMediaFeatureFlags = {
79
80
  folderUploads: false,
80
81
  observedWidth: false,
81
82
  timestampOnVideo: false,
82
- mediaUploadApiV2: true
83
+ mediaUploadApiV2: true,
84
+ memoryCacheLogging: false
83
85
  };
84
86
  /**
85
87
  * Public accessor from components to fallback to defaults if flags not passed,
@@ -8,7 +8,8 @@ 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'
11
+ mediaUploadApiV2: 'confluence.enable.media.upload.api.v2',
12
+ memoryCacheLogging: 'confluence-frontend-media-card-memory-cache-logging'
12
13
  },
13
14
  jira: {
14
15
  newCardExperience: 'issue.details.media-cards-new-experience',
@@ -20,7 +21,8 @@ var productKeys = {
20
21
  observedWidth: '',
21
22
  // TODO https://product-fabric.atlassian.net/browse/MEX-1620
22
23
  timestampOnVideo: '',
23
- mediaUploadApiV2: 'issue.details.enable-media-upload-api-version-2'
24
+ mediaUploadApiV2: 'issue.details.enable-media-upload-api-version-2',
25
+ memoryCacheLogging: 'jira-frontend-media-card-memory-cache-logging'
24
26
  }
25
27
  };
26
28
  export var getProductKeys = function getProductKeys() {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-common",
3
- "version": "2.15.0",
3
+ "version": "2.16.2",
4
4
  "sideEffects": false
5
5
  }
@@ -33,6 +33,7 @@ export declare type WithPerformanceAttributes = {
33
33
  };
34
34
  export declare type SuccessAttributes = {
35
35
  status: 'success';
36
+ fileMediatype?: MediaType;
36
37
  };
37
38
  export declare type FailureAttributes = {
38
39
  status: 'fail';
@@ -6,6 +6,7 @@ export interface MediaFeatureFlags {
6
6
  observedWidth?: boolean;
7
7
  timestampOnVideo?: boolean;
8
8
  mediaUploadApiV2?: boolean;
9
+ memoryCacheLogging?: boolean;
9
10
  }
10
11
  export interface WithMediaFeatureFlags {
11
12
  featureFlags?: MediaFeatureFlags;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-common",
3
- "version": "2.15.0",
3
+ "version": "2.16.2",
4
4
  "description": "Includes common utilities used by other media packages",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -33,9 +33,9 @@
33
33
  "scripts": {},
34
34
  "dependencies": {
35
35
  "@atlaskit/analytics-gas-types": "^5.0.5",
36
- "@atlaskit/analytics-namespaced-context": "^6.4.0",
36
+ "@atlaskit/analytics-namespaced-context": "^6.5.0",
37
37
  "@atlaskit/analytics-next": "^8.1.1",
38
- "@atlaskit/section-message": "^6.0.0",
38
+ "@atlaskit/section-message": "^6.2.0",
39
39
  "@babel/runtime": "^7.0.0"
40
40
  },
41
41
  "peerDependencies": {
@@ -49,7 +49,7 @@
49
49
  "enzyme": "^3.10.0",
50
50
  "react": "^16.8.0",
51
51
  "react-dom": "^16.8.0",
52
- "typescript": "4.2.4"
52
+ "typescript": "4.3.5"
53
53
  },
54
54
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
55
55
  }
package/report.api.md ADDED
@@ -0,0 +1,308 @@
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
+ import { GasCorePayload } from '@atlaskit/analytics-gas-types';
7
+ import { default as React_2 } from 'react';
8
+
9
+ export declare const ANALYTICS_MEDIA_CHANNEL = 'media';
10
+
11
+ export declare const areEqualFeatureFlags: (
12
+ ffA?: MediaFeatureFlags | undefined,
13
+ ffB?: MediaFeatureFlags | undefined,
14
+ ) => boolean;
15
+
16
+ declare type BaseAttributes = {};
17
+
18
+ declare type BaseEventPayload<Attributes extends BaseAttributes> = Omit<
19
+ GasCorePayload,
20
+ 'attributes'
21
+ > & {
22
+ attributes: Attributes;
23
+ };
24
+
25
+ export declare type ContextPublicAttributes = PackageAttributes;
26
+
27
+ export declare type ContextStaticProps = WithMediaFeatureFlags;
28
+
29
+ export declare const debounce: (
30
+ func: Function,
31
+ wait: number,
32
+ ) => (...args: any[]) => void;
33
+
34
+ export declare const defaultMediaFeatureFlags: Required<MediaFeatureFlags>;
35
+
36
+ export declare const downloadUrl: (
37
+ url: string,
38
+ options?: DownloadUrlOptions | undefined,
39
+ ) => void;
40
+
41
+ declare interface DownloadUrlOptions {
42
+ name?: string;
43
+ }
44
+
45
+ export declare type FailureAttributes = {
46
+ status: 'fail';
47
+ failReason: string;
48
+ error?: string;
49
+ errorDetail?: string;
50
+ };
51
+
52
+ export declare type FileAttributes = {
53
+ fileId: string;
54
+ fileSize?: number;
55
+ fileMediatype?: MediaType;
56
+ fileMimetype?: string;
57
+ fileSource?: string;
58
+ fileStatus?: FileStatus;
59
+ };
60
+
61
+ export declare type FileStatus =
62
+ | 'uploading'
63
+ | 'processing'
64
+ | 'processed'
65
+ | 'error'
66
+ | 'failed-processing';
67
+
68
+ /**
69
+ * Takes a record of {Media Feature Flag Names → boolean}.
70
+ * Returns the Launch Darkly Keys from all products for each of the flags set as true in the input record.
71
+ * */
72
+ export declare const filterFeatureFlagKeysAllProducts: (
73
+ flags: RequiredMediaFeatureFlags,
74
+ ) => Array<string>;
75
+
76
+ export declare const filterFeatureFlagNames: (
77
+ flags: RequiredMediaFeatureFlags,
78
+ ) => Array<keyof MediaFeatureFlags>;
79
+
80
+ /**
81
+ * Public accessor from components to fallback to defaults if flags not passed,
82
+ * otherwise whatever product has set will be returned.
83
+ *
84
+ * To override locally for testing:
85
+ * - `localStorage[flagName] = true` to enable locally,
86
+ * - `delete localStorage[flagName]` to remove.
87
+ *
88
+ * (you will see a warning in console if override used)
89
+ * */
90
+ export declare function getMediaFeatureFlag<T = boolean>(
91
+ flagName: keyof MediaFeatureFlags,
92
+ featureFlags?: MediaFeatureFlags,
93
+ ): T;
94
+
95
+ export declare const getMediaTypeFromMimeType: (mimeType: string) => MediaType;
96
+
97
+ export declare const isAudioMimeTypeSupportedByServer: (
98
+ mimeType: string,
99
+ ) => boolean;
100
+
101
+ export declare const isDocumentMimeTypeSupportedByBrowser: (
102
+ mimeType: string,
103
+ ) => boolean;
104
+
105
+ export declare const isDocumentMimeTypeSupportedByServer: (
106
+ mimeType: string,
107
+ ) => boolean;
108
+
109
+ export declare const isImageMimeTypeSupportedByBrowser: (
110
+ mimeType: string,
111
+ ) => boolean;
112
+
113
+ export declare const isImageMimeTypeSupportedByServer: (
114
+ mimeType: string,
115
+ ) => boolean;
116
+
117
+ export declare const isMimeTypeSupportedByBrowser: (
118
+ mimeType: string,
119
+ ) => boolean;
120
+
121
+ export declare const isMimeTypeSupportedByServer: (mimeType: string) => boolean;
122
+
123
+ export declare const isUndefined: (value: any) => boolean;
124
+
125
+ export declare const isUnknownMimeTypeSupportedByServer: (
126
+ mimeType: string,
127
+ ) => boolean;
128
+
129
+ export declare const isVideoMimeTypeSupportedByServer: (
130
+ mimeType: string,
131
+ ) => boolean;
132
+
133
+ export declare const matches: (srcObj: Object) => (obj: Object) => boolean;
134
+
135
+ export declare interface MediaFeatureFlags {
136
+ newCardExperience?: boolean;
137
+ captions?: boolean;
138
+ mediaInline?: boolean;
139
+ folderUploads?: boolean;
140
+ observedWidth?: boolean;
141
+ timestampOnVideo?: boolean;
142
+ mediaUploadApiV2?: boolean;
143
+ }
144
+
145
+ export declare type MediaType =
146
+ | 'doc'
147
+ | 'audio'
148
+ | 'video'
149
+ | 'image'
150
+ | 'archive'
151
+ | 'unknown';
152
+
153
+ export declare interface NumericalCardDimensions {
154
+ width: number;
155
+ height: number;
156
+ }
157
+
158
+ export declare const omitBy: (
159
+ obj: Object,
160
+ predicate: Function,
161
+ ) => {
162
+ [k: string]: any;
163
+ };
164
+
165
+ export declare type OperationalAttributes =
166
+ | BaseAttributes
167
+ | (BaseAttributes & WithFileAttributes)
168
+ | (BaseAttributes & WithFileAttributes & StatusAttributes)
169
+ | (BaseAttributes &
170
+ WithFileAttributes &
171
+ StatusAttributes &
172
+ WithPerformanceAttributes);
173
+
174
+ export declare type OperationalEventPayload<
175
+ Attributes extends OperationalAttributes,
176
+ Action extends string,
177
+ ActionSubject extends string,
178
+ ActionSubjectId extends string = string
179
+ > = BaseEventPayload<Attributes> & {
180
+ eventType: 'operational';
181
+ action: Action;
182
+ actionSubject: ActionSubject;
183
+ actionSubjectId?: ActionSubjectId;
184
+ };
185
+
186
+ export declare type PackageAttributes = {
187
+ packageName: string;
188
+ packageVersion: string;
189
+ componentName: string;
190
+ component: string;
191
+ };
192
+
193
+ export declare type PerformanceAttributes = {
194
+ overall: {
195
+ durationSincePageStart: number;
196
+ durationSinceCommenced?: number;
197
+ };
198
+ };
199
+
200
+ export declare const pick: (
201
+ obj?: Object | undefined,
202
+ keys?: Array<String>,
203
+ ) => {
204
+ [k: string]: any;
205
+ };
206
+
207
+ declare type RequiredMediaFeatureFlags = Record<
208
+ keyof Required<MediaFeatureFlags>,
209
+ boolean
210
+ >;
211
+
212
+ export declare type ScreenAttributes =
213
+ | BaseAttributes
214
+ | (BaseAttributes & WithFileAttributes);
215
+
216
+ export declare type ScreenEventPayload<
217
+ Attributes extends ScreenAttributes,
218
+ ActionSubject extends string
219
+ > = BaseEventPayload<Attributes> & {
220
+ eventType: 'screen';
221
+ actionSubject: ActionSubject;
222
+ name: ActionSubject;
223
+ };
224
+
225
+ export declare type SSR = 'client' | 'server';
226
+
227
+ declare type StatusAttributes = SuccessAttributes | FailureAttributes;
228
+
229
+ export declare type SuccessAttributes = {
230
+ status: 'success';
231
+ };
232
+
233
+ export declare type TrackAttributes =
234
+ | BaseAttributes
235
+ | (BaseAttributes & WithFileAttributes);
236
+
237
+ export declare type TrackEventPayload<
238
+ Attributes extends TrackAttributes,
239
+ Action extends string,
240
+ ActionSubject extends string,
241
+ ActionSubjectId extends string = string
242
+ > = BaseEventPayload<Attributes> & {
243
+ eventType: 'track';
244
+ action: Action;
245
+ actionSubject: ActionSubject;
246
+ actionSubjectId?: ActionSubjectId;
247
+ };
248
+
249
+ export declare type UIAttributes =
250
+ | BaseAttributes
251
+ | (BaseAttributes & WithFileAttributes);
252
+
253
+ export declare type UIEventPayload<
254
+ Attributes extends UIAttributes,
255
+ Action extends string,
256
+ ActionSubject extends string
257
+ > = BaseEventPayload<Attributes> & {
258
+ eventType: 'ui';
259
+ action: Action;
260
+ actionSubject: ActionSubject;
261
+ actionSubjectId?: string;
262
+ };
263
+
264
+ export declare const useMemoizeFeatureFlags: (
265
+ featureFlags?: MediaFeatureFlags | undefined,
266
+ ) => MediaFeatureFlags | undefined;
267
+
268
+ export declare type WithFileAttributes = {
269
+ fileAttributes: FileAttributes;
270
+ };
271
+
272
+ /**
273
+ * HOC for attaching MediaAnalyticsContext to a top-level React Component.
274
+ *
275
+ * Similar than "packages/analytics/analytics-next/src/hocs/withAnalyticsContext.tsx",
276
+ * except that we restrict attributes put in this context using ContextPublicAttributes and ContextPrivateAttributes.
277
+ *
278
+ * As a constraint, the wrapped React Component's props must extend ContextStaticProps.
279
+ *
280
+ * @param {ContextPublicAttributes} attributes public attributes to put in context
281
+ *
282
+ * @see packages/analytics/analytics-next/src/hocs/withAnalyticsContext.tsx
283
+ */
284
+ export declare const withMediaAnalyticsContext: (
285
+ contextPublicAttributes: ContextPublicAttributes,
286
+ options?: {
287
+ filterFeatureFlags?: Array<keyof MediaFeatureFlags>;
288
+ },
289
+ ) => <
290
+ Props extends WithMediaFeatureFlags,
291
+ Component extends React_2.ComponentType<Props>
292
+ >(
293
+ WrappedComponent: React_2.JSXElementConstructor<Props> & Component,
294
+ ) => React_2.ForwardRefExoticComponent<
295
+ React_2.PropsWithoutRef<JSX.LibraryManagedAttributes<Component, Props>> &
296
+ React_2.RefAttributes<any>
297
+ >;
298
+
299
+ export declare interface WithMediaFeatureFlags {
300
+ featureFlags?: MediaFeatureFlags;
301
+ }
302
+
303
+ export declare type WithPerformanceAttributes = {
304
+ performanceAttributes?: PerformanceAttributes;
305
+ };
306
+
307
+ export {};
308
+ ```