Skip to content

Commit da9d84a

Browse files
[Chat] Remove inline image from stable (#4010)
* Revert "[Chat] Remove file card group message from stable API (#3940)" This reverts commit 74a97ba. * Revert "[Chat] Rename ImageGallery related Chat Theme (#3936)" This reverts commit 98b9f7d. * Revert Inline Image GA changes * Fix lint issues * Change files * Duplicate change files for beta release * Separate file sharing with inline image * Remove test CC * Update FileDownloadCards.test.tsx * Update ChatScreen.tsx
1 parent dd3ed49 commit da9d84a

59 files changed

Lines changed: 387 additions & 375 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

change-beta/@azure-communication-react-169d96fe-1654-46b0-8571-4a7c4fa48e18.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

change-beta/@azure-communication-react-271e1156-3766-4b14-99c4-12db881e1dad.json renamed to change-beta/@azure-communication-react-61f937b2-cbad-478d-8fd1-0dee23f52308.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"type": "minor",
2+
"type": "none",
33
"area": "improvement",
44
"workstream": "InlineImageGA",
5-
"comment": "Remove FileCardGroupMessage From Stable API",
5+
"comment": "Remove Inline Image from stable",
66
"packageName": "@azure/communication-react",
77
"email": "107075081+Leah-Xia-Microsoft@users.noreply.github.com",
8-
"dependentChangeType": "patch"
8+
"dependentChangeType": "none"
99
}

change-beta/@azure-communication-react-99ebd20a-7a27-4d7e-b690-43735bea7e93.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

change/@azure-communication-react-169d96fe-1654-46b0-8571-4a7c4fa48e18.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

change/@azure-communication-react-271e1156-3766-4b14-99c4-12db881e1dad.json renamed to change/@azure-communication-react-61f937b2-cbad-478d-8fd1-0dee23f52308.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"type": "minor",
2+
"type": "none",
33
"area": "improvement",
44
"workstream": "InlineImageGA",
5-
"comment": "Remove FileCardGroupMessage From Stable API",
5+
"comment": "Remove Inline Image from stable",
66
"packageName": "@azure/communication-react",
77
"email": "107075081+Leah-Xia-Microsoft@users.noreply.github.com",
8-
"dependentChangeType": "patch"
8+
"dependentChangeType": "none"
99
}

change/@azure-communication-react-99ebd20a-7a27-4d7e-b690-43735bea7e93.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

