@medipha/feed 0.3.7 → 0.3.9

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.
@@ -69,7 +69,7 @@ export declare function createFeedApi(config: FeedApiConfig): {
69
69
  updatePost: (postId: string, input: UpdatePostInput) => Promise<FeedPost>;
70
70
  submitPost: (postId: string) => Promise<FeedPost>;
71
71
  deletePost: (postId: string) => Promise<void>;
72
- uploadMedia: (file: Blob, fileName: string) => Promise<FeedMedia>;
72
+ uploadMedia: (file: Blob, fileName: string, onProgress?: (ratio: number) => void) => Promise<FeedMedia>;
73
73
  listManagePosts: (params?: ListManagePostsParams, signal?: AbortSignal) => Promise<OffsetPage<FeedPost>>;
74
74
  getManageCounts: (range?: Partial<DateRangeParams>, signal?: AbortSignal) => Promise<ManageCounts>;
75
75
  approvePosts: (postIds: string[]) => Promise<void>;
@@ -12,6 +12,8 @@ export interface FeedRequestOptions {
12
12
  body?: unknown;
13
13
  signal?: AbortSignal;
14
14
  responseType?: 'json' | 'blob';
15
+ /** Upload progress from 0 to 1; fetch cannot report it, so the request goes through XMLHttpRequest. */
16
+ onUploadProgress?: (ratio: number) => void;
15
17
  }
16
18
  export type FeedRequest = <T>(path: string, options?: FeedRequestOptions) => Promise<T>;
17
19
  export declare function createFeedRequest(config: FeedApiConfig): FeedRequest;
@@ -4,14 +4,17 @@ interface MediaPickerButtonsProps {
4
4
  count: number;
5
5
  disabled?: boolean;
6
6
  variant?: 'label' | 'icon';
7
- onUploadStart: () => void;
8
- onUploaded: (media: FeedMedia | null) => void;
7
+ /** Each upload has an id so the composer can show its own progress while several run at once. */
8
+ onUploadStart: (uploadId: string) => void;
9
+ onUploadProgress: (uploadId: string, ratio: number) => void;
10
+ onUploaded: (uploadId: string, media: FeedMedia | null) => void;
9
11
  }
10
- export declare function MediaPickerButtons({ count, disabled, variant, onUploadStart, onUploaded, }: MediaPickerButtonsProps): import('react/jsx-runtime').JSX.Element;
12
+ export declare function MediaPickerButtons({ count, disabled, variant, onUploadStart, onUploadProgress, onUploaded, }: MediaPickerButtonsProps): import('react/jsx-runtime').JSX.Element;
11
13
  interface AttachedMediaProps {
12
14
  media: FeedMedia[];
13
- uploadingCount: number;
15
+ /** Upload progress of each file still going out, from 0 to 1. */
16
+ uploading: number[];
14
17
  onRemove: (mediaId: string) => void;
15
18
  }
16
- export declare function AttachedMedia({ media, uploadingCount, onRemove }: AttachedMediaProps): import('react/jsx-runtime').JSX.Element | null;
19
+ export declare function AttachedMedia({ media, uploading, onRemove }: AttachedMediaProps): import('react/jsx-runtime').JSX.Element | null;
17
20
  export {};