@azure/communication-react 1.18.0-alpha-202407050014 → 1.18.0-alpha-202407090014

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.
Files changed (127) hide show
  1. package/dist/communication-react.d.ts +131 -28
  2. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-DeZQ3bKG.js → ChatMessageComponentAsRichTextEditBox-RrIa2t97.js} +62 -17
  3. package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-RrIa2t97.js.map +1 -0
  4. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-D63MoVhd.js → RichTextSendBoxWrapper-Bz_1ebsD.js} +2 -2
  5. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-D63MoVhd.js.map → RichTextSendBoxWrapper-Bz_1ebsD.js.map} +1 -1
  6. package/dist/dist-cjs/communication-react/{index-xFes8-H4.js → index-DGXoGo4W.js} +1041 -579
  7. package/dist/dist-cjs/communication-react/index-DGXoGo4W.js.map +1 -0
  8. package/dist/dist-cjs/communication-react/index.js +1 -1
  9. package/dist/dist-esm/acs-ui-common/src/common.d.ts +13 -0
  10. package/dist/dist-esm/acs-ui-common/src/common.js.map +1 -1
  11. package/dist/dist-esm/acs-ui-common/src/dataConversion.d.ts +6 -0
  12. package/dist/dist-esm/acs-ui-common/src/dataConversion.js +17 -0
  13. package/dist/dist-esm/acs-ui-common/src/dataConversion.js.map +1 -0
  14. package/dist/dist-esm/acs-ui-common/src/index.d.ts +2 -0
  15. package/dist/dist-esm/acs-ui-common/src/index.js +2 -0
  16. package/dist/dist-esm/acs-ui-common/src/index.js.map +1 -1
  17. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  18. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  19. package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +1 -1
  20. package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
  21. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.d.ts +3 -0
  22. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js +57 -4
  23. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js.map +1 -1
  24. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +34 -8
  25. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
  26. package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js +3 -0
  27. package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js.map +1 -1
  28. package/dist/dist-esm/communication-react/src/index.d.ts +1 -0
  29. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  30. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.d.ts +4 -0
  31. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js +7 -1
  32. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js.map +1 -1
  33. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.d.ts +4 -0
  34. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js +62 -15
  35. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js.map +1 -1
  36. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js +1 -3
  37. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js.map +1 -1
  38. package/dist/dist-esm/react-components/src/components/MessageStatusIndicatorInternal.js +1 -1
  39. package/dist/dist-esm/react-components/src/components/MessageStatusIndicatorInternal.js.map +1 -1
  40. package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +18 -0
  41. package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
  42. package/dist/dist-esm/react-components/src/components/NotificationStack.d.ts +58 -26
  43. package/dist/dist-esm/react-components/src/components/NotificationStack.js.map +1 -1
  44. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.d.ts +6 -0
  45. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.js +27 -1
  46. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/CopyPastePlugin.js.map +1 -1
  47. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.d.ts +1 -1
  48. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.js +27 -1
  49. package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/UpdateContentPlugin.js.map +1 -1
  50. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.d.ts +2 -1
  51. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js +24 -12
  52. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js.map +1 -1
  53. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.d.ts +2 -1
  54. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js +6 -2
  55. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js.map +1 -1
  56. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.d.ts +13 -1
  57. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +57 -27
  58. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -1
  59. package/dist/dist-esm/react-components/src/components/styles/Common.style.d.ts +4 -0
  60. package/dist/dist-esm/react-components/src/components/styles/Common.style.js +4 -0
  61. package/dist/dist-esm/react-components/src/components/styles/Common.style.js.map +1 -1
  62. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js +18 -0
  63. package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js.map +1 -1
  64. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js +6 -3
  65. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js.map +1 -1
  66. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.d.ts +20 -0
  67. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +81 -0
  68. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
  69. package/dist/dist-esm/react-components/src/components/utils.js +16 -1
  70. package/dist/dist-esm/react-components/src/components/utils.js.map +1 -1
  71. package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +42 -1
  72. package/dist/dist-esm/react-components/src/theming/icons.d.ts +1 -0
  73. package/dist/dist-esm/react-components/src/theming/icons.js +4 -0
  74. package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
  75. package/dist/dist-esm/react-components/src/types/Attachment.d.ts +4 -0
  76. package/dist/dist-esm/react-components/src/types/Attachment.js.map +1 -1
  77. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js +65 -13
  78. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
  79. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.d.ts +1 -0
  80. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +8 -3
  81. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
  82. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.d.ts +1 -0
  83. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +6 -2
  84. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
  85. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.d.ts +1 -0
  86. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js +3 -1
  87. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js.map +1 -1
  88. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.d.ts +1 -0
  89. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js +3 -1
  90. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js.map +1 -1
  91. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/TransferPage.js +5 -1
  92. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/TransferPage.js.map +1 -1
  93. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/TrackErrors.d.ts +6 -6
  94. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/TrackErrors.js +22 -20
  95. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/TrackErrors.js.map +1 -1
  96. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.d.ts +47 -0
  97. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js +104 -0
  98. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js.map +1 -1
  99. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +5 -0
  100. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +22 -0
  101. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
  102. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +13 -0
  103. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
  104. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.d.ts +5 -0
  105. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +16 -0
  106. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js.map +1 -1
  107. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +47 -18
  108. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
  109. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +3 -0
  110. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +20 -0
  111. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
  112. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts +9 -0
  113. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
  114. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.d.ts +1 -1
  115. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js.map +1 -1
  116. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js +4 -0
  117. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js.map +1 -1
  118. package/dist/dist-esm/react-composites/src/composites/ChatComposite/image-upload/useImageUpload.d.ts +12 -0
  119. package/dist/dist-esm/react-composites/src/composites/ChatComposite/image-upload/useImageUpload.js +129 -0
  120. package/dist/dist-esm/react-composites/src/composites/ChatComposite/image-upload/useImageUpload.js.map +1 -0
  121. package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.d.ts +3 -0
  122. package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.js +4 -3
  123. package/dist/dist-esm/react-composites/src/composites/common/SendBoxPicker.js.map +1 -1
  124. package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +1 -0
  125. package/package.json +2 -2
  126. package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-DeZQ3bKG.js.map +0 -1
  127. package/dist/dist-cjs/communication-react/index-xFes8-H4.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AzureCommunicationChatAdapter.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;;;;;;;;AAElC,OAAO,EACL,8BAA8B,EAI/B,gDAAuC;AACxC,OAAO,EAAgB,yBAAyB,EAAE,mDAA0C;AAY5F,OAAO,EAAE,6BAA6B,EAAgC,yCAAgC;AACtG,OAAO,YAAY,MAAM,QAAQ,CAAC;AAclC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,yCAAgC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAInG;;;GAGG;AACH,MAAM,OAAO,WAAW;IAKtB,YAAY,WAA4B,EAAE,QAAgB;QAJlD,YAAO,GAAiB,IAAI,YAAY,EAAE,CAAC;QAKjD,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,4DAA4D,CAAC;QACrE,CAAC;QACD,IAAI,CAAC,KAAK,GAAG;YACX,MAAM,EAAE,WAAW,CAAC,MAAM;YAC1B,WAAW,EAAE,WAAW,CAAC,WAAW;YACpC,MAAM;YACN,YAAY,EAAE,WAAW,CAAC,YAAY;SACvC,CAAC;IACJ,CAAC;IAEM,aAAa,CAAC,OAA6C;QAChE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAEM,cAAc,CAAC,OAA6C;QACjE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OA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AI,CAAC,CAAC,YAAY,CAAC,KAAK,SAAS,CAAC;AAC1G,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n _createStatefulChatClientInner,\n ChatClientState,\n ChatError,\n StatefulChatClient\n} from '@internal/chat-stateful-client';\nimport { ChatHandlers, createDefaultChatHandlers } from '@internal/chat-component-bindings';\nimport { ChatMessage, ChatMessageType, ChatThreadClient, SendMessageOptions } from '@azure/communication-chat';\nimport { CommunicationTokenCredential, CommunicationUserIdentifier } from '@azure/communication-common';\nimport type {\n ChatMessageDeletedEvent,\n ChatMessageEditedEvent,\n ChatMessageReceivedEvent,\n ChatThreadPropertiesUpdatedEvent,\n ParticipantsAddedEvent,\n ParticipantsRemovedEvent,\n ReadReceiptReceivedEvent\n} from '@azure/communication-chat';\nimport { toFlatCommunicationIdentifier, _TelemetryImplementationHint } from '@internal/acs-ui-common';\nimport EventEmitter from 'events';\nimport {\n ChatAdapter,\n ChatAdapterState,\n MessageDeletedListener,\n MessageEditedListener,\n MessageReadListener,\n MessageReceivedListener,\n ParticipantsAddedListener,\n ParticipantsRemovedListener,\n TopicChangedListener\n} from './ChatAdapter';\nimport { ResourceDetails } from './ChatAdapter';\nimport { AdapterError } from '../../common/adapters';\nimport { useEffect, useRef, useState } from 'react';\nimport { _isValidIdentifier } from '@internal/acs-ui-common';\nimport { TEAMS_LIMITATION_LEARN_MORE, UNSUPPORTED_CHAT_THREAD_TYPE } from '../../common/constants';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { MessageOptions } from '@internal/acs-ui-common';\n\n/**\n * Context of Chat, which is a centralized context for all state updates\n * @private\n */\nexport class ChatContext {\n private emitter: EventEmitter = new EventEmitter();\n private state: ChatAdapterState;\n private threadId: string;\n\n constructor(clientState: ChatClientState, threadId: string) {\n const thread = clientState.threads[threadId];\n this.threadId = threadId;\n if (!thread) {\n throw 'Cannot find threadId, please initialize thread before use!';\n }\n this.state = {\n userId: clientState.userId,\n displayName: clientState.displayName,\n thread,\n latestErrors: clientState.latestErrors\n };\n }\n\n public onStateChange(handler: (_uiState: ChatAdapterState) => void): void {\n this.emitter.on('stateChanged', handler);\n }\n\n public offStateChange(handler: (_uiState: ChatAdapterState) => void): void {\n this.emitter.off('stateChanged', handler);\n }\n\n public setState(state: ChatAdapterState): void {\n this.state = state;\n this.emitter.emit('stateChanged', this.state);\n }\n\n public getState(): ChatAdapterState {\n return this.state;\n }\n\n public setError(error: Error): void {\n this.setState({ ...this.state, error });\n }\n\n public updateClientState(clientState: ChatClientState): void {\n const thread = clientState.threads[this.threadId];\n if (!thread) {\n throw 'Cannot find threadId, please make sure thread state is still in Stateful ChatClient.';\n }\n\n let updatedState: ChatAdapterState = {\n userId: clientState.userId,\n displayName: clientState.displayName,\n thread,\n latestErrors: clientState.latestErrors\n };\n\n /* @conditional-compile-remove(file-sharing-acs) */\n updatedState = { ...updatedState };\n\n this.setState(updatedState);\n }\n}\n\n/**\n * @private\n */\nexport class AzureCommunicationChatAdapter implements ChatAdapter {\n private chatClient: StatefulChatClient;\n private chatThreadClient: ChatThreadClient;\n private context: ChatContext;\n private handlers: ChatHandlers;\n private emitter: EventEmitter = new EventEmitter();\n\n constructor(chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient) {\n this.bindAllPublicMethods();\n this.chatClient = chatClient;\n this.chatThreadClient = chatThreadClient;\n this.context = new ChatContext(chatClient.getState(), chatThreadClient.threadId);\n\n const onStateChange = (clientState: ChatClientState): void => {\n // unsubscribe when the instance gets disposed\n if (!this) {\n chatClient.offStateChange(onStateChange);\n return;\n }\n this.context.updateClientState(clientState);\n };\n\n this.handlers = createDefaultChatHandlers(chatClient, chatThreadClient);\n\n this.chatClient.onStateChange(onStateChange);\n this.subscribeAllEvents();\n }\n\n private bindAllPublicMethods(): void {\n this.onStateChange = this.onStateChange.bind(this);\n this.offStateChange = this.offStateChange.bind(this);\n this.getState = this.getState.bind(this);\n this.dispose = this.dispose.bind(this);\n this.fetchInitialData = this.fetchInitialData.bind(this);\n this.sendMessage = this.sendMessage.bind(this);\n this.sendReadReceipt = this.sendReadReceipt.bind(this);\n this.sendTypingIndicator = this.sendTypingIndicator.bind(this);\n this.updateMessage = this.updateMessage.bind(this);\n this.deleteMessage = this.deleteMessage.bind(this);\n this.removeParticipant = this.removeParticipant.bind(this);\n this.setTopic = this.setTopic.bind(this);\n this.loadPreviousChatMessages = this.loadPreviousChatMessages.bind(this);\n this.on = this.on.bind(this);\n this.off = this.off.bind(this);\n this.downloadResourceToCache = this.downloadResourceToCache.bind(this);\n this.removeResourceFromCache = this.removeResourceFromCache.bind(this);\n }\n\n dispose(): void {\n this.unsubscribeAllEvents();\n this.chatClient.dispose();\n }\n\n async fetchInitialData(): Promise<void> {\n // If get properties fails we dont want to try to get the participants after.\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.chatThreadClient.getProperties();\n // Fetch all participants who joined before the local user.\n for await (const _page of this.chatThreadClient.listParticipants().byPage({\n // Fetch 100 participants per page by default.\n maxPageSize: 100\n // eslint-disable-next-line curly\n }));\n });\n }\n\n getState(): ChatAdapterState {\n return this.context.getState();\n }\n\n onStateChange(handler: (state: ChatAdapterState) => void): void {\n this.context.onStateChange(handler);\n }\n\n offStateChange(handler: (state: ChatAdapterState) => void): void {\n this.context.offStateChange(handler);\n }\n\n async sendMessage(\n content: string,\n options?: SendMessageOptions | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions\n ): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n return await this.handlers.onSendMessage(content, options);\n });\n }\n\n async sendReadReceipt(chatMessageId: string): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onMessageSeen(chatMessageId);\n });\n }\n\n async sendTypingIndicator(): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onTyping();\n });\n }\n\n async removeParticipant(userId: string): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onRemoveParticipant(userId);\n });\n }\n\n async setTopic(topicName: string): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.updateThreadTopicName(topicName);\n });\n }\n\n async loadPreviousChatMessages(messagesToLoad: number): Promise<boolean> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return await this.handlers.onLoadPreviousChatMessages(messagesToLoad);\n });\n }\n\n async updateMessage(\n messageId: string,\n content: string,\n options?: Record<string, string> | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions\n ): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n /* @conditional-compile-remove(file-sharing-acs) */\n const messageOptions: MessageOptions = {};\n /* @conditional-compile-remove(file-sharing-acs) */\n if (\n options &&\n // if options.attachments is an array or undefined (for removal all attachments),\n // then given options is a MessageOptions\n (Array.isArray(options.attachments) || options.attachments === undefined)\n ) {\n messageOptions.attachments = options.attachments ?? [];\n }\n /* @conditional-compile-remove(file-sharing-acs) */\n if (\n options &&\n // if options.metadata is provided, we need to add it in MessageOptions\n options.metadata &&\n typeof options.metadata === 'object'\n ) {\n messageOptions.metadata = options.metadata;\n }\n /* @conditional-compile-remove(file-sharing-acs) */\n if (options && !('attachments' in options) && !('metadata' in options)) {\n // if options don't have attachments or metadata,\n // then it is a Record<string, string>\n /* @conditional-compile-remove(file-sharing-acs) */\n return await this.handlers.onUpdateMessage(messageId, content, options);\n }\n /* @conditional-compile-remove(file-sharing-acs) */\n return await this.handlers.onUpdateMessage(messageId, content, messageOptions);\n // metadata is never used in the current stable\n return await this.handlers.onUpdateMessage(messageId, content);\n });\n }\n\n async deleteMessage(messageId: string): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return await this.handlers.onDeleteMessage(messageId);\n });\n }\n\n async downloadResourceToCache(resourceDetails: ResourceDetails): Promise<void> {\n this.chatClient.downloadResourceToCache(\n resourceDetails.threadId,\n resourceDetails.messageId,\n resourceDetails.resourceUrl\n );\n }\n\n removeResourceFromCache(resourceDetails: ResourceDetails): void {\n this.chatClient.removeResourceFromCache(\n resourceDetails.threadId,\n resourceDetails.messageId,\n resourceDetails.resourceUrl\n );\n }\n\n private messageReceivedListener(event: ChatMessageReceivedEvent): void {\n const isCurrentChatAdapterThread = event.threadId === this.chatThreadClient.threadId;\n\n if (!isCurrentChatAdapterThread) {\n return;\n }\n\n const message = convertEventToChatMessage(event);\n this.emitter.emit('messageReceived', { message });\n\n const currentUserId = toFlatCommunicationIdentifier(this.chatClient.getState().userId);\n if (message?.sender && toFlatCommunicationIdentifier(message.sender) === currentUserId) {\n this.emitter.emit('messageSent', { message });\n }\n }\n\n private messageEditedListener(event: ChatMessageEditedEvent): void {\n const isCurrentChatAdapterThread = event.threadId === this.chatThreadClient.threadId;\n if (!isCurrentChatAdapterThread) {\n return;\n }\n\n const message = convertEventToChatMessage(event);\n this.emitter.emit('messageEdited', { message });\n }\n\n private messageDeletedListener(event: ChatMessageDeletedEvent): void {\n const isCurrentChatAdapterThread = event.threadId === this.chatThreadClient.threadId;\n if (!isCurrentChatAdapterThread) {\n return;\n }\n\n const message = convertEventToChatMessage(event);\n this.emitter.emit('messageDeleted', { message });\n }\n\n private messageReadListener({ chatMessageId, recipient }: ReadReceiptReceivedEvent): void {\n const message = this.getState().thread.chatMessages[chatMessageId];\n if (message) {\n this.emitter.emit('messageRead', { message, readBy: recipient });\n }\n }\n\n private participantsAddedListener({ addedBy, participantsAdded }: ParticipantsAddedEvent): void {\n this.emitter.emit('participantsAdded', { addedBy, participantsAdded });\n }\n\n private participantsRemovedListener({ removedBy, participantsRemoved }: ParticipantsRemovedEvent): void {\n this.emitter.emit('participantsRemoved', { removedBy, participantsRemoved });\n }\n\n private chatThreadPropertiesUpdatedListener(event: ChatThreadPropertiesUpdatedEvent): void {\n this.emitter.emit('topicChanged', { topic: event.properties.topic });\n }\n\n private subscribeAllEvents(): void {\n this.chatClient.on('chatThreadPropertiesUpdated', this.chatThreadPropertiesUpdatedListener.bind(this));\n this.chatClient.on('participantsAdded', this.participantsAddedListener.bind(this));\n this.chatClient.on('participantsRemoved', this.participantsRemovedListener.bind(this));\n this.chatClient.on('chatMessageReceived', this.messageReceivedListener.bind(this));\n this.chatClient.on('chatMessageEdited', this.messageEditedListener.bind(this));\n this.chatClient.on('chatMessageDeleted', this.messageDeletedListener.bind(this));\n this.chatClient.on('readReceiptReceived', this.messageReadListener.bind(this));\n this.chatClient.on('participantsRemoved', this.participantsRemovedListener.bind(this));\n }\n\n private unsubscribeAllEvents(): void {\n this.chatClient.off('chatThreadPropertiesUpdated', this.chatThreadPropertiesUpdatedListener.bind(this));\n this.chatClient.off('participantsAdded', this.participantsAddedListener.bind(this));\n this.chatClient.off('participantsRemoved', this.participantsRemovedListener.bind(this));\n this.chatClient.off('chatMessageReceived', this.messageReceivedListener.bind(this));\n this.chatClient.off('chatMessageEdited', this.messageEditedListener.bind(this));\n this.chatClient.off('chatMessageDeleted', this.messageDeletedListener.bind(this));\n this.chatClient.off('readReceiptReceived', this.messageReadListener.bind(this));\n this.chatClient.off('participantsRemoved', this.participantsRemovedListener.bind(this));\n }\n\n on(event: 'messageReceived', listener: MessageReceivedListener): void;\n on(event: 'messageEdited', listener: MessageEditedListener): void;\n on(event: 'messageDeleted', listener: MessageDeletedListener): void;\n on(event: 'messageSent', listener: MessageReceivedListener): void;\n on(event: 'messageRead', listener: MessageReadListener): void;\n on(event: 'participantsAdded', listener: ParticipantsAddedListener): void;\n on(event: 'participantsRemoved', listener: ParticipantsRemovedListener): void;\n on(event: 'topicChanged', listener: TopicChangedListener): void;\n on(event: 'error', listener: (e: AdapterError) => void): void;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n on(event: string, listener: (e: any) => void): void {\n this.emitter.on(event, listener);\n }\n\n off(event: 'messageReceived', listener: MessageReceivedListener): void;\n off(event: 'messageEdited', listener: MessageEditedListener): void;\n off(event: 'messageDeleted', listener: MessageDeletedListener): void;\n off(event: 'messageSent', listener: MessageReceivedListener): void;\n off(event: 'messageRead', listener: MessageReadListener): void;\n off(event: 'participantsAdded', listener: ParticipantsAddedListener): void;\n off(event: 'participantsRemoved', listener: ParticipantsRemovedListener): void;\n off(event: 'topicChanged', listener: TopicChangedListener): void;\n off(event: 'error', listener: (e: AdapterError) => void): void;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n off(event: string, listener: (e: any) => void): void {\n this.emitter.off(event, listener);\n }\n\n private async asyncTeeErrorToEventEmitter<T>(f: () => Promise<T>): Promise<T> {\n try {\n return await f();\n } catch (error) {\n if (isChatError(error as Error)) {\n this.emitter.emit('error', error as AdapterError);\n }\n throw error;\n }\n }\n}\n\nconst convertEventToChatMessage = (\n event: ChatMessageReceivedEvent | ChatMessageEditedEvent | ChatMessageDeletedEvent\n): ChatMessage => {\n return {\n id: event.id,\n version: event.version,\n content: isChatMessageDeletedEvent(event) ? undefined : { message: event.message },\n type: convertEventType(event.type),\n sender: event.sender,\n senderDisplayName: event.senderDisplayName,\n sequenceId: '',\n createdOn: new Date(event.createdOn),\n editedOn: isChatMessageEditedEvent(event) ? event.editedOn : undefined,\n deletedOn: isChatMessageDeletedEvent(event) ? event.deletedOn : undefined\n };\n};\n\nconst isChatMessageEditedEvent = (\n event: ChatMessageReceivedEvent | ChatMessageEditedEvent | ChatMessageDeletedEvent\n): event is ChatMessageEditedEvent => {\n return 'editedOn' in event;\n};\n\nconst isChatMessageDeletedEvent = (\n event: ChatMessageReceivedEvent | ChatMessageEditedEvent | ChatMessageDeletedEvent\n): event is ChatMessageDeletedEvent => {\n return 'deletedOn' in event;\n};\n\n// only text/html message type will be received from event\nconst convertEventType = (type: string): ChatMessageType => {\n const lowerCaseType = type.toLowerCase();\n if (lowerCaseType === 'richtext/html' || lowerCaseType === 'html') {\n return 'html';\n } else {\n return 'text';\n }\n};\n\n/**\n * Arguments for creating the Azure Communication Services implementation of {@link ChatAdapter}.\n *\n * @public\n */\nexport type AzureCommunicationChatAdapterArgs = {\n endpoint: string;\n userId: CommunicationUserIdentifier;\n displayName: string;\n credential: CommunicationTokenCredential;\n threadId: string;\n};\n\n/**\n * Create a {@link ChatAdapter} backed by Azure Communication Services.\n *\n * This is the default implementation of {@link ChatAdapter} provided by this library.\n *\n * @public\n */\nexport const createAzureCommunicationChatAdapter = async ({\n endpoint: endpointUrl,\n userId,\n displayName,\n credential,\n threadId\n}: AzureCommunicationChatAdapterArgs): Promise<ChatAdapter> => {\n return _createAzureCommunicationChatAdapterInner(endpointUrl, userId, displayName, credential, threadId);\n};\n\n/**\n * This inner function is used to allow injection of TelemetryImplementationHint without changing the public API.\n *\n * @internal\n */\nexport const _createAzureCommunicationChatAdapterInner = async (\n endpoint: string,\n userId: CommunicationUserIdentifier,\n displayName: string,\n credential: CommunicationTokenCredential,\n threadId: string,\n telemetryImplementationHint: _TelemetryImplementationHint = 'Chat'\n): Promise<ChatAdapter> => {\n if (!_isValidIdentifier(userId)) {\n throw new Error('Provided userId is invalid. Please provide valid identifier object.');\n }\n\n const chatClient = _createStatefulChatClientInner(\n {\n userId,\n displayName,\n endpoint,\n credential\n },\n undefined,\n telemetryImplementationHint\n );\n const chatThreadClient = await chatClient.getChatThreadClient(threadId);\n await chatClient.startRealtimeNotifications();\n\n const adapter = await createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient);\n\n return adapter;\n};\n\n/**\n * This inner function to create ChatAdapterPromise in case when threadID is not avaialble.\n * ThreadId is a promise to allow for lazy initialization of the adapter.\n * @internal\n */\nexport const _createLazyAzureCommunicationChatAdapterInner = async (\n endpoint: string,\n userId: CommunicationUserIdentifier,\n displayName: string,\n credential: CommunicationTokenCredential,\n threadId: Promise<string>,\n telemetryImplementationHint: _TelemetryImplementationHint = 'Chat'\n): Promise<ChatAdapter> => {\n if (!_isValidIdentifier(userId)) {\n throw new Error('Provided userId is invalid. Please provide valid identifier object.');\n }\n\n const chatClient = _createStatefulChatClientInner(\n {\n userId,\n displayName,\n endpoint,\n credential\n },\n undefined,\n telemetryImplementationHint\n );\n return threadId.then(async (threadId) => {\n if (UNSUPPORTED_CHAT_THREAD_TYPE.some((t) => threadId.includes(t))) {\n console.error(\n `Invalid Chat ThreadId: ${threadId}. Please note with Teams Channel Meetings, only Calling is supported and Chat is not currently supported. Read more: ${TEAMS_LIMITATION_LEARN_MORE}.`\n );\n }\n\n const chatThreadClient = await chatClient.getChatThreadClient(threadId);\n await chatClient.startRealtimeNotifications();\n\n const adapter = await createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient);\n\n return adapter;\n });\n};\n\n/**\n * A custom React hook to simplify the creation of {@link ChatAdapter}.\n *\n * Similar to {@link createAzureCommunicationChatAdapter}, but takes care of asynchronous\n * creation of the adapter internally.\n *\n * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments\n * as they are created. The adapter is only created when all arguments are defined.\n *\n * Note that you must memoize the arguments to avoid recreating adapter on each render.\n * See storybook for typical usage examples.\n *\n * @public\n */\nexport const useAzureCommunicationChatAdapter = (\n /**\n * Arguments to be passed to {@link createAzureCommunicationChatAdapter}.\n *\n * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments\n * as they are created. The adapter is only created when all arguments are defined.\n */\n args: Partial<AzureCommunicationChatAdapterArgs>,\n /**\n * Optional callback to modify the adapter once it is created.\n *\n * If set, must return the modified adapter.\n */\n afterCreate?: (adapter: ChatAdapter) => Promise<ChatAdapter>,\n /**\n * Optional callback called before the adapter is disposed.\n *\n * This is useful for clean up tasks, e.g., leaving any ongoing calls.\n */\n beforeDispose?: (adapter: ChatAdapter) => Promise<void>\n): ChatAdapter | undefined => {\n const { credential, displayName, endpoint, threadId, userId } = args;\n\n // State update needed to rerender the parent component when a new adapter is created.\n const [adapter, setAdapter] = useState<ChatAdapter | undefined>(undefined);\n // Ref needed for cleanup to access the old adapter created asynchronously.\n const adapterRef = useRef<ChatAdapter | undefined>(undefined);\n\n const afterCreateRef = useRef<((adapter: ChatAdapter) => Promise<ChatAdapter>) | undefined>(undefined);\n const beforeDisposeRef = useRef<((adapter: ChatAdapter) => Promise<void>) | undefined>(undefined);\n // These refs are updated on *each* render, so that the latest values\n // are used in the `useEffect` closures below.\n // Using a Ref ensures that new values for the callbacks do not trigger the\n // useEffect blocks, and a new adapter creation / distruction is not triggered.\n afterCreateRef.current = afterCreate;\n beforeDisposeRef.current = beforeDispose;\n\n useEffect(\n () => {\n if (!credential || !displayName || !endpoint || !threadId || !userId) {\n return;\n }\n (async () => {\n if (adapterRef.current) {\n // Dispose the old adapter when a new one is created.\n //\n // This clean up function uses `adapterRef` because `adapter` can not be added to the dependency array of\n // this `useEffect` -- we do not want to trigger a new adapter creation because of the first adapter\n // creation.\n if (beforeDisposeRef.current) {\n await beforeDisposeRef.current(adapterRef.current);\n }\n adapterRef.current.dispose();\n adapterRef.current = undefined;\n }\n\n let newAdapter = await createAzureCommunicationChatAdapter({\n credential,\n displayName,\n endpoint,\n threadId,\n userId\n });\n if (afterCreateRef.current) {\n newAdapter = await afterCreateRef.current(newAdapter);\n }\n adapterRef.current = newAdapter;\n setAdapter(newAdapter);\n })();\n },\n // Explicitly list all arguments so that caller doesn't have to memoize the `args` object.\n [adapterRef, afterCreateRef, beforeDisposeRef, credential, displayName, endpoint, threadId, userId]\n );\n\n // Dispose any existing adapter when the component unmounts.\n useEffect(() => {\n return () => {\n (async () => {\n if (adapterRef.current) {\n if (beforeDisposeRef.current) {\n await beforeDisposeRef.current(adapterRef.current);\n }\n adapterRef.current.dispose();\n adapterRef.current = undefined;\n }\n })();\n };\n }, []);\n\n return adapter;\n};\n\n/**\n * Create a {@link ChatAdapter} using the provided {@link StatefulChatClient}.\n *\n * Useful if you want to keep a reference to {@link StatefulChatClient}.\n * Consider using {@link createAzureCommunicationChatAdapter} for a simpler API.\n *\n * @public\n */\nexport async function createAzureCommunicationChatAdapterFromClient(\n chatClient: StatefulChatClient,\n chatThreadClient: ChatThreadClient\n): Promise<ChatAdapter> {\n return new AzureCommunicationChatAdapter(chatClient, chatThreadClient);\n}\n\nconst isChatError = (e: Error): e is ChatError => {\n return 'target' in e && e['target'] !== undefined && 'innerError' in e && e['innerError'] !== undefined;\n};\n"]}
1
+ {"version":3,"file":"AzureCommunicationChatAdapter.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;;;;;;;;AAElC,OAAO,EACL,8BAA8B,EAI/B,gDAAuC;AACxC,OAAO,EAAgB,yBAAyB,EAAE,mDAA0C;AAc5F,OAAO,EAAE,6BAA6B,EAAgC,yCAAgC;AACtG,OAAO,YAAY,MAAM,QAAQ,CAAC;AAclC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,yCAAgC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAInG;;;GAGG;AACH,MAAM,OAAO,WAAW;IAKtB,YAAY,WAA4B,EAAE,QAAgB;QAJlD,YAAO,GAAiB,IAAI,YAAY,EAAE,CAAC;QAKjD,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,4DAA4D,CAAC;QACrE,CAAC;QACD,IAAI,CAAC,KAAK,GAAG;YACX,MAAM,EAAE,WAAW,CAAC,MAAM;YAC1B,WAAW,EAAE,WAAW,CAAC,WAAW;YACpC,MAAM;YACN,YAAY,EAAE,WAAW,CAAC,YAAY;SACvC,CAAC;IACJ,CAAC;IAEM,aAAa,CAAC,OAA6C;QAChE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAEM,cAAc,CAAC,OAA6C;QACjE,IAAI,CAAC,OAAO,CAAC,GAAG,CA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AC;oBACvB,IAAI,gBAAgB,CAAC,OAAO,EAAE,CAAC;wBAC7B,MAAM,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;oBACrD,CAAC;oBACD,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;oBAC7B,UAAU,CAAC,OAAO,GAAG,SAAS,CAAC;gBACjC,CAAC;YACH,CAAC,CAAA,CAAC,EAAE,CAAC;QACP,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAgB,6CAA6C,CACjE,UAA8B,EAC9B,gBAAkC;;QAElC,OAAO,IAAI,6BAA6B,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;IACzE,CAAC;CAAA;AAED,MAAM,WAAW,GAAG,CAAC,CAAQ,EAAkB,EAAE;IAC/C,OAAO,QAAQ,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,SAAS,IAAI,YAAY,IAAI,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,KAAK,SAAS,CAAC;AAC1G,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n _createStatefulChatClientInner,\n ChatClientState,\n ChatError,\n StatefulChatClient\n} from '@internal/chat-stateful-client';\nimport { ChatHandlers, createDefaultChatHandlers } from '@internal/chat-component-bindings';\nimport { ChatMessage, ChatMessageType, ChatThreadClient, SendMessageOptions } from '@azure/communication-chat';\nimport { CommunicationTokenCredential, CommunicationUserIdentifier } from '@azure/communication-common';\nimport type {\n ChatMessageDeletedEvent,\n ChatMessageEditedEvent,\n ChatMessageReceivedEvent,\n ChatThreadPropertiesUpdatedEvent,\n ParticipantsAddedEvent,\n ParticipantsRemovedEvent,\n ReadReceiptReceivedEvent\n} from '@azure/communication-chat';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport type { UploadChatImageResult } from '@internal/acs-ui-common';\nimport { toFlatCommunicationIdentifier, _TelemetryImplementationHint } from '@internal/acs-ui-common';\nimport EventEmitter from 'events';\nimport {\n ChatAdapter,\n ChatAdapterState,\n MessageDeletedListener,\n MessageEditedListener,\n MessageReadListener,\n MessageReceivedListener,\n ParticipantsAddedListener,\n ParticipantsRemovedListener,\n TopicChangedListener\n} from './ChatAdapter';\nimport { ResourceDetails } from './ChatAdapter';\nimport { AdapterError } from '../../common/adapters';\nimport { useEffect, useRef, useState } from 'react';\nimport { _isValidIdentifier } from '@internal/acs-ui-common';\nimport { TEAMS_LIMITATION_LEARN_MORE, UNSUPPORTED_CHAT_THREAD_TYPE } from '../../common/constants';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { MessageOptions } from '@internal/acs-ui-common';\n\n/**\n * Context of Chat, which is a centralized context for all state updates\n * @private\n */\nexport class ChatContext {\n private emitter: EventEmitter = new EventEmitter();\n private state: ChatAdapterState;\n private threadId: string;\n\n constructor(clientState: ChatClientState, threadId: string) {\n const thread = clientState.threads[threadId];\n this.threadId = threadId;\n if (!thread) {\n throw 'Cannot find threadId, please initialize thread before use!';\n }\n this.state = {\n userId: clientState.userId,\n displayName: clientState.displayName,\n thread,\n latestErrors: clientState.latestErrors\n };\n }\n\n public onStateChange(handler: (_uiState: ChatAdapterState) => void): void {\n this.emitter.on('stateChanged', handler);\n }\n\n public offStateChange(handler: (_uiState: ChatAdapterState) => void): void {\n this.emitter.off('stateChanged', handler);\n }\n\n public setState(state: ChatAdapterState): void {\n this.state = state;\n this.emitter.emit('stateChanged', this.state);\n }\n\n public getState(): ChatAdapterState {\n return this.state;\n }\n\n public setError(error: Error): void {\n this.setState({ ...this.state, error });\n }\n\n public updateClientState(clientState: ChatClientState): void {\n const thread = clientState.threads[this.threadId];\n if (!thread) {\n throw 'Cannot find threadId, please make sure thread state is still in Stateful ChatClient.';\n }\n\n let updatedState: ChatAdapterState = {\n userId: clientState.userId,\n displayName: clientState.displayName,\n thread,\n latestErrors: clientState.latestErrors\n };\n\n /* @conditional-compile-remove(file-sharing-acs) */\n updatedState = { ...updatedState };\n\n this.setState(updatedState);\n }\n}\n\n/**\n * @private\n */\nexport class AzureCommunicationChatAdapter implements ChatAdapter {\n private chatClient: StatefulChatClient;\n private chatThreadClient: ChatThreadClient;\n private context: ChatContext;\n private handlers: ChatHandlers;\n private emitter: EventEmitter = new EventEmitter();\n\n constructor(chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient) {\n this.bindAllPublicMethods();\n this.chatClient = chatClient;\n this.chatThreadClient = chatThreadClient;\n this.context = new ChatContext(chatClient.getState(), chatThreadClient.threadId);\n\n const onStateChange = (clientState: ChatClientState): void => {\n // unsubscribe when the instance gets disposed\n if (!this) {\n chatClient.offStateChange(onStateChange);\n return;\n }\n this.context.updateClientState(clientState);\n };\n\n this.handlers = createDefaultChatHandlers(chatClient, chatThreadClient);\n\n this.chatClient.onStateChange(onStateChange);\n this.subscribeAllEvents();\n }\n\n private bindAllPublicMethods(): void {\n this.onStateChange = this.onStateChange.bind(this);\n this.offStateChange = this.offStateChange.bind(this);\n this.getState = this.getState.bind(this);\n this.dispose = this.dispose.bind(this);\n this.fetchInitialData = this.fetchInitialData.bind(this);\n this.sendMessage = this.sendMessage.bind(this);\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n this.uploadImage = this.uploadImage.bind(this);\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n this.deleteImage = this.deleteImage.bind(this);\n this.sendReadReceipt = this.sendReadReceipt.bind(this);\n this.sendTypingIndicator = this.sendTypingIndicator.bind(this);\n this.updateMessage = this.updateMessage.bind(this);\n this.deleteMessage = this.deleteMessage.bind(this);\n this.removeParticipant = this.removeParticipant.bind(this);\n this.setTopic = this.setTopic.bind(this);\n this.loadPreviousChatMessages = this.loadPreviousChatMessages.bind(this);\n this.on = this.on.bind(this);\n this.off = this.off.bind(this);\n this.downloadResourceToCache = this.downloadResourceToCache.bind(this);\n this.removeResourceFromCache = this.removeResourceFromCache.bind(this);\n }\n\n dispose(): void {\n this.unsubscribeAllEvents();\n this.chatClient.dispose();\n }\n\n async fetchInitialData(): Promise<void> {\n // If get properties fails we dont want to try to get the participants after.\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.chatThreadClient.getProperties();\n // Fetch all participants who joined before the local user.\n for await (const _page of this.chatThreadClient.listParticipants().byPage({\n // Fetch 100 participants per page by default.\n maxPageSize: 100\n // eslint-disable-next-line curly\n }));\n });\n }\n\n getState(): ChatAdapterState {\n return this.context.getState();\n }\n\n onStateChange(handler: (state: ChatAdapterState) => void): void {\n this.context.onStateChange(handler);\n }\n\n offStateChange(handler: (state: ChatAdapterState) => void): void {\n this.context.offStateChange(handler);\n }\n\n async sendMessage(\n content: string,\n options?: SendMessageOptions | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions\n ): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n return await this.handlers.onSendMessage(content, options);\n });\n }\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n async uploadImage(image: Blob, imageFilename: string): Promise<UploadChatImageResult> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return await this.handlers.onUploadImage(image, imageFilename);\n });\n }\n\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n async deleteImage(imageId: string): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return await this.handlers.onDeleteImage(imageId);\n });\n }\n\n async sendReadReceipt(chatMessageId: string): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onMessageSeen(chatMessageId);\n });\n }\n\n async sendTypingIndicator(): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onTyping();\n });\n }\n\n async removeParticipant(userId: string): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.onRemoveParticipant(userId);\n });\n }\n\n async setTopic(topicName: string): Promise<void> {\n await this.asyncTeeErrorToEventEmitter(async () => {\n await this.handlers.updateThreadTopicName(topicName);\n });\n }\n\n async loadPreviousChatMessages(messagesToLoad: number): Promise<boolean> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return await this.handlers.onLoadPreviousChatMessages(messagesToLoad);\n });\n }\n\n async updateMessage(\n messageId: string,\n content: string,\n options?: Record<string, string> | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions\n ): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n /* @conditional-compile-remove(file-sharing-acs) */\n const messageOptions: MessageOptions = {};\n /* @conditional-compile-remove(file-sharing-acs) */\n if (\n options &&\n // if options.attachments is an array or undefined (for removal all attachments),\n // then given options is a MessageOptions\n (Array.isArray(options.attachments) || options.attachments === undefined)\n ) {\n messageOptions.attachments = options.attachments ?? [];\n }\n /* @conditional-compile-remove(file-sharing-acs) */\n if (\n options &&\n // if options.metadata is provided, we need to add it in MessageOptions\n options.metadata &&\n typeof options.metadata === 'object'\n ) {\n messageOptions.metadata = options.metadata;\n }\n /* @conditional-compile-remove(file-sharing-acs) */\n if (options && !('attachments' in options) && !('metadata' in options)) {\n // if options don't have attachments or metadata,\n // then it is a Record<string, string>\n /* @conditional-compile-remove(file-sharing-acs) */\n return await this.handlers.onUpdateMessage(messageId, content, options);\n }\n /* @conditional-compile-remove(file-sharing-acs) */\n return await this.handlers.onUpdateMessage(messageId, content, messageOptions);\n // metadata is never used in the current stable\n return await this.handlers.onUpdateMessage(messageId, content);\n });\n }\n\n async deleteMessage(messageId: string): Promise<void> {\n return await this.asyncTeeErrorToEventEmitter(async () => {\n return await this.handlers.onDeleteMessage(messageId);\n });\n }\n\n async downloadResourceToCache(resourceDetails: ResourceDetails): Promise<void> {\n this.chatClient.downloadResourceToCache(\n resourceDetails.threadId,\n resourceDetails.messageId,\n resourceDetails.resourceUrl\n );\n }\n\n removeResourceFromCache(resourceDetails: ResourceDetails): void {\n this.chatClient.removeResourceFromCache(\n resourceDetails.threadId,\n resourceDetails.messageId,\n resourceDetails.resourceUrl\n );\n }\n\n private messageReceivedListener(event: ChatMessageReceivedEvent): void {\n const isCurrentChatAdapterThread = event.threadId === this.chatThreadClient.threadId;\n\n if (!isCurrentChatAdapterThread) {\n return;\n }\n\n const message = convertEventToChatMessage(event);\n this.emitter.emit('messageReceived', { message });\n\n const currentUserId = toFlatCommunicationIdentifier(this.chatClient.getState().userId);\n if (message?.sender && toFlatCommunicationIdentifier(message.sender) === currentUserId) {\n this.emitter.emit('messageSent', { message });\n }\n }\n\n private messageEditedListener(event: ChatMessageEditedEvent): void {\n const isCurrentChatAdapterThread = event.threadId === this.chatThreadClient.threadId;\n if (!isCurrentChatAdapterThread) {\n return;\n }\n\n const message = convertEventToChatMessage(event);\n this.emitter.emit('messageEdited', { message });\n }\n\n private messageDeletedListener(event: ChatMessageDeletedEvent): void {\n const isCurrentChatAdapterThread = event.threadId === this.chatThreadClient.threadId;\n if (!isCurrentChatAdapterThread) {\n return;\n }\n\n const message = convertEventToChatMessage(event);\n this.emitter.emit('messageDeleted', { message });\n }\n\n private messageReadListener({ chatMessageId, recipient }: ReadReceiptReceivedEvent): void {\n const message = this.getState().thread.chatMessages[chatMessageId];\n if (message) {\n this.emitter.emit('messageRead', { message, readBy: recipient });\n }\n }\n\n private participantsAddedListener({ addedBy, participantsAdded }: ParticipantsAddedEvent): void {\n this.emitter.emit('participantsAdded', { addedBy, participantsAdded });\n }\n\n private participantsRemovedListener({ removedBy, participantsRemoved }: ParticipantsRemovedEvent): void {\n this.emitter.emit('participantsRemoved', { removedBy, participantsRemoved });\n }\n\n private chatThreadPropertiesUpdatedListener(event: ChatThreadPropertiesUpdatedEvent): void {\n this.emitter.emit('topicChanged', { topic: event.properties.topic });\n }\n\n private subscribeAllEvents(): void {\n this.chatClient.on('chatThreadPropertiesUpdated', this.chatThreadPropertiesUpdatedListener.bind(this));\n this.chatClient.on('participantsAdded', this.participantsAddedListener.bind(this));\n this.chatClient.on('participantsRemoved', this.participantsRemovedListener.bind(this));\n this.chatClient.on('chatMessageReceived', this.messageReceivedListener.bind(this));\n this.chatClient.on('chatMessageEdited', this.messageEditedListener.bind(this));\n this.chatClient.on('chatMessageDeleted', this.messageDeletedListener.bind(this));\n this.chatClient.on('readReceiptReceived', this.messageReadListener.bind(this));\n this.chatClient.on('participantsRemoved', this.participantsRemovedListener.bind(this));\n }\n\n private unsubscribeAllEvents(): void {\n this.chatClient.off('chatThreadPropertiesUpdated', this.chatThreadPropertiesUpdatedListener.bind(this));\n this.chatClient.off('participantsAdded', this.participantsAddedListener.bind(this));\n this.chatClient.off('participantsRemoved', this.participantsRemovedListener.bind(this));\n this.chatClient.off('chatMessageReceived', this.messageReceivedListener.bind(this));\n this.chatClient.off('chatMessageEdited', this.messageEditedListener.bind(this));\n this.chatClient.off('chatMessageDeleted', this.messageDeletedListener.bind(this));\n this.chatClient.off('readReceiptReceived', this.messageReadListener.bind(this));\n this.chatClient.off('participantsRemoved', this.participantsRemovedListener.bind(this));\n }\n\n on(event: 'messageReceived', listener: MessageReceivedListener): void;\n on(event: 'messageEdited', listener: MessageEditedListener): void;\n on(event: 'messageDeleted', listener: MessageDeletedListener): void;\n on(event: 'messageSent', listener: MessageReceivedListener): void;\n on(event: 'messageRead', listener: MessageReadListener): void;\n on(event: 'participantsAdded', listener: ParticipantsAddedListener): void;\n on(event: 'participantsRemoved', listener: ParticipantsRemovedListener): void;\n on(event: 'topicChanged', listener: TopicChangedListener): void;\n on(event: 'error', listener: (e: AdapterError) => void): void;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n on(event: string, listener: (e: any) => void): void {\n this.emitter.on(event, listener);\n }\n\n off(event: 'messageReceived', listener: MessageReceivedListener): void;\n off(event: 'messageEdited', listener: MessageEditedListener): void;\n off(event: 'messageDeleted', listener: MessageDeletedListener): void;\n off(event: 'messageSent', listener: MessageReceivedListener): void;\n off(event: 'messageRead', listener: MessageReadListener): void;\n off(event: 'participantsAdded', listener: ParticipantsAddedListener): void;\n off(event: 'participantsRemoved', listener: ParticipantsRemovedListener): void;\n off(event: 'topicChanged', listener: TopicChangedListener): void;\n off(event: 'error', listener: (e: AdapterError) => void): void;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n off(event: string, listener: (e: any) => void): void {\n this.emitter.off(event, listener);\n }\n\n private async asyncTeeErrorToEventEmitter<T>(f: () => Promise<T>): Promise<T> {\n try {\n return await f();\n } catch (error) {\n if (isChatError(error as Error)) {\n this.emitter.emit('error', error as AdapterError);\n }\n throw error;\n }\n }\n}\n\nconst convertEventToChatMessage = (\n event: ChatMessageReceivedEvent | ChatMessageEditedEvent | ChatMessageDeletedEvent\n): ChatMessage => {\n return {\n id: event.id,\n version: event.version,\n content: isChatMessageDeletedEvent(event) ? undefined : { message: event.message },\n type: convertEventType(event.type),\n sender: event.sender,\n senderDisplayName: event.senderDisplayName,\n sequenceId: '',\n createdOn: new Date(event.createdOn),\n editedOn: isChatMessageEditedEvent(event) ? event.editedOn : undefined,\n deletedOn: isChatMessageDeletedEvent(event) ? event.deletedOn : undefined\n };\n};\n\nconst isChatMessageEditedEvent = (\n event: ChatMessageReceivedEvent | ChatMessageEditedEvent | ChatMessageDeletedEvent\n): event is ChatMessageEditedEvent => {\n return 'editedOn' in event;\n};\n\nconst isChatMessageDeletedEvent = (\n event: ChatMessageReceivedEvent | ChatMessageEditedEvent | ChatMessageDeletedEvent\n): event is ChatMessageDeletedEvent => {\n return 'deletedOn' in event;\n};\n\n// only text/html message type will be received from event\nconst convertEventType = (type: string): ChatMessageType => {\n const lowerCaseType = type.toLowerCase();\n if (lowerCaseType === 'richtext/html' || lowerCaseType === 'html') {\n return 'html';\n } else {\n return 'text';\n }\n};\n\n/**\n * Arguments for creating the Azure Communication Services implementation of {@link ChatAdapter}.\n *\n * @public\n */\nexport type AzureCommunicationChatAdapterArgs = {\n endpoint: string;\n userId: CommunicationUserIdentifier;\n displayName: string;\n credential: CommunicationTokenCredential;\n threadId: string;\n};\n\n/**\n * Create a {@link ChatAdapter} backed by Azure Communication Services.\n *\n * This is the default implementation of {@link ChatAdapter} provided by this library.\n *\n * @public\n */\nexport const createAzureCommunicationChatAdapter = async ({\n endpoint: endpointUrl,\n userId,\n displayName,\n credential,\n threadId\n}: AzureCommunicationChatAdapterArgs): Promise<ChatAdapter> => {\n return _createAzureCommunicationChatAdapterInner(endpointUrl, userId, displayName, credential, threadId);\n};\n\n/**\n * This inner function is used to allow injection of TelemetryImplementationHint without changing the public API.\n *\n * @internal\n */\nexport const _createAzureCommunicationChatAdapterInner = async (\n endpoint: string,\n userId: CommunicationUserIdentifier,\n displayName: string,\n credential: CommunicationTokenCredential,\n threadId: string,\n telemetryImplementationHint: _TelemetryImplementationHint = 'Chat'\n): Promise<ChatAdapter> => {\n if (!_isValidIdentifier(userId)) {\n throw new Error('Provided userId is invalid. Please provide valid identifier object.');\n }\n\n const chatClient = _createStatefulChatClientInner(\n {\n userId,\n displayName,\n endpoint,\n credential\n },\n undefined,\n telemetryImplementationHint\n );\n const chatThreadClient = await chatClient.getChatThreadClient(threadId);\n await chatClient.startRealtimeNotifications();\n\n const adapter = await createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient);\n\n return adapter;\n};\n\n/**\n * This inner function to create ChatAdapterPromise in case when threadID is not avaialble.\n * ThreadId is a promise to allow for lazy initialization of the adapter.\n * @internal\n */\nexport const _createLazyAzureCommunicationChatAdapterInner = async (\n endpoint: string,\n userId: CommunicationUserIdentifier,\n displayName: string,\n credential: CommunicationTokenCredential,\n threadId: Promise<string>,\n telemetryImplementationHint: _TelemetryImplementationHint = 'Chat'\n): Promise<ChatAdapter> => {\n if (!_isValidIdentifier(userId)) {\n throw new Error('Provided userId is invalid. Please provide valid identifier object.');\n }\n\n const chatClient = _createStatefulChatClientInner(\n {\n userId,\n displayName,\n endpoint,\n credential\n },\n undefined,\n telemetryImplementationHint\n );\n return threadId.then(async (threadId) => {\n if (UNSUPPORTED_CHAT_THREAD_TYPE.some((t) => threadId.includes(t))) {\n console.error(\n `Invalid Chat ThreadId: ${threadId}. Please note with Teams Channel Meetings, only Calling is supported and Chat is not currently supported. Read more: ${TEAMS_LIMITATION_LEARN_MORE}.`\n );\n }\n\n const chatThreadClient = await chatClient.getChatThreadClient(threadId);\n await chatClient.startRealtimeNotifications();\n\n const adapter = await createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient);\n\n return adapter;\n });\n};\n\n/**\n * A custom React hook to simplify the creation of {@link ChatAdapter}.\n *\n * Similar to {@link createAzureCommunicationChatAdapter}, but takes care of asynchronous\n * creation of the adapter internally.\n *\n * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments\n * as they are created. The adapter is only created when all arguments are defined.\n *\n * Note that you must memoize the arguments to avoid recreating adapter on each render.\n * See storybook for typical usage examples.\n *\n * @public\n */\nexport const useAzureCommunicationChatAdapter = (\n /**\n * Arguments to be passed to {@link createAzureCommunicationChatAdapter}.\n *\n * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments\n * as they are created. The adapter is only created when all arguments are defined.\n */\n args: Partial<AzureCommunicationChatAdapterArgs>,\n /**\n * Optional callback to modify the adapter once it is created.\n *\n * If set, must return the modified adapter.\n */\n afterCreate?: (adapter: ChatAdapter) => Promise<ChatAdapter>,\n /**\n * Optional callback called before the adapter is disposed.\n *\n * This is useful for clean up tasks, e.g., leaving any ongoing calls.\n */\n beforeDispose?: (adapter: ChatAdapter) => Promise<void>\n): ChatAdapter | undefined => {\n const { credential, displayName, endpoint, threadId, userId } = args;\n\n // State update needed to rerender the parent component when a new adapter is created.\n const [adapter, setAdapter] = useState<ChatAdapter | undefined>(undefined);\n // Ref needed for cleanup to access the old adapter created asynchronously.\n const adapterRef = useRef<ChatAdapter | undefined>(undefined);\n\n const afterCreateRef = useRef<((adapter: ChatAdapter) => Promise<ChatAdapter>) | undefined>(undefined);\n const beforeDisposeRef = useRef<((adapter: ChatAdapter) => Promise<void>) | undefined>(undefined);\n // These refs are updated on *each* render, so that the latest values\n // are used in the `useEffect` closures below.\n // Using a Ref ensures that new values for the callbacks do not trigger the\n // useEffect blocks, and a new adapter creation / distruction is not triggered.\n afterCreateRef.current = afterCreate;\n beforeDisposeRef.current = beforeDispose;\n\n useEffect(\n () => {\n if (!credential || !displayName || !endpoint || !threadId || !userId) {\n return;\n }\n (async () => {\n if (adapterRef.current) {\n // Dispose the old adapter when a new one is created.\n //\n // This clean up function uses `adapterRef` because `adapter` can not be added to the dependency array of\n // this `useEffect` -- we do not want to trigger a new adapter creation because of the first adapter\n // creation.\n if (beforeDisposeRef.current) {\n await beforeDisposeRef.current(adapterRef.current);\n }\n adapterRef.current.dispose();\n adapterRef.current = undefined;\n }\n\n let newAdapter = await createAzureCommunicationChatAdapter({\n credential,\n displayName,\n endpoint,\n threadId,\n userId\n });\n if (afterCreateRef.current) {\n newAdapter = await afterCreateRef.current(newAdapter);\n }\n adapterRef.current = newAdapter;\n setAdapter(newAdapter);\n })();\n },\n // Explicitly list all arguments so that caller doesn't have to memoize the `args` object.\n [adapterRef, afterCreateRef, beforeDisposeRef, credential, displayName, endpoint, threadId, userId]\n );\n\n // Dispose any existing adapter when the component unmounts.\n useEffect(() => {\n return () => {\n (async () => {\n if (adapterRef.current) {\n if (beforeDisposeRef.current) {\n await beforeDisposeRef.current(adapterRef.current);\n }\n adapterRef.current.dispose();\n adapterRef.current = undefined;\n }\n })();\n };\n }, []);\n\n return adapter;\n};\n\n/**\n * Create a {@link ChatAdapter} using the provided {@link StatefulChatClient}.\n *\n * Useful if you want to keep a reference to {@link StatefulChatClient}.\n * Consider using {@link createAzureCommunicationChatAdapter} for a simpler API.\n *\n * @public\n */\nexport async function createAzureCommunicationChatAdapterFromClient(\n chatClient: StatefulChatClient,\n chatThreadClient: ChatThreadClient\n): Promise<ChatAdapter> {\n return new AzureCommunicationChatAdapter(chatClient, chatThreadClient);\n}\n\nconst isChatError = (e: Error): e is ChatError => {\n return 'target' in e && e['target'] !== undefined && 'innerError' in e && e['innerError'] !== undefined;\n};\n"]}
@@ -1,4 +1,5 @@
1
1
  import type { ChatMessage, ChatParticipant, SendMessageOptions } from '@azure/communication-chat';
2
+ import type { UploadChatImageResult } from "../../../../../acs-ui-common/src";
2
3
  import type { CommunicationIdentifierKind, CommunicationUserKind } from '@azure/communication-common';
3
4
  import { ChatThreadClientState } from "../../../../../chat-stateful-client/src";
4
5
  import type { AdapterError, AdapterErrors, AdapterState, Disposable } from '../../common/adapters';
@@ -48,6 +49,14 @@ export interface ChatAdapterThreadManagement {
48
49
  * Please note that SendMessageOptions is being deprecated, please use MessageOptions instead.
49
50
  */
50
51
  sendMessage(content: string, options?: SendMessageOptions | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions): Promise<void>;
52
+ /**
53
+ * Upload an inline image for a message.
54
+ */
55
+ uploadImage(image: Blob, imageFilename: string): Promise<UploadChatImageResult>;
56
+ /**
57
+ * Delete an inline image for a message.
58
+ */
59
+ deleteImage(imageId: string): Promise<void>;
51
60
  /**
52
61
  * Send a read receipt for a message.
53
62
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ChatAdapter.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/adapter/ChatAdapter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ChatMessage, ChatParticipant, SendMessageOptions } from '@azure/communication-chat';\nimport type { CommunicationIdentifierKind, CommunicationUserKind } from '@azure/communication-common';\nimport { ChatThreadClientState } from '@internal/chat-stateful-client';\nimport type { AdapterError, AdapterErrors, AdapterState, Disposable } from '../../common/adapters';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { MessageOptions } from '@internal/acs-ui-common';\n\n/**\n * {@link ChatAdapter} state for pure UI purposes.\n *\n * @public\n */\nexport type ChatAdapterUiState = {\n // FIXME(Delete?)\n // Self-contained state for composite\n error?: Error;\n};\n\n/**\n * {@link ChatAdapter} state inferred from Azure Communication Services backend.\n *\n * @public\n */\nexport type ChatCompositeClientState = {\n userId: CommunicationIdentifierKind;\n displayName: string;\n thread: ChatThreadClientState;\n /**\n * Latest error encountered for each operation performed via the adapter.\n */\n latestErrors: AdapterErrors;\n};\n\n/**\n * {@link ChatAdapter} state.\n *\n * @public\n */\nexport type ChatAdapterState = ChatAdapterUiState & ChatCompositeClientState;\n\n/**\n * Functionality for managing the current chat thread.\n *\n * @public\n */\nexport interface ChatAdapterThreadManagement {\n /**\n * Fetch initial state for the Chat adapter.\n *\n * Performs the minimal fetch necessary for ChatComposite and API methods.\n */\n fetchInitialData(): Promise<void>;\n /**\n * Send a message in the thread.\n * Please note that SendMessageOptions is being deprecated, please use MessageOptions instead.\n */\n sendMessage(\n content: string,\n options?: SendMessageOptions | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions\n ): Promise<void>;\n /**\n * Send a read receipt for a message.\n */\n sendReadReceipt(chatMessageId: string): Promise<void>;\n /**\n * Send typing indicator in the thread.\n */\n sendTypingIndicator(): Promise<void>;\n /**\n * Remove a participant in the thread.\n */\n removeParticipant(userId: string): Promise<void>;\n /**\n * Set the topic for the thread.\n */\n setTopic(topicName: string): Promise<void>;\n /**\n * Update a message content.\n * Please note that metadata is being deprecated, please use MessageOptions.metadata instead.\n */\n updateMessage(\n messageId: string,\n content: string,\n options?: Record<string, string> | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions\n ): Promise<void>;\n /**\n * Delete a message in the thread.\n */\n deleteMessage(messageId: string): Promise<void>;\n /**\n * Load more previous messages in the chat thread history.\n *\n * @remarks\n * This method is usually used to control incremental fetch/infinite scroll\n *\n */\n loadPreviousChatMessages(messagesToLoad: number): Promise<boolean>;\n /**\n * Downloads a resource into the cache for the given message.\n */\n downloadResourceToCache(resourceDetails: ResourceDetails): Promise<void>;\n /**\n * Removes a resource from the cache for the given message.\n */\n removeResourceFromCache(resourceDetails: ResourceDetails): void;\n}\n/**\n * Details required for download a resource to cache.\n *\n * @public\n */\nexport type ResourceDetails = {\n threadId: string;\n messageId: string;\n resourceUrl: string;\n};\n\n/**\n * Chat composite events that can be subscribed to.\n *\n * @public\n */\nexport interface ChatAdapterSubscribers {\n /**\n * Subscribe function for 'messageReceived' event.\n */\n on(event: 'messageReceived', listener: MessageReceivedListener): void;\n /**\n * Subscribe function for 'messageEdited' event.\n */\n on(event: 'messageEdited', listener: MessageEditedListener): void;\n /**\n * Subscribe function for 'messageDeleted' event.\n */\n on(event: 'messageDeleted', listener: MessageDeletedListener): void;\n /**\n * Subscribe function for 'messageSent' event.\n */\n on(event: 'messageSent', listener: MessageSentListener): void;\n /**\n * Subscribe function for 'messageRead' event.\n */\n on(event: 'messageRead', listener: MessageReadListener): void;\n /**\n * Subscribe function for 'participantsAdded' event.\n */\n on(event: 'participantsAdded', listener: ParticipantsAddedListener): void;\n /**\n * Subscribe function for 'participantsRemoved' event.\n */\n on(event: 'participantsRemoved', listener: ParticipantsRemovedListener): void;\n /**\n * Subscribe function for 'topicChanged' event.\n */\n on(event: 'topicChanged', listener: TopicChangedListener): void;\n /**\n * Subscribe function for 'error' event.\n */\n on(event: 'error', listener: (e: AdapterError) => void): void;\n\n /**\n * Unsubscribe function for 'messageReceived' event.\n */\n off(event: 'messageReceived', listener: MessageReceivedListener): void;\n /**\n * Unsubscribe function for 'messageEdited' event.\n */\n off(event: 'messageEdited', listener: MessageEditedListener): void;\n /**\n * Unsubscribe function for 'messageDeleted' event.\n */\n off(event: 'messageDeleted', listener: MessageDeletedListener): void;\n /**\n * Unsubscribe function for 'messageSent' event.\n */\n off(event: 'messageSent', listener: MessageSentListener): void;\n /**\n * Unsubscribe function for 'messageRead' event.\n */\n off(event: 'messageRead', listener: MessageReadListener): void;\n /**\n * Unsubscribe function for 'participantsAdded' event.\n */\n off(event: 'participantsAdded', listener: ParticipantsAddedListener): void;\n /**\n * Unsubscribe function for 'participantsRemoved' event.\n */\n off(event: 'participantsRemoved', listener: ParticipantsRemovedListener): void;\n /**\n * Unsubscribe function for 'topicChanged' event.\n */\n off(event: 'topicChanged', listener: TopicChangedListener): void;\n /**\n * Unsubscribe function for 'error' event.\n */\n off(event: 'error', listener: (e: AdapterError) => void): void;\n}\n\n/**\n * {@link ChatComposite} Adapter interface.\n *\n * @public\n */\nexport type ChatAdapter = ChatAdapterThreadManagement &\n AdapterState<ChatAdapterState> &\n Disposable &\n ChatAdapterSubscribers;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'messageReceived' event.\n *\n * @public\n */\nexport type MessageReceivedListener = (event: { message: ChatMessage }) => void;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'messageSent' event.\n *\n * @public\n */\nexport type MessageSentListener = MessageReceivedListener;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'messageEdited' event.\n *\n * @public\n */\nexport type MessageEditedListener = MessageReceivedListener;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'messageDeleted' event.\n *\n * @public\n */\nexport type MessageDeletedListener = MessageReceivedListener;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'messageRead' event.\n *\n * @public\n */\nexport type MessageReadListener = (event: { message: ChatMessage; readBy: CommunicationUserKind }) => void;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'participantsAdded' event.\n *\n * @public\n */\nexport type ParticipantsAddedListener = (event: {\n participantsAdded: ChatParticipant[];\n addedBy: ChatParticipant;\n}) => void;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'participantsRemoved' event.\n *\n * @public\n */\nexport type ParticipantsRemovedListener = (event: {\n participantsRemoved: ChatParticipant[];\n removedBy: ChatParticipant;\n}) => void;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'topicChanged' event.\n *\n * @public\n */\nexport type TopicChangedListener = (event: { topic: string }) => void;\n"]}
1
+ {"version":3,"file":"ChatAdapter.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/adapter/ChatAdapter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ChatMessage, ChatParticipant, SendMessageOptions } from '@azure/communication-chat';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport type { UploadChatImageResult } from '@internal/acs-ui-common';\nimport type { CommunicationIdentifierKind, CommunicationUserKind } from '@azure/communication-common';\nimport { ChatThreadClientState } from '@internal/chat-stateful-client';\nimport type { AdapterError, AdapterErrors, AdapterState, Disposable } from '../../common/adapters';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { MessageOptions } from '@internal/acs-ui-common';\n\n/**\n * {@link ChatAdapter} state for pure UI purposes.\n *\n * @public\n */\nexport type ChatAdapterUiState = {\n // FIXME(Delete?)\n // Self-contained state for composite\n error?: Error;\n};\n\n/**\n * {@link ChatAdapter} state inferred from Azure Communication Services backend.\n *\n * @public\n */\nexport type ChatCompositeClientState = {\n userId: CommunicationIdentifierKind;\n displayName: string;\n thread: ChatThreadClientState;\n /**\n * Latest error encountered for each operation performed via the adapter.\n */\n latestErrors: AdapterErrors;\n};\n\n/**\n * {@link ChatAdapter} state.\n *\n * @public\n */\nexport type ChatAdapterState = ChatAdapterUiState & ChatCompositeClientState;\n\n/**\n * Functionality for managing the current chat thread.\n *\n * @public\n */\nexport interface ChatAdapterThreadManagement {\n /**\n * Fetch initial state for the Chat adapter.\n *\n * Performs the minimal fetch necessary for ChatComposite and API methods.\n */\n fetchInitialData(): Promise<void>;\n /**\n * Send a message in the thread.\n * Please note that SendMessageOptions is being deprecated, please use MessageOptions instead.\n */\n sendMessage(\n content: string,\n options?: SendMessageOptions | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions\n ): Promise<void>;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Upload an inline image for a message.\n */\n uploadImage(image: Blob, imageFilename: string): Promise<UploadChatImageResult>;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n /**\n * Delete an inline image for a message.\n */\n deleteImage(imageId: string): Promise<void>;\n /**\n * Send a read receipt for a message.\n */\n sendReadReceipt(chatMessageId: string): Promise<void>;\n /**\n * Send typing indicator in the thread.\n */\n sendTypingIndicator(): Promise<void>;\n /**\n * Remove a participant in the thread.\n */\n removeParticipant(userId: string): Promise<void>;\n /**\n * Set the topic for the thread.\n */\n setTopic(topicName: string): Promise<void>;\n /**\n * Update a message content.\n * Please note that metadata is being deprecated, please use MessageOptions.metadata instead.\n */\n updateMessage(\n messageId: string,\n content: string,\n options?: Record<string, string> | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions\n ): Promise<void>;\n /**\n * Delete a message in the thread.\n */\n deleteMessage(messageId: string): Promise<void>;\n /**\n * Load more previous messages in the chat thread history.\n *\n * @remarks\n * This method is usually used to control incremental fetch/infinite scroll\n *\n */\n loadPreviousChatMessages(messagesToLoad: number): Promise<boolean>;\n /**\n * Downloads a resource into the cache for the given message.\n */\n downloadResourceToCache(resourceDetails: ResourceDetails): Promise<void>;\n /**\n * Removes a resource from the cache for the given message.\n */\n removeResourceFromCache(resourceDetails: ResourceDetails): void;\n}\n/**\n * Details required for download a resource to cache.\n *\n * @public\n */\nexport type ResourceDetails = {\n threadId: string;\n messageId: string;\n resourceUrl: string;\n};\n\n/**\n * Chat composite events that can be subscribed to.\n *\n * @public\n */\nexport interface ChatAdapterSubscribers {\n /**\n * Subscribe function for 'messageReceived' event.\n */\n on(event: 'messageReceived', listener: MessageReceivedListener): void;\n /**\n * Subscribe function for 'messageEdited' event.\n */\n on(event: 'messageEdited', listener: MessageEditedListener): void;\n /**\n * Subscribe function for 'messageDeleted' event.\n */\n on(event: 'messageDeleted', listener: MessageDeletedListener): void;\n /**\n * Subscribe function for 'messageSent' event.\n */\n on(event: 'messageSent', listener: MessageSentListener): void;\n /**\n * Subscribe function for 'messageRead' event.\n */\n on(event: 'messageRead', listener: MessageReadListener): void;\n /**\n * Subscribe function for 'participantsAdded' event.\n */\n on(event: 'participantsAdded', listener: ParticipantsAddedListener): void;\n /**\n * Subscribe function for 'participantsRemoved' event.\n */\n on(event: 'participantsRemoved', listener: ParticipantsRemovedListener): void;\n /**\n * Subscribe function for 'topicChanged' event.\n */\n on(event: 'topicChanged', listener: TopicChangedListener): void;\n /**\n * Subscribe function for 'error' event.\n */\n on(event: 'error', listener: (e: AdapterError) => void): void;\n\n /**\n * Unsubscribe function for 'messageReceived' event.\n */\n off(event: 'messageReceived', listener: MessageReceivedListener): void;\n /**\n * Unsubscribe function for 'messageEdited' event.\n */\n off(event: 'messageEdited', listener: MessageEditedListener): void;\n /**\n * Unsubscribe function for 'messageDeleted' event.\n */\n off(event: 'messageDeleted', listener: MessageDeletedListener): void;\n /**\n * Unsubscribe function for 'messageSent' event.\n */\n off(event: 'messageSent', listener: MessageSentListener): void;\n /**\n * Unsubscribe function for 'messageRead' event.\n */\n off(event: 'messageRead', listener: MessageReadListener): void;\n /**\n * Unsubscribe function for 'participantsAdded' event.\n */\n off(event: 'participantsAdded', listener: ParticipantsAddedListener): void;\n /**\n * Unsubscribe function for 'participantsRemoved' event.\n */\n off(event: 'participantsRemoved', listener: ParticipantsRemovedListener): void;\n /**\n * Unsubscribe function for 'topicChanged' event.\n */\n off(event: 'topicChanged', listener: TopicChangedListener): void;\n /**\n * Unsubscribe function for 'error' event.\n */\n off(event: 'error', listener: (e: AdapterError) => void): void;\n}\n\n/**\n * {@link ChatComposite} Adapter interface.\n *\n * @public\n */\nexport type ChatAdapter = ChatAdapterThreadManagement &\n AdapterState<ChatAdapterState> &\n Disposable &\n ChatAdapterSubscribers;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'messageReceived' event.\n *\n * @public\n */\nexport type MessageReceivedListener = (event: { message: ChatMessage }) => void;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'messageSent' event.\n *\n * @public\n */\nexport type MessageSentListener = MessageReceivedListener;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'messageEdited' event.\n *\n * @public\n */\nexport type MessageEditedListener = MessageReceivedListener;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'messageDeleted' event.\n *\n * @public\n */\nexport type MessageDeletedListener = MessageReceivedListener;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'messageRead' event.\n *\n * @public\n */\nexport type MessageReadListener = (event: { message: ChatMessage; readBy: CommunicationUserKind }) => void;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'participantsAdded' event.\n *\n * @public\n */\nexport type ParticipantsAddedListener = (event: {\n participantsAdded: ChatParticipant[];\n addedBy: ChatParticipant;\n}) => void;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'participantsRemoved' event.\n *\n * @public\n */\nexport type ParticipantsRemovedListener = (event: {\n participantsRemoved: ChatParticipant[];\n removedBy: ChatParticipant;\n}) => void;\n\n/**\n * Callback for {@link ChatAdapterSubscribers} 'topicChanged' event.\n *\n * @public\n */\nexport type TopicChangedListener = (event: { topic: string }) => void;\n"]}
@@ -71,7 +71,7 @@ interface ClearAction extends Action {
71
71
  /**
72
72
  * @private
73
73
  */
74
- type Actions = SetAction | ProgressAction | CompleteAction | FailedAction | RemoveAction | ClearAction;
74
+ export type Actions = SetAction | ProgressAction | CompleteAction | FailedAction | RemoveAction | ClearAction;
75
75
  /**
76
76
  * @internal
77
77
  */
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentUpload.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAelC;;GAEG;AACH,MAAM,CAAN,IAAY,0BAOX;AAPD,WAAY,0BAA0B;IACpC,yCAAW,CAAA;IACX,mDAAqB,CAAA;IACrB,qDAAuB,CAAA;IACvB,+CAAiB,CAAA;IACjB,+CAAiB,CAAA;IACjB,6CAAe,CAAA;AACjB,CAAC,EAPW,0BAA0B,KAA1B,0BAA0B,QAOrC;AAyED,mDAAmD;AACnD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,KAAyB,EAAE,MAAe,EAAsB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AE,CACrB,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,iCAAM,CAAC,KAAE,QAAQ,kCAAO,CAAC,CAAC,QAAQ,KAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,OAAK,CAAC,CAAC,CAAC,CAClG,CAAC;QAEJ,KAAK,0BAA0B,CAAC,KAAK;YACnC,OAAO,EAAE,CAAC;QACZ;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentUploadTask, AttachmentSelectionHandler, AttachmentActionHandler } from '@internal/react-components';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadata, AttachmentMetadataInProgress, AttachmentProgressError } from '@internal/acs-ui-common';\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @internal\n */\nexport interface AttachmentUpload extends AttachmentUploadTask {\n metadata: AttachmentMetadataInProgress;\n}\n\n/**\n * @private\n */\nexport enum AttachmentUploadActionType {\n Set = 'set',\n Progress = 'progress',\n Completed = 'completed',\n Failed = 'failed',\n Remove = 'remove',\n Clear = 'clear'\n}\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @private\n */\ninterface Action {\n type: AttachmentUploadActionType;\n}\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @private\n */\ninterface SetAction extends Action {\n type: AttachmentUploadActionType.Set;\n newUploads: AttachmentUpload[];\n}\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @private\n */\ninterface ProgressAction extends Action {\n type: AttachmentUploadActionType.Progress;\n taskId: string;\n progress: number;\n}\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @private\n */\ninterface CompleteAction extends Action {\n type: AttachmentUploadActionType.Completed;\n taskId: string;\n id: string;\n url: string;\n}\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @private\n */\ninterface FailedAction extends Action {\n type: AttachmentUploadActionType.Failed;\n taskId: string;\n message: string;\n}\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @private\n */\ninterface RemoveAction extends Action {\n type: AttachmentUploadActionType.Remove;\n id: string;\n}\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @private\n */\ninterface ClearAction extends Action {\n type: AttachmentUploadActionType.Clear;\n}\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @private\n */\ntype Actions = SetAction | ProgressAction | CompleteAction | FailedAction | RemoveAction | ClearAction;\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @internal\n */\nexport const AttachmentUploadReducer = (state: AttachmentUpload[], action: Actions): AttachmentUpload[] => {\n switch (action.type) {\n case AttachmentUploadActionType.Set:\n return state.filter((v) => !v.metadata.error).concat(action.newUploads);\n\n case AttachmentUploadActionType.Completed:\n return state.map((v) =>\n v.taskId === action.taskId\n ? { ...v, metadata: { ...v.metadata, id: action.id, url: action.url, progress: 1 } }\n : v\n );\n\n case AttachmentUploadActionType.Failed:\n return state.map((v) =>\n v.taskId === action.taskId\n ? {\n ...v,\n metadata: {\n ...v.metadata,\n error: {\n message: action.message\n }\n }\n }\n : v\n );\n\n case AttachmentUploadActionType.Remove:\n return state.filter((v) => !v.metadata.error).filter((v) => v.metadata.id !== action.id);\n\n case AttachmentUploadActionType.Progress:\n return state.map((v) =>\n v.taskId === action.taskId ? { ...v, metadata: { ...v.metadata, progress: action.progress } } : v\n );\n\n case AttachmentUploadActionType.Clear:\n return [];\n default:\n return state;\n }\n};\n\n/* @conditional-compile-remove(file-sharing-acs) */\nexport type {\n AttachmentMetadata,\n AttachmentSelectionHandler,\n AttachmentActionHandler,\n AttachmentUploadTask,\n AttachmentProgressError\n};\n"]}
1
+ {"version":3,"file":"AttachmentUpload.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.ts"],"names":[],"mappings":"AAA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AC;QAEJ,KAAK,0BAA0B,CAAC,MAAM;YACpC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,CAAC,CAAC;QAE3F,KAAK,0BAA0B,CAAC,QAAQ;YACtC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACrB,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,iCAAM,CAAC,KAAE,QAAQ,kCAAO,CAAC,CAAC,QAAQ,KAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,OAAK,CAAC,CAAC,CAAC,CAClG,CAAC;QAEJ,KAAK,0BAA0B,CAAC,KAAK;YACnC,OAAO,EAAE,CAAC;QACZ;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentUploadTask, AttachmentSelectionHandler, AttachmentActionHandler } from '@internal/react-components';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadata, AttachmentMetadataInProgress, AttachmentProgressError } from '@internal/acs-ui-common';\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @internal\n */\nexport interface AttachmentUpload extends AttachmentUploadTask {\n metadata: AttachmentMetadataInProgress;\n}\n\n/**\n * @private\n */\nexport enum AttachmentUploadActionType {\n Set = 'set',\n Progress = 'progress',\n Completed = 'completed',\n Failed = 'failed',\n Remove = 'remove',\n Clear = 'clear'\n}\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @private\n */\ninterface Action {\n type: AttachmentUploadActionType;\n}\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @private\n */\ninterface SetAction extends Action {\n type: AttachmentUploadActionType.Set;\n newUploads: AttachmentUpload[];\n}\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @private\n */\ninterface ProgressAction extends Action {\n type: AttachmentUploadActionType.Progress;\n taskId: string;\n progress: number;\n}\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @private\n */\ninterface CompleteAction extends Action {\n type: AttachmentUploadActionType.Completed;\n taskId: string;\n id: string;\n url: string;\n}\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @private\n */\ninterface FailedAction extends Action {\n type: AttachmentUploadActionType.Failed;\n taskId: string;\n message: string;\n}\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @private\n */\ninterface RemoveAction extends Action {\n type: AttachmentUploadActionType.Remove;\n id: string;\n}\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @private\n */\ninterface ClearAction extends Action {\n type: AttachmentUploadActionType.Clear;\n}\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @private\n */\nexport type Actions = SetAction | ProgressAction | CompleteAction | FailedAction | RemoveAction | ClearAction;\n\n/* @conditional-compile-remove(file-sharing-acs) */\n/**\n * @internal\n */\nexport const AttachmentUploadReducer = (state: AttachmentUpload[], action: Actions): AttachmentUpload[] => {\n switch (action.type) {\n case AttachmentUploadActionType.Set:\n return state.filter((v) => !v.metadata.error).concat(action.newUploads);\n\n case AttachmentUploadActionType.Completed:\n return state.map((v) =>\n v.taskId === action.taskId\n ? { ...v, metadata: { ...v.metadata, id: action.id, url: action.url, progress: 1 } }\n : v\n );\n\n case AttachmentUploadActionType.Failed:\n return state.map((v) =>\n v.taskId === action.taskId\n ? {\n ...v,\n metadata: {\n ...v.metadata,\n error: {\n message: action.message\n }\n }\n }\n : v\n );\n\n case AttachmentUploadActionType.Remove:\n return state.filter((v) => !v.metadata.error).filter((v) => v.metadata.id !== action.id);\n\n case AttachmentUploadActionType.Progress:\n return state.map((v) =>\n v.taskId === action.taskId ? { ...v, metadata: { ...v.metadata, progress: action.progress } } : v\n );\n\n case AttachmentUploadActionType.Clear:\n return [];\n default:\n return state;\n }\n};\n\n/* @conditional-compile-remove(file-sharing-acs) */\nexport type {\n AttachmentMetadata,\n AttachmentSelectionHandler,\n AttachmentActionHandler,\n AttachmentUploadTask,\n AttachmentProgressError\n};\n"]}
@@ -28,6 +28,10 @@ const createCompositeHandlers = memoizeOne((adapter) => ({
28
28
  }
29
29
  return adapter.sendMessage(content, options);
30
30
  },
31
+ /* @conditional-compile-remove(rich-text-editor-image-upload) */
32
+ onUploadImage: adapter.uploadImage,
33
+ /* @conditional-compile-remove(rich-text-editor-image-upload) */
34
+ onDeleteImage: adapter.deleteImage,
31
35
  onLoadPreviousChatMessages: adapter.loadPreviousChatMessages,
32
36
  onMessageSeen: adapter.sendReadReceipt,
33
37
  onTyping: adapter.sendTypingIndicator,
@@ -1 +1 @@
1
- {"version":3,"file":"useHandlers.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/hooks/useHandlers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAI5D;;GAEG;AACH,+HAA+H;AAC/H,MAAM,CAAC,MAAM,WAAW,GAAG;AACzB,6DAA6D;AAC7D,UAAkD,EACU,EAAE;IAC9D,OAAO,uBAAuB,CAAC,UAAU,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,UAAU,CACxC,CAAC,OAAoB,EAAgB,EAAE,CAAC,CAAC;IACvC,0DAA0D;IAC1D,8DAA8D;IAC9D,aAAa,EAAE,CAAC,OAAe,EAAE,OAAY,EAAE,EAAE;QAC/C,mDAAmD;QACnD,IACE,OAAO;YACP,aAAa,IAAI,OAAO;YACxB,OAAO,CAAC,WAAW;YACnB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;YACtB,CAAC,CAAC,gBAAgB,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAC7C,CAAC;YACD,MAAM,oBAAoB,GAAG;gBAC3B,QAAQ,kCACH,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KACpB,mBAAmB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,CAAC,GAC1D;aACF,CAAC;YACF,OAAO,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;QAC5D,CAAC;QACD,OAAO,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IACD,0BAA0B,EAAE,OAAO,CAAC,wBAAwB;IAC5D,aAAa,EAAE,OAAO,CAAC,eAAe;IACtC,QAAQ,EAAE,OAAO,CAAC,mBAAmB;IACrC,mBAAmB,EAAE,OAAO,CAAC,iBAAiB;IAC9C,qBAAqB,EAAE,OAAO,CAAC,QAAQ;IACvC,eAAe,EAAE,UACf,SAAiB,EACjB,OAAe;IACf,mDAAmD;IACnD,OAAwB;QAExB,mDAAmD;QACnD,MAAM,qBAAqB,GAAmB;YAC5C,WAAW,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW;SAClC,CAAC;QACF,OAAO,OAAO,CAAC,aAAa,CAC1B,SAAS,EACT,OAAO;QACP,mDAAmD,CAAC,qBAAqB,CAC1E,CAAC;IACJ,CAAC;IACD,eAAe,EAAE,OAAO,CAAC,aAAa;CACvC,CAAC,CACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CommonProperties } from '@internal/acs-ui-common';\nimport { ChatHandlers } from '@internal/chat-component-bindings';\n\nimport { ReactElement } from 'react';\nimport memoizeOne from 'memoize-one';\nimport { ChatAdapter } from '../adapter/ChatAdapter';\nimport { useAdapter } from '../adapter/ChatAdapterProvider';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { MessageOptions } from '@internal/acs-ui-common';\n\n/**\n * @private\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type\nexport const useHandlers = <PropsT>(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _component: (props: PropsT) => ReactElement | null\n): Pick<ChatHandlers, CommonProperties<ChatHandlers, PropsT>> => {\n return createCompositeHandlers(useAdapter());\n};\n\nconst createCompositeHandlers = memoizeOne(\n (adapter: ChatAdapter): ChatHandlers => ({\n // have to use `any` here so we don't import from Chat SDK\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onSendMessage: (content: string, options: any) => {\n /* @conditional-compile-remove(file-sharing-acs) */\n if (\n options &&\n 'attachments' in options &&\n options.attachments &&\n options.attachments[0] &&\n !('attachmentType' in options.attachments[0])\n ) {\n const adapterMessageOption = {\n metadata: {\n ...options?.metadata,\n fileSharingMetadata: JSON.stringify(options?.attachments)\n }\n };\n return adapter.sendMessage(content, adapterMessageOption);\n }\n return adapter.sendMessage(content, options);\n },\n onLoadPreviousChatMessages: adapter.loadPreviousChatMessages,\n onMessageSeen: adapter.sendReadReceipt,\n onTyping: adapter.sendTypingIndicator,\n onRemoveParticipant: adapter.removeParticipant,\n updateThreadTopicName: adapter.setTopic,\n onUpdateMessage: function (\n messageId: string,\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) {\n /* @conditional-compile-remove(file-sharing-acs) */\n const adapterMessageOptions: MessageOptions = {\n attachments: options?.attachments\n };\n return adapter.updateMessage(\n messageId,\n content,\n /* @conditional-compile-remove(file-sharing-acs) */ adapterMessageOptions\n );\n },\n onDeleteMessage: adapter.deleteMessage\n })\n);\n"]}
1
+ {"version":3,"file":"useHandlers.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/hooks/useHandlers.ts"],"names":[],"mappings":"AAAA,uCA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B;IACrC,mBAAmB,EAAE,OAAO,CAAC,iBAAiB;IAC9C,qBAAqB,EAAE,OAAO,CAAC,QAAQ;IACvC,eAAe,EAAE,UACf,SAAiB,EACjB,OAAe;IACf,mDAAmD;IACnD,OAAwB;QAExB,mDAAmD;QACnD,MAAM,qBAAqB,GAAmB;YAC5C,WAAW,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW;SAClC,CAAC;QACF,OAAO,OAAO,CAAC,aAAa,CAC1B,SAAS,EACT,OAAO;QACP,mDAAmD,CAAC,qBAAqB,CAC1E,CAAC;IACJ,CAAC;IACD,eAAe,EAAE,OAAO,CAAC,aAAa;CACvC,CAAC,CACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CommonProperties } from '@internal/acs-ui-common';\nimport { ChatHandlers } from '@internal/chat-component-bindings';\n\nimport { ReactElement } from 'react';\nimport memoizeOne from 'memoize-one';\nimport { ChatAdapter } from '../adapter/ChatAdapter';\nimport { useAdapter } from '../adapter/ChatAdapterProvider';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { MessageOptions } from '@internal/acs-ui-common';\n\n/**\n * @private\n */\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type\nexport const useHandlers = <PropsT>(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _component: (props: PropsT) => ReactElement | null\n): Pick<ChatHandlers, CommonProperties<ChatHandlers, PropsT>> => {\n return createCompositeHandlers(useAdapter());\n};\n\nconst createCompositeHandlers = memoizeOne(\n (adapter: ChatAdapter): ChatHandlers => ({\n // have to use `any` here so we don't import from Chat SDK\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onSendMessage: (content: string, options: any) => {\n /* @conditional-compile-remove(file-sharing-acs) */\n if (\n options &&\n 'attachments' in options &&\n options.attachments &&\n options.attachments[0] &&\n !('attachmentType' in options.attachments[0])\n ) {\n const adapterMessageOption = {\n metadata: {\n ...options?.metadata,\n fileSharingMetadata: JSON.stringify(options?.attachments)\n }\n };\n return adapter.sendMessage(content, adapterMessageOption);\n }\n return adapter.sendMessage(content, options);\n },\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onUploadImage: adapter.uploadImage,\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onDeleteImage: adapter.deleteImage,\n onLoadPreviousChatMessages: adapter.loadPreviousChatMessages,\n onMessageSeen: adapter.sendReadReceipt,\n onTyping: adapter.sendTypingIndicator,\n onRemoveParticipant: adapter.removeParticipant,\n updateThreadTopicName: adapter.setTopic,\n onUpdateMessage: function (\n messageId: string,\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) {\n /* @conditional-compile-remove(file-sharing-acs) */\n const adapterMessageOptions: MessageOptions = {\n attachments: options?.attachments\n };\n return adapter.updateMessage(\n messageId,\n content,\n /* @conditional-compile-remove(file-sharing-acs) */ adapterMessageOptions\n );\n },\n onDeleteMessage: adapter.deleteMessage\n })\n);\n"]}
@@ -0,0 +1,12 @@
1
+ import { Dispatch } from 'react';
2
+ import { AttachmentUpload, Actions } from '../file-sharing/AttachmentUpload';
3
+ /**
4
+ * @private
5
+ */
6
+ export declare const useImageUpload: () => [
7
+ AttachmentUpload[],
8
+ Dispatch<Actions>,
9
+ onUploadInlineImage: (image: string, fileName: string) => Promise<void>,
10
+ onCancelInlineImageUploadHandler: (imageId: string) => void
11
+ ];
12
+ //# sourceMappingURL=useImageUpload.d.ts.map
@@ -0,0 +1,129 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ /* @conditional-compile-remove(rich-text-editor-image-upload) */
13
+ import { useCallback, useReducer } from 'react';
14
+ /* @conditional-compile-remove(rich-text-editor-image-upload) */
15
+ import { AttachmentUploadActionType, AttachmentUploadReducer } from '../file-sharing/AttachmentUpload';
16
+ /* @conditional-compile-remove(rich-text-editor-image-upload) */
17
+ import { useAdapter } from '../adapter/ChatAdapterProvider';
18
+ /* @conditional-compile-remove(rich-text-editor-image-upload) */
19
+ import { nanoid } from 'nanoid';
20
+ /* @conditional-compile-remove(rich-text-editor-image-upload) */
21
+ const fetchBlobData = (resource, options) => __awaiter(void 0, void 0, void 0, function* () {
22
+ // default timeout is 30 seconds
23
+ const { timeout = 30000, abortController } = options;
24
+ const id = setTimeout(() => {
25
+ abortController.abort();
26
+ }, timeout);
27
+ const response = yield fetch(resource, Object.assign(Object.assign({}, options), { signal: abortController.signal }));
28
+ clearTimeout(id);
29
+ return response;
30
+ });
31
+ /* @conditional-compile-remove(rich-text-editor-image-upload) */
32
+ const getInlineImageData = (image) => __awaiter(void 0, void 0, void 0, function* () {
33
+ const blobImage = undefined;
34
+ if (image.startsWith('blob') || image.startsWith('http')) {
35
+ const res = yield fetchBlobData(image, { abortController: new AbortController() });
36
+ const blobImage = yield res.blob();
37
+ return blobImage;
38
+ }
39
+ return blobImage;
40
+ });
41
+ /* @conditional-compile-remove(rich-text-editor-image-upload) */
42
+ /**
43
+ * @private
44
+ */
45
+ export const useImageUpload = () => {
46
+ const MAX_INLINE_IMAGE_UPLOAD_SIZE_MB = 20;
47
+ const adapter = useAdapter();
48
+ const [inlineImageUploads, handleInlineImageUploadAction] = useReducer(AttachmentUploadReducer, []);
49
+ const inlineImageUploadHandler = useCallback((uploadTasks) => __awaiter(void 0, void 0, void 0, function* () {
50
+ var _a, _b, _c, _d, _e;
51
+ for (const task of uploadTasks) {
52
+ const uploadTask = task;
53
+ const image = uploadTask.image;
54
+ if (!image) {
55
+ uploadTask.notifyUploadFailed(`Image data for "${(_a = task.metadata) === null || _a === void 0 ? void 0 : _a.name}" is not provided.`);
56
+ continue;
57
+ }
58
+ if (image && image.size > MAX_INLINE_IMAGE_UPLOAD_SIZE_MB * 1024 * 1024) {
59
+ uploadTask.notifyUploadFailed(`"${(_b = task.metadata) === null || _b === void 0 ? void 0 : _b.name}" is too big. Select a file under ${MAX_INLINE_IMAGE_UPLOAD_SIZE_MB}MB.`);
60
+ continue;
61
+ }
62
+ const SUPPORTED_FILES = ['jpg', 'jpeg', 'png', 'gif', 'heic', 'webp'];
63
+ const imageExtension = (_d = (_c = task.metadata) === null || _c === void 0 ? void 0 : _c.name.split('.').pop()) !== null && _d !== void 0 ? _d : '';
64
+ if (!SUPPORTED_FILES.includes(imageExtension)) {
65
+ uploadTask.notifyUploadFailed(`Uploading ".${imageExtension}" image is not allowed.`);
66
+ continue;
67
+ }
68
+ try {
69
+ const response = yield adapter.uploadImage(image, (_e = task.metadata) === null || _e === void 0 ? void 0 : _e.name);
70
+ uploadTask.notifyUploadCompleted(response.id, task.metadata.url || '');
71
+ }
72
+ catch (error) {
73
+ console.error(error);
74
+ uploadTask.notifyUploadFailed('Unable to upload inline image. Please try again later.');
75
+ }
76
+ }
77
+ }), [adapter]);
78
+ const onUploadInlineImage = useCallback((image, fileName) => __awaiter(void 0, void 0, void 0, function* () {
79
+ if (!image) {
80
+ return;
81
+ }
82
+ const imageData = yield getInlineImageData(image);
83
+ if (!imageData) {
84
+ return;
85
+ }
86
+ const taskId = nanoid();
87
+ const uploadTask = {
88
+ image: imageData,
89
+ taskId,
90
+ metadata: {
91
+ id: taskId,
92
+ name: fileName,
93
+ url: image,
94
+ progress: 0
95
+ },
96
+ notifyUploadProgressChanged: (value) => {
97
+ handleInlineImageUploadAction({ type: AttachmentUploadActionType.Progress, taskId, progress: value });
98
+ },
99
+ notifyUploadCompleted: (id, url) => {
100
+ handleInlineImageUploadAction({ type: AttachmentUploadActionType.Completed, taskId, id, url });
101
+ },
102
+ notifyUploadFailed: (message) => {
103
+ handleInlineImageUploadAction({ type: AttachmentUploadActionType.Failed, taskId, message });
104
+ // remove the failed upload task when error banner is auto dismissed after 10 seconds
105
+ // so the banner won't be shown again on UI re-rendering.
106
+ setTimeout(() => {
107
+ handleInlineImageUploadAction({ type: AttachmentUploadActionType.Remove, id: taskId });
108
+ }, 10 * 1000);
109
+ }
110
+ };
111
+ const newUploads = [uploadTask];
112
+ handleInlineImageUploadAction({ type: AttachmentUploadActionType.Set, newUploads });
113
+ inlineImageUploadHandler(newUploads);
114
+ }), [inlineImageUploadHandler]);
115
+ const onCancelInlineImageUploadHandler = useCallback((imageId) => {
116
+ const imageUpload = inlineImageUploads.find((upload) => upload.metadata.id === imageId);
117
+ const uploadId = imageUpload === null || imageUpload === void 0 ? void 0 : imageUpload.metadata.id;
118
+ if (!uploadId) {
119
+ return;
120
+ }
121
+ handleInlineImageUploadAction({ type: AttachmentUploadActionType.Remove, id: uploadId });
122
+ // TODO: remove local blob
123
+ if ((imageUpload === null || imageUpload === void 0 ? void 0 : imageUpload.metadata.progress) === 1) {
124
+ adapter.deleteImage(imageId);
125
+ }
126
+ }, [adapter, inlineImageUploads]);
127
+ return [inlineImageUploads, handleInlineImageUploadAction, onUploadInlineImage, onCancelInlineImageUploadHandler];
128
+ };
129
+ //# sourceMappingURL=useImageUpload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useImageUpload.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/image-upload/useImageUpload.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,gEAAgE;AAChE,OAAO,EAAY,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1D,gEAAgE;AAChE,OAAO,EAEL,0BAA0B,EAC1B,uBAAuB,EAGxB,MAAM,kCAAkC,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C;IACF,OAAO,CAAC,kBAAkB,EAAE,6BAA6B,EAAE,mBAAmB,EAAE,gCAAgC,CAAC,CAAC;AACpH,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { Dispatch, useCallback, useReducer } from 'react';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport {\n AttachmentUpload,\n AttachmentUploadActionType,\n AttachmentUploadReducer,\n AttachmentUploadTask,\n Actions\n} from '../file-sharing/AttachmentUpload';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { useAdapter } from '../adapter/ChatAdapterProvider';\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nimport { nanoid } from 'nanoid';\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nconst fetchBlobData = async (\n resource: string | URL | Request,\n options: { timeout?: number; headers?: Headers; abortController: AbortController }\n): Promise<Response> => {\n // default timeout is 30 seconds\n const { timeout = 30000, abortController } = options;\n\n const id = setTimeout(() => {\n abortController.abort();\n }, timeout);\n\n const response = await fetch(resource, {\n ...options,\n signal: abortController.signal\n });\n clearTimeout(id);\n return response;\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\nconst getInlineImageData = async (image: string): Promise<Blob | undefined> => {\n const blobImage: Blob | undefined = undefined;\n if (image.startsWith('blob') || image.startsWith('http')) {\n const res = await fetchBlobData(image, { abortController: new AbortController() });\n const blobImage = await res.blob();\n return blobImage;\n }\n return blobImage;\n};\n\n/* @conditional-compile-remove(rich-text-editor-image-upload) */\n/**\n * @private\n */\nexport const useImageUpload = (): [\n AttachmentUpload[],\n Dispatch<Actions>,\n onUploadInlineImage: (image: string, fileName: string) => Promise<void>,\n onCancelInlineImageUploadHandler: (imageId: string) => void\n] => {\n const MAX_INLINE_IMAGE_UPLOAD_SIZE_MB = 20;\n const adapter = useAdapter();\n const [inlineImageUploads, handleInlineImageUploadAction] = useReducer(AttachmentUploadReducer, []);\n\n const inlineImageUploadHandler = useCallback(\n async (uploadTasks: AttachmentUpload[]): Promise<void> => {\n for (const task of uploadTasks) {\n const uploadTask = task as AttachmentUploadTask;\n const image: Blob | undefined = uploadTask.image;\n if (!image) {\n uploadTask.notifyUploadFailed(`Image data for \"${task.metadata?.name}\" is not provided.`);\n continue;\n }\n if (image && image.size > MAX_INLINE_IMAGE_UPLOAD_SIZE_MB * 1024 * 1024) {\n uploadTask.notifyUploadFailed(\n `\"${task.metadata?.name}\" is too big. Select a file under ${MAX_INLINE_IMAGE_UPLOAD_SIZE_MB}MB.`\n );\n continue;\n }\n\n const SUPPORTED_FILES: Array<string> = ['jpg', 'jpeg', 'png', 'gif', 'heic', 'webp'];\n const imageExtension = task.metadata?.name.split('.').pop() ?? '';\n if (!SUPPORTED_FILES.includes(imageExtension)) {\n uploadTask.notifyUploadFailed(`Uploading \".${imageExtension}\" image is not allowed.`);\n continue;\n }\n\n try {\n const response = await adapter.uploadImage(image, task.metadata?.name);\n uploadTask.notifyUploadCompleted(response.id, task.metadata.url || '');\n } catch (error) {\n console.error(error);\n uploadTask.notifyUploadFailed('Unable to upload inline image. Please try again later.');\n }\n }\n },\n [adapter]\n );\n\n const onUploadInlineImage = useCallback(\n async (image: string, fileName: string): Promise<void> => {\n if (!image) {\n return;\n }\n const imageData = await getInlineImageData(image);\n if (!imageData) {\n return;\n }\n const taskId = nanoid();\n const uploadTask: AttachmentUpload = {\n image: imageData,\n taskId,\n metadata: {\n id: taskId,\n name: fileName,\n url: image,\n progress: 0\n },\n notifyUploadProgressChanged: (value: number) => {\n handleInlineImageUploadAction({ type: AttachmentUploadActionType.Progress, taskId, progress: value });\n },\n notifyUploadCompleted: (id: string, url: string) => {\n handleInlineImageUploadAction({ type: AttachmentUploadActionType.Completed, taskId, id, url });\n },\n notifyUploadFailed: (message: string) => {\n handleInlineImageUploadAction({ type: AttachmentUploadActionType.Failed, taskId, message });\n // remove the failed upload task when error banner is auto dismissed after 10 seconds\n // so the banner won't be shown again on UI re-rendering.\n setTimeout(() => {\n handleInlineImageUploadAction({ type: AttachmentUploadActionType.Remove, id: taskId });\n }, 10 * 1000);\n }\n };\n\n const newUploads = [uploadTask];\n handleInlineImageUploadAction({ type: AttachmentUploadActionType.Set, newUploads });\n inlineImageUploadHandler(newUploads);\n },\n [inlineImageUploadHandler]\n );\n\n const onCancelInlineImageUploadHandler = useCallback(\n (imageId: string) => {\n const imageUpload = inlineImageUploads.find((upload) => upload.metadata.id === imageId);\n const uploadId = imageUpload?.metadata.id;\n if (!uploadId) {\n return;\n }\n handleInlineImageUploadAction({ type: AttachmentUploadActionType.Remove, id: uploadId });\n // TODO: remove local blob\n if (imageUpload?.metadata.progress === 1) {\n adapter.deleteImage(imageId);\n }\n },\n [adapter, inlineImageUploads]\n );\n return [inlineImageUploads, handleInlineImageUploadAction, onUploadInlineImage, onCancelInlineImageUploadHandler];\n};\n"]}
@@ -23,6 +23,9 @@ export type SendBoxPickerProps = {
23
23
  richTextEditorOptions?: RichTextEditorOptions;
24
24
  attachments?: AttachmentMetadataInProgress[];
25
25
  onCancelAttachmentUpload?: (attachmentId: string) => void;
26
+ onUploadInlineImage?: (imageUrl: string, imageFileName: string) => void;
27
+ imageUploadsInProgress?: AttachmentMetadataInProgress[];
28
+ onCancelInlineImageUpload?: (imageId: string) => void;
26
29
  };
