Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
09468e6
Use resourceCache from adapter state for fullsize image src
Leah-Xia-Microsoft Mar 2, 2024
da03ff4
Clean full size cache when ImageOverlay is closed
Leah-Xia-Microsoft Mar 2, 2024
dc9fbf8
Change files
Leah-Xia-Microsoft Mar 2, 2024
dbb2efb
Duplicate change files for beta release
Leah-Xia-Microsoft Mar 2, 2024
676b7d6
Update ChatScreen.tsx
Leah-Xia-Microsoft Mar 2, 2024
6922e00
Remove cc for stable
Leah-Xia-Microsoft Mar 2, 2024
1dd3191
Merge branch 'main' into leahxia/useAdapterStateForFullsizeCache
Leah-Xia-Microsoft Mar 2, 2024
0f25341
Merge branch 'main' of https://github.com/Azure/communication-ui-libr…
JoshuaLai Mar 4, 2024
f11bfcb
Remove the InlineImageMetadata type
JoshuaLai Mar 4, 2024
d3bc3d3
Change files
JoshuaLai Mar 4, 2024
dca8589
Duplicate change files for beta release
JoshuaLai Mar 4, 2024
45d9ac2
Update storybook removing reference to inline image
JoshuaLai Mar 4, 2024
c5c9550
Merge branch 'main' into feature/removeInlineImageMetadata
JoshuaLai Mar 4, 2024
63f24f3
Removing and cleaning up Storybook
JoshuaLai Mar 4, 2024
1830c0b
Merge branch 'feature/removeInlineImageMetadata' of https://github.co…
JoshuaLai Mar 4, 2024
743c04f
Clean up storybook reference
JoshuaLai Mar 4, 2024
c405456
Clean up commented code
JoshuaLai Mar 4, 2024
ee2bcb3
Remove AttachmentMetadata
Leah-Xia-Microsoft Mar 5, 2024
8ccf5cd
Change files
Leah-Xia-Microsoft Mar 5, 2024
c964209
Duplicate change files for beta release
Leah-Xia-Microsoft Mar 5, 2024
06fc3e6
Merge branch 'main' into leahxia/remove-AttachmentMetadata
Leah-Xia-Microsoft Mar 5, 2024
cd704c8
Rename FileMetadata to AttachmentMetadata
Leah-Xia-Microsoft Mar 5, 2024
4ab91fc
Fix stable
Leah-Xia-Microsoft Mar 5, 2024
390f3c7
Remove attachmentType
Leah-Xia-Microsoft Mar 5, 2024
5fc6fde
Remove attachmentType arg
Leah-Xia-Microsoft Mar 5, 2024
2645032
Merge branch 'main' into leahxia/remove-AttachmentMetadata
emlynmac Mar 6, 2024
7cee6c5
Update FileDownloadCards.test.tsx
Leah-Xia-Microsoft Mar 6, 2024
2a37e99
Merge branch 'leahxia/remove-AttachmentMetadata' of https://github.co…
Leah-Xia-Microsoft Mar 6, 2024
7fdef4b
Update FileDownloadCards.test.tsx
Leah-Xia-Microsoft Mar 6, 2024
6cd8379
Merge branch 'main' into leahxia/remove-AttachmentMetadata
Leah-Xia-Microsoft Mar 6, 2024
b21a3f0
Fix build
Leah-Xia-Microsoft Mar 6, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

