@atlaskit/media-common 2.16.4 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/docs/index.js +9 -1
  3. package/dist/cjs/docs/media-use-only.js +41 -0
  4. package/dist/cjs/index.js +6 -0
  5. package/dist/cjs/mediaFeatureFlags/mediaFeatureFlags.js +0 -16
  6. package/dist/cjs/mediaFeatureFlags/productKeys.js +0 -2
  7. package/dist/cjs/utils/helpers.js +29 -10
  8. package/dist/cjs/version.json +1 -1
  9. package/dist/es2019/docs/index.js +2 -1
  10. package/dist/es2019/docs/media-use-only.js +29 -0
  11. package/dist/es2019/index.js +1 -1
  12. package/dist/es2019/mediaFeatureFlags/mediaFeatureFlags.js +0 -14
  13. package/dist/es2019/mediaFeatureFlags/productKeys.js +0 -2
  14. package/dist/es2019/utils/helpers.js +22 -6
  15. package/dist/es2019/version.json +1 -1
  16. package/dist/esm/docs/index.js +2 -1
  17. package/dist/esm/docs/media-use-only.js +31 -0
  18. package/dist/esm/index.js +1 -1
  19. package/dist/esm/mediaFeatureFlags/mediaFeatureFlags.js +0 -14
  20. package/dist/esm/mediaFeatureFlags/productKeys.js +0 -2
  21. package/dist/esm/utils/helpers.js +27 -8
  22. package/dist/esm/version.json +1 -1
  23. package/dist/types/analytics/types.d.ts +6 -2
  24. package/dist/types/docs/index.d.ts +1 -0
  25. package/dist/types/docs/media-use-only.d.ts +5 -0
  26. package/dist/types/index.d.ts +6 -2
  27. package/dist/types/mediaFeatureFlags/types.d.ts +0 -1
  28. package/dist/types/utils/helpers.d.ts +1 -5
  29. package/package.json +2 -9
  30. package/report.api.md +173 -124
  31. package/dist/types-ts4.0/analytics/constants.d.ts +0 -1
  32. package/dist/types-ts4.0/analytics/index.d.ts +0 -3
  33. package/dist/types-ts4.0/analytics/types.d.ts +0 -77
  34. package/dist/types-ts4.0/analytics/withMediaAnalyticsContext.d.ts +0 -18
  35. package/dist/types-ts4.0/docs/index.d.ts +0 -1
  36. package/dist/types-ts4.0/docs/rxjs-notice.d.ts +0 -2
  37. package/dist/types-ts4.0/downloadUrl.d.ts +0 -4
  38. package/dist/types-ts4.0/index.d.ts +0 -15
  39. package/dist/types-ts4.0/mediaFeatureFlag-local.d.ts +0 -1
  40. package/dist/types-ts4.0/mediaFeatureFlags/index.d.ts +0 -2
  41. package/dist/types-ts4.0/mediaFeatureFlags/mediaFeatureFlags.d.ts +0 -26
  42. package/dist/types-ts4.0/mediaFeatureFlags/productKeys.d.ts +0 -2
  43. package/dist/types-ts4.0/mediaFeatureFlags/types.d.ts +0 -21
  44. package/dist/types-ts4.0/mediaTypeUtils/index.d.ts +0 -4
  45. package/dist/types-ts4.0/mediaTypeUtils/isArchive.d.ts +0 -1
  46. package/dist/types-ts4.0/mediaTypeUtils/isMimeTypeSupportedByBrowser.d.ts +0 -14
  47. package/dist/types-ts4.0/mediaTypeUtils/isMimeTypeSupportedByServer.d.ts +0 -6
  48. package/dist/types-ts4.0/utils/helpers.d.ts +0 -14
package/report.api.md CHANGED
@@ -1,57 +1,79 @@
1
- ## API Report File for "@atlaskit/media-common".
1
+ <!-- API Report Version: 2.3 -->
2
2
 
3
- > Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
3
+ ## API Report File for "@atlaskit/media-common"
4
4
 