27
30
  /**
28
31
  * @private
@@ -24,9 +24,10 @@ export const loadRichTextSendBox = () => import('./RichTextSendBoxWrapper').then
24
24
  * @private
25
25
  */
26
26
  export const SendBoxPicker = (props) => {
27
- const {
28
27
  /* @conditional-compile-remove(rich-text-editor-composite-support) */
29
- richTextEditorOptions } = props;
28
+ const { richTextEditorOptions } = props;
29
+ /* @conditional-compile-remove(rich-text-editor-image-upload) */
30
+ const { onPaste, onUploadInlineImage, imageUploadsInProgress, onCancelInlineImageUpload } = richTextEditorOptions || {};
30
31
  const sendBoxProps = usePropsFor(SendBox);
31
32
  /* @conditional-compile-remove(rich-text-editor-composite-support) */
32
33
  const isRichTextEditorEnabled = useMemo(() => {
@@ -37,7 +38,7 @@ export const SendBoxPicker = (props) => {
37
38
  if (isRichTextEditorEnabled) {
38
39
  return (React.createElement(_ErrorBoundary, { fallback: sendBox },
39
40
  React.createElement(Suspense, { fallback: sendBox },
40
- React.createElement(RichTextSendBoxWrapper, Object.assign({}, props)))));
41
+ React.createElement(RichTextSendBoxWrapper, Object.assign({}, props, { onPaste: onPaste, onUploadInlineImage: onUploadInlineImage, imageUploadsInProgress: imageUploadsInProgress, onCancelInlineImageUpload: onCancelInlineImageUpload })))));
41
42
  }
42
43
  return sendBox;
43
44
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SendBoxPicker.js","sourceRoot":"","sources":["../../../../../../../react-composites/src/composites/common/SendBoxPicker.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,OAAO,EAAsB,yCAAmC;AAGzE,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,qEAAqE;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,qEAAqE;AACrE,OAAO,EAAE,cAAc,EAAwB,yCAAmC;AAIlF,qEAAqE;AACrE;;GAEG;AACH,MAAM,sBAAsB,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAC7C,MAAM,CAAC,0BAA0B,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAClG,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAEhC,EAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC;AAoBxG;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAyB,EAAe,EAAE;IACtE,MAAM;IACJ,qEAAqE;IACrE,qBAAqB,EACtB,GAAG,KAAK,CAAC;IAEV,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IAE1C,qEAAqE;IACrE,MAAM,uBAAuB,GAAG,OAAO,CAAC,GAAG,EAAE;QAC3C,OAAO,qBAAqB,KAAK,SAAS,CAAC;IAC7C,CAAC,EAAE,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAE5B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,oBAAC,OAAO,oBAAK,YAAY,EAAM,KAAK,EAAI,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC;IAE/F,qEAAqE;IACrE,IAAI,uBAAuB,EAAE,CAAC;QAC5B,OAAO,CACL,oBAAC,cAAc,IAAC,QAAQ,EAAE,OAAO;YAC/B,oBAAC,QAAQ,IAAC,QAAQ,EAAE,OAAO;gBACzB,oBAAC,sBAAsB,oBAAK,KAAK,EAAI,CAC5B,CACI,CAClB,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useMemo } from 'react';\nimport { SendBox, SendBoxStylesProps } from '@internal/react-components';\n/* @conditional-compile-remove(rich-text-editor-composite-support) */\nimport { RichTextEditorOptions } from '@internal/react-components';\nimport { usePropsFor } from '../ChatComposite/hooks/usePropsFor';\n/* @conditional-compile-remove(rich-text-editor-composite-support) */\nimport { Suspense } from 'react';\n/* @conditional-compile-remove(rich-text-editor-composite-support) */\nimport { _ErrorBoundary, RichTextSendBoxProps } from '@internal/react-components';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadataInProgress, MessageOptions } from '@internal/acs-ui-common';\n\n/* @conditional-compile-remove(rich-text-editor-composite-support) */\n/**\n * Wrapper for RichTextSendBox component to allow us to use usePropsFor with richTextSendBox with lazy loading\n */\nconst RichTextSendBoxWrapper = React.lazy(() =>\n import('./RichTextSendBoxWrapper').then((module) => ({ default: module.RichTextSendBoxWrapper }))\n);\n\n/**\n * @private\n * Use this function to load RoosterJS dependencies early in the lifecycle.\n * It should be the same import as used for lazy loading.\n *\n/* @conditional-compile-remove(rich-text-editor-composite-support)\n */\nexport const loadRichTextSendBox = (): Promise<{\n default: React.ComponentType<RichTextSendBoxProps>;\n}> => import('./RichTextSendBoxWrapper').then((module) => ({ default: module.RichTextSendBoxWrapper }));\n\n/**\n * @private\n */\nexport type SendBoxPickerProps = {\n styles?: SendBoxStylesProps;\n autoFocus?: 'sendBoxTextField';\n onSendMessage: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */ options?: MessageOptions\n ) => Promise<void>;\n /* @conditional-compile-remove(rich-text-editor-composite-support) */\n richTextEditorOptions?: RichTextEditorOptions;\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments?: AttachmentMetadataInProgress[];\n /* @conditional-compile-remove(file-sharing-acs) */\n onCancelAttachmentUpload?: (attachmentId: string) => void;\n};\n\n/**\n * @private\n */\nexport const SendBoxPicker = (props: SendBoxPickerProps): JSX.Element => {\n const {\n /* @conditional-compile-remove(rich-text-editor-composite-support) */\n richTextEditorOptions\n } = props;\n\n const sendBoxProps = usePropsFor(SendBox);\n\n /* @conditional-compile-remove(rich-text-editor-composite-support) */\n const isRichTextEditorEnabled = useMemo(() => {\n return richTextEditorOptions !== undefined;\n }, [richTextEditorOptions]);\n\n const sendBox = useMemo(() => <SendBox {...sendBoxProps} {...props} />, [props, sendBoxProps]);\n\n /* @conditional-compile-remove(rich-text-editor-composite-support) */\n if (isRichTextEditorEnabled) {\n return (\n <_ErrorBoundary fallback={sendBox}>\n <Suspense fallback={sendBox}>\n <RichTextSendBoxWrapper {...props} />\n </Suspense>\n </_ErrorBoundary>\n );\n }\n return sendBox;\n};\n"]}
1
+ {"version":3,"file":"SendBoxPicker.js","sourceRoot":"","sources":["../../../../../../../react-composites/src/composites/common/SendBoxPicker.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,OAAO,EAAsB,yCAAmC;AAGzE,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,qEAAqE;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,qEAAqE;AACrE,OAAO,EAAE,cAAc,EAAwB,yCAAmC;AAIlF,qEAAqE;AACrE;;GAEG;AACH,MAAM,sBAAsB,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAC7C,MAAM,CAAC,0BAA0B,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAClG,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAEhC,EAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC;AA0BxG;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAyB,EAAe,EAAE;IACtE,qEAAqE;IACrE,MAAM,EAAE,qBAAqB,EAAE,GAAG,KAAK,CAAC;IACxC,gEAAgE;IAChE,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,GACvF,qBAAqB,IAAI,EAAE,CAAC;IAE9B,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IAE1C,qEAAqE;IACrE,MAAM,uBAAuB,GAAG,OAAO,CAAC,GAAG,EAAE;QAC3C,OAAO,qBAAqB,KAAK,SAAS,CAAC;IAC7C,CAAC,EAAE,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAE5B,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,oBAAC,OAAO,oBAAK,YAAY,EAAM,KAAK,EAAI,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC;IAE/F,qEAAqE;IACrE,IAAI,uBAAuB,EAAE,CAAC;QAC5B,OAAO,CACL,oBAAC,cAAc,IAAC,QAAQ,EAAE,OAAO;YAC/B,oBAAC,QAAQ,IAAC,QAAQ,EAAE,OAAO;gBACzB,oBAAC,sBAAsB,oBACjB,KAAK,IACT,OAAO,EAAE,OAAO,EAChB,mBAAmB,EAAE,mBAAmB,EACxC,sBAAsB,EAAE,sBAAsB,EAC9C,yBAAyB,EAAE,yBAAyB,IACpD,CACO,CACI,CAClB,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useMemo } from 'react';\nimport { SendBox, SendBoxStylesProps } from '@internal/react-components';\n/* @conditional-compile-remove(rich-text-editor-composite-support) */\nimport { RichTextEditorOptions } from '@internal/react-components';\nimport { usePropsFor } from '../ChatComposite/hooks/usePropsFor';\n/* @conditional-compile-remove(rich-text-editor-composite-support) */\nimport { Suspense } from 'react';\n/* @conditional-compile-remove(rich-text-editor-composite-support) */\nimport { _ErrorBoundary, RichTextSendBoxProps } from '@internal/react-components';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { AttachmentMetadataInProgress, MessageOptions } from '@internal/acs-ui-common';\n\n/* @conditional-compile-remove(rich-text-editor-composite-support) */\n/**\n * Wrapper for RichTextSendBox component to allow us to use usePropsFor with richTextSendBox with lazy loading\n */\nconst RichTextSendBoxWrapper = React.lazy(() =>\n import('./RichTextSendBoxWrapper').then((module) => ({ default: module.RichTextSendBoxWrapper }))\n);\n\n/**\n * @private\n * Use this function to load RoosterJS dependencies early in the lifecycle.\n * It should be the same import as used for lazy loading.\n *\n/* @conditional-compile-remove(rich-text-editor-composite-support)\n */\nexport const loadRichTextSendBox = (): Promise<{\n default: React.ComponentType<RichTextSendBoxProps>;\n}> => import('./RichTextSendBoxWrapper').then((module) => ({ default: module.RichTextSendBoxWrapper }));\n\n/**\n * @private\n */\nexport type SendBoxPickerProps = {\n styles?: SendBoxStylesProps;\n autoFocus?: 'sendBoxTextField';\n onSendMessage: (\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */ options?: MessageOptions\n ) => Promise<void>;\n /* @conditional-compile-remove(rich-text-editor-composite-support) */\n richTextEditorOptions?: RichTextEditorOptions;\n /* @conditional-compile-remove(file-sharing-acs) */\n attachments?: AttachmentMetadataInProgress[];\n /* @conditional-compile-remove(file-sharing-acs) */\n onCancelAttachmentUpload?: (attachmentId: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onUploadInlineImage?: (imageUrl: string, imageFileName: string) => void;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n imageUploadsInProgress?: AttachmentMetadataInProgress[];\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n onCancelInlineImageUpload?: (imageId: string) => void;\n};\n\n/**\n * @private\n */\nexport const SendBoxPicker = (props: SendBoxPickerProps): JSX.Element => {\n /* @conditional-compile-remove(rich-text-editor-composite-support) */\n const { richTextEditorOptions } = props;\n /* @conditional-compile-remove(rich-text-editor-image-upload) */\n const { onPaste, onUploadInlineImage, imageUploadsInProgress, onCancelInlineImageUpload } =\n richTextEditorOptions || {};\n\n const sendBoxProps = usePropsFor(SendBox);\n\n /* @conditional-compile-remove(rich-text-editor-composite-support) */\n const isRichTextEditorEnabled = useMemo(() => {\n return richTextEditorOptions !== undefined;\n }, [richTextEditorOptions]);\n\n const sendBox = useMemo(() => <SendBox {...sendBoxProps} {...props} />, [props, sendBoxProps]);\n\n /* @conditional-compile-remove(rich-text-editor-composite-support) */\n if (isRichTextEditorEnabled) {\n return (\n <_ErrorBoundary fallback={sendBox}>\n <Suspense fallback={sendBox}>\n <RichTextSendBoxWrapper\n {...props}\n onPaste={onPaste}\n onUploadInlineImage={onUploadInlineImage}\n imageUploadsInProgress={imageUploadsInProgress}\n onCancelInlineImageUpload={onCancelInlineImageUpload}\n />\n </Suspense>\n </_ErrorBoundary>\n );\n }\n return sendBox;\n};\n"]}
@@ -120,6 +120,7 @@ export declare const DEFAULT_COMPOSITE_ICONS: {
120
120
  ErrorBarCallVideoRecoveredBySystem: React.JSX.Element;
121
121
  ErrorBarCallVideoStoppedBySystem: React.JSX.Element;
122
122
  ErrorBarMutedByRemoteParticipant: React.JSX.Element;
123
+ NotificationBarRecording: React.JSX.Element;
123
124
  MessageResend: React.JSX.Element;
124
125
  ParticipantItemSpotlighted: React.JSX.Element;
125
126
  HoldCallContextualMenuItem: React.JSX.Element;