import { ActiveErrorMessage } from '@internal/react-components';
import { AreEqual } from '@internal/acs-ui-common';
import { AttachmentMetadata } from '@internal/react-components';
import { ChatClientState } from '@internal/chat-stateful-client';
import { ChatThreadClient } from '@azure/communication-chat';
import { Common } from '@internal/acs-ui-common';
import { CommunicationParticipant } from '@internal/react-components';
import { ErrorBar } from '@internal/react-components';
import { FileMetadata } from '@internal/react-components';
import { Message } from '@internal/react-components';
import { MessageThread } from '@internal/react-components';
import { ParticipantList } from '@internal/react-components';
Expand Down Expand Up @@ -49,7 +49,7 @@ export type ChatHandlers = {
onLoadPreviousChatMessages: (messagesToLoad: number) => Promise<boolean>;
onUpdateMessage: (messageId: string, content: string, options?: {
metadata?: Record<string, string>;
attachmentMetadata?: FileMetadata[];
attachmentMetadata?: AttachmentMetadata[];
}) => Promise<void>;
onDeleteMessage: (messageId: string) => Promise<void>;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Common, fromFlatCommunicationIdentifier } from '@internal/acs-ui-common
import { StatefulChatClient } from '@internal/chat-stateful-client';
import { ChatMessage, ChatMessageReadReceipt, ChatThreadClient, SendMessageOptions } from '@azure/communication-chat';
import memoizeOne from 'memoize-one';
import { FileMetadata } from '@internal/react-components';
import { AttachmentMetadata } from '@internal/react-components';

