in packages/chat-component-bindings/src/handlers/createHandlers.ts [67:110]
onSendMessage: async function (
content: string,
options?: SendMessageOptions | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions
) {
const sendMessageRequest = {
content,
senderDisplayName: chatClient.getState().displayName
};
/* @conditional-compile-remove(rich-text-editor-image-upload) */
const imageAttachments: ChatAttachment[] | undefined = getImageAttachmentsFromHTMLContent(content);
/* @conditional-compile-remove(file-sharing-acs) */
const hasAttachments =
options &&
'attachments' in options &&
options.attachments &&
options.attachments[0] &&
!(options.attachments[0] as ChatAttachment).attachmentType;
/* @conditional-compile-remove(rich-text-editor-image-upload) */
const hasImages = imageAttachments && imageAttachments.length > 0;
/* @conditional-compile-remove(file-sharing-acs) */
/* @conditional-compile-remove(rich-text-editor-image-upload) */
if (
/* @conditional-compile-remove(file-sharing-acs) */ hasAttachments ||
/* @conditional-compile-remove(rich-text-editor-image-upload) */ hasImages
) {
const chatSDKOptions: SendMessageOptions = {
metadata: {
...options?.metadata,
/* @conditional-compile-remove(file-sharing-acs) */
fileSharingMetadata: JSON.stringify(options?.attachments)
},
/* @conditional-compile-remove(rich-text-editor-image-upload) */
attachments: imageAttachments,
type: options?.type
};
await chatThreadClient.sendMessage(sendMessageRequest, chatSDKOptions);
return;
}
await chatThreadClient.sendMessage(sendMessageRequest, options as SendMessageOptions);
},