@azure/communication-react 1.13.0-alpha-202402161702 → 1.13.0-alpha-202402210012
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.
- package/dist/communication-react.d.ts +10 -32
- package/dist/dist-cjs/communication-react/index.js +73 -115
- package/dist/dist-cjs/communication-react/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +6 -5
- package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
- package/dist/dist-esm/chat-stateful-client/src/ChatContext.d.ts +1 -1
- package/dist/dist-esm/chat-stateful-client/src/ChatContext.js +7 -5
- package/dist/dist-esm/chat-stateful-client/src/ChatContext.js.map +1 -1
- package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js +4 -5
- package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js.map +1 -1
- package/dist/dist-esm/communication-react/src/index.d.ts +1 -1
- package/dist/dist-esm/communication-react/src/index.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsMessageBubble.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js +2 -2
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/FileDownloadCards.d.ts +4 -10
- package/dist/dist-esm/react-components/src/components/FileDownloadCards.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +2 -8
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +4 -15
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +3 -5
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.d.ts +1 -5
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +2 -7
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +41 -19
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +3 -20
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +7 -57
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts +1 -5
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.d.ts +0 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
- package/package.json +1 -1
@@ -243,17 +243,6 @@ export declare type AreParamEqual<A extends (props: any) => JSX.Element | undefi
|
|
243
243
|
*/
|
244
244
|
export declare type AreTypeEqual<A, B> = A extends B ? (B extends A ? true : false) : false;
|
245
245
|
|
246
|
-
/**
|
247
|
-
* Metadata of the attachment object returned by the ACS SDK.
|
248
|
-
* @beta
|
249
|
-
*/
|
250
|
-
export declare interface AttachmentDownloadResult {
|
251
|
-
/**
|
252
|
-
* Blob URL for the attachment.
|
253
|
-
*/
|
254
|
-
blobUrl: string;
|
255
|
-
}
|
256
|
-
|
257
246
|
/**
|
258
247
|
* Metadata containing information about the uploaded file.
|
259
248
|
* @beta
|
@@ -360,7 +349,6 @@ export declare type AzureCommunicationCallWithChatAdapterFromClientArgs = {
|
|
360
349
|
chatClient: StatefulChatClient;
|
361
350
|
chatThreadClient: ChatThreadClient;
|
362
351
|
callAdapterOptions?: AzureCommunicationCallAdapterOptions;
|
363
|
-
chatAdapterOptions?: AzureCommunicationChatAdapterOptions;
|
364
352
|
};
|
365
353
|
|
366
354
|
/**
|
@@ -376,14 +364,6 @@ export declare type AzureCommunicationChatAdapterArgs = {
|
|
376
364
|
threadId: string;
|
377
365
|
};
|
378
366
|
|
379
|
-
/**
|
380
|
-
* Configuration options to include when creating AzureCommunicationChatAdapter.
|
381
|
-
* @beta
|
382
|
-
*/
|
383
|
-
export declare type AzureCommunicationChatAdapterOptions = {
|
384
|
-
credential?: CommunicationTokenCredential;
|
385
|
-
};
|
386
|
-
|
387
367
|
/**
|
388
368
|
* Arguments for creating the Azure Communication Services implementation of {@link CallAdapter}.
|
389
369
|
*
|
@@ -3130,10 +3110,9 @@ export declare interface CallWithChatAdapterManagement {
|
|
3130
3110
|
updateFileUploadErrorMessage: (id: string, errorMessage: string) => void;
|
3131
3111
|
/** @beta */
|
3132
3112
|
updateFileUploadMetadata: (id: string, metadata: AttachmentMetadata) => void;
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3136
|
-
downloadResourceToCache(resourceDetails: ResourceDetails): void;
|
3113
|
+
/** @beta */
|
3114
|
+
downloadResourceToCache(resourceDetails: ResourceDetails): Promise<void>;
|
3115
|
+
/** @beta */
|
3137
3116
|
removeResourceFromCache(resourceDetails: ResourceDetails): void;
|
3138
3117
|
/**
|
3139
3118
|
* Puts the Call in a Localhold.
|
@@ -4390,13 +4369,10 @@ export declare interface ChatAdapterThreadManagement {
|
|
4390
4369
|
*
|
4391
4370
|
*/
|
4392
4371
|
loadPreviousChatMessages(messagesToLoad: number): Promise<boolean>;
|
4393
|
-
downloadAttachment: (options: {
|
4394
|
-
attachmentUrl: string;
|
4395
|
-
}) => Promise<AttachmentDownloadResult>;
|
4396
4372
|
/**
|
4397
4373
|
* Downloads a resource into the cache for the given message.
|
4398
4374
|
*/
|
4399
|
-
downloadResourceToCache(resourceDetails: ResourceDetails): void
|
4375
|
+
downloadResourceToCache(resourceDetails: ResourceDetails): Promise<void>;
|
4400
4376
|
/**
|
4401
4377
|
* Removes a resource from the cache for the given message.
|
4402
4378
|
*/
|
@@ -5813,7 +5789,7 @@ export declare const createAzureCommunicationCallWithChatAdapter: ({ userId, dis
|
|
5813
5789
|
*
|
5814
5790
|
* @public
|
5815
5791
|
*/
|
5816
|
-
export declare const createAzureCommunicationCallWithChatAdapterFromClients: ({ callClient, callAgent, callLocator, chatClient, chatThreadClient, callAdapterOptions
|
5792
|
+
export declare const createAzureCommunicationCallWithChatAdapterFromClients: ({ callClient, callAgent, callLocator, chatClient, chatThreadClient, callAdapterOptions }: AzureCommunicationCallWithChatAdapterFromClientArgs) => Promise<CallWithChatAdapter>;
|
5817
5793
|
|
5818
5794
|
/**
|
5819
5795
|
* Create a {@link ChatAdapter} backed by Azure Communication Services.
|
@@ -5832,9 +5808,7 @@ export declare const createAzureCommunicationChatAdapter: ({ endpoint: endpointU
|
|
5832
5808
|
*
|
5833
5809
|
* @public
|
5834
5810
|
*/
|
5835
|
-
export declare function createAzureCommunicationChatAdapterFromClient(chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient
|
5836
|
-
credential?: CommunicationTokenCredential;
|
5837
|
-
}): Promise<ChatAdapter>;
|
5811
|
+
export declare function createAzureCommunicationChatAdapterFromClient(chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient): Promise<ChatAdapter>;
|
5838
5812
|
|
5839
5813
|
/**
|
5840
5814
|
* Type of {@link createDefaultCallingHandlers}.
|
@@ -7567,6 +7541,10 @@ export declare interface InlineImageMetadata {
|
|
7567
7541
|
* Download URL for the full resolution version.
|
7568
7542
|
*/
|
7569
7543
|
url: string;
|
7544
|
+
/**
|
7545
|
+
* Optional fetched Image source fot the full resolution version.
|
7546
|
+
*/
|
7547
|
+
fullSizeImageSrc?: string;
|
7570
7548
|
}
|
7571
7549
|
|
7572
7550
|
/**
|
@@ -173,7 +173,7 @@ function getDefaultExportFromCjs (x) {
|
|
173
173
|
// Copyright (c) Microsoft Corporation.
|
174
174
|
// Licensed under the MIT License.
|
175
175
|
// GENERATED FILE. DO NOT EDIT MANUALLY.
|
176
|
-
var telemetryVersion = '1.13.0-alpha-
|
176
|
+
var telemetryVersion = '1.13.0-alpha-202402210012';
|
177
177
|
|
178
178
|
|
179
179
|
var telemetryVersion$1 = /*@__PURE__*/getDefaultExportFromCjs(telemetryVersion);
|
@@ -10682,7 +10682,7 @@ const messageContentAriaText = (props) => {
|
|
10682
10682
|
};
|
10683
10683
|
/* @conditional-compile-remove(image-overlay) */
|
10684
10684
|
const defaultOnRenderInlineImage = (inlineImage) => {
|
10685
|
-
return React.createElement("img", Object.assign({ tabIndex: 0, "data-ui-id": inlineImage.imgAttrs.id }, inlineImage.imgAttrs));
|
10685
|
+
return (React.createElement("img", Object.assign({ key: inlineImage.imgAttrs.id, tabIndex: 0, "data-ui-id": inlineImage.imgAttrs.id }, inlineImage.imgAttrs)));
|
10686
10686
|
};
|
10687
10687
|
const processHtmlToReact = (props) => {
|
10688
10688
|
var _a;
|
@@ -11037,7 +11037,7 @@ const MessageBubble = (props) => {
|
|
11037
11037
|
}, author: React.createElement(react.Text, { className: chatMessageAuthorStyle }, message.senderDisplayName), body: {
|
11038
11038
|
className: chatItemMessageContainerClassName,
|
11039
11039
|
style: Object.assign({}, createStyleFromV8Style(messageContainerStyle))
|
11040
|
-
}, "data-ui-id": "chat-composite-message", timestamp: React.createElement(react.Text, { className: chatMessageDateStyle, "data-ui-id": ids.messageTimestamp }, formattedTimestamp) }, getContent()))),
|
11040
|
+
}, "data-ui-id": "chat-composite-message", timestamp: React.createElement(react.Text, { className: chatMessageDateStyle, "data-ui-id": ids.messageTimestamp }, formattedTimestamp), details: getMessageDetails() }, getContent()))),
|
11041
11041
|
chatActionsEnabled && (React.createElement(ChatMessageActionFlyout, { hidden: !chatMessageActionFlyoutTarget, target: chatMessageActionFlyoutTarget, increaseFlyoutItemSize: wasInteractionByTouch, onDismiss: onActionFlyoutDismiss, onEditClick: onEditClick, onRemoveClick: onRemoveClick, onResendClick: onResendClick, strings: strings, messageReadBy: messageReadBy, messageStatus: messageStatus !== null && messageStatus !== void 0 ? messageStatus : 'failed', remoteParticipantsCount: remoteParticipantsCount, onRenderAvatar: onRenderAvatar, showMessageStatus: showMessageStatus }))));
|
11042
11042
|
return chatMessage;
|
11043
11043
|
};
|
@@ -21176,12 +21176,12 @@ const extractAttachedFilesMetadata = (metadata) => {
|
|
21176
21176
|
}
|
21177
21177
|
};
|
21178
21178
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
21179
|
-
const extractTeamsAttachmentsMetadata = (attachments) => {
|
21179
|
+
const extractTeamsAttachmentsMetadata = (attachments, resourceCache) => {
|
21180
21180
|
/* @conditional-compile-remove(file-sharing) */
|
21181
21181
|
const files = [];
|
21182
21182
|
const inlineImages = [];
|
21183
21183
|
attachments.forEach((attachment) => {
|
21184
|
-
var _a;
|
21184
|
+
var _a, _b, _c;
|
21185
21185
|
const attachmentType = mapAttachmentType(attachment.attachmentType);
|
21186
21186
|
/* @conditional-compile-remove(file-sharing) */
|
21187
21187
|
const contentType = extractAttachmentContentTypeFromName(attachment.name);
|
@@ -21190,7 +21190,8 @@ const extractTeamsAttachmentsMetadata = (attachments) => {
|
|
21190
21190
|
attachmentType: attachmentType,
|
21191
21191
|
id: attachment.id,
|
21192
21192
|
url: extractAttachmentUrl(attachment),
|
21193
|
-
previewUrl: attachment.previewUrl
|
21193
|
+
previewUrl: attachment.previewUrl,
|
21194
|
+
fullSizeImageSrc: (_b = resourceCache === null || resourceCache === void 0 ? void 0 : resourceCache[(_a = attachment.url) !== null && _a !== void 0 ? _a : '']) !== null && _b !== void 0 ? _b : ''
|
21194
21195
|
});
|
21195
21196
|
}
|
21196
21197
|
/* @conditional-compile-remove(file-sharing) */
|
@@ -21198,7 +21199,7 @@ const extractTeamsAttachmentsMetadata = (attachments) => {
|
|
21198
21199
|
files.push({
|
21199
21200
|
attachmentType: attachmentType,
|
21200
21201
|
id: attachment.id,
|
21201
|
-
name: (
|
21202
|
+
name: (_c = attachment.name) !== null && _c !== void 0 ? _c : '',
|
21202
21203
|
extension: contentType !== null && contentType !== void 0 ? contentType : '',
|
21203
21204
|
url: extractAttachmentUrl(attachment),
|
21204
21205
|
payload: { teamsFileAttachment: 'true' }
|
@@ -21310,7 +21311,7 @@ const extractAttachmentsMetadata = (message) => {
|
|
21310
21311
|
}
|
21311
21312
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
21312
21313
|
if ((_a = message.content) === null || _a === void 0 ? void 0 : _a.attachments) {
|
21313
|
-
const teamsAttachments = extractTeamsAttachmentsMetadata((_b = message.content) === null || _b === void 0 ? void 0 : _b.attachments);
|
21314
|
+
const teamsAttachments = extractTeamsAttachmentsMetadata((_b = message.content) === null || _b === void 0 ? void 0 : _b.attachments, message.resourceCache);
|
21314
21315
|
/* @conditional-compile-remove(file-sharing) */
|
21315
21316
|
files = files.concat(teamsAttachments.files);
|
21316
21317
|
inlineImages = inlineImages.concat(teamsAttachments.inlineImages);
|
@@ -21798,22 +21799,21 @@ class ResourceDownloadQueue {
|
|
21798
21799
|
else {
|
21799
21800
|
message = yield this.downloadAllPreviewUrls(message, operation);
|
21800
21801
|
}
|
21801
|
-
this.isActive = false;
|
21802
21802
|
this._context.setChatMessage(threadId, message);
|
21803
21803
|
}
|
21804
21804
|
catch (error) {
|
21805
21805
|
console.log('Downloading Resource error: ', error);
|
21806
21806
|
}
|
21807
|
+
finally {
|
21808
|
+
this.isActive = false;
|
21809
|
+
}
|
21807
21810
|
}
|
21808
21811
|
});
|
21809
21812
|
}
|
21810
21813
|
downloadSingleUrl(message, resourceUrl, operation) {
|
21811
21814
|
return __awaiter$t(this, void 0, void 0, function* () {
|
21812
|
-
if (message.resourceCache === undefined) {
|
21813
|
-
message.resourceCache = {};
|
21814
|
-
}
|
21815
21815
|
const blobUrl = yield operation(resourceUrl, this._credential);
|
21816
|
-
message.resourceCache[resourceUrl]
|
21816
|
+
message = Object.assign(Object.assign({}, message), { resourceCache: Object.assign(Object.assign({}, message.resourceCache), { [resourceUrl]: blobUrl }) });
|
21817
21817
|
return message;
|
21818
21818
|
});
|
21819
21819
|
}
|
@@ -21938,16 +21938,18 @@ let ChatContext$1 = class ChatContext {
|
|
21938
21938
|
}
|
21939
21939
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
21940
21940
|
downloadResourceToCache(threadId, messageId, resourceUrl) {
|
21941
|
-
|
21942
|
-
|
21943
|
-
|
21941
|
+
var _a;
|
21942
|
+
return __awaiter$s(this, void 0, void 0, function* () {
|
21943
|
+
let message = (_a = this.getState().threads[threadId]) === null || _a === void 0 ? void 0 : _a.chatMessages[messageId];
|
21944
21944
|
if (message && this._fullsizeImageQueue) {
|
21945
21945
|
if (!message.resourceCache) {
|
21946
|
-
message
|
21946
|
+
message = Object.assign(Object.assign({}, message), { resourceCache: {} });
|
21947
21947
|
}
|
21948
21948
|
// Need to discuss retry logic in case of failure
|
21949
21949
|
this._fullsizeImageQueue.addMessage(message);
|
21950
|
-
this._fullsizeImageQueue.startQueue(threadId, fetchImageSource, {
|
21950
|
+
yield this._fullsizeImageQueue.startQueue(threadId, fetchImageSource, {
|
21951
|
+
singleUrl: resourceUrl
|
21952
|
+
});
|
21951
21953
|
}
|
21952
21954
|
});
|
21953
21955
|
}
|
@@ -23425,19 +23427,12 @@ class ChatContext {
|
|
23425
23427
|
* @private
|
23426
23428
|
*/
|
23427
23429
|
class AzureCommunicationChatAdapter {
|
23428
|
-
constructor(chatClient, chatThreadClient
|
23429
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ options) {
|
23430
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
23431
|
-
this.credential = undefined;
|
23430
|
+
constructor(chatClient, chatThreadClient) {
|
23432
23431
|
this.emitter = new EventEmitter();
|
23433
23432
|
this.bindAllPublicMethods();
|
23434
23433
|
this.chatClient = chatClient;
|
23435
23434
|
this.chatThreadClient = chatThreadClient;
|
23436
23435
|
this.context = new ChatContext(chatClient.getState(), chatThreadClient.threadId);
|
23437
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
23438
|
-
if (options && options.credential) {
|
23439
|
-
this.credential = options.credential;
|
23440
|
-
}
|
23441
23436
|
/* @conditional-compile-remove(file-sharing) */
|
23442
23437
|
this.fileUploadAdapter = new AzureCommunicationFileUploadAdapter(this.context);
|
23443
23438
|
const onStateChange = (clientState) => {
|
@@ -23483,8 +23478,6 @@ class AzureCommunicationChatAdapter {
|
|
23483
23478
|
/* @conditional-compile-remove(file-sharing) */
|
23484
23479
|
this.updateFileUploadMetadata = this.updateFileUploadMetadata.bind(this);
|
23485
23480
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
23486
|
-
this.downloadAttachment = this.downloadAttachment.bind(this); // ToDo: This method is to be removed
|
23487
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
23488
23481
|
this.downloadResourceToCache = this.downloadResourceToCache.bind(this);
|
23489
23482
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
23490
23483
|
this.removeResourceFromCache = this.removeResourceFromCache.bind(this);
|
@@ -23631,47 +23624,12 @@ class AzureCommunicationChatAdapter {
|
|
23631
23624
|
this.fileUploadAdapter.updateFileUploadMetadata(id, metadata);
|
23632
23625
|
}
|
23633
23626
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
23634
|
-
|
23635
|
-
downloadAttachment(options) {
|
23636
|
-
return __awaiter$n(this, void 0, void 0, function* () {
|
23637
|
-
return this.asyncTeeErrorToEventEmitter(() => __awaiter$n(this, void 0, void 0, function* () {
|
23638
|
-
if (this.credential === undefined) {
|
23639
|
-
throw new ChatError('ChatThreadClient.getMessage', new Error('AccessToken is null'));
|
23640
|
-
}
|
23641
|
-
const accessToken = yield this.credential.getToken();
|
23642
|
-
if (!accessToken) {
|
23643
|
-
throw new ChatError('ChatThreadClient.getMessage', new Error('AccessToken is null'));
|
23644
|
-
}
|
23645
|
-
return this.downloadAuthenticatedFile(accessToken.token, options);
|
23646
|
-
}));
|
23647
|
-
});
|
23648
|
-
}
|
23649
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
23650
|
-
// ToDo: This method is to be removed
|
23651
|
-
downloadAuthenticatedFile(accessToken, options) {
|
23627
|
+
downloadResourceToCache(resourceDetails) {
|
23652
23628
|
return __awaiter$n(this, void 0, void 0, function* () {
|
23653
|
-
|
23654
|
-
return __awaiter$n(this, void 0, void 0, function* () {
|
23655
|
-
const headers = new Headers();
|
23656
|
-
headers.append('Authorization', `Bearer ${token}`);
|
23657
|
-
try {
|
23658
|
-
return yield fetch(url, { headers });
|
23659
|
-
}
|
23660
|
-
catch (err) {
|
23661
|
-
throw new ChatError('ChatThreadClient.getMessage', err);
|
23662
|
-
}
|
23663
|
-
});
|
23664
|
-
}
|
23665
|
-
const response = yield fetchWithAuthentication(options.attachmentUrl, accessToken);
|
23666
|
-
const blob = yield response.blob();
|
23667
|
-
return { blobUrl: URL.createObjectURL(blob) };
|
23629
|
+
this.chatClient.downloadResourceToCache(resourceDetails.threadId, resourceDetails.messageId, resourceDetails.resourceUrl);
|
23668
23630
|
});
|
23669
23631
|
}
|
23670
23632
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
23671
|
-
downloadResourceToCache(resourceDetails) {
|
23672
|
-
this.chatClient.downloadResourceToCache(resourceDetails.threadId, resourceDetails.messageId, resourceDetails.resourceUrl);
|
23673
|
-
}
|
23674
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
23675
23633
|
removeResourceFromCache(resourceDetails) {
|
23676
23634
|
this.chatClient.removeResourceFromCache(resourceDetails.threadId, resourceDetails.messageId, resourceDetails.resourceUrl);
|
23677
23635
|
}
|
@@ -23817,10 +23775,7 @@ const _createAzureCommunicationChatAdapterInner = (endpoint, userId, displayName
|
|
23817
23775
|
}, undefined, telemetryImplementationHint);
|
23818
23776
|
const chatThreadClient = yield chatClient.getChatThreadClient(threadId);
|
23819
23777
|
yield chatClient.startRealtimeNotifications();
|
23820
|
-
|
23821
|
-
const options = { credential: credential };
|
23822
|
-
const adapter = yield createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient,
|
23823
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ options);
|
23778
|
+
const adapter = yield createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient);
|
23824
23779
|
return adapter;
|
23825
23780
|
});
|
23826
23781
|
/**
|
@@ -23927,12 +23882,9 @@ beforeDispose) => {
|
|
23927
23882
|
*
|
23928
23883
|
* @public
|
23929
23884
|
*/
|
23930
|
-
function createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient
|
23931
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
23932
|
-
options) {
|
23885
|
+
function createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient) {
|
23933
23886
|
return __awaiter$n(this, void 0, void 0, function* () {
|
23934
|
-
return new AzureCommunicationChatAdapter(chatClient, chatThreadClient
|
23935
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */ options);
|
23887
|
+
return new AzureCommunicationChatAdapter(chatClient, chatThreadClient);
|
23936
23888
|
});
|
23937
23889
|
}
|
23938
23890
|
const isChatError = (e) => {
|
@@ -24620,8 +24572,6 @@ const ChatScreen = (props) => {
|
|
24620
24572
|
/* @conditional-compile-remove(file-sharing) */
|
24621
24573
|
const [downloadErrorMessage, setDownloadErrorMessage] = React.useState('');
|
24622
24574
|
/* @conditional-compile-remove(image-overlay) */
|
24623
|
-
const [fullSizeAttachments, setFullSizeAttachments] = React.useState({});
|
24624
|
-
/* @conditional-compile-remove(image-overlay) */
|
24625
24575
|
const [overlayImageItem, setOverlayImageItem] = React.useState();
|
24626
24576
|
/* @conditional-compile-remove(image-overlay) */
|
24627
24577
|
const [isImageOverlayOpen, setIsImageOverlayOpen] = React.useState(false);
|
@@ -24642,6 +24592,34 @@ const ChatScreen = (props) => {
|
|
24642
24592
|
const typingIndicatorProps = usePropsFor$2(TypingIndicator);
|
24643
24593
|
const headerProps = useAdaptedSelector$1(getHeaderProps);
|
24644
24594
|
const errorBarProps = usePropsFor$2(ErrorBar);
|
24595
|
+
/* @conditional-compile-remove(image-overlay) */
|
24596
|
+
React.useEffect(() => {
|
24597
|
+
var _a;
|
24598
|
+
if (overlayImageItem === undefined) {
|
24599
|
+
return;
|
24600
|
+
}
|
24601
|
+
const messages = messageThreadProps.messages.filter((message) => {
|
24602
|
+
return message.messageId === (overlayImageItem === null || overlayImageItem === void 0 ? void 0 : overlayImageItem.messageId);
|
24603
|
+
});
|
24604
|
+
if (messages.length <= 0 || messages[0].messageType !== 'chat') {
|
24605
|
+
return;
|
24606
|
+
}
|
24607
|
+
const message = messages[0];
|
24608
|
+
if (overlayImageItem.imageSrc === '' && message.inlineImages && ((_a = message.inlineImages) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
24609
|
+
const inlineImages = message.inlineImages.filter((attachment) => {
|
24610
|
+
return attachment.id === (overlayImageItem === null || overlayImageItem === void 0 ? void 0 : overlayImageItem.attachmentId);
|
24611
|
+
});
|
24612
|
+
if (inlineImages.length <= 0 ||
|
24613
|
+
inlineImages[0].fullSizeImageSrc === undefined ||
|
24614
|
+
inlineImages[0].fullSizeImageSrc === '' ||
|
24615
|
+
overlayImageItem.imageSrc === inlineImages[0].fullSizeImageSrc) {
|
24616
|
+
return;
|
24617
|
+
}
|
24618
|
+
setOverlayImageItem(Object.assign(Object.assign({}, overlayImageItem), { imageSrc: inlineImages[0].fullSizeImageSrc }));
|
24619
|
+
}
|
24620
|
+
// Disable eslint because we are using the overlayImageItem in this effect but don't want to have it as a dependency, as it will cause an infinite loop.
|
24621
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
24622
|
+
}, [messageThreadProps.messages]);
|
24645
24623
|
const onRenderAvatarCallback = React.useCallback((userId, defaultOptions) => {
|
24646
24624
|
return (React.createElement(AvatarPersona, Object.assign({ userId: userId, hidePersonaDetails: true }, defaultOptions, { dataProvider: onFetchAvatarPersonaData })));
|
24647
24625
|
}, [onFetchAvatarPersonaData]);
|
@@ -24695,28 +24673,24 @@ const ChatScreen = (props) => {
|
|
24695
24673
|
const overlayImage = {
|
24696
24674
|
title: chatMessage.senderDisplayName || '',
|
24697
24675
|
titleIcon: titleIcon,
|
24698
|
-
|
24699
|
-
imageSrc: ''
|
24676
|
+
attachmentId: attachment.id,
|
24677
|
+
imageSrc: attachment.fullSizeImageSrc || '',
|
24678
|
+
messageId: messageId
|
24700
24679
|
};
|
24701
24680
|
setIsImageOverlayOpen(true);
|
24702
|
-
|
24703
|
-
setOverlayImageItem(Object.assign(Object.assign({}, overlayImage), { imageSrc: fullSizeAttachments[attachment.id] }));
|
24704
|
-
return;
|
24705
|
-
}
|
24681
|
+
setOverlayImageItem(overlayImage);
|
24706
24682
|
if (attachment.attachmentType === 'inlineImage' && attachment.url) {
|
24707
|
-
|
24708
|
-
|
24709
|
-
|
24710
|
-
|
24711
|
-
|
24712
|
-
setOverlayImageItem(Object.assign(Object.assign({}, overlayImage), { imageSrc: blobUrl }));
|
24713
|
-
}
|
24683
|
+
adapter.downloadResourceToCache({
|
24684
|
+
threadId: adapter.getState().thread.threadId,
|
24685
|
+
messageId: messageId,
|
24686
|
+
resourceUrl: attachment.url
|
24687
|
+
});
|
24714
24688
|
}
|
24715
|
-
}), [adapter,
|
24689
|
+
}), [adapter, messageThreadProps, onRenderAvatarCallback]);
|
24716
24690
|
/* @conditional-compile-remove(image-overlay) */
|
24717
24691
|
const inlineImageOptions = {
|
24718
24692
|
onRenderInlineImage: (inlineImage, defaultOnRender) => {
|
24719
|
-
return (React.createElement("span", { onClick: () => onInlineImageClicked(inlineImage.imgAttrs.id || '', inlineImage.messageId), tabIndex: 0, role: "button", onKeyDown: (e) => {
|
24693
|
+
return (React.createElement("span", { key: inlineImage.imgAttrs.id, onClick: () => onInlineImageClicked(inlineImage.imgAttrs.id || '', inlineImage.messageId), tabIndex: 0, role: "button", onKeyDown: (e) => {
|
24720
24694
|
if (e.key === 'Enter') {
|
24721
24695
|
onInlineImageClicked(inlineImage.imgAttrs.id || '', inlineImage.messageId);
|
24722
24696
|
}
|
@@ -24736,7 +24710,7 @@ const ChatScreen = (props) => {
|
|
24736
24710
|
const a = document.createElement('a');
|
24737
24711
|
// Set the href and download attributes for the anchor element
|
24738
24712
|
a.href = imageSrc;
|
24739
|
-
a.download = (overlayImageItem === null || overlayImageItem === void 0 ? void 0 : overlayImageItem.
|
24713
|
+
a.download = (overlayImageItem === null || overlayImageItem === void 0 ? void 0 : overlayImageItem.attachmentId) || '';
|
24740
24714
|
a.rel = 'noopener noreferrer';
|
24741
24715
|
a.target = '_blank';
|
24742
24716
|
// Programmatically click the anchor element to trigger the download
|
@@ -24744,7 +24718,7 @@ const ChatScreen = (props) => {
|
|
24744
24718
|
a.click();
|
24745
24719
|
document.body.removeChild(a);
|
24746
24720
|
}
|
24747
|
-
}, [overlayImageItem === null || overlayImageItem === void 0 ? void 0 : overlayImageItem.
|
24721
|
+
}, [overlayImageItem === null || overlayImageItem === void 0 ? void 0 : overlayImageItem.attachmentId]);
|
24748
24722
|
const AttachFileButton = React.useCallback(() => {
|
24749
24723
|
if (!(fileSharing === null || fileSharing === void 0 ? void 0 : fileSharing.uploadHandler)) {
|
24750
24724
|
return null;
|
@@ -34983,17 +34957,12 @@ class CallWithChatBackedChatAdapter {
|
|
34983
34957
|
this.callWithChatAdapter = callWithChatAdapter;
|
34984
34958
|
}
|
34985
34959
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
34986
|
-
|
34987
|
-
downloadAttachment(options) {
|
34960
|
+
downloadResourceToCache(resourceDetails) {
|
34988
34961
|
return __awaiter$3(this, void 0, void 0, function* () {
|
34989
|
-
|
34962
|
+
this.callWithChatAdapter.downloadResourceToCache(resourceDetails);
|
34990
34963
|
});
|
34991
34964
|
}
|
34992
34965
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
34993
|
-
downloadResourceToCache(resourceDetails) {
|
34994
|
-
this.callWithChatAdapter.downloadResourceToCache(resourceDetails);
|
34995
|
-
}
|
34996
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
34997
34966
|
removeResourceFromCache(resourceDetails) {
|
34998
34967
|
this.callWithChatAdapter.removeResourceFromCache(resourceDetails);
|
34999
34968
|
}
|
@@ -35640,8 +35609,6 @@ class AzureCommunicationCallWithChatAdapter {
|
|
35640
35609
|
/* @conditional-compile-remove(file-sharing) */
|
35641
35610
|
this.updateFileUploadMetadata = this.updateFileUploadMetadata.bind(this);
|
35642
35611
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
35643
|
-
this.downloadAttachment = this.downloadAttachment.bind(this); // ToDo: This method is to be removed
|
35644
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
35645
35612
|
this.downloadResourceToCache = this.downloadResourceToCache.bind(this);
|
35646
35613
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
35647
35614
|
this.removeResourceFromCache = this.removeResourceFromCache.bind(this);
|
@@ -35900,17 +35867,12 @@ class AzureCommunicationCallWithChatAdapter {
|
|
35900
35867
|
});
|
35901
35868
|
}
|
35902
35869
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
35903
|
-
|
35904
|
-
downloadAttachment(options) {
|
35870
|
+
downloadResourceToCache(resourceDetails) {
|
35905
35871
|
return __awaiter$2(this, void 0, void 0, function* () {
|
35906
|
-
|
35872
|
+
this.chatAdapter.downloadResourceToCache(resourceDetails);
|
35907
35873
|
});
|
35908
35874
|
}
|
35909
35875
|
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
35910
|
-
downloadResourceToCache(resourceDetails) {
|
35911
|
-
this.chatAdapter.downloadResourceToCache(resourceDetails);
|
35912
|
-
}
|
35913
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
35914
35876
|
removeResourceFromCache(resourceDetails) {
|
35915
35877
|
this.chatAdapter.removeResourceFromCache(resourceDetails);
|
35916
35878
|
}
|
@@ -36324,15 +36286,11 @@ beforeDispose) => {
|
|
36324
36286
|
*/
|
36325
36287
|
const createAzureCommunicationCallWithChatAdapterFromClients = ({ callClient, callAgent, callLocator, chatClient, chatThreadClient,
|
36326
36288
|
/* @conditional-compile-remove(video-background-effects) */
|
36327
|
-
callAdapterOptions,
|
36328
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
36329
|
-
chatAdapterOptions }) => __awaiter$2(void 0, void 0, void 0, function* () {
|
36289
|
+
callAdapterOptions }) => __awaiter$2(void 0, void 0, void 0, function* () {
|
36330
36290
|
const createCallAdapterPromise = createAzureCommunicationCallAdapterFromClient(callClient, callAgent, callLocator,
|
36331
36291
|
/* @conditional-compile-remove(video-background-effects) */
|
36332
36292
|
callAdapterOptions);
|
36333
|
-
const createChatAdapterPromise = createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient
|
36334
|
-
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
|
36335
|
-
chatAdapterOptions);
|
36293
|
+
const createChatAdapterPromise = createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient);
|
36336
36294
|
const [callAdapter, chatAdapter] = yield Promise.all([createCallAdapterPromise, createChatAdapterPromise]);
|
36337
36295
|
return new AzureCommunicationCallWithChatAdapter(callAdapter, chatAdapter);
|
36338
36296
|
});
|