Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/config/api-extractor/api-extractor.stable.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"addToApiReportFile": false
},
"ae-incompatible-release-tags": {
"logLevel": "error",
"logLevel": "warning",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an annoyance now :(

"addToApiReportFile": false
}
},
Expand Down
4 changes: 2 additions & 2 deletions common/config/babel/.babelrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ process.env['COMMUNICATION_REACT_FLAVOR'] === 'stable' &&
// Demo feature. Used in live-documentation of conditional compilation.
// Do not use in production code.
'demo',
// Ability to upload/download files in message thread.
'file-sharing',
// Camera switcher in the local video preview tile. These are used by `call-with-chat-composite` feature.
// Perhaps we should merge this into the `call-with-chat-composite` feature?
'local-camera-switcher',
Expand All @@ -43,6 +41,8 @@ process.env['COMMUNICATION_REACT_FLAVOR'] === 'stable' &&
// Demo feature. Used in live-documentation of conditional compilation.
// Do not use in production code.
'stabilizedDemo',
// Ability to upload/download files in message thread.
'file-sharing',
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One line stabilization!

]
}
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ export interface CameraButtonStrings {
}

// @public
export type ChatAdapter = ChatAdapterThreadManagement & AdapterState<ChatAdapterState> & Disposable & ChatAdapterSubscribers;
export type ChatAdapter = ChatAdapterThreadManagement & AdapterState<ChatAdapterState> & Disposable & ChatAdapterSubscribers & FileUploadAdapter;

