@azure/communication-react 1.14.0-alpha-202403060013 → 1.14.0-alpha-202403080013

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 (112) hide show
  1. package/dist/communication-react.d.ts +127 -51
  2. package/dist/dist-cjs/communication-react/RichTextSendBoxWrapper-CQnsLK4_.js +51 -0
  3. package/dist/dist-cjs/communication-react/RichTextSendBoxWrapper-CQnsLK4_.js.map +1 -0
  4. package/dist/dist-cjs/communication-react/index--vbi3hW5.js +38028 -0
  5. package/dist/dist-cjs/communication-react/index--vbi3hW5.js.map +1 -0
  6. package/dist/dist-cjs/communication-react/index.js +157 -37619
  7. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  8. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  9. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  10. package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.d.ts +2 -1
  11. package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.js +5 -0
  12. package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.js.map +1 -1
  13. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +15 -9
  14. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
  15. package/dist/dist-esm/chat-stateful-client/src/ChatContext.js +4 -4
  16. package/dist/dist-esm/chat-stateful-client/src/ChatContext.js.map +1 -1
  17. package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.d.ts +0 -11
  18. package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js +19 -47
  19. package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js.map +1 -1
  20. package/dist/dist-esm/chat-stateful-client/src/index.d.ts +1 -0
  21. package/dist/dist-esm/chat-stateful-client/src/index.js.map +1 -1
  22. package/dist/dist-esm/chat-stateful-client/src/types/ChatMessageWithStatus.d.ts +9 -1
  23. package/dist/dist-esm/chat-stateful-client/src/types/ChatMessageWithStatus.js.map +1 -1
  24. package/dist/dist-esm/communication-react/src/index.d.ts +3 -2
  25. package/dist/dist-esm/communication-react/src/index.js +2 -0
  26. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  27. package/dist/dist-esm/react-components/src/components/CaptionsSettingsModal.js +4 -4
  28. package/dist/dist-esm/react-components/src/components/CaptionsSettingsModal.js.map +1 -1
  29. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.d.ts +2 -2
  30. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js +16 -34
  31. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.js.map +1 -1
  32. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsRichTextEditBox.d.ts +18 -0
  33. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsRichTextEditBox.js +102 -0
  34. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentAsRichTextEditBox.js.map +1 -0
  35. package/dist/dist-esm/react-components/src/components/FileDownloadCards.d.ts +1 -7
  36. package/dist/dist-esm/react-components/src/components/FileDownloadCards.js +5 -17
  37. package/dist/dist-esm/react-components/src/components/FileDownloadCards.js.map +1 -1
  38. package/dist/dist-esm/react-components/src/components/{RTE → RichTextEditor}/RichTextEditor.d.ts +14 -2
  39. package/dist/dist-esm/react-components/src/components/{RTE → RichTextEditor}/RichTextEditor.js +22 -21
  40. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js.map +1 -0
  41. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.d.ts +28 -0
  42. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js +50 -0
  43. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextInputBoxComponent.js.map +1 -0
  44. package/dist/dist-esm/react-components/src/components/{RTE/RTERibbonButtons.d.ts → RichTextEditor/RichTextRibbonButtons.d.ts} +2 -2
  45. package/dist/dist-esm/react-components/src/components/{RTE/RTERibbonButtons.js → RichTextEditor/RichTextRibbonButtons.js} +9 -9
  46. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextRibbonButtons.js.map +1 -0
  47. package/dist/dist-esm/react-components/src/components/{RTE/RTESendBox.d.ts → RichTextEditor/RichTextSendBox.d.ts} +5 -1
  48. package/dist/dist-esm/react-components/src/components/{RTE/RTESendBox.js → RichTextEditor/RichTextSendBox.js} +33 -20
  49. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -0
  50. package/dist/dist-esm/react-components/src/components/{RTE/RTESendBoxErrors.d.ts → RichTextEditor/RichTextSendBoxErrors.d.ts} +3 -3
  51. package/dist/dist-esm/react-components/src/components/{RTE/RTESendBoxErrors.js → RichTextEditor/RichTextSendBoxErrors.js} +2 -2
  52. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBoxErrors.js.map +1 -0
  53. package/dist/dist-esm/react-components/src/components/SendBox.js +2 -2
  54. package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
  55. package/dist/dist-esm/react-components/src/components/index.d.ts +4 -2
  56. package/dist/dist-esm/react-components/src/components/index.js +4 -1
  57. package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
  58. package/dist/dist-esm/react-components/src/components/styles/ChatMessageComponent.styles.d.ts +4 -0
  59. package/dist/dist-esm/react-components/src/components/styles/ChatMessageComponent.styles.js +10 -0
  60. package/dist/dist-esm/react-components/src/components/styles/ChatMessageComponent.styles.js.map +1 -1
  61. package/dist/dist-esm/react-components/src/components/styles/EditBox.styles.d.ts +10 -4
  62. package/dist/dist-esm/react-components/src/components/styles/EditBox.styles.js +17 -4
  63. package/dist/dist-esm/react-components/src/components/styles/EditBox.styles.js.map +1 -1
  64. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.d.ts +34 -2
  65. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js +72 -11
  66. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js.map +1 -1
  67. package/dist/dist-esm/react-components/src/components/styles/RichTextInputBoxComponent.styles.d.ts +17 -0
  68. package/dist/dist-esm/react-components/src/components/styles/RichTextInputBoxComponent.styles.js +30 -0
  69. package/dist/dist-esm/react-components/src/components/styles/RichTextInputBoxComponent.styles.js.map +1 -0
  70. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.d.ts +15 -0
  71. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js +22 -11
  72. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js.map +1 -1
  73. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.d.ts +23 -0
  74. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js +44 -0
  75. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js.map +1 -0
  76. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.d.ts +1 -1
  77. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +1 -1
  78. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
  79. package/dist/dist-esm/react-components/src/localization/LocalizationProvider.d.ts +2 -2
  80. package/dist/dist-esm/react-components/src/localization/LocalizationProvider.js.map +1 -1
  81. package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +2 -1
  82. package/dist/dist-esm/react-components/src/theming/icons.d.ts +10 -8
  83. package/dist/dist-esm/react-components/src/theming/icons.js +13 -9
  84. package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
  85. package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +3 -3
  86. package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
  87. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js +6 -1
  88. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
  89. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.d.ts +14 -0
  90. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatComposite.js.map +1 -1
  91. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.d.ts +0 -1
  92. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +6 -15
  93. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
  94. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUpload.js.map +1 -1
  95. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.d.ts +1 -0
  96. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
  97. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/fileUploadsSelector.d.ts +2 -2
  98. package/dist/dist-esm/react-composites/src/composites/common/RichTextSendBoxWrapper.d.ts +9 -0
  99. package/dist/dist-esm/react-composites/src/composites/common/RichTextSendBoxWrapper.js +20 -0
  100. package/dist/dist-esm/react-composites/src/composites/common/RichTextSendBoxWrapper.js.map +1 -0
  101. package/dist/dist-esm/react-composites/src/composites/common/SendBox.d.ts +17 -0
  102. package/dist/dist-esm/react-composites/src/composites/common/SendBox.js +46 -0
  103. package/dist/dist-esm/react-composites/src/composites/common/SendBox.js.map +1 -0
  104. package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +10 -8
  105. package/package.json +1 -1
  106. package/dist/dist-esm/react-components/src/components/RTE/RTEInputBoxComponent.d.ts +0 -25
  107. package/dist/dist-esm/react-components/src/components/RTE/RTEInputBoxComponent.js +0 -21
  108. package/dist/dist-esm/react-components/src/components/RTE/RTEInputBoxComponent.js.map +0 -1
  109. package/dist/dist-esm/react-components/src/components/RTE/RTERibbonButtons.js.map +0 -1
  110. package/dist/dist-esm/react-components/src/components/RTE/RTESendBox.js.map +0 -1
  111. package/dist/dist-esm/react-components/src/components/RTE/RTESendBoxErrors.js.map +0 -1
  112. package/dist/dist-esm/react-components/src/components/RTE/RichTextEditor.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ResourceDownloadQueue.js","sourceRoot":"","sources":["../../../../../chat-stateful-client/src/ResourceDownloadQueue.ts"],"names":[],"mappings":";;;;;;;;;AAIA,uEAAuE;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAM9C,uEAAuE;AACvE;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAMhC,YAAY,OAAoB,EAAE,UAAwC;QALlE,sCAAiC,GAA4B,EAAE,CAAC;QAEhE,aAAQ,GAAG,KAAK,CAAC;QAIvB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAEM,kCAAkC,CAAC,OAA8B;;QACtE,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,MAAM,kBAAkB,GAAG,MAAA,OAAO,CAAC,OAAO,0CAAE,WAAW,CAAC;QACxD,IAAI,kBAAkB,EAAE,CAAC;YACvB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,iCAAiC,EAAE,CAAC;gBACvD,MAAM,kBAAkB,GAAG,MAAA,MAAA,CAAC,CAAC,OAAO,0CAAE,WAAW,mCAAI,EAAE,CAAC;gBACxD,QAAQ,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC/F,IAAI,QAAQ,EAAE,CAAC;oBACb,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEM,UAAU,CAAC,OAA8B;QAC9C,0CAA0C;QAC1C,MAAM,IAAI,qBAAQ,OAAO,CAAE,CAAC;QAC5B,IAAI,CAAC,iCAAiC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC;IAEY,UAAU,C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,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;YAEzD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,kCAChC,OAAO,KACV,MAAM,EAAE,UAAU,CAAC,MAAM,IACzB,CAAC;YACH,YAAY,CAAC,EAAE,CAAC,CAAC;YACjB,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;IACD,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,QAAQ,EAAE,CAAC;IAChD,MAAM,QAAQ,GAAG,MAAM,uBAAuB,CAAC,GAAG,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IACvE,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,OAAO,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAA,CAAC;AAMF,uEAAuE;AACvE;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAG9C,YAAY,qBAA4C;QACtD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;IACrD,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ChatContext } from './ChatContext';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ChatError } from './ChatClientState';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport type { CommunicationTokenCredential } from '@azure/communication-common';\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n/**\n * @private\n */\nexport class ResourceDownloadQueue {\n private _messagesNeedingResourceRetrieval: ChatMessageWithStatus[] = [];\n private _context: ChatContext;\n private isActive = false;\n private _credential: CommunicationTokenCredential;\n\n constructor(context: ChatContext, credential: CommunicationTokenCredential) {\n this._context = context;\n this._credential = credential;\n }\n\n public containsMessageWithSameAttachments(message: ChatMessageWithStatus): boolean {\n let contains = false;\n const incomingAttachment = message.content?.attachments;\n if (incomingAttachment) {\n for (const m of this._messagesNeedingResourceRetrieval) {\n const existingAttachment = m.content?.attachments ?? [];\n contains = incomingAttachment.every((element, index) => element === existingAttachment[index]);\n if (contains) {\n break;\n }\n }\n }\n\n return contains;\n }\n\n public addMessage(message: ChatMessageWithStatus): void {\n // make a copy of message and add to queue\n const copy = { ...message };\n this._messagesNeedingResourceRetrieval.push(copy);\n }\n\n public async startQueue(threadId: string, operation: ImageRequest, options?: { singleUrl: string }): Promise<void> {\n if (this.isActive) {\n return;\n }\n while (this._messagesNeedingResourceRetrieval.length > 0) {\n this.isActive = true;\n let message = this._messagesNeedingResourceRetrieval.shift();\n if (!message) {\n this.isActive = false;\n continue;\n }\n\n if (options) {\n const singleUrl = options.singleUrl;\n message = await this.downloadSingleUrl(message, singleUrl, operation);\n } else {\n message = await this.downloadAllPreviewUrls(message, operation);\n }\n this._context.setChatMessage(threadId, message);\n this.isActive = false;\n }\n }\n\n private async downloadSingleUrl(\n message: ChatMessageWithStatus,\n resourceUrl: string,\n operation: ImageRequest\n ): Promise<ChatMessageWithStatus> {\n const blobUrl = await this.downloadResource(operation, resourceUrl);\n message = { ...message, resourceCache: { ...message.resourceCache, [resourceUrl]: blobUrl } };\n return message;\n }\n\n private async downloadAllPreviewUrls(\n message: ChatMessageWithStatus,\n operation: ImageRequest\n ): Promise<ChatMessageWithStatus> {\n const attachments = message.content?.attachments;\n if (message.type === 'html' && attachments) {\n if (message.resourceCache === undefined) {\n message.resourceCache = {};\n }\n for (const attachment of attachments) {\n if (attachment.previewUrl && attachment.attachmentType === 'image') {\n const blobUrl = await this.downloadResource(operation, attachment.previewUrl);\n message.resourceCache[attachment.previewUrl] = blobUrl;\n }\n }\n }\n\n return message;\n }\n\n private async downloadResource(operation: ImageRequest, url: string): Promise<string> {\n let blobUrl = URL.createObjectURL(new Blob());\n try {\n blobUrl = await operation(url, this._credential);\n } catch (error) {\n console.log('Downloading Resource error: ', error);\n }\n return blobUrl;\n }\n}\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n/**\n * @private\n */\nexport const requestPreviewUrl = async (\n message: ChatMessageWithStatus,\n credential: CommunicationTokenCredential\n): Promise<ChatMessageWithStatus> => {\n const attachments = message.content?.attachments;\n if (message.type === 'html' && attachments) {\n if (message.resourceCache === undefined) {\n message.resourceCache = {};\n }\n for (const attachment of attachments) {\n if (attachment.previewUrl) {\n const previewUrl = attachment.previewUrl;\n try {\n const src = await fetchImageSource(previewUrl, credential);\n message.resourceCache[previewUrl] = src;\n } catch (error) {\n throw new ResourceDownloadError(message);\n }\n }\n }\n }\n\n return message;\n};\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n/**\n * @private\n */\nexport const fetchImageSource = async (src: string, credential: CommunicationTokenCredential): Promise<string> => {\n async function fetchWithAuthentication(url: string, token: string): Promise<Response> {\n const headers = new Headers();\n headers.append('Authorization', `Bearer ${token}`);\n try {\n return await fetchWithTimeout(url, { headers });\n } catch (err) {\n throw new ChatError('ChatThreadClient.getMessage', err as Error);\n }\n }\n async function fetchWithTimeout(\n resource: string | URL | Request,\n options: { timeout?: number; headers?: Headers }\n ): Promise<Response> {\n // default timeout is 30 seconds\n const { timeout = 30000 } = options;\n\n const controller = new AbortController();\n const id = setTimeout(() => controller.abort(), timeout);\n\n const response = await fetch(resource, {\n ...options,\n signal: controller.signal\n });\n clearTimeout(id);\n return response;\n }\n const accessToken = await credential.getToken();\n const response = await fetchWithAuthentication(src, accessToken.token);\n const blob = await response.blob();\n return URL.createObjectURL(blob);\n};\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\ninterface ImageRequest {\n (request: string, credential: CommunicationTokenCredential): Promise<string>;\n}\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n/**\n * @private\n */\nexport class ResourceDownloadError extends Error {\n public chatMessageWithStatus: ChatMessageWithStatus;\n\n constructor(chatMessageWithStatus: ChatMessageWithStatus) {\n super();\n this.chatMessageWithStatus = chatMessageWithStatus;\n }\n}\n"]}
1
+ {"version":3,"file":"ResourceDownloadQueue.js","sourceRoot":"","sources":["../../../../../chat-stateful-client/src/ResourceDownloadQueue.ts"],"names":[],"mappings":";;;;;;;;;AAIA,uEAAuE;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAM9C,uEAAuE;AACvE;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAMhC,YAAY,OAAoB,EAAE,UAAwC;QALlE,sCAAiC,GAA4B,EAAE,CAAC;QAEhE,aAAQ,GAAG,KAAK,CAAC;QAIvB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;IAEM,kCAAkC,CAAC,OAA8B;;QACtE,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,MAAM,kBAAkB,GAAG,MAAA,OAAO,CAAC,OAAO,0CAAE,WAAW,CAAC;QACxD,IAAI,kBAAkB,EAAE,CAAC;YACvB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,iCAAiC,EAAE,CAAC;gBACvD,MAAM,kBAAkB,GAAG,MAAA,MAAA,CAAC,CAAC,OAAO,0CAAE,WAAW,mCAAI,EAAE,CAAC;gBACxD,QAAQ,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC/F,IAAI,QAAQ,EAAE,CAAC;oBACb,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEM,UAAU,CAAC,OAA8B;QAC9C,0CAA0C;QAC1C,MAAM,IAAI,qBAAQ,OAAO,CAAE,C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C,OAAO,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAA,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ChatContext } from './ChatContext';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ChatError } from './ChatClientState';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport { ChatMessageWithStatus, ResourceFetchResult } from './types/ChatMessageWithStatus';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nimport type { CommunicationTokenCredential } from '@azure/communication-common';\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n/**\n * @private\n */\nexport class ResourceDownloadQueue {\n private _messagesNeedingResourceRetrieval: ChatMessageWithStatus[] = [];\n private _context: ChatContext;\n private isActive = false;\n private _credential: CommunicationTokenCredential;\n\n constructor(context: ChatContext, credential: CommunicationTokenCredential) {\n this._context = context;\n this._credential = credential;\n }\n\n public containsMessageWithSameAttachments(message: ChatMessageWithStatus): boolean {\n let contains = false;\n const incomingAttachment = message.content?.attachments;\n if (incomingAttachment) {\n for (const m of this._messagesNeedingResourceRetrieval) {\n const existingAttachment = m.content?.attachments ?? [];\n contains = incomingAttachment.every((element, index) => element === existingAttachment[index]);\n if (contains) {\n break;\n }\n }\n }\n\n return contains;\n }\n\n public addMessage(message: ChatMessageWithStatus): void {\n // make a copy of message and add to queue\n const copy = { ...message };\n this._messagesNeedingResourceRetrieval.push(copy);\n }\n\n public async startQueue(threadId: string, operation: ImageRequest, options?: { singleUrl: string }): Promise<void> {\n if (this.isActive) {\n return;\n }\n while (this._messagesNeedingResourceRetrieval.length > 0) {\n this.isActive = true;\n let message = this._messagesNeedingResourceRetrieval.shift();\n if (!message) {\n this.isActive = false;\n continue;\n }\n\n if (options) {\n const singleUrl = options.singleUrl;\n message = await this.downloadSingleUrl(message, singleUrl, operation);\n } else {\n message = await this.downloadAllPreviewUrls(message, operation);\n }\n this._context.setChatMessage(threadId, message);\n this.isActive = false;\n }\n }\n\n private async downloadSingleUrl(\n message: ChatMessageWithStatus,\n resourceUrl: string,\n operation: ImageRequest\n ): Promise<ChatMessageWithStatus> {\n const response: ResourceFetchResult = { sourceUrl: '' };\n try {\n const blobUrl = await this.downloadResource(operation, resourceUrl);\n response.sourceUrl = blobUrl;\n } catch (error) {\n response.error = error as Error;\n }\n\n message = { ...message, resourceCache: { ...message.resourceCache, [resourceUrl]: response } };\n return message;\n }\n\n private async downloadAllPreviewUrls(\n message: ChatMessageWithStatus,\n operation: ImageRequest\n ): Promise<ChatMessageWithStatus> {\n const attachments = message.content?.attachments;\n if (message.type === 'html' && attachments) {\n if (message.resourceCache === undefined) {\n message.resourceCache = {};\n }\n for (const attachment of attachments) {\n if (attachment.previewUrl && attachment.attachmentType === 'image') {\n const response: ResourceFetchResult = { sourceUrl: '' };\n try {\n const blobUrl = await this.downloadResource(operation, attachment.previewUrl);\n response.sourceUrl = blobUrl;\n } catch (error) {\n response.error = error as Error;\n }\n message.resourceCache[attachment.previewUrl] = response;\n }\n }\n }\n\n return message;\n }\n\n private async downloadResource(operation: ImageRequest, url: string): Promise<string> {\n const blobUrl = await operation(url, this._credential);\n return blobUrl;\n }\n}\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n/**\n * @private\n */\nexport const fetchImageSource = async (src: string, credential: CommunicationTokenCredential): Promise<string> => {\n async function fetchWithAuthentication(url: string, token: string): Promise<Response> {\n const headers = new Headers();\n headers.append('Authorization', `Bearer ${token}`);\n try {\n return await fetchWithTimeout(url, { headers });\n } catch (err) {\n throw new ChatError('ChatThreadClient.getMessage', err as Error);\n }\n }\n async function fetchWithTimeout(\n resource: string | URL | Request,\n options: { timeout?: number; headers?: Headers }\n ): Promise<Response> {\n // default timeout is 30 seconds\n const { timeout = 30000 } = options;\n\n const controller = new AbortController();\n const id = setTimeout(() => controller.abort(), timeout);\n\n const response = await fetch(resource, {\n ...options,\n signal: controller.signal\n });\n clearTimeout(id);\n return response;\n }\n const accessToken = await credential.getToken();\n const response = await fetchWithAuthentication(src, accessToken.token);\n const blob = await response.blob();\n return URL.createObjectURL(blob);\n};\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\ninterface ImageRequest {\n (request: string, credential: CommunicationTokenCredential): Promise<string>;\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  export { createStatefulChatClient, _createStatefulChatClientInner, _createStatefulChatClientWithDeps } from './StatefulChatClient';
2
2
  export type { StatefulChatClient, StatefulChatClientArgs, StatefulChatClientOptions } from './StatefulChatClient';
3
3
  export type { ChatMessageWithStatus } from './types/ChatMessageWithStatus';
4
+ export type { ResourceFetchResult } from './types/ChatMessageWithStatus';
4
5
  export { ChatError } from './ChatClientState';
5
6
  export type { ChatClientState, ChatErrors, ChatThreadClientState, ChatThreadProperties, ChatErrorTarget } from './ChatClientState';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../chat-stateful-client/src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,iCAAiC,EAClC,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport {\n createStatefulChatClient,\n _createStatefulChatClientInner,\n _createStatefulChatClientWithDeps\n} from './StatefulChatClient';\nexport type { StatefulChatClient, StatefulChatClientArgs, StatefulChatClientOptions } from './StatefulChatClient';\nexport type { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\nexport { ChatError } from './ChatClientState';\nexport type {\n ChatClientState,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget\n} from './ChatClientState';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../chat-stateful-client/src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,iCAAiC,EAClC,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport {\n createStatefulChatClient,\n _createStatefulChatClientInner,\n _createStatefulChatClientWithDeps\n} from './StatefulChatClient';\nexport type { StatefulChatClient, StatefulChatClientArgs, StatefulChatClientOptions } from './StatefulChatClient';\nexport type { ChatMessageWithStatus } from './types/ChatMessageWithStatus';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nexport type { ResourceFetchResult } from './types/ChatMessageWithStatus';\nexport { ChatError } from './ChatClientState';\nexport type {\n ChatClientState,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget\n} from './ChatClientState';\n"]}
@@ -12,6 +12,14 @@ export type ChatMessageWithStatus = ChatMessage & {
12
12
  clientMessageId?: string;
13
13
  status: MessageStatus;
14
14
  policyViolation?: boolean;
15
- resourceCache?: Record<string, string>;
15
+ resourceCache?: Record<string, ResourceFetchResult>;
16
+ };
17
+ /**
18
+ * Result of the Resource downloaded from stateful client
19
+ * @public
20
+ */
21
+ export type ResourceFetchResult = {
22
+ sourceUrl: string;
23
+ error?: Error;
16
24
  };
17
25
  //# sourceMappingURL=ChatMessageWithStatus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatMessageWithStatus.js","sourceRoot":"","sources":["../../../../../../chat-stateful-client/src/types/ChatMessageWithStatus.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ChatMessage } from '@azure/communication-chat';\nimport { MessageStatus } from '@internal/acs-ui-common';\n\n/**\n * An extension to {@link @azure/communication-chat#ChatMessage} that stores\n * client-side only metadata for chat messages.\n *\n * TODO: The name has bitrotted. Rename me.\n *\n * @public\n */\nexport type ChatMessageWithStatus = ChatMessage & {\n clientMessageId?: string;\n status: MessageStatus;\n /* @conditional-compile-remove(data-loss-prevention) */\n policyViolation?: boolean;\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n resourceCache?: Record<string, string>;\n};\n"]}
1
+ {"version":3,"file":"ChatMessageWithStatus.js","sourceRoot":"","sources":["../../../../../../chat-stateful-client/src/types/ChatMessageWithStatus.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { ChatMessage } from '@azure/communication-chat';\nimport { MessageStatus } from '@internal/acs-ui-common';\n\n/**\n * An extension to {@link @azure/communication-chat#ChatMessage} that stores\n * client-side only metadata for chat messages.\n *\n * TODO: The name has bitrotted. Rename me.\n *\n * @public\n */\nexport type ChatMessageWithStatus = ChatMessage & {\n clientMessageId?: string;\n status: MessageStatus;\n /* @conditional-compile-remove(data-loss-prevention) */\n policyViolation?: boolean;\n /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n resourceCache?: Record<string, ResourceFetchResult>;\n};\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\n/**\n * Result of the Resource downloaded from stateful client\n * @public\n */\nexport type ResourceFetchResult = {\n sourceUrl: string;\n error?: Error;\n};\n"]}
@@ -40,14 +40,14 @@ export type { MentionOptions, MentionDisplayOptions, MentionLookupOptions, Menti
40
40
  export type { _IdentifierProviderProps, _Identifiers, ActiveErrorMessage, BaseCustomStyles, CallParticipantListParticipant, CameraButtonContextualMenuStyles, CameraButtonProps, CameraButtonStrings, CameraButtonStyles, ChatMessage, CommunicationParticipant, ComponentLocale, ComponentSlotStyle, ComponentStrings, ContentSystemMessage, ControlBarButtonProps, ControlBarButtonStrings, ControlBarButtonStyles, ControlBarLayout, ControlBarProps, CreateVideoStreamViewResult, CustomAvatarOptions, CustomMessage, DevicesButtonContextualMenuStyles, DevicesButtonProps, DevicesButtonStrings, DevicesButtonStyles, EndCallButtonProps, EndCallButtonStrings, ErrorBarProps, ErrorBarStrings, ErrorType, GridLayoutProps, GridLayoutStyles, HorizontalGalleryStyles, JumpToNewMessageButtonProps, LocalizationProviderProps, LocalVideoCameraCycleButtonProps, LoadingState, Message, MessageAttachedStatus, MessageCommon, MessageContentType, MessageProps, MessageRenderer, MessageStatusIndicatorProps, MessageStatusIndicatorStrings, MessageThreadProps, MessageThreadStrings, MessageThreadStyles, MicrophoneButtonContextualMenuStyles, MicrophoneButtonProps, MicrophoneButtonStrings, MicrophoneButtonStyles, OnRenderAvatarCallback, OptionsDevice, ParticipantAddedSystemMessage, ParticipantItemProps, ParticipantItemStrings, ParticipantItemStyles, ParticipantListItemStyles, ParticipantListParticipant, ParticipantListProps, ParticipantListStyles, ParticipantMenuItemsCallback, ParticipantRemovedSystemMessage, ParticipantState, ParticipantsButtonContextualMenuStyles, ParticipantsButtonProps, ParticipantsButtonStrings, ParticipantsButtonStyles, ReadReceiptsBySenderId, ScreenShareButtonProps, ScreenShareButtonStrings, SendBoxProps, SendBoxStrings, SendBoxStylesProps, StreamMediaProps, SystemMessage, SystemMessageCommon, TopicUpdatedSystemMessage, TypingIndicatorProps, TypingIndicatorStrings, TypingIndicatorStylesProps, UpdateMessageCallback, CancelEditCallback, VideoGalleryLayout, VideoGalleryLocalParticipant, VideoGalleryParticipant, VideoGalleryProps, VideoGalleryRemoteParticipant, VideoGalleryStream, VideoGalleryStrings, VideoGalleryStyles, VideoStreamOptions, VideoTileProps, VideoTileStylesProps, ViewScalingMode, VideoTileContextualMenuProps, VideoTileDrawerMenuProps } from '../../react-components/src';
41
41
  export type { RaiseHandButtonProps, RaiseHandButtonStrings, RaisedHand } from '../../react-components/src';
42
42
  export type { ReactionButtonStrings, Reaction, ReactionButtonProps, ReactionResources, ReactionSprite } from '../../react-components/src';
43
- export type { RichTextSendBoxStrings } from '../../react-components/src';
43
+ export { RichTextSendBox } from '../../react-components/src';
44
+ export type { RichTextSendBoxProps, RichTextSendBoxStrings } from '../../react-components/src';
44
45
  export type { Spotlight } from '../../react-components/src';
45
46
  export type { ImageOverlayProps, ImageOverlayStrings } from '../../react-components/src';
46
47
  export type { BlockedMessage } from '../../react-components/src';
47
48
  export type { DialpadMode, DialpadProps, DialpadStrings, DialpadStyles, DtmfTone, LongPressTrigger } from '../../react-components/src';
48
49
  export type { ActiveFileUpload, SendBoxErrorBarError, FileDownloadHandler, FileDownloadError } from '../../react-components/src';
49
50
  export type { AttachmentMetadata } from '../../react-components/src';
50
- export type { FileMetadata } from '../../react-components/src';
51
51
  export type { ChatAttachmentType } from '../../react-components/src';
52
52
  export type { InlineImageOptions, InlineImage } from '../../react-components/src';
53
53
  export type { HoldButtonProps, HoldButtonStrings, VideoTileStrings } from '../../react-components/src';
@@ -61,6 +61,7 @@ export * from '../../calling-stateful-client/src/index-public';
61
61
  export type { DeclarativeCallAgent } from '../../calling-stateful-client/src';
62
62
  export { createStatefulChatClient } from '../../chat-stateful-client/src';
63
63
  export type { StatefulChatClient, StatefulChatClientArgs, StatefulChatClientOptions, ChatMessageWithStatus, ChatClientState, ChatError, ChatErrors, ChatThreadClientState, ChatThreadProperties, ChatErrorTarget } from '../../chat-stateful-client/src';
64
+ export type { ResourceFetchResult } from '../../chat-stateful-client/src';
64
65
  export * from '../../react-composites/src/index-public';
65
66
  export * from './mergedHooks';
66
67
  export { UnsupportedBrowser } from '../../react-components/src';
@@ -32,6 +32,8 @@ export { RaiseHandButton } from '../../react-components/src';
32
32
  export { Dialpad } from '../../react-components/src';
33
33
  /* @conditional-compile-remove(call-readiness) */
34
34
  export { CameraAndMicrophoneSitePermissions, MicrophoneSitePermissions, CameraSitePermissions } from '../../react-components/src';
35
+ /* @conditional-compile-remove(rich-text-editor) */
36
+ export { RichTextSendBox } from '../../react-components/src';
35
37
  export * from '../../react-components/src/localization/locales';
36
38
  export * from '../../react-components/src/theming';
37
39
  export * from '../../calling-stateful-client/src/index-public';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAmCzG,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,sCAAsC,CAAC;AAE9C,yDAAyD;AACzD,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,iCAAiC,EAClC,MAAM,sCAAsC,CAAC;AAuB9C,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EAC1B,MAAM,mCAAmC,CAAC;AAU3C,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,UAAU,EACV,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,OAAO,EACP,WAAW,EACX,eAAe,EACf,YAAY,EACZ,SAAS,EACT,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACvB,MAAM,4BAA4B,CAAC;AACpC,gDAAgD;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,6CAA6C;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,6CAA6C;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,0CAA0C,CAAC,6CAA6C;AACxF,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,iDAAiD;AACjD,OAAO,EACL,kCAAkC,EAClC,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AAwLpC,cAAc,iDAAiD,CAAC;AAChE,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAG/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAa1E,cAAc,yCAAyC,CAAC;AACxD,cAAc,eAAe,CAAC;AAE9B,sDAAsD;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,sDAAsD;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAGvE,sDAAsD;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * `@azure/communication-react` is an npm package that exports the functionality of the Azure Communication Services - UI Library.\n *\n * This package makes it easy for you to build modern communications user experiences using Azure Communication Services. It gives you a library of production-ready UI components that you can drop into your applications:\n * - Composites: These components are turn-key solutions that implement common communication scenarios. You can quickly add video calling or chat experiences to your applications. Composites are open-source higher order components built using UI components.\n * - UI Components - These components are open-source building blocks that let you build custom communications experience. Components are offered for both calling and chat capabilities that can be combined to build experiences.\n *\n * These UI client libraries all use Microsoft's Fluent design language and assets. Fluent UI provides a foundational layer for the UI Library and is actively used across Microsoft products.\n *\n * In conjunction with the UI components, the UI Library exposes a stateful client library for calling and chat. This client is agnostic to any specific state management framework and can be integrated with common state managers like Redux or React Context.\n * This stateful client library can be used with the UI Components to pass props and methods for the UI Components to render data. For more information, see Stateful Client Overview.\n *\n * For more information visit: https://aka.ms/acsstorybook\n *\n * @packageDocumentation\n */\n\nexport { fromFlatCommunicationIdentifier, toFlatCommunicationIdentifier } from '../../acs-ui-common/src';\nexport type {\n AreEqual,\n CommonProperties,\n MessageStatus,\n Common,\n AreTypeEqual,\n AreParamEqual\n} from '../../acs-ui-common/src';\n\n// Not to export chat/calling specific hook from binding package\nexport type {\n CallClientProviderProps,\n CallAgentProviderProps,\n CallProviderProps,\n GetCallingSelector,\n CallingHandlers,\n CallingBaseSelectorProps,\n CommonCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(video-background-effects) */\nexport type { VideoBackgroundEffectsDependency, CallingHandlersOptions } from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(close-captions) */\nexport type { CaptionsOptions } from '../../calling-component-bindings/src';\n\nexport type {\n ChatClientProviderProps,\n ChatThreadClientProviderProps,\n GetChatSelector,\n ChatHandlers,\n ChatBaseSelectorProps\n} from '../../chat-component-bindings/src';\n\nexport {\n CallClientProvider,\n CallAgentProvider,\n CallProvider,\n useCallClient,\n useCallAgent,\n useCall,\n useDeviceManager,\n getCallingSelector,\n createDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport {\n useTeamsCallAgent,\n useTeamsCall,\n createDefaultTeamsCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport type { TeamsCallingHandlers } from '../../calling-component-bindings/src';\n\nexport type {\n ScreenShareButtonSelector,\n CameraButtonSelector,\n VideoGallerySelector,\n DevicesButtonSelector,\n EmptySelector,\n ErrorBarSelector as CallErrorBarSelector,\n ParticipantListSelector,\n MicrophoneButtonSelector,\n ParticipantsButtonSelector,\n CreateDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonSelector } from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(raise-hand) */\nexport type { RaiseHandButtonSelector } from '../../calling-component-bindings/src';\n\nexport {\n ChatClientProvider,\n ChatThreadClientProvider,\n useChatClient,\n useChatThreadClient,\n getChatSelector,\n createDefaultChatHandlers\n} from '../../chat-component-bindings/src';\n\nexport type {\n MessageThreadSelector,\n TypingIndicatorSelector,\n ChatParticipantListSelector,\n SendBoxSelector,\n ErrorBarSelector as ChatErrorBarSelector\n} from '../../chat-component-bindings/src';\n\nexport {\n _IdentifierProvider,\n CameraButton,\n ControlBar,\n ControlBarButton,\n DevicesButton,\n EndCallButton,\n ErrorBar,\n GridLayout,\n LocalizationProvider,\n MessageStatusIndicator,\n MessageThread,\n MicrophoneButton,\n ParticipantItem,\n ParticipantList,\n ParticipantsButton,\n ScreenShareButton,\n SendBox,\n StreamMedia,\n TypingIndicator,\n VideoGallery,\n VideoTile,\n COMPONENT_LOCALE_EN_GB,\n COMPONENT_LOCALE_AR_SA,\n COMPONENT_LOCALE_CS_CZ,\n COMPONENT_LOCALE_DE_DE,\n COMPONENT_LOCALE_ES_ES,\n COMPONENT_LOCALE_FI_FI,\n COMPONENT_LOCALE_FR_FR,\n COMPONENT_LOCALE_HE_IL,\n COMPONENT_LOCALE_IT_IT,\n COMPONENT_LOCALE_JA_JP,\n COMPONENT_LOCALE_KO_KR,\n COMPONENT_LOCALE_NB_NO,\n COMPONENT_LOCALE_NL_NL,\n COMPONENT_LOCALE_PL_PL,\n COMPONENT_LOCALE_PT_BR,\n COMPONENT_LOCALE_RU_RU,\n COMPONENT_LOCALE_SV_SE,\n COMPONENT_LOCALE_TR_TR,\n COMPONENT_LOCALE_ZH_CN,\n COMPONENT_LOCALE_ZH_TW\n} from '../../react-components/src';\n/* @conditional-compile-remove(image-overlay) */\nexport { ImageOverlay } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport { HoldButton } from '../../react-components/src';\n\n/* @conditional-compile-remove(raise-hand) */\nexport { RaiseHandButton } from '../../react-components/src';\n\n/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */\nexport { Dialpad } from '../../react-components/src';\n\n/* @conditional-compile-remove(call-readiness) */\nexport {\n CameraAndMicrophoneSitePermissions,\n MicrophoneSitePermissions,\n CameraSitePermissions\n} from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n CameraAndMicrophoneSitePermissionsStrings,\n CameraAndMicrophoneSitePermissionsProps,\n CameraSitePermissionsStrings,\n CameraSitePermissionsProps,\n CommonSitePermissionsProps,\n SitePermissionsStrings,\n SitePermissionsStyles,\n MicrophoneSitePermissionsStrings,\n MicrophoneSitePermissionsProps\n} from '../../react-components/src';\n\n/* @conditional-compile-remove(total-participant-count) */\nexport type { ParticipantListStrings } from '../../react-components/src';\n\n/* @conditional-compile-remove(mention) */\nexport type {\n MentionOptions,\n MentionDisplayOptions,\n MentionLookupOptions,\n Mention,\n MentionPopoverStrings\n} from '../../react-components/src';\n\nexport type {\n _IdentifierProviderProps,\n _Identifiers,\n ActiveErrorMessage,\n BaseCustomStyles,\n CallParticipantListParticipant,\n CameraButtonContextualMenuStyles,\n CameraButtonProps,\n CameraButtonStrings,\n CameraButtonStyles,\n ChatMessage,\n CommunicationParticipant,\n ComponentLocale,\n ComponentSlotStyle,\n ComponentStrings,\n ContentSystemMessage,\n ControlBarButtonProps,\n ControlBarButtonStrings,\n ControlBarButtonStyles,\n ControlBarLayout,\n ControlBarProps,\n CreateVideoStreamViewResult,\n CustomAvatarOptions,\n CustomMessage,\n DevicesButtonContextualMenuStyles,\n DevicesButtonProps,\n DevicesButtonStrings,\n DevicesButtonStyles,\n EndCallButtonProps,\n EndCallButtonStrings,\n ErrorBarProps,\n ErrorBarStrings,\n ErrorType,\n GridLayoutProps,\n GridLayoutStyles,\n HorizontalGalleryStyles,\n JumpToNewMessageButtonProps,\n LocalizationProviderProps,\n LocalVideoCameraCycleButtonProps,\n LoadingState,\n Message,\n MessageAttachedStatus,\n MessageCommon,\n MessageContentType,\n MessageProps,\n MessageRenderer,\n MessageStatusIndicatorProps,\n MessageStatusIndicatorStrings,\n MessageThreadProps,\n MessageThreadStrings,\n MessageThreadStyles,\n MicrophoneButtonContextualMenuStyles,\n MicrophoneButtonProps,\n MicrophoneButtonStrings,\n MicrophoneButtonStyles,\n OnRenderAvatarCallback,\n OptionsDevice,\n ParticipantAddedSystemMessage,\n ParticipantItemProps,\n ParticipantItemStrings,\n ParticipantItemStyles,\n ParticipantListItemStyles,\n ParticipantListParticipant,\n ParticipantListProps,\n ParticipantListStyles,\n ParticipantMenuItemsCallback,\n ParticipantRemovedSystemMessage,\n ParticipantState,\n ParticipantsButtonContextualMenuStyles,\n ParticipantsButtonProps,\n ParticipantsButtonStrings,\n ParticipantsButtonStyles,\n ReadReceiptsBySenderId,\n ScreenShareButtonProps,\n ScreenShareButtonStrings,\n SendBoxProps,\n SendBoxStrings,\n SendBoxStylesProps,\n StreamMediaProps,\n SystemMessage,\n SystemMessageCommon,\n TopicUpdatedSystemMessage,\n TypingIndicatorProps,\n TypingIndicatorStrings,\n TypingIndicatorStylesProps,\n UpdateMessageCallback,\n CancelEditCallback,\n VideoGalleryLayout,\n VideoGalleryLocalParticipant,\n VideoGalleryParticipant,\n VideoGalleryProps,\n VideoGalleryRemoteParticipant,\n VideoGalleryStream,\n VideoGalleryStrings,\n VideoGalleryStyles,\n VideoStreamOptions,\n VideoTileProps,\n VideoTileStylesProps,\n ViewScalingMode,\n VideoTileContextualMenuProps,\n VideoTileDrawerMenuProps\n} from '../../react-components/src';\n/* @conditional-compile-remove(raise-hand) */\nexport type { RaiseHandButtonProps, RaiseHandButtonStrings, RaisedHand } from '../../react-components/src';\n/* @conditional-compile-remove(reaction) */\nexport type {\n ReactionButtonStrings,\n Reaction,\n ReactionButtonProps,\n ReactionResources,\n ReactionSprite\n} from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport type { RichTextSendBoxStrings } from '../../react-components/src';\n/* @conditional-compile-remove(spotlight) */\nexport type { Spotlight } from '../../react-components/src';\n/* @conditional-compile-remove(image-overlay) */\nexport type { ImageOverlayProps, ImageOverlayStrings } from '../../react-components/src';\n/* @conditional-compile-remove(data-loss-prevention) */\nexport type { BlockedMessage } from '../../react-components/src';\n/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */\nexport type {\n DialpadMode,\n DialpadProps,\n DialpadStrings,\n DialpadStyles,\n DtmfTone,\n LongPressTrigger\n} from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing) */\nexport type {\n ActiveFileUpload,\n SendBoxErrorBarError,\n FileDownloadHandler,\n FileDownloadError\n} from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing) */\nexport type { AttachmentMetadata } from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing) */\nexport type { FileMetadata } from '../../react-components/src';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nexport type { ChatAttachmentType } from '../../react-components/src';\n/* @conditional-compile-remove(image-overlay) */\nexport type { InlineImageOptions, InlineImage } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonProps, HoldButtonStrings, VideoTileStrings } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type { BrowserPermissionDeniedStrings, BrowserPermissionDeniedProps } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n BrowserPermissionDeniedIOSStrings,\n BrowserPermissionDeniedStyles,\n BrowserPermissionDeniedIOSProps\n} from '../../react-components/src';\n/* @conditional-compile-remove(vertical-gallery) */\nexport type { OverflowGalleryPosition } from '../../react-components/src';\n/* @conditional-compile-remove(click-to-call) */ /* @conditional-compile-remove(rooms) */\nexport type { LocalVideoTileSize } from '../../react-components/src';\nexport * from '../../react-components/src/localization/locales';\nexport * from '../../react-components/src/theming';\nexport * from '../../calling-stateful-client/src/index-public';\n/* @conditional-compile-remove(one-to-n-calling) */\nexport type { DeclarativeCallAgent } from '../../calling-stateful-client/src';\nexport { createStatefulChatClient } from '../../chat-stateful-client/src';\nexport type {\n StatefulChatClient,\n StatefulChatClientArgs,\n StatefulChatClientOptions,\n ChatMessageWithStatus,\n ChatClientState,\n ChatError,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget\n} from '../../chat-stateful-client/src';\nexport * from '../../react-composites/src/index-public';\nexport * from './mergedHooks';\n\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowser } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserStrings, UnsupportedBrowserProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowserVersion } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserVersionStrings, UnsupportedBrowserVersionProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedOperatingSystem } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedOperatingSystemStrings, UnsupportedOperatingSystemProps } from '../../react-components/src';\n/* @conditional-compile-remove(vertical-gallery) */\nexport type {\n VerticalGalleryStyles,\n VerticalGalleryStrings,\n VerticalGalleryControlBarStyles\n} from '../../react-components/src';\n/* @conditional-compile-remove(close-captions) */\nexport type { SpokenLanguageStrings, CaptionLanguageStrings } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { SurveyIssues } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { SurveyIssuesHeadingStrings } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { CallSurveyImprovementSuggestions } from '../../react-components/src';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;;;;;;;GAeG;AAEH,OA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AC,6CAA6C;AACxF,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,iDAAiD;AACjD,OAAO,EACL,kCAAkC,EAClC,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AA0IpC,mDAAmD;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AA6C7D,cAAc,iDAAiD,CAAC;AAChE,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAG/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAgB1E,cAAc,yCAAyC,CAAC;AACxD,cAAc,eAAe,CAAC;AAE9B,sDAAsD;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,sDAAsD;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAGvE,sDAAsD;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * `@azure/communication-react` is an npm package that exports the functionality of the Azure Communication Services - UI Library.\n *\n * This package makes it easy for you to build modern communications user experiences using Azure Communication Services. It gives you a library of production-ready UI components that you can drop into your applications:\n * - Composites: These components are turn-key solutions that implement common communication scenarios. You can quickly add video calling or chat experiences to your applications. Composites are open-source higher order components built using UI components.\n * - UI Components - These components are open-source building blocks that let you build custom communications experience. Components are offered for both calling and chat capabilities that can be combined to build experiences.\n *\n * These UI client libraries all use Microsoft's Fluent design language and assets. Fluent UI provides a foundational layer for the UI Library and is actively used across Microsoft products.\n *\n * In conjunction with the UI components, the UI Library exposes a stateful client library for calling and chat. This client is agnostic to any specific state management framework and can be integrated with common state managers like Redux or React Context.\n * This stateful client library can be used with the UI Components to pass props and methods for the UI Components to render data. For more information, see Stateful Client Overview.\n *\n * For more information visit: https://aka.ms/acsstorybook\n *\n * @packageDocumentation\n */\n\nexport { fromFlatCommunicationIdentifier, toFlatCommunicationIdentifier } from '../../acs-ui-common/src';\nexport type {\n AreEqual,\n CommonProperties,\n MessageStatus,\n Common,\n AreTypeEqual,\n AreParamEqual\n} from '../../acs-ui-common/src';\n\n// Not to export chat/calling specific hook from binding package\nexport type {\n CallClientProviderProps,\n CallAgentProviderProps,\n CallProviderProps,\n GetCallingSelector,\n CallingHandlers,\n CallingBaseSelectorProps,\n CommonCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(video-background-effects) */\nexport type { VideoBackgroundEffectsDependency, CallingHandlersOptions } from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(close-captions) */\nexport type { CaptionsOptions } from '../../calling-component-bindings/src';\n\nexport type {\n ChatClientProviderProps,\n ChatThreadClientProviderProps,\n GetChatSelector,\n ChatHandlers,\n ChatBaseSelectorProps\n} from '../../chat-component-bindings/src';\n\nexport {\n CallClientProvider,\n CallAgentProvider,\n CallProvider,\n useCallClient,\n useCallAgent,\n useCall,\n useDeviceManager,\n getCallingSelector,\n createDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport {\n useTeamsCallAgent,\n useTeamsCall,\n createDefaultTeamsCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport type { TeamsCallingHandlers } from '../../calling-component-bindings/src';\n\nexport type {\n ScreenShareButtonSelector,\n CameraButtonSelector,\n VideoGallerySelector,\n DevicesButtonSelector,\n EmptySelector,\n ErrorBarSelector as CallErrorBarSelector,\n ParticipantListSelector,\n MicrophoneButtonSelector,\n ParticipantsButtonSelector,\n CreateDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonSelector } from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(raise-hand) */\nexport type { RaiseHandButtonSelector } from '../../calling-component-bindings/src';\n\nexport {\n ChatClientProvider,\n ChatThreadClientProvider,\n useChatClient,\n useChatThreadClient,\n getChatSelector,\n createDefaultChatHandlers\n} from '../../chat-component-bindings/src';\n\nexport type {\n MessageThreadSelector,\n TypingIndicatorSelector,\n ChatParticipantListSelector,\n SendBoxSelector,\n ErrorBarSelector as ChatErrorBarSelector\n} from '../../chat-component-bindings/src';\n\nexport {\n _IdentifierProvider,\n CameraButton,\n ControlBar,\n ControlBarButton,\n DevicesButton,\n EndCallButton,\n ErrorBar,\n GridLayout,\n LocalizationProvider,\n MessageStatusIndicator,\n MessageThread,\n MicrophoneButton,\n ParticipantItem,\n ParticipantList,\n ParticipantsButton,\n ScreenShareButton,\n SendBox,\n StreamMedia,\n TypingIndicator,\n VideoGallery,\n VideoTile,\n COMPONENT_LOCALE_EN_GB,\n COMPONENT_LOCALE_AR_SA,\n COMPONENT_LOCALE_CS_CZ,\n COMPONENT_LOCALE_DE_DE,\n COMPONENT_LOCALE_ES_ES,\n COMPONENT_LOCALE_FI_FI,\n COMPONENT_LOCALE_FR_FR,\n COMPONENT_LOCALE_HE_IL,\n COMPONENT_LOCALE_IT_IT,\n COMPONENT_LOCALE_JA_JP,\n COMPONENT_LOCALE_KO_KR,\n COMPONENT_LOCALE_NB_NO,\n COMPONENT_LOCALE_NL_NL,\n COMPONENT_LOCALE_PL_PL,\n COMPONENT_LOCALE_PT_BR,\n COMPONENT_LOCALE_RU_RU,\n COMPONENT_LOCALE_SV_SE,\n COMPONENT_LOCALE_TR_TR,\n COMPONENT_LOCALE_ZH_CN,\n COMPONENT_LOCALE_ZH_TW\n} from '../../react-components/src';\n/* @conditional-compile-remove(image-overlay) */\nexport { ImageOverlay } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport { HoldButton } from '../../react-components/src';\n\n/* @conditional-compile-remove(raise-hand) */\nexport { RaiseHandButton } from '../../react-components/src';\n\n/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */\nexport { Dialpad } from '../../react-components/src';\n\n/* @conditional-compile-remove(call-readiness) */\nexport {\n CameraAndMicrophoneSitePermissions,\n MicrophoneSitePermissions,\n CameraSitePermissions\n} from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n CameraAndMicrophoneSitePermissionsStrings,\n CameraAndMicrophoneSitePermissionsProps,\n CameraSitePermissionsStrings,\n CameraSitePermissionsProps,\n CommonSitePermissionsProps,\n SitePermissionsStrings,\n SitePermissionsStyles,\n MicrophoneSitePermissionsStrings,\n MicrophoneSitePermissionsProps\n} from '../../react-components/src';\n\n/* @conditional-compile-remove(total-participant-count) */\nexport type { ParticipantListStrings } from '../../react-components/src';\n\n/* @conditional-compile-remove(mention) */\nexport type {\n MentionOptions,\n MentionDisplayOptions,\n MentionLookupOptions,\n Mention,\n MentionPopoverStrings\n} from '../../react-components/src';\n\nexport type {\n _IdentifierProviderProps,\n _Identifiers,\n ActiveErrorMessage,\n BaseCustomStyles,\n CallParticipantListParticipant,\n CameraButtonContextualMenuStyles,\n CameraButtonProps,\n CameraButtonStrings,\n CameraButtonStyles,\n ChatMessage,\n CommunicationParticipant,\n ComponentLocale,\n ComponentSlotStyle,\n ComponentStrings,\n ContentSystemMessage,\n ControlBarButtonProps,\n ControlBarButtonStrings,\n ControlBarButtonStyles,\n ControlBarLayout,\n ControlBarProps,\n CreateVideoStreamViewResult,\n CustomAvatarOptions,\n CustomMessage,\n DevicesButtonContextualMenuStyles,\n DevicesButtonProps,\n DevicesButtonStrings,\n DevicesButtonStyles,\n EndCallButtonProps,\n EndCallButtonStrings,\n ErrorBarProps,\n ErrorBarStrings,\n ErrorType,\n GridLayoutProps,\n GridLayoutStyles,\n HorizontalGalleryStyles,\n JumpToNewMessageButtonProps,\n LocalizationProviderProps,\n LocalVideoCameraCycleButtonProps,\n LoadingState,\n Message,\n MessageAttachedStatus,\n MessageCommon,\n MessageContentType,\n MessageProps,\n MessageRenderer,\n MessageStatusIndicatorProps,\n MessageStatusIndicatorStrings,\n MessageThreadProps,\n MessageThreadStrings,\n MessageThreadStyles,\n MicrophoneButtonContextualMenuStyles,\n MicrophoneButtonProps,\n MicrophoneButtonStrings,\n MicrophoneButtonStyles,\n OnRenderAvatarCallback,\n OptionsDevice,\n ParticipantAddedSystemMessage,\n ParticipantItemProps,\n ParticipantItemStrings,\n ParticipantItemStyles,\n ParticipantListItemStyles,\n ParticipantListParticipant,\n ParticipantListProps,\n ParticipantListStyles,\n ParticipantMenuItemsCallback,\n ParticipantRemovedSystemMessage,\n ParticipantState,\n ParticipantsButtonContextualMenuStyles,\n ParticipantsButtonProps,\n ParticipantsButtonStrings,\n ParticipantsButtonStyles,\n ReadReceiptsBySenderId,\n ScreenShareButtonProps,\n ScreenShareButtonStrings,\n SendBoxProps,\n SendBoxStrings,\n SendBoxStylesProps,\n StreamMediaProps,\n SystemMessage,\n SystemMessageCommon,\n TopicUpdatedSystemMessage,\n TypingIndicatorProps,\n TypingIndicatorStrings,\n TypingIndicatorStylesProps,\n UpdateMessageCallback,\n CancelEditCallback,\n VideoGalleryLayout,\n VideoGalleryLocalParticipant,\n VideoGalleryParticipant,\n VideoGalleryProps,\n VideoGalleryRemoteParticipant,\n VideoGalleryStream,\n VideoGalleryStrings,\n VideoGalleryStyles,\n VideoStreamOptions,\n VideoTileProps,\n VideoTileStylesProps,\n ViewScalingMode,\n VideoTileContextualMenuProps,\n VideoTileDrawerMenuProps\n} from '../../react-components/src';\n/* @conditional-compile-remove(raise-hand) */\nexport type { RaiseHandButtonProps, RaiseHandButtonStrings, RaisedHand } from '../../react-components/src';\n/* @conditional-compile-remove(reaction) */\nexport type {\n ReactionButtonStrings,\n Reaction,\n ReactionButtonProps,\n ReactionResources,\n ReactionSprite\n} from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport { RichTextSendBox } from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport type { RichTextSendBoxProps, RichTextSendBoxStrings } from '../../react-components/src';\n/* @conditional-compile-remove(spotlight) */\nexport type { Spotlight } from '../../react-components/src';\n/* @conditional-compile-remove(image-overlay) */\nexport type { ImageOverlayProps, ImageOverlayStrings } from '../../react-components/src';\n/* @conditional-compile-remove(data-loss-prevention) */\nexport type { BlockedMessage } from '../../react-components/src';\n/* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */\nexport type {\n DialpadMode,\n DialpadProps,\n DialpadStrings,\n DialpadStyles,\n DtmfTone,\n LongPressTrigger\n} from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing) */\nexport type {\n ActiveFileUpload,\n SendBoxErrorBarError,\n FileDownloadHandler,\n FileDownloadError\n} from '../../react-components/src';\n/* @conditional-compile-remove(file-sharing) */\nexport type { AttachmentMetadata } from '../../react-components/src';\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nexport type { ChatAttachmentType } from '../../react-components/src';\n/* @conditional-compile-remove(image-overlay) */\nexport type { InlineImageOptions, InlineImage } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonProps, HoldButtonStrings, VideoTileStrings } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type { BrowserPermissionDeniedStrings, BrowserPermissionDeniedProps } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n BrowserPermissionDeniedIOSStrings,\n BrowserPermissionDeniedStyles,\n BrowserPermissionDeniedIOSProps\n} from '../../react-components/src';\n/* @conditional-compile-remove(vertical-gallery) */\nexport type { OverflowGalleryPosition } from '../../react-components/src';\n/* @conditional-compile-remove(click-to-call) */ /* @conditional-compile-remove(rooms) */\nexport type { LocalVideoTileSize } from '../../react-components/src';\nexport * from '../../react-components/src/localization/locales';\nexport * from '../../react-components/src/theming';\nexport * from '../../calling-stateful-client/src/index-public';\n/* @conditional-compile-remove(one-to-n-calling) */\nexport type { DeclarativeCallAgent } from '../../calling-stateful-client/src';\nexport { createStatefulChatClient } from '../../chat-stateful-client/src';\nexport type {\n StatefulChatClient,\n StatefulChatClientArgs,\n StatefulChatClientOptions,\n ChatMessageWithStatus,\n ChatClientState,\n ChatError,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget\n} from '../../chat-stateful-client/src';\n\n/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */\nexport type { ResourceFetchResult } from '../../chat-stateful-client/src';\nexport * from '../../react-composites/src/index-public';\nexport * from './mergedHooks';\n\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowser } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserStrings, UnsupportedBrowserProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowserVersion } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserVersionStrings, UnsupportedBrowserVersionProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedOperatingSystem } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedOperatingSystemStrings, UnsupportedOperatingSystemProps } from '../../react-components/src';\n/* @conditional-compile-remove(vertical-gallery) */\nexport type {\n VerticalGalleryStyles,\n VerticalGalleryStrings,\n VerticalGalleryControlBarStyles\n} from '../../react-components/src';\n/* @conditional-compile-remove(close-captions) */\nexport type { SpokenLanguageStrings, CaptionLanguageStrings } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { SurveyIssues } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { SurveyIssuesHeadingStrings } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { CallSurveyImprovementSuggestions } from '../../react-components/src';\n"]}
@@ -25,12 +25,12 @@ export const _CaptionsSettingsModal = (props) => {
25
25
  const theme = useTheme();
26
26
  const [hasSetSpokenLanguage, setHasSetSpokenLanguage] = useState(false);
27
27
  const [selectedSpokenLanguage, setSelectedSpokenLanguage] = useState({
28
- key: currentSpokenLanguage !== null && currentSpokenLanguage !== void 0 ? currentSpokenLanguage : defaultSpokenLanguage,
29
- text: currentSpokenLanguage !== null && currentSpokenLanguage !== void 0 ? currentSpokenLanguage : defaultSpokenLanguage
28
+ key: currentSpokenLanguage || defaultSpokenLanguage,
29
+ text: currentSpokenLanguage || defaultSpokenLanguage
30
30
  });
31
31
  const [selectedCaptionLanguage, setSelectedCaptionLanguage] = useState({
32
- key: currentCaptionLanguage !== null && currentCaptionLanguage !== void 0 ? currentCaptionLanguage : _spokenLanguageToCaptionLanguage[selectedSpokenLanguage.key],
33
- text: currentCaptionLanguage !== null && currentCaptionLanguage !== void 0 ? currentCaptionLanguage : _spokenLanguageToCaptionLanguage[selectedSpokenLanguage.key]
32
+ key: currentCaptionLanguage || _spokenLanguageToCaptionLanguage[selectedSpokenLanguage.key],
33
+ text: currentCaptionLanguage || _spokenLanguageToCaptionLanguage[selectedSpokenLanguage.key]
34
34
  });
35
35
  useEffect(() => {
36
36
  // set spoken language when start captions with a spoken language specified.
@@ -1 +1 @@
1
- {"version":3,"file":"CaptionsSettingsModal.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/CaptionsSettingsModal.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAEL,KAAK,EACL,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,QAAQ,EAER,aAAa,EACb,aAAa,EACd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,yBAAyB,EACzB,YAAY,EACZ,0BAA0B,EAC1B,qBAAqB,EACrB,cAAc,EACd,gCAAgC,EAChC,cAAc,EACd,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE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AC,IAAI,IAAC,SAAS,EAAE,cAAc,IAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,0BAA0B,CAAQ;YAC7E,oBAAC,UAAU,IACT,SAAS,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,EACjC,SAAS,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,yCAAyC,EAC7D,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GACrC,CACI;QAER,oBAAC,KAAK,IAAC,SAAS,EAAE,0BAA0B,IAAG,yBAAyB,EAAE,CAAS;QACnF,oBAAC,KAAK,IAAC,UAAU,QAAC,eAAe,EAAC,KAAK,EAAC,SAAS,EAAE,yBAAyB;YAC1E,oBAAC,aAAa,IAAC,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,SAAS;gBAC5D,kCAAO,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,kCAAkC,CAAQ,CAC5C;YAChB,oBAAC,aAAa,IAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC;gBAC5D,kCAAO,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,iCAAiC,CAAQ,CAC3C,CACV,CACF,CAET,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useCallback } from 'react';\nimport { useMemo, useState, useEffect } from 'react';\nimport {\n IModalStyles,\n Modal,\n Stack,\n useTheme,\n Text,\n IconButton,\n Dropdown,\n IDropdownOption,\n DefaultButton,\n PrimaryButton\n} from '@fluentui/react';\n\nimport {\n buttonsContainerClassName,\n buttonStyles,\n dropdownContainerClassName,\n dropdownInfoTextStyle,\n dropdownStyles,\n themedCaptionsSettingsModalStyle,\n titleClassName,\n titleContainerClassName\n} from './styles/CaptionsSettingsModal.styles';\nimport { _captionsOptions } from './StartCaptionsButton';\nimport { defaultSpokenLanguage } from './utils';\nimport {\n SpokenLanguageStrings,\n CaptionLanguageStrings,\n _spokenLanguageToCaptionLanguage,\n _SupportedSpokenLanguage,\n _SupportedCaptionLanguage,\n SpokenLanguageDropdownOptions,\n CaptionLanguageDropdownOptions\n} from '../types';\nimport { _preventDismissOnEvent } from '@internal/acs-ui-common';\n\n/**\n * @internal\n * strings for captions setting modal\n */\nexport interface _CaptionsSettingsModalStrings {\n captionsSettingsModalTitle?: string;\n captionsSettingsSpokenLanguageDropdownLabel?: string;\n captionsSettingsCaptionLanguageDropdownLabel?: string;\n captionsSettingsSpokenLanguageDropdownInfoText?: string;\n captionsSettingsCaptionLanguageDropdownInfoText?: string;\n captionsSettingsConfirmButtonLabel?: string;\n captionsSettingsCancelButtonLabel?: string;\n captionsSettingsModalAriaLabel?: string;\n captionsSettingsCloseModalButtonAriaLabel?: string;\n}\n\n/**\n * @internal\n * _CaptionsSettingsModal Component Props.\n */\nexport interface _CaptionsSettingsModalProps {\n supportedSpokenLanguages: _SupportedSpokenLanguage[];\n supportedCaptionLanguages: _SupportedCaptionLanguage[];\n onSetSpokenLanguage: (language: _SupportedSpokenLanguage) => Promise<void>;\n onSetCaptionLanguage: (language: _SupportedCaptionLanguage) => Promise<void>;\n onStartCaptions: (options?: _captionsOptions) => Promise<void>;\n currentSpokenLanguage: _SupportedSpokenLanguage;\n currentCaptionLanguage: _SupportedCaptionLanguage;\n spokenLanguageStrings?: SpokenLanguageStrings;\n captionLanguageStrings?: CaptionLanguageStrings;\n isCaptionsFeatureActive?: boolean;\n strings?: _CaptionsSettingsModalStrings;\n showModal?: boolean;\n onDismissCaptionsSettings?: () => void;\n changeCaptionLanguage?: boolean;\n}\n\n/**\n * @internal\n * a component for setting spoken languages\n */\nexport const _CaptionsSettingsModal = (props: _CaptionsSettingsModalProps): JSX.Element => {\n const {\n supportedSpokenLanguages,\n supportedCaptionLanguages,\n currentSpokenLanguage,\n currentCaptionLanguage,\n isCaptionsFeatureActive,\n showModal,\n onSetSpokenLanguage,\n onSetCaptionLanguage,\n onDismissCaptionsSettings,\n onStartCaptions,\n strings,\n spokenLanguageStrings,\n captionLanguageStrings,\n changeCaptionLanguage = false\n } = props;\n\n const theme = useTheme();\n\n const [hasSetSpokenLanguage, setHasSetSpokenLanguage] = useState(false);\n\n const [selectedSpokenLanguage, setSelectedSpokenLanguage] = useState<SpokenLanguageDropdownOptions>({\n key: currentSpokenLanguage ?? defaultSpokenLanguage,\n text: currentSpokenLanguage ?? defaultSpokenLanguage\n });\n\n const [selectedCaptionLanguage, setSelectedCaptionLanguage] = useState<CaptionLanguageDropdownOptions>({\n key: currentCaptionLanguage ?? _spokenLanguageToCaptionLanguage[selectedSpokenLanguage.key],\n text: currentCaptionLanguage ?? _spokenLanguageToCaptionLanguage[selectedSpokenLanguage.key]\n });\n\n useEffect(() => {\n // set spoken language when start captions with a spoken language specified.\n // this is to fix the bug when a second user starts captions with a new spoken language, captions bot ignore that spoken language\n if (isCaptionsFeatureActive && !hasSetSpokenLanguage) {\n onSetSpokenLanguage(selectedSpokenLanguage.key);\n // we only need to call set spoken language once when first starting captions\n setHasSetSpokenLanguage(true);\n }\n }, [isCaptionsFeatureActive, onSetSpokenLanguage, selectedSpokenLanguage.key, hasSetSpokenLanguage]);\n\n const onDismiss = useCallback((): void => {\n if (onDismissCaptionsSettings) {\n onDismissCaptionsSettings();\n }\n }, [onDismissCaptionsSettings]);\n\n const onConfirm = useCallback(async (): Promise<void> => {\n const spokenLanguageCode = selectedSpokenLanguage.key;\n const captionLanguageCode = selectedCaptionLanguage.key;\n if (isCaptionsFeatureActive) {\n onSetSpokenLanguage(spokenLanguageCode);\n onSetCaptionLanguage(captionLanguageCode);\n } else {\n await onStartCaptions({ spokenLanguage: spokenLanguageCode });\n }\n onDismiss();\n }, [\n onDismiss,\n isCaptionsFeatureActive,\n onSetSpokenLanguage,\n onSetCaptionLanguage,\n onStartCaptions,\n selectedSpokenLanguage.key,\n selectedCaptionLanguage.key\n ]);\n\n const spokenLanguageDropdownOptions: IDropdownOption[] = useMemo(() => {\n return supportedSpokenLanguages.map((languageCode) => {\n return {\n key: languageCode,\n text: spokenLanguageStrings ? spokenLanguageStrings[languageCode] : languageCode\n };\n });\n }, [supportedSpokenLanguages, spokenLanguageStrings]);\n\n const captionLanguageDropdownOptions: IDropdownOption[] = useMemo(() => {\n return supportedCaptionLanguages.map((languageCode) => {\n return {\n key: languageCode,\n text: captionLanguageStrings ? captionLanguageStrings[languageCode] : languageCode\n };\n });\n }, [supportedCaptionLanguages, captionLanguageStrings]);\n\n const sortedSpokenLanguageDropdownOptions: IDropdownOption[] = useMemo(() => {\n const copy = [...spokenLanguageDropdownOptions];\n return copy.sort((a, b) => (a.text > b.text ? 1 : -1));\n }, [spokenLanguageDropdownOptions]);\n\n const sortedCaptionLanguageDropdownOptions: IDropdownOption[] = useMemo(() => {\n const copy = [...captionLanguageDropdownOptions];\n return copy.sort((a, b) => (a.text > b.text ? 1 : -1));\n }, [captionLanguageDropdownOptions]);\n\n const onSpokenLanguageChange = (\n event: React.FormEvent<HTMLDivElement>,\n option: SpokenLanguageDropdownOptions | undefined\n ): void => {\n if (option) {\n setSelectedSpokenLanguage(option);\n }\n };\n\n const onCaptionLanguageChange = (\n event: React.FormEvent<HTMLDivElement>,\n option: CaptionLanguageDropdownOptions | undefined\n ): void => {\n if (option) {\n setSelectedCaptionLanguage(option);\n }\n };\n\n const calloutProps = useMemo(\n () => ({\n preventDismissOnEvent: _preventDismissOnEvent\n }),\n []\n );\n\n const CaptionsSettingsComponent = useCallback((): JSX.Element => {\n const placeholderSpokenLanguage = currentSpokenLanguage ?? defaultSpokenLanguage;\n const placeholderCaptionLanguage =\n currentCaptionLanguage ?? _spokenLanguageToCaptionLanguage[placeholderSpokenLanguage];\n return (\n <Stack>\n <Dropdown\n label={strings?.captionsSettingsSpokenLanguageDropdownLabel}\n selectedKey={selectedSpokenLanguage ? selectedSpokenLanguage.key : undefined}\n onChange={(ev, option) => onSpokenLanguageChange(ev, option as SpokenLanguageDropdownOptions)}\n calloutProps={calloutProps}\n placeholder={placeholderSpokenLanguage}\n options={sortedSpokenLanguageDropdownOptions}\n styles={dropdownStyles}\n />\n <Text className={dropdownInfoTextStyle(theme)}>{strings?.captionsSettingsSpokenLanguageDropdownInfoText}</Text>\n {changeCaptionLanguage && (\n <>\n <Dropdown\n label={strings?.captionsSettingsCaptionLanguageDropdownLabel}\n selectedKey={selectedCaptionLanguage ? selectedCaptionLanguage.key : undefined}\n onChange={(ev, option) => onCaptionLanguageChange(ev, option as CaptionLanguageDropdownOptions)}\n calloutProps={calloutProps}\n placeholder={placeholderCaptionLanguage}\n options={sortedCaptionLanguageDropdownOptions}\n styles={dropdownStyles}\n />\n <Text className={dropdownInfoTextStyle(theme)}>\n {strings?.captionsSettingsCaptionLanguageDropdownInfoText}\n </Text>\n </>\n )}\n </Stack>\n );\n }, [\n calloutProps,\n currentSpokenLanguage,\n currentCaptionLanguage,\n sortedSpokenLanguageDropdownOptions,\n sortedCaptionLanguageDropdownOptions,\n selectedCaptionLanguage,\n selectedSpokenLanguage,\n strings?.captionsSettingsSpokenLanguageDropdownInfoText,\n strings?.captionsSettingsCaptionLanguageDropdownLabel,\n strings?.captionsSettingsSpokenLanguageDropdownLabel,\n strings?.captionsSettingsCaptionLanguageDropdownInfoText,\n theme,\n changeCaptionLanguage\n ]);\n\n const CaptionsSettingsModalStyle: Partial<IModalStyles> = useMemo(\n () => themedCaptionsSettingsModalStyle(theme),\n [theme]\n );\n\n return (\n <>\n {\n <Modal\n titleAriaId={strings?.captionsSettingsModalAriaLabel}\n isOpen={showModal}\n onDismiss={onDismiss}\n isBlocking={true}\n styles={CaptionsSettingsModalStyle}\n >\n <Stack horizontal horizontalAlign=\"space-between\" verticalAlign=\"center\" className={titleContainerClassName}>\n <Text className={titleClassName}>{strings?.captionsSettingsModalTitle}</Text>\n <IconButton\n iconProps={{ iconName: 'Cancel' }}\n ariaLabel={strings?.captionsSettingsCloseModalButtonAriaLabel}\n onClick={onDismiss}\n style={{ color: theme.palette.black }}\n />\n </Stack>\n\n <Stack className={dropdownContainerClassName}>{CaptionsSettingsComponent()}</Stack>\n <Stack horizontal horizontalAlign=\"end\" className={buttonsContainerClassName}>\n <PrimaryButton styles={buttonStyles(theme)} onClick={onConfirm}>\n <span>{strings?.captionsSettingsConfirmButtonLabel}</span>\n </PrimaryButton>\n <DefaultButton onClick={onDismiss} styles={buttonStyles(theme)}>\n <span>{strings?.captionsSettingsCancelButtonLabel}</span>\n </DefaultButton>\n </Stack>\n </Modal>\n }\n </>\n );\n};\n"]}
1
+ {"version":3,"file":"CaptionsSettingsModal.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/CaptionsSettingsModal.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAEL,KAAK,EACL,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,QAAQ,EAER,aAAa,EACb,aAAa,EACd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,yBAAyB,EACzB,YAAY,EACZ,0BAA0B,EAC1B,qBAAqB,EACrB,cAAc,EACd,gCAAgC,EAChC,cAAc,EACd,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAGL,gCAAgC,EAKjC,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,sBAAsB,EAAE,mCAAgC;AAuCjE;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAkC,EAAe,EAAE;IACxF,MAAM,EACJ,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB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AAG,yBAAyB,EAAE,CAAS;QACnF,oBAAC,KAAK,IAAC,UAAU,QAAC,eAAe,EAAC,KAAK,EAAC,SAAS,EAAE,yBAAyB;YAC1E,oBAAC,aAAa,IAAC,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,SAAS;gBAC5D,kCAAO,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,kCAAkC,CAAQ,CAC5C;YAChB,oBAAC,aAAa,IAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC;gBAC5D,kCAAO,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,iCAAiC,CAAQ,CAC3C,CACV,CACF,CAET,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useCallback } from 'react';\nimport { useMemo, useState, useEffect } from 'react';\nimport {\n IModalStyles,\n Modal,\n Stack,\n useTheme,\n Text,\n IconButton,\n Dropdown,\n IDropdownOption,\n DefaultButton,\n PrimaryButton\n} from '@fluentui/react';\n\nimport {\n buttonsContainerClassName,\n buttonStyles,\n dropdownContainerClassName,\n dropdownInfoTextStyle,\n dropdownStyles,\n themedCaptionsSettingsModalStyle,\n titleClassName,\n titleContainerClassName\n} from './styles/CaptionsSettingsModal.styles';\nimport { _captionsOptions } from './StartCaptionsButton';\nimport { defaultSpokenLanguage } from './utils';\nimport {\n SpokenLanguageStrings,\n CaptionLanguageStrings,\n _spokenLanguageToCaptionLanguage,\n _SupportedSpokenLanguage,\n _SupportedCaptionLanguage,\n SpokenLanguageDropdownOptions,\n CaptionLanguageDropdownOptions\n} from '../types';\nimport { _preventDismissOnEvent } from '@internal/acs-ui-common';\n\n/**\n * @internal\n * strings for captions setting modal\n */\nexport interface _CaptionsSettingsModalStrings {\n captionsSettingsModalTitle?: string;\n captionsSettingsSpokenLanguageDropdownLabel?: string;\n captionsSettingsCaptionLanguageDropdownLabel?: string;\n captionsSettingsSpokenLanguageDropdownInfoText?: string;\n captionsSettingsCaptionLanguageDropdownInfoText?: string;\n captionsSettingsConfirmButtonLabel?: string;\n captionsSettingsCancelButtonLabel?: string;\n captionsSettingsModalAriaLabel?: string;\n captionsSettingsCloseModalButtonAriaLabel?: string;\n}\n\n/**\n * @internal\n * _CaptionsSettingsModal Component Props.\n */\nexport interface _CaptionsSettingsModalProps {\n supportedSpokenLanguages: _SupportedSpokenLanguage[];\n supportedCaptionLanguages: _SupportedCaptionLanguage[];\n onSetSpokenLanguage: (language: _SupportedSpokenLanguage) => Promise<void>;\n onSetCaptionLanguage: (language: _SupportedCaptionLanguage) => Promise<void>;\n onStartCaptions: (options?: _captionsOptions) => Promise<void>;\n currentSpokenLanguage: _SupportedSpokenLanguage;\n currentCaptionLanguage: _SupportedCaptionLanguage;\n spokenLanguageStrings?: SpokenLanguageStrings;\n captionLanguageStrings?: CaptionLanguageStrings;\n isCaptionsFeatureActive?: boolean;\n strings?: _CaptionsSettingsModalStrings;\n showModal?: boolean;\n onDismissCaptionsSettings?: () => void;\n changeCaptionLanguage?: boolean;\n}\n\n/**\n * @internal\n * a component for setting spoken languages\n */\nexport const _CaptionsSettingsModal = (props: _CaptionsSettingsModalProps): JSX.Element => {\n const {\n supportedSpokenLanguages,\n supportedCaptionLanguages,\n currentSpokenLanguage,\n currentCaptionLanguage,\n isCaptionsFeatureActive,\n showModal,\n onSetSpokenLanguage,\n onSetCaptionLanguage,\n onDismissCaptionsSettings,\n onStartCaptions,\n strings,\n spokenLanguageStrings,\n captionLanguageStrings,\n changeCaptionLanguage = false\n } = props;\n\n const theme = useTheme();\n\n const [hasSetSpokenLanguage, setHasSetSpokenLanguage] = useState(false);\n\n const [selectedSpokenLanguage, setSelectedSpokenLanguage] = useState<SpokenLanguageDropdownOptions>({\n key: currentSpokenLanguage || defaultSpokenLanguage,\n text: currentSpokenLanguage || defaultSpokenLanguage\n });\n\n const [selectedCaptionLanguage, setSelectedCaptionLanguage] = useState<CaptionLanguageDropdownOptions>({\n key: currentCaptionLanguage || _spokenLanguageToCaptionLanguage[selectedSpokenLanguage.key],\n text: currentCaptionLanguage || _spokenLanguageToCaptionLanguage[selectedSpokenLanguage.key]\n });\n\n useEffect(() => {\n // set spoken language when start captions with a spoken language specified.\n // this is to fix the bug when a second user starts captions with a new spoken language, captions bot ignore that spoken language\n if (isCaptionsFeatureActive && !hasSetSpokenLanguage) {\n onSetSpokenLanguage(selectedSpokenLanguage.key);\n // we only need to call set spoken language once when first starting captions\n setHasSetSpokenLanguage(true);\n }\n }, [isCaptionsFeatureActive, onSetSpokenLanguage, selectedSpokenLanguage.key, hasSetSpokenLanguage]);\n\n const onDismiss = useCallback((): void => {\n if (onDismissCaptionsSettings) {\n onDismissCaptionsSettings();\n }\n }, [onDismissCaptionsSettings]);\n\n const onConfirm = useCallback(async (): Promise<void> => {\n const spokenLanguageCode = selectedSpokenLanguage.key;\n const captionLanguageCode = selectedCaptionLanguage.key;\n if (isCaptionsFeatureActive) {\n onSetSpokenLanguage(spokenLanguageCode);\n onSetCaptionLanguage(captionLanguageCode);\n } else {\n await onStartCaptions({ spokenLanguage: spokenLanguageCode });\n }\n onDismiss();\n }, [\n onDismiss,\n isCaptionsFeatureActive,\n onSetSpokenLanguage,\n onSetCaptionLanguage,\n onStartCaptions,\n selectedSpokenLanguage.key,\n selectedCaptionLanguage.key\n ]);\n\n const spokenLanguageDropdownOptions: IDropdownOption[] = useMemo(() => {\n return supportedSpokenLanguages.map((languageCode) => {\n return {\n key: languageCode,\n text: spokenLanguageStrings ? spokenLanguageStrings[languageCode] : languageCode\n };\n });\n }, [supportedSpokenLanguages, spokenLanguageStrings]);\n\n const captionLanguageDropdownOptions: IDropdownOption[] = useMemo(() => {\n return supportedCaptionLanguages.map((languageCode) => {\n return {\n key: languageCode,\n text: captionLanguageStrings ? captionLanguageStrings[languageCode] : languageCode\n };\n });\n }, [supportedCaptionLanguages, captionLanguageStrings]);\n\n const sortedSpokenLanguageDropdownOptions: IDropdownOption[] = useMemo(() => {\n const copy = [...spokenLanguageDropdownOptions];\n return copy.sort((a, b) => (a.text > b.text ? 1 : -1));\n }, [spokenLanguageDropdownOptions]);\n\n const sortedCaptionLanguageDropdownOptions: IDropdownOption[] = useMemo(() => {\n const copy = [...captionLanguageDropdownOptions];\n return copy.sort((a, b) => (a.text > b.text ? 1 : -1));\n }, [captionLanguageDropdownOptions]);\n\n const onSpokenLanguageChange = (\n event: React.FormEvent<HTMLDivElement>,\n option: SpokenLanguageDropdownOptions | undefined\n ): void => {\n if (option) {\n setSelectedSpokenLanguage(option);\n }\n };\n\n const onCaptionLanguageChange = (\n event: React.FormEvent<HTMLDivElement>,\n option: CaptionLanguageDropdownOptions | undefined\n ): void => {\n if (option) {\n setSelectedCaptionLanguage(option);\n }\n };\n\n const calloutProps = useMemo(\n () => ({\n preventDismissOnEvent: _preventDismissOnEvent\n }),\n []\n );\n\n const CaptionsSettingsComponent = useCallback((): JSX.Element => {\n const placeholderSpokenLanguage = currentSpokenLanguage ?? defaultSpokenLanguage;\n const placeholderCaptionLanguage =\n currentCaptionLanguage ?? _spokenLanguageToCaptionLanguage[placeholderSpokenLanguage];\n return (\n <Stack>\n <Dropdown\n label={strings?.captionsSettingsSpokenLanguageDropdownLabel}\n selectedKey={selectedSpokenLanguage ? selectedSpokenLanguage.key : undefined}\n onChange={(ev, option) => onSpokenLanguageChange(ev, option as SpokenLanguageDropdownOptions)}\n calloutProps={calloutProps}\n placeholder={placeholderSpokenLanguage}\n options={sortedSpokenLanguageDropdownOptions}\n styles={dropdownStyles}\n />\n <Text className={dropdownInfoTextStyle(theme)}>{strings?.captionsSettingsSpokenLanguageDropdownInfoText}</Text>\n {changeCaptionLanguage && (\n <>\n <Dropdown\n label={strings?.captionsSettingsCaptionLanguageDropdownLabel}\n selectedKey={selectedCaptionLanguage ? selectedCaptionLanguage.key : undefined}\n onChange={(ev, option) => onCaptionLanguageChange(ev, option as CaptionLanguageDropdownOptions)}\n calloutProps={calloutProps}\n placeholder={placeholderCaptionLanguage}\n options={sortedCaptionLanguageDropdownOptions}\n styles={dropdownStyles}\n />\n <Text className={dropdownInfoTextStyle(theme)}>\n {strings?.captionsSettingsCaptionLanguageDropdownInfoText}\n </Text>\n </>\n )}\n </Stack>\n );\n }, [\n calloutProps,\n currentSpokenLanguage,\n currentCaptionLanguage,\n sortedSpokenLanguageDropdownOptions,\n sortedCaptionLanguageDropdownOptions,\n selectedCaptionLanguage,\n selectedSpokenLanguage,\n strings?.captionsSettingsSpokenLanguageDropdownInfoText,\n strings?.captionsSettingsCaptionLanguageDropdownLabel,\n strings?.captionsSettingsSpokenLanguageDropdownLabel,\n strings?.captionsSettingsCaptionLanguageDropdownInfoText,\n theme,\n changeCaptionLanguage\n ]);\n\n const CaptionsSettingsModalStyle: Partial<IModalStyles> = useMemo(\n () => themedCaptionsSettingsModalStyle(theme),\n [theme]\n );\n\n return (\n <>\n {\n <Modal\n titleAriaId={strings?.captionsSettingsModalAriaLabel}\n isOpen={showModal}\n onDismiss={onDismiss}\n isBlocking={true}\n styles={CaptionsSettingsModalStyle}\n >\n <Stack horizontal horizontalAlign=\"space-between\" verticalAlign=\"center\" className={titleContainerClassName}>\n <Text className={titleClassName}>{strings?.captionsSettingsModalTitle}</Text>\n <IconButton\n iconProps={{ iconName: 'Cancel' }}\n ariaLabel={strings?.captionsSettingsCloseModalButtonAriaLabel}\n onClick={onDismiss}\n style={{ color: theme.palette.black }}\n />\n </Stack>\n\n <Stack className={dropdownContainerClassName}>{CaptionsSettingsComponent()}</Stack>\n <Stack horizontal horizontalAlign=\"end\" className={buttonsContainerClassName}>\n <PrimaryButton styles={buttonStyles(theme)} onClick={onConfirm}>\n <span>{strings?.captionsSettingsConfirmButtonLabel}</span>\n </PrimaryButton>\n <DefaultButton onClick={onDismiss} styles={buttonStyles(theme)}>\n <span>{strings?.captionsSettingsCancelButtonLabel}</span>\n </DefaultButton>\n </Stack>\n </Modal>\n }\n </>\n );\n};\n"]}
@@ -1,13 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { MessageThreadStrings } from '../MessageThread';
3
3
  import { ChatMessage } from '../../types';
4
- import { FileMetadata } from '../FileDownloadCards';
4
+ import { AttachmentMetadata } from '../FileDownloadCards';
5
5
  import { MentionLookupOptions } from '../MentionPopover';
6
6
  /** @private */
7
7
  export type ChatMessageComponentAsEditBoxProps = {
8
8
  onCancel?: (messageId: string) => void;
9
9
  onSubmit: (text: string, metadata?: Record<string, string>, options?: {
10
- attachmentMetadata?: FileMetadata[];
10
+ attachmentMetadata?: AttachmentMetadata[];
11
11
  }) => void;
12
12
  message: ChatMessage;
13
13
  strings: MessageThreadStrings;
@@ -1,26 +1,21 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- import { concatStyleSets, Icon, mergeStyles, Stack } from '@fluentui/react';
3
+ import { concatStyleSets, mergeStyles, Stack } from '@fluentui/react';
4
4
  import { ChatMyMessage } from '@fluentui-contrib/react-chat';
5
5
  import { mergeClasses } from '@fluentui/react-components';
6
6
  import { _formatString } from "../../../../acs-ui-common/src";
7
7
  import { useTheme } from '../../theming/FluentThemeProvider';
8
8
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
9
- import { editBoxStyle, inputBoxIcon, editingButtonStyle, editBoxStyleSet } from '../styles/EditBox.styles';
9
+ import { editBoxStyle, editingButtonStyle, editBoxStyleSet, inputBoxIcon } from '../styles/EditBox.styles';
10
10
  import { InputBoxComponent } from '../InputBoxComponent';
11
11
  import { InputBoxButton } from '../InputBoxButton';
12
12
  import { useChatMyMessageStyles } from '../styles/MessageThread.styles';
13
13
  import { _FileUploadCards } from '../FileUploadCards';
14
14
  import { chatMessageFailedTagStyle, editChatMessageFailedTagStyle, chatMessageFailedTagStackItemStyle, editChatMessageButtonsStackStyle, useChatMessageEditContainerStyles } from '../styles/ChatMessageComponent.styles';
15
- const MAXIMUM_LENGTH_OF_MESSAGE = 8000;
16
- const onRenderCancelIcon = (color) => {
17
- const className = mergeStyles(inputBoxIcon, { color });
18
- return React.createElement(Icon, { iconName: 'EditBoxCancel', className: className });
19
- };
20
- const onRenderSubmitIcon = (color) => {
21
- const className = mergeStyles(inputBoxIcon, { color });
22
- return React.createElement(Icon, { iconName: 'EditBoxSubmit', className: className });
23
- };
15
+ import { MAXIMUM_LENGTH_OF_MESSAGE } from '../utils/SendBoxUtils';
16
+ import { getMessageState, onRenderCancelIcon, onRenderSubmitIcon } from '../utils/ChatMessageComponentAsEditBoxUtils';
17
+ /* @conditional-compile-remove(file-sharing) */
18
+ import { getMessageAttachedFilesMetadata } from '../utils/ChatMessageComponentAsEditBoxUtils';
24
19
  /**
25
20
  * @private
26
21
  */
@@ -48,8 +43,16 @@ export const ChatMessageComponentAsEditBox = (props) => {
48
43
  const textTooLongMessage = messageState === 'too long'
49
44
  ? _formatString(strings.editBoxTextLimit, { limitNumber: `${MAXIMUM_LENGTH_OF_MESSAGE}` })
50
45
  : undefined;
51
- const onRenderThemedCancelIcon = useCallback((isHover) => onRenderCancelIcon(isHover ? theme.palette.accent : theme.palette.neutralSecondary), [theme.palette.neutralSecondary, theme.palette.accent]);
52
- const onRenderThemedSubmitIcon = useCallback((isHover) => onRenderSubmitIcon(isHover ? theme.palette.accent : theme.palette.neutralSecondary), [theme.palette.neutralSecondary, theme.palette.accent]);
46
+ const iconClassName = useCallback((isHover) => {
47
+ const color = isHover ? theme.palette.accent : theme.palette.neutralSecondary;
48
+ return mergeStyles(inputBoxIcon, { color });
49
+ }, [theme.palette.accent, theme.palette.neutralSecondary]);
50
+ const onRenderThemedCancelIcon = useCallback((isHover) => {
51
+ return onRenderCancelIcon(iconClassName(isHover));
52
+ }, [iconClassName]);
53
+ const onRenderThemedSubmitIcon = useCallback((isHover) => {
54
+ return onRenderSubmitIcon(iconClassName(isHover));
55
+ }, [iconClassName]);
53
56
  const editBoxStyles = useMemo(() => {
54
57
  return concatStyleSets(editBoxStyleSet, { textField: { borderColor: theme.palette.themePrimary } });
55
58
  }, [theme.palette.themePrimary]);
@@ -105,25 +108,4 @@ export const ChatMessageComponentAsEditBox = (props) => {
105
108
  className: mergeClasses(editContainerStyles.body, message.failureReason !== undefined ? editContainerStyles.bodyError : editContainerStyles.bodyDefault, attached !== 'top' ? editContainerStyles.bodyAttached : undefined)
106
109
  } }, getContent()));
107
110
  };
108
- const isMessageTooLong = (messageText) => messageText.length > MAXIMUM_LENGTH_OF_MESSAGE;
109
- function isMessageEmpty(messageText,
110
- /* @conditional-compile-remove(file-sharing) */
111
- attachmentMetadata) {
112
- /* @conditional-compile-remove(file-sharing) */
113
- return messageText.trim().length === 0 && (attachmentMetadata === null || attachmentMetadata === void 0 ? void 0 : attachmentMetadata.length) === 0;
114
- return messageText.trim().length === 0;
115
- }
116
- function getMessageState(messageText,
117
- /* @conditional-compile-remove(file-sharing) */ attachmentMetadata) {
118
- return isMessageEmpty(messageText, /* @conditional-compile-remove(file-sharing) */ attachmentMetadata)
119
- ? 'too short'
120
- : isMessageTooLong(messageText)
121
- ? 'too long'
122
- : 'OK';
123
- }
124
- /* @conditional-compile-remove(file-sharing) */
125
- // @TODO: Remove when file-sharing feature becomes stable.
126
- const getMessageAttachedFilesMetadata = (message) => {
127
- return message.files;
128
- };
129
111
  //# sourceMappingURL=ChatMessageComponentAsEditBox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatMessageComponentAsEditBox.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAc,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,sCAAgC;AACxD,OAAO,EAAE,QAAQ,EAA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Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { concatStyleSets, Icon, ITextField, mergeStyles, Stack } from '@fluentui/react';\nimport { ChatMyMessage } from '@fluentui-contrib/react-chat';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { useTheme } from '../../theming/FluentThemeProvider';\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { editBoxStyle, inputBoxIcon, editingButtonStyle, editBoxStyleSet } from '../styles/EditBox.styles';\nimport { InputBoxComponent } from '../InputBoxComponent';\nimport { InputBoxButton } from '../InputBoxButton';\nimport { MessageThreadStrings } from '../MessageThread';\nimport { useChatMyMessageStyles } from '../styles/MessageThread.styles';\nimport { ChatMessage } from '../../types';\nimport { _FileUploadCards } from '../FileUploadCards';\n/* @conditional-compile-remove(file-sharing) */\nimport { FileMetadata } from '../FileDownloadCards';\nimport {\n chatMessageFailedTagStyle,\n editChatMessageFailedTagStyle,\n chatMessageFailedTagStackItemStyle,\n editChatMessageButtonsStackStyle,\n useChatMessageEditContainerStyles\n} from '../styles/ChatMessageComponent.styles';\n/* @conditional-compile-remove(mention) */\nimport { MentionLookupOptions } from '../MentionPopover';\n\nconst MAXIMUM_LENGTH_OF_MESSAGE = 8000;\n\nconst onRenderCancelIcon = (color: string): JSX.Element => {\n const className = mergeStyles(inputBoxIcon, { color });\n return <Icon iconName={'EditBoxCancel'} className={className} />;\n};\n\nconst onRenderSubmitIcon = (color: string): JSX.Element => {\n const className = mergeStyles(inputBoxIcon, { color });\n return <Icon iconName={'EditBoxSubmit'} className={className} />;\n};\n\n/** @private */\nexport type ChatMessageComponentAsEditBoxProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (\n text: string,\n metadata?: Record<string, string>,\n options?: {\n /* @conditional-compile-remove(file-sharing) */\n attachmentMetadata?: FileMetadata[];\n }\n ) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions?: MentionLookupOptions;\n};\n\ntype MessageState = 'OK' | 'too short' | 'too long';\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsEditBox = (props: ChatMessageComponentAsEditBoxProps): JSX.Element => {\n const { onCancel, onSubmit, strings, message } = props;\n /* @conditional-compile-remove(mention) */\n const { mentionLookupOptions } = props;\n\n const [textValue, setTextValue] = useState<string>(message.content || '');\n /* @conditional-compile-remove(file-sharing) */\n const [attachmentMetadata, setAttachedFilesMetadata] = React.useState(getMessageAttachedFilesMetadata(message));\n const editTextFieldRef = React.useRef<ITextField>(null);\n const theme = useTheme();\n const messageState = getMessageState(\n textValue,\n /* @conditional-compile-remove(file-sharing) */ attachmentMetadata ?? []\n );\n const submitEnabled = messageState === 'OK';\n\n const editContainerStyles = useChatMessageEditContainerStyles();\n const chatMyMessageStyles = useChatMyMessageStyles();\n\n useEffect(() => {\n editTextFieldRef.current?.focus();\n }, []);\n\n const setText = (event?: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string): void => {\n setTextValue(newValue ?? '');\n };\n\n const textTooLongMessage =\n messageState === 'too long'\n ? _formatString(strings.editBoxTextLimit, { limitNumber: `${MAXIMUM_LENGTH_OF_MESSAGE}` })\n : undefined;\n\n const onRenderThemedCancelIcon = useCallback(\n (isHover: boolean) => onRenderCancelIcon(isHover ? theme.palette.accent : theme.palette.neutralSecondary),\n [theme.palette.neutralSecondary, theme.palette.accent]\n );\n\n const onRenderThemedSubmitIcon = useCallback(\n (isHover: boolean) => onRenderSubmitIcon(isHover ? theme.palette.accent : theme.palette.neutralSecondary),\n [theme.palette.neutralSecondary, theme.palette.accent]\n );\n\n const editBoxStyles = useMemo(() => {\n return concatStyleSets(editBoxStyleSet, { textField: { borderColor: theme.palette.themePrimary } });\n }, [theme.palette.themePrimary]);\n\n /* @conditional-compile-remove(file-sharing) */\n const onRenderFileUploads = useCallback(() => {\n return (\n !!attachmentMetadata &&\n attachmentMetadata.length > 0 && (\n <div style={{ margin: '0.25rem' }}>\n <_FileUploadCards\n activeFileUploads={attachmentMetadata?.map((file) => ({\n id: file.name,\n filename: file.name,\n progress: 1\n }))}\n onCancelFileUpload={(fileId) => {\n setAttachedFilesMetadata(attachmentMetadata?.filter((file) => file.name !== fileId));\n }}\n />\n </div>\n )\n );\n }, [attachmentMetadata]);\n\n const getContent = (): JSX.Element => {\n return (\n <>\n <InputBoxComponent\n data-ui-id=\"edit-box\"\n textFieldRef={editTextFieldRef}\n inputClassName={editBoxStyle}\n placeholderText={strings.editBoxPlaceholderText}\n textValue={textValue}\n onChange={setText}\n onKeyDown={(ev) => {\n if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown') {\n ev.stopPropagation();\n }\n }}\n onEnterKeyDown={() => {\n submitEnabled &&\n onSubmit(\n textValue,\n message.metadata,\n /* @conditional-compile-remove(file-sharing) */ {\n attachmentMetadata\n }\n );\n }}\n supportNewline={false}\n maxLength={MAXIMUM_LENGTH_OF_MESSAGE}\n errorMessage={textTooLongMessage}\n styles={editBoxStyles}\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions={mentionLookupOptions}\n ></InputBoxComponent>\n <Stack\n horizontal\n horizontalAlign=\"end\"\n className={editChatMessageButtonsStackStyle}\n tokens={{ childrenGap: '0.25rem' }}\n >\n {message.failureReason && (\n <Stack.Item grow align=\"stretch\" className={chatMessageFailedTagStackItemStyle}>\n <div className={mergeStyles(chatMessageFailedTagStyle(theme), editChatMessageFailedTagStyle)}>\n {message.failureReason}\n </div>\n </Stack.Item>\n )}\n <Stack.Item align=\"end\">\n <InputBoxButton\n className={editingButtonStyle}\n ariaLabel={strings.editBoxCancelButton}\n tooltipContent={strings.editBoxCancelButton}\n onRenderIcon={onRenderThemedCancelIcon}\n onClick={() => {\n onCancel && onCancel(message.messageId);\n }}\n id={'dismissIconWrapper'}\n />\n </Stack.Item>\n <Stack.Item align=\"end\">\n <InputBoxButton\n className={editingButtonStyle}\n ariaLabel={strings.editBoxSubmitButton}\n tooltipContent={strings.editBoxSubmitButton}\n onRenderIcon={onRenderThemedSubmitIcon}\n onClick={(e) => {\n submitEnabled &&\n onSubmit(\n textValue,\n message.metadata,\n /* @conditional-compile-remove(file-sharing) */ {\n attachmentMetadata\n }\n );\n e.stopPropagation();\n }}\n id={'submitIconWrapper'}\n />\n </Stack.Item>\n </Stack>\n {/* @conditional-compile-remove(file-sharing) */ onRenderFileUploads()}\n </>\n );\n };\n\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n return (\n <ChatMyMessage\n attached={attached}\n root={{\n className: chatMyMessageStyles.root\n }}\n body={{\n className: mergeClasses(\n editContainerStyles.body,\n message.failureReason !== undefined ? editContainerStyles.bodyError : editContainerStyles.bodyDefault,\n attached !== 'top' ? editContainerStyles.bodyAttached : undefined\n )\n }}\n >\n {getContent()}\n </ChatMyMessage>\n );\n};\n\nconst isMessageTooLong = (messageText: string): boolean => messageText.length > MAXIMUM_LENGTH_OF_MESSAGE;\nfunction isMessageEmpty(\n messageText: string,\n /* @conditional-compile-remove(file-sharing) */\n attachmentMetadata?: FileMetadata[]\n): boolean {\n /* @conditional-compile-remove(file-sharing) */\n return messageText.trim().length === 0 && attachmentMetadata?.length === 0;\n return messageText.trim().length === 0;\n}\nfunction getMessageState(\n messageText: string,\n /* @conditional-compile-remove(file-sharing) */ attachmentMetadata: FileMetadata[]\n): MessageState {\n return isMessageEmpty(messageText, /* @conditional-compile-remove(file-sharing) */ attachmentMetadata)\n ? 'too short'\n : isMessageTooLong(messageText)\n ? 'too long'\n : 'OK';\n}\n\n/* @conditional-compile-remove(file-sharing) */\n// @TODO: Remove when file-sharing feature becomes stable.\nconst getMessageAttachedFilesMetadata = (message: ChatMessage): FileMetadata[] | undefined => {\n return message.files;\n};\n"]}
1
+ {"version":3,"file":"ChatMessageComponentAsEditBox.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/ChatMessage/ChatMessageComponentAsEditBox.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;A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,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;IACzG,OAAO,CACL,oBAAC,aAAa,IACZ,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE;YACJ,SAAS,EAAE,mBAAmB,CAAC,IAAI;SACpC,EACD,IAAI,EAAE;YACJ,SAAS,EAAE,YAAY,CACrB,mBAAmB,CAAC,IAAI,EACxB,OAAO,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,WAAW,EACrG,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAClE;SACF,IAEA,UAAU,EAAE,CACC,CACjB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { concatStyleSets, ITextField, mergeStyles, Stack } from '@fluentui/react';\nimport { ChatMyMessage } from '@fluentui-contrib/react-chat';\nimport { mergeClasses } from '@fluentui/react-components';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { useTheme } from '../../theming/FluentThemeProvider';\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { editBoxStyle, editingButtonStyle, editBoxStyleSet, inputBoxIcon } from '../styles/EditBox.styles';\nimport { InputBoxComponent } from '../InputBoxComponent';\nimport { InputBoxButton } from '../InputBoxButton';\nimport { MessageThreadStrings } from '../MessageThread';\nimport { useChatMyMessageStyles } from '../styles/MessageThread.styles';\nimport { ChatMessage } from '../../types';\nimport { _FileUploadCards } from '../FileUploadCards';\n/* @conditional-compile-remove(file-sharing) */\nimport { AttachmentMetadata } from '../FileDownloadCards';\nimport {\n chatMessageFailedTagStyle,\n editChatMessageFailedTagStyle,\n chatMessageFailedTagStackItemStyle,\n editChatMessageButtonsStackStyle,\n useChatMessageEditContainerStyles\n} from '../styles/ChatMessageComponent.styles';\n/* @conditional-compile-remove(mention) */\nimport { MentionLookupOptions } from '../MentionPopover';\nimport { MAXIMUM_LENGTH_OF_MESSAGE } from '../utils/SendBoxUtils';\nimport { getMessageState, onRenderCancelIcon, onRenderSubmitIcon } from '../utils/ChatMessageComponentAsEditBoxUtils';\n/* @conditional-compile-remove(file-sharing) */\nimport { getMessageAttachedFilesMetadata } from '../utils/ChatMessageComponentAsEditBoxUtils';\n\n/** @private */\nexport type ChatMessageComponentAsEditBoxProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (\n text: string,\n metadata?: Record<string, string>,\n options?: {\n /* @conditional-compile-remove(file-sharing) */\n attachmentMetadata?: AttachmentMetadata[];\n }\n ) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions?: MentionLookupOptions;\n};\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsEditBox = (props: ChatMessageComponentAsEditBoxProps): JSX.Element => {\n const { onCancel, onSubmit, strings, message } = props;\n /* @conditional-compile-remove(mention) */\n const { mentionLookupOptions } = props;\n\n const [textValue, setTextValue] = useState<string>(message.content || '');\n /* @conditional-compile-remove(file-sharing) */\n const [attachmentMetadata, setAttachedFilesMetadata] = React.useState(getMessageAttachedFilesMetadata(message));\n const editTextFieldRef = React.useRef<ITextField>(null);\n const theme = useTheme();\n const messageState = getMessageState(\n textValue,\n /* @conditional-compile-remove(file-sharing) */ attachmentMetadata ?? []\n );\n const submitEnabled = messageState === 'OK';\n\n const editContainerStyles = useChatMessageEditContainerStyles();\n const chatMyMessageStyles = useChatMyMessageStyles();\n\n useEffect(() => {\n editTextFieldRef.current?.focus();\n }, []);\n\n const setText = (event?: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string): void => {\n setTextValue(newValue ?? '');\n };\n\n const textTooLongMessage =\n messageState === 'too long'\n ? _formatString(strings.editBoxTextLimit, { limitNumber: `${MAXIMUM_LENGTH_OF_MESSAGE}` })\n : undefined;\n\n const iconClassName = useCallback(\n (isHover: boolean) => {\n const color = isHover ? theme.palette.accent : theme.palette.neutralSecondary;\n return mergeStyles(inputBoxIcon, { color });\n },\n [theme.palette.accent, theme.palette.neutralSecondary]\n );\n\n const onRenderThemedCancelIcon = useCallback(\n (isHover: boolean) => {\n return onRenderCancelIcon(iconClassName(isHover));\n },\n [iconClassName]\n );\n\n const onRenderThemedSubmitIcon = useCallback(\n (isHover: boolean) => {\n return onRenderSubmitIcon(iconClassName(isHover));\n },\n [iconClassName]\n );\n\n const editBoxStyles = useMemo(() => {\n return concatStyleSets(editBoxStyleSet, { textField: { borderColor: theme.palette.themePrimary } });\n }, [theme.palette.themePrimary]);\n\n /* @conditional-compile-remove(file-sharing) */\n const onRenderFileUploads = useCallback(() => {\n return (\n !!attachmentMetadata &&\n attachmentMetadata.length > 0 && (\n <div style={{ margin: '0.25rem' }}>\n <_FileUploadCards\n activeFileUploads={attachmentMetadata?.map((file) => ({\n id: file.name,\n filename: file.name,\n progress: 1\n }))}\n onCancelFileUpload={(fileId) => {\n setAttachedFilesMetadata(attachmentMetadata?.filter((file) => file.name !== fileId));\n }}\n />\n </div>\n )\n );\n }, [attachmentMetadata]);\n\n const getContent = (): JSX.Element => {\n return (\n <>\n <InputBoxComponent\n data-ui-id=\"edit-box\"\n textFieldRef={editTextFieldRef}\n inputClassName={editBoxStyle}\n placeholderText={strings.editBoxPlaceholderText}\n textValue={textValue}\n onChange={setText}\n onKeyDown={(ev) => {\n if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown') {\n ev.stopPropagation();\n }\n }}\n onEnterKeyDown={() => {\n submitEnabled &&\n onSubmit(\n textValue,\n message.metadata,\n /* @conditional-compile-remove(file-sharing) */ {\n attachmentMetadata\n }\n );\n }}\n supportNewline={false}\n maxLength={MAXIMUM_LENGTH_OF_MESSAGE}\n errorMessage={textTooLongMessage}\n styles={editBoxStyles}\n /* @conditional-compile-remove(mention) */\n mentionLookupOptions={mentionLookupOptions}\n ></InputBoxComponent>\n <Stack\n horizontal\n horizontalAlign=\"end\"\n className={editChatMessageButtonsStackStyle}\n tokens={{ childrenGap: '0.25rem' }}\n >\n {message.failureReason && (\n <Stack.Item grow align=\"stretch\" className={chatMessageFailedTagStackItemStyle}>\n <div className={mergeStyles(chatMessageFailedTagStyle(theme), editChatMessageFailedTagStyle)}>\n {message.failureReason}\n </div>\n </Stack.Item>\n )}\n <Stack.Item align=\"end\">\n <InputBoxButton\n className={editingButtonStyle}\n ariaLabel={strings.editBoxCancelButton}\n tooltipContent={strings.editBoxCancelButton}\n onRenderIcon={onRenderThemedCancelIcon}\n onClick={() => {\n onCancel && onCancel(message.messageId);\n }}\n id={'dismissIconWrapper'}\n />\n </Stack.Item>\n <Stack.Item align=\"end\">\n <InputBoxButton\n className={editingButtonStyle}\n ariaLabel={strings.editBoxSubmitButton}\n tooltipContent={strings.editBoxSubmitButton}\n onRenderIcon={onRenderThemedSubmitIcon}\n onClick={(e) => {\n submitEnabled &&\n onSubmit(\n textValue,\n message.metadata,\n /* @conditional-compile-remove(file-sharing) */ {\n attachmentMetadata\n }\n );\n e.stopPropagation();\n }}\n id={'submitIconWrapper'}\n />\n </Stack.Item>\n </Stack>\n {/* @conditional-compile-remove(file-sharing) */ onRenderFileUploads()}\n </>\n );\n };\n\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n return (\n <ChatMyMessage\n attached={attached}\n root={{\n className: chatMyMessageStyles.root\n }}\n body={{\n className: mergeClasses(\n editContainerStyles.body,\n message.failureReason !== undefined ? editContainerStyles.bodyError : editContainerStyles.bodyDefault,\n attached !== 'top' ? editContainerStyles.bodyAttached : undefined\n )\n }}\n >\n {getContent()}\n </ChatMyMessage>\n );\n};\n"]}
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import { MessageThreadStrings } from '../MessageThread';
3
+ import { ChatMessage } from '../../types';
4
+ import { AttachmentMetadata } from '../FileDownloadCards';
5
+ /** @beta */
6
+ export type ChatMessageComponentAsRichTextEditBoxProps = {
7
+ onCancel?: (messageId: string) => void;
8
+ onSubmit: (text: string, metadata?: Record<string, string>, options?: {
9
+ attachmentMetadata?: AttachmentMetadata[];
10
+ }) => void;
11
+ message: ChatMessage;
12
+ strings: MessageThreadStrings;
13
+ };
14
+ /**
15
+ * @beta
16
+ */
17
+ export declare const ChatMessageComponentAsRichTextEditBox: (props: ChatMessageComponentAsRichTextEditBoxProps) => JSX.Element;
18
+ //# sourceMappingURL=ChatMessageComponentAsRichTextEditBox.d.ts.map