common/config/babel/features.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ module.exports = {
4141
"teams-adhoc-call",
4242
// Joining calls using teams token
4343
"teams-identity-support",
44+
// Chat teams interop to display images and file attachments in chat messages
45+
"teams-inline-images-and-file-sharing",
4446
"unsupported-browser",
4547
// Support Calling SDK isReceiving flag, shows a loading spinner on the video tile when isAvailable is true but isReceiving is false
4648
"video-stream-is-receiving-flag",
@@ -62,6 +64,8 @@ module.exports = {
6264
"capabilities",
6365
// Feature for custom video gallery layouts
6466
"gallery-layouts",
67+
// Feature image gallery
68+
"image-gallery",
6569
// Feature for large Gallery layout
6670
"large-gallery",
6771
// feature for positioning the overflowGallery at the top of the screen in the composite

packages/chat-component-bindings/src/messageThreadSelector.ts

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ import {
1919
CommunicationParticipant,
2020
SystemMessage,
2121
MessageContentType,
22-
ReadReceiptsBySenderId,
23-
InlineImageMetadata,
24-
ChatAttachmentType as AttachmentType
22+
ReadReceiptsBySenderId
2523
} from '@internal/react-components';
2624
/* @conditional-compile-remove(data-loss-prevention) */
2725
import { BlockedMessage } from '@internal/react-components';
@@ -32,7 +30,10 @@ import { ACSKnownMessageType } from './utils/constants';
3230
import { updateMessagesWithAttached } from './utils/updateMessagesWithAttached';
3331
/* @conditional-compile-remove(file-sharing) */
3432
import { FileMetadata } from '@internal/react-components';
33+
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
3534
import { ChatAttachment, ChatAttachmentType } from '@azure/communication-chat';
35+
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
36+
import { ChatAttachmentType as AttachmentType, InlineImageMetadata } from '@internal/react-components';
3637

3738
const memoizedAllConvertChatMessage = memoizeFnAll(
3839
(
@@ -72,7 +73,7 @@ const extractAttachedFilesMetadata = (metadata: Record<string, string>): FileMet
7273
return [];
7374
}
7475
};
75-
76+
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
7677
const extractTeamsAttachmentsMetadata = (
7778
attachments: ChatAttachment[]
7879
): { /* @conditional-compile-remove(file-sharing) */ files: FileMetadata[]; inlineImages: InlineImageMetadata[] } => {
@@ -97,7 +98,7 @@ const extractTeamsAttachmentsMetadata = (
9798
attachmentType: attachmentType,
9899
id: attachment.id,
99100
name: attachment.name ?? '',
100-
extension: contentType,
101+
extension: contentType ?? '',
101102
url: extractAttachmentUrl(attachment),
102103
payload: { teamsFileAttachment: 'true' }
103104
});
@@ -128,6 +129,7 @@ const convertToUiBlockedMessage = (
128129
};
129130
};
130131

132+
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
131133
const mapAttachmentType = (attachmentType: ChatAttachmentType): AttachmentType => {
132134
if (attachmentType === 'image') {
133135
return 'inlineImage';
@@ -139,12 +141,14 @@ const mapAttachmentType = (attachmentType: ChatAttachmentType): AttachmentType =
139141
return 'unknown';
140142
};
141143

144+
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
142145
const extractAttachmentUrl = (attachment: ChatAttachment): string => {
143146
/* @conditional-compile-remove(file-sharing) */
144147
return attachment.attachmentType === 'file' && attachment.previewUrl ? attachment.previewUrl : attachment.url || '';
145148
return attachment.url || '';
146149
};
147150
const processChatMessageContent = (message: ChatMessageWithStatus): string | undefined => {
151+
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
148152
if (sanitizedMessageContentType(message.type).includes('html') && message.content?.attachments) {
149153
const attachments: ChatAttachment[] = message.content?.attachments;
150154
const teamsImageHtmlContent = attachments
@@ -160,11 +164,13 @@ const processChatMessageContent = (message: ChatMessageWithStatus): string | und
160164
return message.content?.message;
161165
};
162166

167+
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
163168
const generateImageAttachmentImgHtml = (attachment: ChatAttachment): string => {
164169
const contentType = extractAttachmentContentTypeFromName(attachment.name);
165170
return `\r\n<p><img alt="image" src="" itemscope="${contentType}" id="${attachment.id}"></p>`;
166171
};
167172

173+
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
168174
const extractAttachmentContentTypeFromName = (name?: string): string => {
169175
if (name === undefined) {
170176
return '';
@@ -177,6 +183,7 @@ const extractAttachmentContentTypeFromName = (name?: string): string => {
177183
return contentType;
178184
};
179185

186+
/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */
180187
const extractAttachmentsMetadata = (
181188
message: ChatMessageWithStatus
182189
): { /* @conditional-compile-remove(file-sharing) */ files: FileMetadata[]; inlineImages: InlineImageMetadata[] } => {
@@ -189,6 +196,7 @@ const extractAttachmentsMetadata = (
189196
files = files.concat(extractAttachedFilesMetadata(message.metadata));
190197
}
191198

199+
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
192200
if (message.content?.attachments) {
193201
const teamsAttachments = extractTeamsAttachmentsMetadata(message.content?.attachments);
194202
/* @conditional-compile-remove(file-sharing) */
@@ -205,7 +213,11 @@ const convertToUiChatMessage = (
205213
isLargeGroup: boolean
206214
): ChatMessage => {
207215
const messageSenderId = message.sender !== undefined ? toFlatCommunicationIdentifier(message.sender) : userId;
208-
const { /* @conditional-compile-remove(file-sharing) */ files, inlineImages } = extractAttachmentsMetadata(message);
216+
/* @conditional-compile-remove(file-sharing) @conditional-compile-remove(teams-inline-images-and-file-sharing) */
217+
const {
218+
/* @conditional-compile-remove(file-sharing) */ files,
219+
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ inlineImages
220+
} = extractAttachmentsMetadata(message);
209221
return {
210222
messageType: 'chat',
211223
createdOn: message.createdOn,
@@ -222,6 +234,7 @@ const convertToUiChatMessage = (
222234
metadata: message.metadata,
223235
/* @conditional-compile-remove(file-sharing) */
224236
files,
237+
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
225238
inlineImages
226239
};
227240
};
@@ -355,7 +368,10 @@ const isMessageValidToRender = (message: ChatMessageWithStatus): boolean => {
355368
if (message.deletedOn) {
356369
return false;
357370
}
358-
if (message.metadata?.fileSharingMetadata || message.content?.attachments) {
371+
if (
372+
message.metadata?.fileSharingMetadata ||
373+
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ message.content?.attachments
374+
) {
359375
return true;
360376
}
361377
/* @conditional-compile-remove(data-loss-prevention) */

packages/chat-stateful-client/src/EventSubscriber.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export class EventSubscriber {
4444
version: event.version,
4545
content: {
4646
message: event.message,
47+
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
4748
attachments: event.attachments
4849
},
4950
type: this.convertEventType(event.type),

packages/communication-react/review/beta/communication-react.api.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ export type AreParamEqual<A extends (props: any) => JSX.Element | undefined, B e
147147
// @public
148148
export type AreTypeEqual<A, B> = A extends B ? (B extends A ? true : false) : false;
149149

150-
// @public
150+
// @beta
151151
export interface AttachmentDownloadResult {
152152
attachmentId: string;
153153
blobUrl: string;
154154
}
155155

156-
// @public
157-
export type AttachmentMetadata = InlineImageMetadata | /* @conditional-compile-remove(file-sharing) */ FileMetadata;
156+
// @beta
157+
export type AttachmentMetadata = FileMetadata | /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ InlineImageMetadata;
158158

159159
// @public
160160
export type AvatarPersonaData = {
@@ -213,7 +213,7 @@ export type AzureCommunicationChatAdapterArgs = {
213213
threadId: string;
214214
};
215215

216-
// @public
216+
// @beta
217217
export type AzureCommunicationChatAdapterOptions = {
218218
credential?: CommunicationTokenCredential;
219219
};
@@ -1614,8 +1614,8 @@ export type ChatAdapterUiState = {
16141614
fileUploads?: FileUploadsUiState;
16151615
};
16161616

1617-
// @public
1618-
export type ChatAttachmentType = 'inlineImage' | /* @conditional-compile-remove(file-sharing) */ 'file' | 'unknown';
1617+
// @beta
1618+
export type ChatAttachmentType = 'unknown' | /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ 'inlineImage' | /* @conditional-compile-remove(file-sharing) */ 'file';
16191619

16201620
// @public
16211621
export type ChatBaseSelectorProps = {
@@ -1747,6 +1747,7 @@ export interface ChatMessage extends MessageCommon {
17471747
failureReason?: string;
17481748
// @beta
17491749
files?: FileMetadata[];
1750+
// @beta
17501751
inlineImages?: InlineImageMetadata[];
17511752
// (undocumented)
17521753
messageType: 'chat';
@@ -1777,14 +1778,14 @@ export type ChatParticipantListSelector = (state: ChatClientState, props: ChatBa
17771778
// @public
17781779
export type ChatReturnProps<Component extends (props: any) => JSX.Element> = GetChatSelector<Component> extends (state: ChatClientState, props: any) => any ? ReturnType<GetChatSelector<Component>> & Common<ChatHandlers, Parameters<Component>[0]> : never;
17791780

1780-
// @public
1781+
// @beta
17811782
export interface ChatTheme {
17821783
chatPalette: {
1783-
imageGalleryOverlayBlack: string;
1784-
imageGalleryTitleWhite: string;
1785-
imageGalleryDefaultButtonBackground: string;
1786-
imageGalleryButtonBackgroundHover: string;
1787-
imageGalleryButtonBackgroundActive: string;
1784+
modalOverlayBlack: string;
1785+
modalTitleWhite: string;
1786+
modalButtonBackground: string;
1787+
modalButtonBackgroundHover: string;
1788+
modalButtonBackgroundActive: string;
17881789
};
17891790
}
17901791

@@ -2346,7 +2347,7 @@ export interface CustomMessage extends MessageCommon {
23462347
}
23472348

23482349
// @public
2349-
export const darkTheme: PartialTheme & CallingTheme & ChatTheme;
2350+
export const darkTheme: PartialTheme & CallingTheme & /* @conditional-compile-remove(image-gallery) */ ChatTheme;
23502351

23512352
// @beta
23522353
export type DeclarativeCallAgent = CallAgent & IncomingCallManagement;
@@ -2967,10 +2968,10 @@ export interface _Identifiers {
29672968
videoTile: string;
29682969
}
29692970

2970-
// @public
2971+
// @beta
29712972
export const ImageGallery: (props: ImageGalleryProps) => JSX.Element;
29722973

2973-
// @public
2974+
// @beta
29742975
export interface ImageGalleryImageProps {
29752976
altText?: string;
29762977
downloadFilename: string;
@@ -2979,7 +2980,7 @@ export interface ImageGalleryImageProps {
29792980
titleIcon?: JSX.Element;
29802981
}
29812982

2982-
// @public
2983+
// @beta
29832984
export interface ImageGalleryProps {
29842985
images: Array<ImageGalleryImageProps>;
29852986
isOpen: boolean;
@@ -2989,7 +2990,7 @@ export interface ImageGalleryProps {
29892990
startIndex?: number;
29902991
}
29912992

2992-
// @public
2993+
// @beta
29932994
export interface ImageGalleryStrings {
29942995
dismissButtonAriaLabel: string;
29952996
downloadButtonLabel: string;
@@ -3009,7 +3010,7 @@ export interface IncomingCallState {
30093010
startTime: Date;
30103011
}
30113012

3012-
// @public
3013+
// @beta
30133014
export interface InlineImageMetadata {
30143015
// (undocumented)
30153016
attachmentType: 'inlineImage';
@@ -3064,7 +3065,7 @@ export interface JumpToNewMessageButtonProps {
30643065
}
30653066

30663067
// @public
3067-
export const lightTheme: PartialTheme & CallingTheme & ChatTheme;
3068+
export const lightTheme: PartialTheme & CallingTheme & /* @conditional-compile-remove(image-gallery) */ ChatTheme;
30683069

30693070
// @public
30703071
export type LoadingState = 'loading' | 'none';

0 commit comments

Comments
 (0)