/**
* Object containing all the handlers required for chat components.
Expand All @@ -31,7 +31,7 @@ export type ChatHandlers = {
options?: {
/* @conditional-compile-remove(file-sharing) */
metadata?: Record<string, string>;
attachmentMetadata?: FileMetadata[];
attachmentMetadata?: AttachmentMetadata[];
}
) => Promise<void>;
onDeleteMessage: (messageId: string) => Promise<void>;
Expand Down Expand Up @@ -64,7 +64,7 @@ export const createDefaultChatHandlers = memoizeOne(
content: string,
options?: {
metadata?: Record<string, string>;
attachmentMetadata?: FileMetadata[];
attachmentMetadata?: AttachmentMetadata[];
}
) => {
const updatedMetadata = options?.metadata ? { ...options.metadata } : {};
Expand Down
12 changes: 6 additions & 6 deletions packages/chat-component-bindings/src/messageThreadSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { DEFAULT_DATA_LOSS_PREVENTION_POLICY_URL } from './utils/constants';
import { ACSKnownMessageType } from './utils/constants';
import { updateMessagesWithAttached } from './utils/updateMessagesWithAttached';
/* @conditional-compile-remove(file-sharing) */
import { FileMetadata } from '@internal/react-components';
import { AttachmentMetadata } from '@internal/react-components';
/* @conditional-compile-remove(file-sharing) */
import { ChatAttachmentType } from '@azure/communication-chat';
import { ChatAttachment } from '@azure/communication-chat';
Expand Down Expand Up @@ -63,7 +63,7 @@ const memoizedAllConvertChatMessage = memoizeFnAll(
);

/* @conditional-compile-remove(file-sharing) */
const extractAttachedFilesMetadata = (metadata: Record<string, string>): FileMetadata[] => {
const extractAttachedFilesMetadata = (metadata: Record<string, string>): AttachmentMetadata[] => {
const fileMetadata = metadata.fileSharingMetadata;
if (!fileMetadata) {
return [];
Expand All @@ -79,10 +79,10 @@ const extractAttachedFilesMetadata = (metadata: Record<string, string>): FileMet
const extractTeamsAttachmentsMetadata = (
attachments: ChatAttachment[]
): {
/* @conditional-compile-remove(file-sharing) */ files: FileMetadata[];
/* @conditional-compile-remove(file-sharing) */ files: AttachmentMetadata[];
} => {
/* @conditional-compile-remove(file-sharing) */
const files: FileMetadata[] = [];
const files: AttachmentMetadata[] = [];
attachments.forEach((attachment) => {
const attachmentType = mapAttachmentType(attachment.attachmentType);
/* @conditional-compile-remove(file-sharing) */
Expand Down Expand Up @@ -212,10 +212,10 @@ const extractAttachmentContentTypeFromName = (name?: string): string => {
const extractAttachmentsMetadata = (
message: ChatMessageWithStatus
): {
/* @conditional-compile-remove(file-sharing) */ files: FileMetadata[];
/* @conditional-compile-remove(file-sharing) */ files: AttachmentMetadata[];
} => {
/* @conditional-compile-remove(file-sharing) */
let files: FileMetadata[] = [];
let files: AttachmentMetadata[] = [];

/* @conditional-compile-remove(file-sharing) */
if (message.metadata) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,18 @@ export type AreParamEqual<A extends (props: any) => JSX.Element | undefined, B e
// @public
export type AreTypeEqual<A, B> = A extends B ? (B extends A ? true : false) : false;

// @beta
export interface AttachmentMetadata {
// (undocumented)
attachmentType: 'file';
extension: string;
id: string;
name: string;
// (undocumented)
payload?: Record<string, string>;
url: string;
}

// @public
export type AvatarPersonaData = {
text?: string;
Expand Down Expand Up @@ -1026,7 +1038,7 @@ export interface CallWithChatAdapterManagement {
// @beta (undocumented)
registerActiveFileUploads: (files: File[]) => FileUploadManager[];
// @beta (undocumented)
registerCompletedFileUploads: (metadata: FileMetadata[]) => FileUploadManager[];
registerCompletedFileUploads: (metadata: AttachmentMetadata[]) => FileUploadManager[];
removeParticipant(userId: string): Promise<void>;
// @beta
removeParticipant(participant: CommunicationIdentifier): Promise<void>;
Expand Down Expand Up @@ -1063,7 +1075,7 @@ export interface CallWithChatAdapterManagement {
// @beta (undocumented)
updateFileUploadErrorMessage: (id: string, errorMessage: string) => void;
// @beta (undocumented)
updateFileUploadMetadata: (id: string, metadata: FileMetadata) => void;
updateFileUploadMetadata: (id: string, metadata: AttachmentMetadata) => void;
// @beta (undocumented)
updateFileUploadProgress: (id: string, progress: number) => void;
updateMessage(messageId: string, content: string, metadata?: Record<string, string>): Promise<void>;
Expand Down Expand Up @@ -1636,7 +1648,7 @@ export interface ChatAdapterThreadManagement {
sendTypingIndicator(): Promise<void>;
setTopic(topicName: string): Promise<void>;
updateMessage(messageId: string, content: string, metadata?: Record<string, string>, options?: {
attachmentMetadata?: FileMetadata[];
attachmentMetadata?: AttachmentMetadata[];
}): Promise<void>;
}

Expand Down Expand Up @@ -1756,7 +1768,7 @@ export type ChatHandlers = {
onLoadPreviousChatMessages: (messagesToLoad: number) => Promise<boolean>;
onUpdateMessage: (messageId: string, content: string, options?: {
metadata?: Record<string, string>;
attachmentMetadata?: FileMetadata[];
attachmentMetadata?: AttachmentMetadata[];
}) => Promise<void>;
onDeleteMessage: (messageId: string) => Promise<void>;
};
Expand All @@ -1778,7 +1790,7 @@ export interface ChatMessage extends MessageCommon {
// (undocumented)
failureReason?: string;
// @beta
files?: FileMetadata[];
files?: AttachmentMetadata[];
// (undocumented)
messageType: 'chat';
metadata?: Record<string, string>;
Expand Down Expand Up @@ -2859,19 +2871,7 @@ export interface FileDownloadError {
}

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

// @beta
export interface FileMetadata {
// (undocumented)
attachmentType: 'file';
extension: string;
id: string;
name: string;
// (undocumented)
payload?: Record<string, string>;
url: string;
}
export type FileDownloadHandler = (userId: string, fileMetadata: AttachmentMetadata) => Promise<URL | FileDownloadError>;

// @beta
export interface FileSharingOptions {
Expand All @@ -2890,11 +2890,11 @@ export interface FileUploadAdapter {
// (undocumented)
registerActiveFileUploads: (files: File[]) => FileUploadManager[];
// (undocumented)
registerCompletedFileUploads: (metadata: FileMetadata[]) => FileUploadManager[];
registerCompletedFileUploads: (metadata: AttachmentMetadata[]) => FileUploadManager[];
// (undocumented)
updateFileUploadErrorMessage: (id: string, errorMessage: string) => void;
// (undocumented)
updateFileUploadMetadata: (id: string, metadata: FileMetadata) => void;
updateFileUploadMetadata: (id: string, metadata: AttachmentMetadata) => void;
// (undocumented)
updateFileUploadProgress: (id: string, progress: number) => void;
}
Expand All @@ -2912,7 +2912,7 @@ export type FileUploadHandler = (userId: string, fileUploads: FileUploadManager[
export interface FileUploadManager {
file?: File;
id: string;
notifyUploadCompleted: (metadata: FileMetadata) => void;
notifyUploadCompleted: (metadata: AttachmentMetadata) => void;
notifyUploadFailed: (message: string) => void;
notifyUploadProgressChanged: (value: number) => void;
}
Expand All @@ -2922,7 +2922,7 @@ export interface FileUploadState {
error?: FileUploadError;
filename: string;
id: string;
metadata?: FileMetadata;
metadata?: AttachmentMetadata;
progress: number;
}

Expand Down Expand Up @@ -4350,7 +4350,7 @@ export interface UnsupportedOperatingSystemStrings {
// @public
export type UpdateMessageCallback = (messageId: string, content: string, options?: {
metadata?: Record<string, string>;
attachmentMetadata?: FileMetadata[];
attachmentMetadata?: AttachmentMetadata[];
}) => Promise<void>;

// @public
Expand Down
2 changes: 1 addition & 1 deletion packages/communication-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ export type {
FileDownloadError
} from '../../react-components/src';
/* @conditional-compile-remove(file-sharing) */
export type { FileMetadata } from '../../react-components/src';
export type { AttachmentMetadata } from '../../react-components/src';
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
export type { ChatAttachmentType } from '../../react-components/src';
/* @conditional-compile-remove(image-overlay) */
Expand Down
32 changes: 16 additions & 16 deletions packages/react-components/review/beta/react-components.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ export type AnnouncerProps = {
ariaLive: 'off' | 'polite' | 'assertive' | undefined;
};

// @beta
export interface AttachmentMetadata {
// (undocumented)
attachmentType: 'file';
extension: string;
id: string;
name: string;
// (undocumented)
payload?: Record<string, string>;
url: string;
}

// @internal
export type _AudioIssue = 'NoLocalAudio' | 'NoRemoteAudio' | 'Echo' | 'AudioNoise' | 'LowVolume' | 'AudioStoppedUnexpectedly' | 'DistortedSpeech' | 'AudioInterruption' | 'OtherIssues';

Expand Down Expand Up @@ -464,7 +476,7 @@ export interface ChatMessage extends MessageCommon {
// (undocumented)
failureReason?: string;
// @beta
files?: FileMetadata[];
files?: AttachmentMetadata[];
Comment thread
jpeng-ms marked this conversation as resolved.
// (undocumented)
messageType: 'chat';
metadata?: Record<string, string>;
Expand Down Expand Up @@ -1159,7 +1171,7 @@ export const _FileDownloadCards: (props: _FileDownloadCardsProps) => JSX.Element
// @internal (undocumented)
export interface _FileDownloadCardsProps {
downloadHandler?: FileDownloadHandler;
fileMetadata?: FileMetadata[];
fileMetadata?: AttachmentMetadata[];
onDownloadErrorMessage?: (errMsg: string) => void;
strings?: _FileDownloadCardsStrings;
userId: string;
Expand All @@ -1178,19 +1190,7 @@ export interface FileDownloadError {
}

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

// @beta
export interface FileMetadata {
// (undocumented)
attachmentType: 'file';
extension: string;
id: string;
name: string;
// (undocumented)
payload?: Record<string, string>;
url: string;
}
export type FileDownloadHandler = (userId: string, fileMetadata: AttachmentMetadata) => Promise<URL | FileDownloadError>;

// @internal
export interface _FileUploadCardsStrings {
Expand Down Expand Up @@ -2498,7 +2498,7 @@ export interface UnsupportedOperatingSystemStrings {
// @public
export type UpdateMessageCallback = (messageId: string, content: string, options?: {
metadata?: Record<string, string>;
attachmentMetadata?: FileMetadata[];
attachmentMetadata?: AttachmentMetadata[];
}) => Promise<void>;

// @internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ export const _FileDownloadCards: (props: _FileDownloadCardsProps) => JSX.Element
// @internal (undocumented)
export interface _FileDownloadCardsProps {
downloadHandler?: FileDownloadHandler;
fileMetadata?: FileMetadata[];
fileMetadata?: AttachmentMetadata[];
onDownloadErrorMessage?: (errMsg: string) => void;
strings?: _FileDownloadCardsStrings;
userId: string;
Expand All @@ -965,10 +965,10 @@ export interface FileDownloadError {
}

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

// @beta
export interface FileMetadata {
export interface AttachmentMetadata {
extension: string;
name: string;
url: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ChatMessage, ComponentSlotStyle, OnRenderAvatarCallback } from '../../t
/* @conditional-compile-remove(data-loss-prevention) */
import { BlockedMessage } from '../../types';
import { ChatMessageComponentAsMessageBubble } from './ChatMessageComponentAsMessageBubble';
import { FileDownloadHandler, FileMetadata } from '../FileDownloadCards';
import { FileDownloadHandler, AttachmentMetadata } from '../FileDownloadCards';
/* @conditional-compile-remove(mention) */
import { MentionOptions } from '../MentionPopover';
/* @conditional-compile-remove(image-overlay) */
Expand All @@ -26,7 +26,7 @@ type ChatMessageComponentProps = {
content: string,
metadata?: Record<string, string>,
options?: {
attachmentMetadata?: FileMetadata[];
attachmentMetadata?: AttachmentMetadata[];
}
) => Promise<void>;
onCancelEditMessage?: (messageId: string) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useChatMyMessageStyles } from '../styles/MessageThread.styles';
import { ChatMessage } from '../../types';
import { _FileUploadCards } from '../FileUploadCards';
/* @conditional-compile-remove(file-sharing) */
import { FileMetadata } from '../FileDownloadCards';
import { AttachmentMetadata } from '../FileDownloadCards';
import {
chatMessageFailedTagStyle,
editChatMessageFailedTagStyle,
Expand Down Expand Up @@ -46,7 +46,7 @@ export type ChatMessageComponentAsEditBoxProps = {
metadata?: Record<string, string>,
options?: {
/* @conditional-compile-remove(file-sharing) */
attachmentMetadata?: FileMetadata[];
attachmentMetadata?: AttachmentMetadata[];
}
) => void;
message: ChatMessage;
Expand Down Expand Up @@ -234,15 +234,15 @@ const isMessageTooLong = (messageText: string): boolean => messageText.length >
function isMessageEmpty(
messageText: string,
/* @conditional-compile-remove(file-sharing) */
attachmentMetadata?: FileMetadata[]
attachmentMetadata?: AttachmentMetadata[]
): boolean {
/* @conditional-compile-remove(file-sharing) */
return messageText.trim().length === 0 && attachmentMetadata?.length === 0;
return messageText.trim().length === 0;
}
function getMessageState(
messageText: string,
/* @conditional-compile-remove(file-sharing) */ attachmentMetadata: FileMetadata[]
/* @conditional-compile-remove(file-sharing) */ attachmentMetadata: AttachmentMetadata[]
): MessageState {
return isMessageEmpty(messageText, /* @conditional-compile-remove(file-sharing) */ attachmentMetadata)
? 'too short'
Expand All @@ -253,6 +253,6 @@ function getMessageState(

/* @conditional-compile-remove(file-sharing) */
// @TODO: Remove when file-sharing feature becomes stable.
const getMessageAttachedFilesMetadata = (message: ChatMessage): FileMetadata[] | undefined => {
const getMessageAttachedFilesMetadata = (message: ChatMessage): AttachmentMetadata[] | undefined => {
return message.files;
};
Loading