5
- [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
5
+ > Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
6
+ > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
7
+
8
+ ### Table of contents
9
+
10
+ - [Main Entry Types](#main-entry-types)
11
+
12
+ ### Main Entry Types
13
+
14
+ <!--SECTION START: Main Entry Types-->
6
15
 
7
16
  ```ts
8
17
  import { GasCorePayload } from '@atlaskit/analytics-gas-types';
9
18
  import { default as React_2 } from 'react';
10
19
 
11
- export declare const ANALYTICS_MEDIA_CHANNEL = 'media';
20
+ // @public (undocumented)
21
+ export const ANALYTICS_MEDIA_CHANNEL = 'media';
12
22
 
13
- export declare const areEqualFeatureFlags: (
23
+ // @public (undocumented)
24
+ export const areEqualFeatureFlags: (
14
25
  ffA?: MediaFeatureFlags | undefined,
15
26
  ffB?: MediaFeatureFlags | undefined,
16
27
  ) => boolean;
17
28
 
18
- declare type BaseAttributes = {};
29
+ // @public (undocumented)
30
+ type BaseAttributes = {};
19
31
 
20
- declare type BaseEventPayload<Attributes extends BaseAttributes> = Omit<
32
+ // @public (undocumented)
33
+ type BaseEventPayload<Attributes extends BaseAttributes> = Omit<
21
34
  GasCorePayload,
22
35
  'attributes'
23
36
  > & {
24
37
  attributes: Attributes;
25
38
  };
26
39
 
27
- export declare type ContextPublicAttributes = PackageAttributes;
40
+ // @public (undocumented)
41
+ export type ContextPublicAttributes = PackageAttributes;
28
42
 
29
- export declare type ContextStaticProps = WithMediaFeatureFlags;
43
+ // @public (undocumented)
44
+ export type ContextStaticProps = WithMediaFeatureFlags;
30
45
 
31
- export declare const debounce: (
46
+ // @public (undocumented)
47
+ export const debounce: (
32
48
  func: Function,
33
49
  wait: number,
34
50
  ) => (...args: any[]) => void;
35
51
 
36
- export declare const defaultMediaFeatureFlags: Required<MediaFeatureFlags>;
52
+ // @public (undocumented)
53
+ export const defaultMediaFeatureFlags: Required<MediaFeatureFlags>;
37
54
 
38
- export declare const downloadUrl: (
55
+ // @public (undocumented)
56
+ export const downloadUrl: (
39
57
  url: string,
40
58
  options?: DownloadUrlOptions | undefined,
41
59
  ) => void;
42
60
 
43
- declare interface DownloadUrlOptions {
61
+ // @public (undocumented)
62
+ interface DownloadUrlOptions {
63
+ // (undocumented)
44
64
  name?: string;
45
65
  }
46
66
 
47
- export declare type FailureAttributes = {
67
+ // @public (undocumented)
68
+ export type FailureAttributes = {
48
69
  status: 'fail';
49
70
  failReason: string;
50
71
  error?: string;
51
72
  errorDetail?: string;
52
73
  };
53
74
 
54
- export declare type FileAttributes = {
75
+ // @public (undocumented)
76
+ export type FileAttributes = {
55
77
  fileId: string;
56
78
  fileSize?: number;
57
79
  fileMediatype?: MediaType;
@@ -60,125 +82,137 @@ export declare type FileAttributes = {
60
82
  fileStatus?: FileStatus;
61
83
  };
62
84
 
63
- export declare type FileStatus =
64
- | 'uploading'
65
- | 'processing'
66
- | 'processed'
85
+ // @public (undocumented)
86
+ export type FileStatus =
67
87
  | 'error'
68
- | 'failed-processing';
88
+ | 'failed-processing'
89
+ | 'processed'
90
+ | 'processing'
91
+ | 'uploading';
69
92
 
70
- /**
71
- * Takes a record of {Media Feature Flag Names → boolean}.
72
- * Returns the Launch Darkly Keys from all products for each of the flags set as true in the input record.
73
- * */
74
- export declare const filterFeatureFlagKeysAllProducts: (
93
+ // @public
94
+ export const filterFeatureFlagKeysAllProducts: (
75
95
  flags: RequiredMediaFeatureFlags,
76
96
  ) => Array<string>;
77
97
 
78
- export declare const filterFeatureFlagNames: (
98
+ // @public (undocumented)
99
+ export const filterFeatureFlagNames: (
79
100
  flags: RequiredMediaFeatureFlags,
80
101
  ) => Array<keyof MediaFeatureFlags>;
81
102
 
82
- /**
83
- * Public accessor from components to fallback to defaults if flags not passed,
84
- * otherwise whatever product has set will be returned.
85
- *
86
- * To override locally for testing:
87
- * - `localStorage[flagName] = true` to enable locally,
88
- * - `delete localStorage[flagName]` to remove.
89
- *
90
- * (you will see a warning in console if override used)
91
- * */
92
- export declare function getMediaFeatureFlag<T = boolean>(
103
+ // @public
104
+ export function getMediaFeatureFlag<T = boolean>(
93
105
  flagName: keyof MediaFeatureFlags,
94
106
  featureFlags?: MediaFeatureFlags,
95
107
  ): T;
96
108
 
97
- export declare const getMediaTypeFromMimeType: (mimeType: string) => MediaType;
109
+ // @public (undocumented)
110
+ export const getMediaTypeFromMimeType: (mimeType: string) => MediaType;
98
111
 
99
- export declare const isAudioMimeTypeSupportedByServer: (
100
- mimeType: string,
101
- ) => boolean;
112
+ // @public (undocumented)
113
+ export function getRandomHex(byte: number): string;
102
114
 
103
- export declare const isDocumentMimeTypeSupportedByBrowser: (
104
- mimeType: string,
105
- ) => boolean;
115
+ // @public (undocumented)
116
+ export const isAudioMimeTypeSupportedByServer: (mimeType: string) => boolean;
106
117
 
107
- export declare const isDocumentMimeTypeSupportedByServer: (
118
+ // @public (undocumented)
119
+ export const isDocumentMimeTypeSupportedByBrowser: (
108
120
  mimeType: string,
109
121
  ) => boolean;
110
122
 
111
- export declare const isImageMimeTypeSupportedByBrowser: (
112
- mimeType: string,
113
- ) => boolean;
123
+ // @public (undocumented)
124
+ export const isDocumentMimeTypeSupportedByServer: (mimeType: string) => boolean;
114
125
 
115
- export declare const isImageMimeTypeSupportedByServer: (
116
- mimeType: string,
117
- ) => boolean;
126
+ // @public (undocumented)
127
+ export const isImageMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
118
128
 
119
- export declare const isMimeTypeSupportedByBrowser: (
120
- mimeType: string,
121
- ) => boolean;
129
+ // @public (undocumented)
130
+ export const isImageMimeTypeSupportedByServer: (mimeType: string) => boolean;
122
131
 
123
- export declare const isMimeTypeSupportedByServer: (mimeType: string) => boolean;
132
+ // @public (undocumented)
133
+ export const isMimeTypeSupportedByBrowser: (mimeType: string) => boolean;
124
134
 
125
- export declare const isUndefined: (value: any) => boolean;
135
+ // @public (undocumented)
136
+ export const isMimeTypeSupportedByServer: (mimeType: string) => boolean;
126
137
 
127
- export declare const isUnknownMimeTypeSupportedByServer: (
128
- mimeType: string,
129
- ) => boolean;
138
+ // @public (undocumented)
139
+ export const isUndefined: (value: any) => boolean;
130
140
 
131
- export declare const isVideoMimeTypeSupportedByServer: (
132
- mimeType: string,
133
- ) => boolean;
141
+ // @public (undocumented)
142
+ export const isUnknownMimeTypeSupportedByServer: (mimeType: string) => boolean;
134
143
 
135
- export declare const matches: (srcObj: Object) => (obj: Object) => boolean;
144
+ // @public (undocumented)
145
+ export const isVideoMimeTypeSupportedByServer: (mimeType: string) => boolean;
136
146
 
137
- export declare interface MediaFeatureFlags {
138
- newCardExperience?: boolean;
147
+ // @public (undocumented)
148
+ export const matches: (srcObj: Object) => (obj: Object) => boolean;
149
+
150
+ // @public (undocumented)
151
+ export interface MediaFeatureFlags {
152
+ // (undocumented)
139
153
  captions?: boolean;
140
- mediaInline?: boolean;
154
+ // (undocumented)
141
155
  folderUploads?: boolean;
156
+ // (undocumented)
157
+ mediaInline?: boolean;
158
+ // (undocumented)
159
+ memoryCacheLogging?: boolean;
160
+ // (undocumented)
161
+ newCardExperience?: boolean;
162
+ // (undocumented)
142
163
  observedWidth?: boolean;
164
+ // (undocumented)
143
165
  timestampOnVideo?: boolean;
144
- mediaUploadApiV2?: boolean;
145
- memoryCacheLogging?: boolean;
146
166
  }
147
167
 
148
- export declare type MediaType =
149
- | 'doc'
168
+ // @public (undocumented)
169
+ export type MediaTraceContext = {
170
+ traceId: string;
171
+ spanId?: string;
172
+ };
173
+
174
+ // @public (undocumented)
175
+ export type MediaType =
176
+ | 'archive'
150
177
  | 'audio'
151
- | 'video'
178
+ | 'doc'
152
179
  | 'image'
153
- | 'archive'
154
- | 'unknown';
180
+ | 'unknown'
181
+ | 'video';
155
182
 
156
- export declare interface NumericalCardDimensions {
157
- width: number;
183
+ // @public (undocumented)
184
+ export interface NumericalCardDimensions {
185
+ // (undocumented)
158
186
  height: number;
187
+ // (undocumented)
188
+ width: number;
159
189
  }
160
190
 
161
- export declare const omitBy: (
191
+ // @public (undocumented)
192
+ export const omitBy: (
162
193
  obj: Object,
163
194
  predicate: Function,
164
195
  ) => {
165
196
  [k: string]: any;
166
197
  };
167
198
 
168
- export declare type OperationalAttributes =
169
- | BaseAttributes
170
- | (BaseAttributes & WithFileAttributes)
171
- | (BaseAttributes & WithFileAttributes & StatusAttributes)
199
+ // @public (undocumented)
200
+ export type OperationalAttributes =
172
201
  | (BaseAttributes &
173
202
  WithFileAttributes &
174
203
  StatusAttributes &
175
- WithPerformanceAttributes);
204
+ WithPerformanceAttributes &
205
+ WithTraceContext)
206
+ | (BaseAttributes & WithFileAttributes & StatusAttributes)
207
+ | (BaseAttributes & WithFileAttributes)
208
+ | BaseAttributes;
176
209
 
177
- export declare type OperationalEventPayload<
210
+ // @public (undocumented)
211
+ export type OperationalEventPayload<
178
212
  Attributes extends OperationalAttributes,
179
213
  Action extends string,
180
214
  ActionSubject extends string,
181
- ActionSubjectId extends string = string
215
+ ActionSubjectId extends string = string,
182
216
  > = BaseEventPayload<Attributes> & {
183
217
  eventType: 'operational';
184
218
  action: Action;
@@ -186,63 +220,74 @@ export declare type OperationalEventPayload<
186
220
  actionSubjectId?: ActionSubjectId;
187
221
  };
188
222
 
189
- export declare type PackageAttributes = {
223
+ // @public (undocumented)
224
+ export type PackageAttributes = {
190
225
  packageName: string;
191
226
  packageVersion: string;
192
227
  componentName: string;
193
228
  component: string;
194
229
  };
195
230
 
196
- export declare type PerformanceAttributes = {
231
+ // @public (undocumented)
232
+ export type PerformanceAttributes = {
197
233
  overall: {
198
234
  durationSincePageStart: number;
199
235
  durationSinceCommenced?: number;
200
236
  };
201
237
  };
202
238
 
203
- export declare const pick: (
239
+ // @public (undocumented)
240
+ export const pick: (
204
241
  obj?: Object | undefined,
205
242
  keys?: Array<String>,
206
243
  ) => {
207
244
  [k: string]: any;
208
245
  };
209
246
 
210
- declare type RequiredMediaFeatureFlags = Record<
247
+ // @public (undocumented)
248
+ type RequiredMediaFeatureFlags = Record<
211
249
  keyof Required<MediaFeatureFlags>,
212
250
  boolean
213
251
  >;
214
252
 
215
- export declare type ScreenAttributes =
216
- | BaseAttributes
217
- | (BaseAttributes & WithFileAttributes);
253
+ // @public (undocumented)
254
+ export type ScreenAttributes =
255
+ | (BaseAttributes & WithFileAttributes)
256
+ | BaseAttributes;
218
257
 
219
- export declare type ScreenEventPayload<
258
+ // @public (undocumented)
259
+ export type ScreenEventPayload<
220
260
  Attributes extends ScreenAttributes,
221
- ActionSubject extends string
261
+ ActionSubject extends string,
222
262
  > = BaseEventPayload<Attributes> & {
223
263
  eventType: 'screen';
224
264
  actionSubject: ActionSubject;
225
265
  name: ActionSubject;
226
266
  };
227
267
 
228
- export declare type SSR = 'client' | 'server';
268
+ // @public (undocumented)
269
+ export type SSR = 'client' | 'server';
229
270
 
230
- declare type StatusAttributes = SuccessAttributes | FailureAttributes;
271
+ // @public (undocumented)
272
+ type StatusAttributes = FailureAttributes | SuccessAttributes;
231
273
 
232
- export declare type SuccessAttributes = {
274
+ // @public (undocumented)
275
+ export type SuccessAttributes = {
233
276
  status: 'success';
234
277
  fileMediatype?: MediaType;
235
278
  };
236
279
 
237
- export declare type TrackAttributes =
238
- | BaseAttributes
239
- | (BaseAttributes & WithFileAttributes);
280
+ // @public (undocumented)
281
+ export type TrackAttributes =
282
+ | (BaseAttributes & WithFileAttributes)
283
+ | BaseAttributes;
240
284
 
241
- export declare type TrackEventPayload<
285
+ // @public (undocumented)
286
+ export type TrackEventPayload<
242
287
  Attributes extends TrackAttributes,
243
288
  Action extends string,
244
289
  ActionSubject extends string,
245
- ActionSubjectId extends string = string
290
+ ActionSubjectId extends string = string,
246
291
  > = BaseEventPayload<Attributes> & {
247
292
  eventType: 'track';
248
293
  action: Action;
@@ -250,14 +295,16 @@ export declare type TrackEventPayload<
250
295
  actionSubjectId?: ActionSubjectId;
251
296
  };
252
297
 
253
- export declare type UIAttributes =
254
- | BaseAttributes
255
- | (BaseAttributes & WithFileAttributes);
298
+ // @public (undocumented)
299
+ export type UIAttributes =
300
+ | (BaseAttributes & WithFileAttributes)
301
+ | BaseAttributes;
256
302
 
257
- export declare type UIEventPayload<
303
+ // @public (undocumented)
304
+ export type UIEventPayload<
258
305
  Attributes extends UIAttributes,
259
306
  Action extends string,
260
- ActionSubject extends string
307
+ ActionSubject extends string,
261
308
  > = BaseEventPayload<Attributes> & {
262
309
  eventType: 'ui';
263
310
  action: Action;
@@ -265,34 +312,25 @@ export declare type UIEventPayload<
265
312
  actionSubjectId?: string;
266
313
  };
267
314
 
268
- export declare const useMemoizeFeatureFlags: (
315
+ // @public (undocumented)
316
+ export const useMemoizeFeatureFlags: (
269
317
  featureFlags?: MediaFeatureFlags | undefined,
270
318
  ) => MediaFeatureFlags | undefined;
271
319
 
272
- export declare type WithFileAttributes = {
320
+ // @public (undocumented)
321
+ export type WithFileAttributes = {
273
322
  fileAttributes: FileAttributes;
274
323
  };
275
324
 
276
- /**
277
- * HOC for attaching MediaAnalyticsContext to a top-level React Component.
278
- *
279
- * Similar than "packages/analytics/analytics-next/src/hocs/withAnalyticsContext.tsx",
280
- * except that we restrict attributes put in this context using ContextPublicAttributes and ContextPrivateAttributes.
281
- *
282
- * As a constraint, the wrapped React Component's props must extend ContextStaticProps.
283
- *
284
- * @param {ContextPublicAttributes} attributes public attributes to put in context
285
- *
286
- * @see packages/analytics/analytics-next/src/hocs/withAnalyticsContext.tsx
287
- */
288
- export declare const withMediaAnalyticsContext: (
325
+ // @public
326
+ export const withMediaAnalyticsContext: (
289
327
  contextPublicAttributes: ContextPublicAttributes,
290
328
  options?: {
291
329
  filterFeatureFlags?: Array<keyof MediaFeatureFlags>;
292
330
  },
293
331
  ) => <
294
332
  Props extends WithMediaFeatureFlags,
295
- Component extends React_2.ComponentType<Props>
333
+ Component extends React_2.ComponentType<Props>,
296
334
  >(
297
335
  WrappedComponent: React_2.JSXElementConstructor<Props> & Component,
298
336
  ) => React_2.ForwardRefExoticComponent<
@@ -300,13 +338,24 @@ export declare const withMediaAnalyticsContext: (
300
338
  React_2.RefAttributes<any>
301
339
  >;
302
340
 
303
- export declare interface WithMediaFeatureFlags {
341
+ // @public (undocumented)
342
+ export interface WithMediaFeatureFlags {
343
+ // (undocumented)
304
344
  featureFlags?: MediaFeatureFlags;
305
345
  }
306
346
 
307
- export declare type WithPerformanceAttributes = {
347
+ // @public (undocumented)
348
+ export type WithPerformanceAttributes = {
308
349
  performanceAttributes?: PerformanceAttributes;
309
350
  };
310
351
 
311
- export {};
352
+ // @public (undocumented)
353
+ export type WithTraceContext = {
354
+ traceContext?: MediaTraceContext;
355
+ metadataTraceContext?: MediaTraceContext;
356
+ };
357
+
358
+ // (No @packageDocumentation comment for this package)
312
359
  ```
360
+
361
+ <!--SECTION END: Main Entry Types-->
@@ -1 +0,0 @@
1
- export declare const ANALYTICS_MEDIA_CHANNEL = "media";
@@ -1,3 +0,0 @@
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';
@@ -1,77 +0,0 @@
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
- };
@@ -1,18 +0,0 @@
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>>;
@@ -1 +0,0 @@
1
- export { createRxjsNotice } from './rxjs-notice';
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare function createRxjsNotice(componentName: string): JSX.Element;
@@ -1,4 +0,0 @@
1
- export interface DownloadUrlOptions {
2
- name?: string;
3
- }
4
- export declare const downloadUrl: (url: string, options?: DownloadUrlOptions | undefined) => void;
@@ -1,15 +0,0 @@
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';
@@ -1 +0,0 @@
1
- export declare const getLocalMediaFeatureFlag: (key: string) => string | null;
@@ -1,2 +0,0 @@
1
- export { getMediaFeatureFlag, useMemoizeFeatureFlags, defaultMediaFeatureFlags, areEqualFeatureFlags, filterFeatureFlagNames, filterFeatureFlagKeysAllProducts, } from './mediaFeatureFlags';
2
- export type { MediaFeatureFlags, WithMediaFeatureFlags, SupportedProduct, } from './types';
@@ -1,26 +0,0 @@
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;
@@ -1,2 +0,0 @@
1
- import { ProductKeys } from './types';
2
- export declare const getProductKeys: () => ProductKeys;