// @public
export type ChatAdapterState = ChatAdapterUiState & ChatCompositeClientState;
Expand Down Expand Up @@ -538,6 +538,7 @@ export interface ChatAdapterThreadManagement {
// @public
export type ChatAdapterUiState = {
error?: Error;
fileUploads?: FileUploadsUiState;
};

// @public
Expand Down Expand Up @@ -576,13 +577,14 @@ export type ChatCompositeClientState = {
};

// @public
export type ChatCompositeIcons = Partial<Pick<CompositeIcons, 'MessageDelivered' | 'MessageFailed' | 'MessageSeen' | 'MessageSending' | 'MessageEdit' | 'MessageRemove' | 'ParticipantItemOptions' | 'ParticipantItemOptionsHovered' | 'SendBoxSend' | 'SendBoxSendHovered' | 'EditBoxCancel' | 'EditBoxSubmit'>>;
export type ChatCompositeIcons = Partial<Pick<CompositeIcons, 'MessageDelivered' | 'MessageFailed' | 'MessageSeen' | 'MessageSending' | 'MessageEdit' | 'MessageRemove' | 'ParticipantItemOptions' | 'ParticipantItemOptionsHovered' | 'SendBoxSend' | 'SendBoxSendHovered' | 'EditBoxCancel' | 'EditBoxSubmit' | 'SendBoxAttachFile'>>;

// @public
export type ChatCompositeOptions = {
errorBar?: boolean;
topic?: boolean;
autoFocus?: 'sendBoxTextField';
fileSharing?: FileSharingOptions;
};

// @public
Expand Down Expand Up @@ -852,6 +854,7 @@ export const COMPOSITE_ONLY_ICONS: {
NoticePageJoinCallFailedDueToNoNetwork: JSX.Element;
NoticePageLeftCall: JSX.Element;
NoticePageRemovedFromCall: JSX.Element;
SendBoxAttachFile: JSX.Element;
};

// @public
Expand Down Expand Up @@ -1022,6 +1025,7 @@ export const DEFAULT_COMPOSITE_ICONS: {
NoticePageJoinCallFailedDueToNoNetwork: JSX.Element;
NoticePageLeftCall: JSX.Element;
NoticePageRemovedFromCall: JSX.Element;
SendBoxAttachFile: JSX.Element;
ControlButtonCameraOff: JSX.Element;
ControlButtonCameraOn: JSX.Element;
ControlButtonEndCall: JSX.Element;
Expand Down Expand Up @@ -1202,6 +1206,72 @@ export interface ErrorBarStrings {
// @public
export type ErrorType = keyof ErrorBarStrings;

// @beta
export interface FileDownloadErrorMessage {
errorMessage: string;
}

// @beta
export type FileDownloadHandler = (userId: string, fileData: FileMetadata) => Promise<URL | FileDownloadErrorMessage>;

// @beta
export interface FileMetadata {
extension: string;
name: string;
url: string;
}

// @beta
export interface FileSharingOptions {
accept?: string;
downloadHandler?: FileDownloadHandler;
multiple?: boolean;
uploadHandler: FileUploadHandler;
}

// @beta (undocumented)
export interface FileUploadAdapter {
// (undocumented)
cancelFileUpload?: (id: string) => void;
// (undocumented)
clearFileUploads?: () => void;
// (undocumented)
registerFileUploads?: (fileUploads: ObservableFileUpload[]) => void;
}

// @beta (undocumented)
export interface FileUploadEventEmitter {
off(event: 'uploadProgressed', listener: UploadProgressListener): void;
off(event: 'uploadCompleted', listener: UploadCompleteListener): void;
off(event: 'uploadFailed', listener: UploadFailedListener): void;
on(event: 'uploadProgressed', listener: UploadProgressListener): void;
on(event: 'uploadCompleted', listener: UploadCompleteListener): void;
on(event: 'uploadFailed', listener: UploadFailedListener): void;
}

// @beta
export type FileUploadHandler = (userId: string, fileUploads: FileUploadManager[]) => void;

// @beta
export interface FileUploadManager {
file: File;
notifyUploadCompleted: (metadata: FileMetadata) => void;
notifyUploadFailed: (message: string) => void;
notifyUploadProgressed: (value: number) => void;
}

// @beta
export interface FileUploadState {
errorMessage?: string;
filename: string;
id: string;
metadata?: FileMetadata;
progress: number;
}

// @beta
export type FileUploadsUiState = Record<string, FileUploadState>;

// @public
export const FluentThemeProvider: (props: FluentThemeProviderProps) => JSX.Element;

Expand Down Expand Up @@ -1518,6 +1588,12 @@ export interface NetworkDiagnosticsState {
latest: LatestNetworkDiagnostics;
}

// @beta
export interface ObservableFileUpload extends FileUploadEventEmitter {
file: File;
id: string;
}

// @public
export type OnRenderAvatarCallback = (
userId?: string, options?: CustomAvatarOptions,
Expand Down Expand Up @@ -1744,6 +1820,8 @@ export const SendBox: (props: SendBoxProps) => JSX.Element;
export interface SendBoxProps {
autoFocus?: 'sendBoxTextField';
disabled?: boolean;
// @beta
onRenderFileUploads?: () => JSX.Element;
onRenderIcon?: (isHover: boolean) => JSX.Element;
onRenderSystemMessage?: (systemMessage: string | undefined) => React_2.ReactElement;
onSendMessage?: (content: string) => Promise<void>;
Expand Down Expand Up @@ -1895,6 +1973,15 @@ export interface TypingIndicatorStylesProps extends BaseCustomStyles {
typingUserDisplayName?: IStyle;
}

// @beta
export type UploadCompleteListener = (id: string, metadata: FileMetadata) => void;

// @beta
export type UploadFailedListener = (id: string, message: string) => void;

// @beta
export type UploadProgressListener = (id: string, value: number) => void;

// @public
export const useCall: () => Call | undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,8 @@ export const SendBox: (props: SendBoxProps) => JSX.Element;
export interface SendBoxProps {
autoFocus?: 'sendBoxTextField';
disabled?: boolean;
// @beta
onRenderFileUploads?: () => JSX.Element;
onRenderIcon?: (isHover: boolean) => JSX.Element;
onRenderSystemMessage?: (systemMessage: string | undefined) => React_2.ReactElement;
onSendMessage?: (content: string) => Promise<void>;
Expand Down
89 changes: 87 additions & 2 deletions packages/react-composites/stable-review/react-composites.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export type CallIdChangedListener = (event: {
}) => void;

// @public
export type ChatAdapter = ChatAdapterThreadManagement & AdapterState<ChatAdapterState> & Disposable & ChatAdapterSubscribers;
export type ChatAdapter = ChatAdapterThreadManagement & AdapterState<ChatAdapterState> & Disposable & ChatAdapterSubscribers & FileUploadAdapter;

// @public
export type ChatAdapterState = ChatAdapterUiState & ChatCompositeClientState;
Expand Down Expand Up @@ -312,6 +312,7 @@ export interface ChatAdapterThreadManagement {
// @public
export type ChatAdapterUiState = {
error?: Error;
fileUploads?: FileUploadsUiState;
};

// @public
Expand All @@ -326,13 +327,14 @@ export type ChatCompositeClientState = {
};

// @public
export type ChatCompositeIcons = Partial<Pick<CompositeIcons, 'MessageDelivered' | 'MessageFailed' | 'MessageSeen' | 'MessageSending' | 'MessageEdit' | 'MessageRemove' | 'ParticipantItemOptions' | 'ParticipantItemOptionsHovered' | 'SendBoxSend' | 'SendBoxSendHovered' | 'EditBoxCancel' | 'EditBoxSubmit'>>;
export type ChatCompositeIcons = Partial<Pick<CompositeIcons, 'MessageDelivered' | 'MessageFailed' | 'MessageSeen' | 'MessageSending' | 'MessageEdit' | 'MessageRemove' | 'ParticipantItemOptions' | 'ParticipantItemOptionsHovered' | 'SendBoxSend' | 'SendBoxSendHovered' | 'EditBoxCancel' | 'EditBoxSubmit' | 'SendBoxAttachFile'>>;

// @public
export type ChatCompositeOptions = {
errorBar?: boolean;
topic?: boolean;
autoFocus?: 'sendBoxTextField';
fileSharing?: FileSharingOptions;
};

// @public
Expand Down Expand Up @@ -404,6 +406,7 @@ export const COMPOSITE_ONLY_ICONS: {
NoticePageJoinCallFailedDueToNoNetwork: JSX.Element;
NoticePageLeftCall: JSX.Element;
NoticePageRemovedFromCall: JSX.Element;
SendBoxAttachFile: JSX.Element;
};

// @public
Expand Down Expand Up @@ -447,6 +450,7 @@ export const DEFAULT_COMPOSITE_ICONS: {
NoticePageJoinCallFailedDueToNoNetwork: JSX.Element;
NoticePageLeftCall: JSX.Element;
NoticePageRemovedFromCall: JSX.Element;
SendBoxAttachFile: JSX.Element;
ControlButtonCameraOff: JSX.Element;
ControlButtonCameraOn: JSX.Element;
ControlButtonEndCall: JSX.Element;
Expand Down Expand Up @@ -502,6 +506,72 @@ export interface Disposable {
dispose(): void;
}

// @beta
export interface FileDownloadErrorMessage {
errorMessage: string;
}

// @beta
export type FileDownloadHandler = (userId: string, fileData: FileMetadata) => Promise<URL | FileDownloadErrorMessage>;

// @beta
export interface FileMetadata {
extension: string;
name: string;
url: string;
}

// @beta
export interface FileSharingOptions {
accept?: string;
downloadHandler?: FileDownloadHandler;
multiple?: boolean;
uploadHandler: FileUploadHandler;
}

// @beta (undocumented)
export interface FileUploadAdapter {
// (undocumented)
cancelFileUpload?: (id: string) => void;
// (undocumented)
clearFileUploads?: () => void;
// (undocumented)
registerFileUploads?: (fileUploads: ObservableFileUpload[]) => void;
}

// @beta (undocumented)
export interface FileUploadEventEmitter {
off(event: 'uploadProgressed', listener: UploadProgressListener): void;
off(event: 'uploadCompleted', listener: UploadCompleteListener): void;
off(event: 'uploadFailed', listener: UploadFailedListener): void;
on(event: 'uploadProgressed', listener: UploadProgressListener): void;
on(event: 'uploadCompleted', listener: UploadCompleteListener): void;
on(event: 'uploadFailed', listener: UploadFailedListener): void;
}

// @beta
export type FileUploadHandler = (userId: string, fileUploads: FileUploadManager[]) => void;

// @beta
export interface FileUploadManager {
file: File;
notifyUploadCompleted: (metadata: FileMetadata) => void;
notifyUploadFailed: (message: string) => void;
notifyUploadProgressed: (value: number) => void;
}

// @beta
export interface FileUploadState {
errorMessage?: string;
filename: string;
id: string;
metadata?: FileMetadata;
progress: number;
}

// @beta
export type FileUploadsUiState = Record<string, FileUploadState>;

// @public
export type IsLocalScreenSharingActiveChangedListener = (event: {
isScreenSharingOn: boolean;
Expand Down Expand Up @@ -543,6 +613,12 @@ export type NetworkDiagnosticChangedEvent = NetworkDiagnosticChangedEventArgs &
type: 'network';
};

// @beta
export interface ObservableFileUpload extends FileUploadEventEmitter {
file: File;
id: string;
}

// @public
export type ParticipantsAddedListener = (event: {
participantsAdded: ChatParticipant[];
Expand Down Expand Up @@ -570,6 +646,15 @@ export type TopicChangedListener = (event: {
topic: string;
}) => void;

// @beta
export type UploadCompleteListener = (id: string, metadata: FileMetadata) => void;

// @beta
export type UploadFailedListener = (id: string, message: string) => void;

// @beta
export type UploadProgressListener = (id: string, value: number) => void;

// (No @packageDocumentation comment for this package)

```