@azure/communication-react 1.28.0-beta.1 → 1.28.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/communication-react.d.ts +4 -0
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-DRUaZRvX.js → ChatMessageComponentAsRichTextEditBox-DQsJ0ty3.js} +2 -2
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-DRUaZRvX.js.map → ChatMessageComponentAsRichTextEditBox-DQsJ0ty3.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-G0IPk_nq.js → RichTextSendBoxWrapper-K8NQvjwe.js} +2 -2
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-G0IPk_nq.js.map → RichTextSendBoxWrapper-K8NQvjwe.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{index-DYS7KDhY.js → index-C-rok69c.js} +98 -25
- package/dist/dist-cjs/communication-react/index-C-rok69c.js.map +1 -0
- package/dist/dist-cjs/communication-react/index.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/captionsSelector.js +2 -1
- package/dist/dist-esm/calling-component-bindings/src/captionsSelector.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/DeviceManagerDeclarative.js +5 -2
- package/dist/dist-esm/calling-stateful-client/src/DeviceManagerDeclarative.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/CaptionsBanner.d.ts +4 -0
- package/dist/dist-esm/react-components/src/components/CaptionsBanner.js +36 -1
- package/dist/dist-esm/react-components/src/components/CaptionsBanner.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/Captions.style.d.ts +4 -0
- package/dist/dist-esm/react-components/src/components/styles/Captions.style.js +13 -0
- package/dist/dist-esm/react-components/src/components/styles/Captions.style.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js +12 -10
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js +27 -8
- package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js.map +1 -1
- package/package.json +1 -1
- package/dist/dist-cjs/communication-react/index-DYS7KDhY.js.map +0 -1
@@ -5460,6 +5460,10 @@ export declare type CaptionsInformation = {
|
|
5460
5460
|
* If you are using both captions and real time text, please ensure that the createdTimeStamp is populated
|
5461
5461
|
*/
|
5462
5462
|
createdTimeStamp?: Date;
|
5463
|
+
/**
|
5464
|
+
* If caption is finalized
|
5465
|
+
*/
|
5466
|
+
isFinalized?: boolean;
|
5463
5467
|
};
|
5464
5468
|
|
5465
5469
|
/**
|
@@ -4,7 +4,7 @@ var react = require('@fluentui/react');
|
|
4
4
|
var reactChat = require('@fluentui-contrib/react-chat');
|
5
5
|
var reactComponents = require('@fluentui/react-components');
|
6
6
|
require('@azure/communication-common');
|
7
|
-
var index = require('./index-
|
7
|
+
var index = require('./index-C-rok69c.js');
|
8
8
|
var React = require('react');
|
9
9
|
require('reselect');
|
10
10
|
require('@azure/communication-calling');
|
@@ -212,4 +212,4 @@ const ChatMessageComponentAsRichTextEditBox = (props) => {
|
|
212
212
|
|
213
213
|
exports.ChatMessageComponentAsRichTextEditBox = ChatMessageComponentAsRichTextEditBox;
|
214
214
|
exports.default = ChatMessageComponentAsRichTextEditBox;
|
215
|
-
//# sourceMappingURL=ChatMessageComponentAsRichTextEditBox-
|
215
|
+
//# sourceMappingURL=ChatMessageComponentAsRichTextEditBox-DQsJ0ty3.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ChatMessageComponentAsRichTextEditBox-DRUaZRvX.js","sources":["../../../preprocess-dist/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.tsx"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { 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 { AttachmentMetadataInProgress } from '@internal/acs-ui-common';\nimport { useTheme } from '../../../theming';\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { useReducer } from 'react';\nimport { editBoxWidthStyles, richTextEditBoxActionButtonIcon } from '../../styles/EditBox.styles';\nimport { InputBoxButton } from '../../InputBoxButton';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { useChatMyMessageStyles } from '../../styles/MessageThread.styles';\nimport { ChatMessage } from '../../../types';\nimport { _AttachmentUploadCards } from '../../Attachment/AttachmentUploadCards';\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { useChatMessageRichTextEditContainerStyles } from '../../styles/ChatMessageComponent.styles';\nimport { MAXIMUM_LENGTH_OF_MESSAGE, modifyInlineImagesInContentString } from '../../utils/SendBoxUtils';\nimport { hasIncompleteAttachmentUploads, removeBrokenImageContentAndClearImageSizeStyles, getContentWithUpdatedInlineImagesInfo, isMessageTooLong, inlineImageIds } from '../../utils/SendBoxUtils';\nimport { getMessageState, MessageState, onRenderCancelIcon, onRenderSubmitIcon } from '../../utils/ChatMessageComponentAsEditBoxUtils';\nimport { attachmentMetadataReducer, getMessageWithAttachmentMetadata, doesMessageContainMultipleAttachments } from '../../utils/ChatMessageComponentAsEditBoxUtils';\nimport { RichTextEditorComponentRef } from '../../RichTextEditor/RichTextEditor';\nimport { RichTextInputBoxComponent } from '../../RichTextEditor/RichTextInputBoxComponent';\nimport { editBoxRichTextEditorStyle, richTextActionButtonsStyle } from '../../styles/RichTextEditor.styles';\nimport { RichTextSendBoxErrors } from '../../RichTextEditor/RichTextSendBoxErrors';\nimport { useLocale } from '../../../localization';\nimport { FluentV9ThemeProvider } from '../../../theming/FluentV9ThemeProvider';\nimport { attachmentUploadCardsStyles } from '../../styles/SendBox.styles';\nimport { SendBoxErrorBarError, SendBoxErrorBarType } from '../../SendBoxErrorBar';\nimport { BROKEN_IMAGE_SVG_DATA } from '../../styles/Common.style';\nimport { getPreviousInlineImages } from '../../utils/RichTextEditorUtils';\n\n/** @private */\nexport type ChatMessageComponentAsRichTextEditBoxProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (text: string, attachmentMetadata?: AttachmentMetadata[]) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n onPaste?: (event: {\n content: DocumentFragment;\n }) => void;\n onRemoveInlineImage?: (imageAttributes: Record<string, string>, messageId: string) => void;\n onInsertInlineImage?: (imageAttributes: Record<string, string>, messageId: string) => void;\n inlineImagesWithProgress?: AttachmentMetadataInProgress[];\n};\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsRichTextEditBox = (props: ChatMessageComponentAsRichTextEditBoxProps): JSX.Element => {\n const {\n onCancel,\n onSubmit,\n strings,\n message,\n onPaste,\n onInsertInlineImage,\n inlineImagesWithProgress,\n onRemoveInlineImage\n } = props;\n const [initialInlineImages, setInitialInlineImages] = useState<Record<string, string>[]>([]);\n const initialContent = useMemo(() => {\n const content = message.content;\n setInitialInlineImages(getPreviousInlineImages(content));\n const document = new DOMParser().parseFromString(content ?? '', 'text/html');\n // The broken image element is a div element with all the attributes of the original image element.\n // We need to convert it to a img element so the Rooster knows how to render it.\n // And we need to copy over all the attributes such as id, width, etc.\n // which is needed for sending the message with the images correctly.\n document.querySelectorAll('.broken-image-wrapper').forEach(brokenImage => {\n const imageElement = document.createElement('img');\n const attributes = brokenImage.attributes;\n for (const attribute of attributes) {\n imageElement.setAttribute(attribute.name, attribute.value);\n }\n imageElement.src = BROKEN_IMAGE_SVG_DATA;\n imageElement.style.width = '3rem';\n imageElement.style.height = '3rem';\n brokenImage.parentElement?.replaceChild(imageElement, brokenImage);\n });\n return document.body.innerHTML;\n return message.content;\n }, [message]);\n const [contentValue, setContentValue] = useState<string>(initialContent || '');\n const [contentValueWithInlineImagesOverflow, setContentValueWithInlineImagesOverflow] = useState(false);\n const [attachmentMetadata, handleAttachmentAction] = useReducer(attachmentMetadataReducer, getMessageWithAttachmentMetadata(message) ?? []);\n const [attachmentUploadsPendingError, setAttachmentUploadsPendingError] = useState<SendBoxErrorBarError | undefined>(undefined);\n const editTextFieldRef = React.useRef<RichTextEditorComponentRef>(null);\n const theme = useTheme();\n const messageState: MessageState = useMemo(() => {\n // get plain text content from the editor to check if the message is empty\n // as the content may contain tags even when the content is empty\n const plainTextContent = editTextFieldRef.current?.getPlainContent() ?? contentValue;\n let messageLengthState = getMessageState(plainTextContent, attachmentMetadata ?? []);\n const imageIds = inlineImageIds(contentValue);\n if (messageLengthState !== 'OK' && imageIds.length > 0) {\n // Check if too long\n if (isMessageTooLong(contentValue.length)) {\n messageLengthState = 'too long';\n } else {\n messageLengthState = 'OK';\n }\n }\n return messageLengthState;\n }, [attachmentMetadata, contentValue]);\n const imageUploadErrorMessage = useMemo(() => {\n return inlineImagesWithProgress?.filter(image => image.error).pop()?.error?.message;\n }, [inlineImagesWithProgress]);\n const editContainerStyles = useChatMessageRichTextEditContainerStyles();\n const chatMyMessageStyles = useChatMyMessageStyles();\n const locale = useLocale().strings;\n const setContent = useCallback((newValue?: string): void => {\n setContentValue(newValue ?? '');\n }, []);\n useEffect(() => {\n editTextFieldRef.current?.focus();\n }, []);\n const textTooLongMessage = useMemo(() => {\n return messageState === 'too long' || contentValueWithInlineImagesOverflow ? _formatString(strings.editBoxTextLimit, {\n limitNumber: `${MAXIMUM_LENGTH_OF_MESSAGE}`\n }) : undefined;\n }, [messageState, strings.editBoxTextLimit, contentValueWithInlineImagesOverflow]);\n const iconClassName = useCallback((isHover: boolean) => {\n const color = isHover ? theme.palette.accent : theme.palette.neutralSecondary;\n return mergeStyles(richTextEditBoxActionButtonIcon, {\n color\n });\n }, [theme.palette.accent, theme.palette.neutralSecondary]);\n const onRenderThemedCancelIcon = useCallback((isHover: boolean) => {\n return onRenderCancelIcon(iconClassName(isHover));\n }, [iconClassName]);\n const onRenderThemedSubmitIcon = useCallback((isHover: boolean) => {\n return onRenderSubmitIcon(iconClassName(isHover));\n }, [iconClassName]);\n const hasMultipleAttachments = useMemo(() => {\n return doesMessageContainMultipleAttachments(message);\n }, [message]);\n const onSubmitHandler = useCallback((): void => {\n if (messageState !== 'OK') {\n return;\n }\n if (inlineImagesWithProgress && inlineImagesWithProgress.length > 0) {\n const contentWithUpdatedInlineImagesInfo = getContentWithUpdatedInlineImagesInfo(contentValue, inlineImagesWithProgress);\n const messageTooLong = isMessageTooLong(contentWithUpdatedInlineImagesInfo.length);\n // Set contentValueWithInlineImagesOverflow state to display the error bar\n setContentValueWithInlineImagesOverflow(messageTooLong);\n // The change from the setContentValueOverflow in the previous line will not kick in yet.\n // We need to rely on the local value of messageTooLong to return early if the message is too long.\n if (messageTooLong) {\n return;\n }\n }\n\n // Don't send message until all attachments have been uploaded successfully\n setAttachmentUploadsPendingError(undefined);\n if (hasIncompleteAttachmentUploads(inlineImagesWithProgress)) {\n setAttachmentUploadsPendingError({\n message: strings.imageUploadsPendingError,\n timestamp: Date.now(),\n errorBarType: SendBoxErrorBarType.info\n });\n return;\n }\n let content = contentValue;\n content = removeBrokenImageContentAndClearImageSizeStyles(content);\n let initInlineImages: Record<string, string>[] = [];\n initInlineImages = initialInlineImages ?? [];\n modifyInlineImagesInContentString(content, initInlineImages, (content: string) => {\n // it's very important to pass an empty attachment here\n // so when user removes all attachments, UI can reflect it instantly\n // if you set it to undefined, the attachments pre-edited would still be there\n // until edit message event is received\n onSubmit(content, attachmentMetadata || []);\n });\n }, [messageState, inlineImagesWithProgress, initialInlineImages, contentValue, strings.imageUploadsPendingError, onSubmit, attachmentMetadata]);\n const actionButtons = useMemo(() => {\n return <Stack horizontal>\n <InputBoxButton className={richTextActionButtonsStyle} ariaLabel={strings.editBoxCancelButton} tooltipContent={strings.editBoxCancelButton} onRenderIcon={onRenderThemedCancelIcon} onClick={() => {\n onCancel && onCancel(message.messageId);\n }} id={'dismissIconWrapper'} data-testId={'chat-message-rich-text-edit-box-cancel-button'} />\n <InputBoxButton className={richTextActionButtonsStyle} ariaLabel={strings.editBoxSubmitButton} tooltipContent={strings.editBoxSubmitButton} onRenderIcon={onRenderThemedSubmitIcon} onClick={e => {\n onSubmitHandler();\n e.stopPropagation();\n }} id={'submitIconWrapper'} data-testId={'chat-message-rich-text-edit-box-submit-button'} />\n </Stack>;\n }, [message.messageId, onCancel, onRenderThemedCancelIcon, onRenderThemedSubmitIcon, strings.editBoxCancelButton, strings.editBoxSubmitButton, onSubmitHandler]);\n const richTextLocaleStrings = useMemo(() => {\n return {\n ...locale.richTextSendBox,\n ...strings\n };\n return locale.sendBox;\n }, [locale.richTextSendBox, strings, locale.sendBox]);\n const onCancelAttachmentUpload = useCallback((attachmentId: string) => {\n // edit box only capable of removing attachments\n // we need to expand attachment actions\n // if we want to support more actions e.g. add\n handleAttachmentAction({\n type: 'remove',\n id: attachmentId\n });\n }, []);\n const onRenderAttachmentUploads = useCallback(() => {\n return <Stack className={attachmentUploadCardsStyles}>\n <FluentV9ThemeProvider v8Theme={theme}>\n <_AttachmentUploadCards attachments={attachmentMetadata} onCancelAttachmentUpload={onCancelAttachmentUpload} />\n </FluentV9ThemeProvider>\n </Stack>;\n }, [attachmentMetadata, onCancelAttachmentUpload, theme]);\n const onChangeHandler = useCallback((content: string | undefined, removedInlineImages?: Record<string, string>[]) => {\n removedInlineImages?.forEach((removedInlineImage: Record<string, string>) => {\n onRemoveInlineImage && onRemoveInlineImage(removedInlineImage, message.messageId);\n });\n setContent(content);\n }, [setContent, onRemoveInlineImage, message.messageId]);\n const getContent = (): JSX.Element => {\n return <Stack className={mergeStyles(editBoxWidthStyles)}>\n <RichTextSendBoxErrors textTooLongMessage={textTooLongMessage} systemMessage={message.failureReason} attachmentUploadsPendingError={attachmentUploadsPendingError} attachmentProgressError={imageUploadErrorMessage ? {\n message: imageUploadErrorMessage,\n timestamp: Date.now(),\n errorBarType: SendBoxErrorBarType.error\n } : undefined} />\n <RichTextInputBoxComponent placeholderText={strings.editBoxPlaceholderText} onChange={onChangeHandler} onEnterKeyDown={onSubmitHandler} editorComponentRef={editTextFieldRef} initialContent={initialContent} strings={richTextLocaleStrings} disabled={false} actionComponents={actionButtons} richTextEditorStyleProps={editBoxRichTextEditorStyle} isHorizontalLayoutDisabled={true} onRenderAttachmentUploads={onRenderAttachmentUploads} onPaste={onPaste} onInsertInlineImage={onInsertInlineImage ? (imageAttributes: Record<string, string>) => {\n onInsertInlineImage(imageAttributes, message.messageId);\n } : undefined} />\n </Stack>;\n };\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n return <ChatMyMessage attached={attached} root={{\n className: mergeClasses(chatMyMessageStyles.root, hasMultipleAttachments ? chatMyMessageStyles.multipleAttachmentsInEditing : undefined)\n }} body={{\n className: mergeClasses(editContainerStyles.body, attached !== 'top' ? editContainerStyles.bodyAttached : undefined)\n }}>\n {getContent()}\n </ChatMyMessage>;\n};\nexport default ChatMessageComponentAsRichTextEditBox;"],"names":["useState","useMemo","getPreviousInlineImages","BROKEN_IMAGE_SVG_DATA","useReducer","attachmentMetadataReducer","getMessageWithAttachmentMetadata","useTheme","getMessageState","inlineImageIds","isMessageTooLong","useChatMessageRichTextEditContainerStyles","useChatMyMessageStyles","useLocale","useCallback","useEffect","_formatString","MAXIMUM_LENGTH_OF_MESSAGE","mergeStyles","richTextEditBoxActionButtonIcon","onRenderCancelIcon","onRenderSubmitIcon","doesMessageContainMultipleAttachments","getContentWithUpdatedInlineImagesInfo","hasIncompleteAttachmentUploads","SendBoxErrorBarType","removeBrokenImageContentAndClearImageSizeStyles","modifyInlineImagesInContentString","Stack","InputBoxButton","richTextActionButtonsStyle","attachmentUploadCardsStyles","FluentV9ThemeProvider","_AttachmentUploadCards","edit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AS,EAAI,CAAA;AACf,YAAA,KAAA,CAAA,aAAA,CAACW,+BAAyB,EAAA,EAAC,eAAe,EAAE,OAAO,CAAC,sBAAsB,EAAE,QAAQ,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,wBAAwB,EAAEC,gCAA0B,EAAE,0BAA0B,EAAE,IAAI,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,GAAG,CAAC,eAAuC,KAAI;AACvhB,oBAAA,mBAAmB,CAAC,eAAe,EAAE,OAAO,CAAC,SAAS,CAAC;AACzD,iBAAC,GAAG,SAAS,EAAA,CAAI,CACT;AACZ,KAAC;IACD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,IAAI,GAAG,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,QAAQ,GAAG,QAAQ,GAAG,KAAK;IACxG,OAAO,KAAA,CAAA,aAAA,CAACC,uBAAa,EAAC,EAAA,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;AAC9C,YAAA,SAAS,EAAEC,4BAAY,CAAC,mBAAmB,CAAC,IAAI,EAAE,sBAAsB,GAAG,mBAAmB,CAAC,4BAA4B,GAAG,SAAS;AACxI,SAAA,EAAE,IAAI,EAAE;YACP,SAAS,EAAEA,4BAAY,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,KAAK,KAAK,GAAG,mBAAmB,CAAC,YAAY,GAAG,SAAS;SACpH,EACI,EAAA,UAAU,EAAE,CACC;AACpB;;;;;"}
|
1
|
+
{"version":3,"file":"ChatMessageComponentAsRichTextEditBox-DQsJ0ty3.js","sources":["../../../preprocess-dist/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.tsx"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { 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 { AttachmentMetadataInProgress } from '@internal/acs-ui-common';\nimport { useTheme } from '../../../theming';\nimport React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { useReducer } from 'react';\nimport { editBoxWidthStyles, richTextEditBoxActionButtonIcon } from '../../styles/EditBox.styles';\nimport { InputBoxButton } from '../../InputBoxButton';\nimport { MessageThreadStrings } from '../../MessageThread';\nimport { useChatMyMessageStyles } from '../../styles/MessageThread.styles';\nimport { ChatMessage } from '../../../types';\nimport { _AttachmentUploadCards } from '../../Attachment/AttachmentUploadCards';\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { useChatMessageRichTextEditContainerStyles } from '../../styles/ChatMessageComponent.styles';\nimport { MAXIMUM_LENGTH_OF_MESSAGE, modifyInlineImagesInContentString } from '../../utils/SendBoxUtils';\nimport { hasIncompleteAttachmentUploads, removeBrokenImageContentAndClearImageSizeStyles, getContentWithUpdatedInlineImagesInfo, isMessageTooLong, inlineImageIds } from '../../utils/SendBoxUtils';\nimport { getMessageState, MessageState, onRenderCancelIcon, onRenderSubmitIcon } from '../../utils/ChatMessageComponentAsEditBoxUtils';\nimport { attachmentMetadataReducer, getMessageWithAttachmentMetadata, doesMessageContainMultipleAttachments } from '../../utils/ChatMessageComponentAsEditBoxUtils';\nimport { RichTextEditorComponentRef } from '../../RichTextEditor/RichTextEditor';\nimport { RichTextInputBoxComponent } from '../../RichTextEditor/RichTextInputBoxComponent';\nimport { editBoxRichTextEditorStyle, richTextActionButtonsStyle } from '../../styles/RichTextEditor.styles';\nimport { RichTextSendBoxErrors } from '../../RichTextEditor/RichTextSendBoxErrors';\nimport { useLocale } from '../../../localization';\nimport { FluentV9ThemeProvider } from '../../../theming/FluentV9ThemeProvider';\nimport { attachmentUploadCardsStyles } from '../../styles/SendBox.styles';\nimport { SendBoxErrorBarError, SendBoxErrorBarType } from '../../SendBoxErrorBar';\nimport { BROKEN_IMAGE_SVG_DATA } from '../../styles/Common.style';\nimport { getPreviousInlineImages } from '../../utils/RichTextEditorUtils';\n\n/** @private */\nexport type ChatMessageComponentAsRichTextEditBoxProps = {\n onCancel?: (messageId: string) => void;\n onSubmit: (text: string, attachmentMetadata?: AttachmentMetadata[]) => void;\n message: ChatMessage;\n strings: MessageThreadStrings;\n onPaste?: (event: {\n content: DocumentFragment;\n }) => void;\n onRemoveInlineImage?: (imageAttributes: Record<string, string>, messageId: string) => void;\n onInsertInlineImage?: (imageAttributes: Record<string, string>, messageId: string) => void;\n inlineImagesWithProgress?: AttachmentMetadataInProgress[];\n};\n\n/**\n * @private\n */\nexport const ChatMessageComponentAsRichTextEditBox = (props: ChatMessageComponentAsRichTextEditBoxProps): JSX.Element => {\n const {\n onCancel,\n onSubmit,\n strings,\n message,\n onPaste,\n onInsertInlineImage,\n inlineImagesWithProgress,\n onRemoveInlineImage\n } = props;\n const [initialInlineImages, setInitialInlineImages] = useState<Record<string, string>[]>([]);\n const initialContent = useMemo(() => {\n const content = message.content;\n setInitialInlineImages(getPreviousInlineImages(content));\n const document = new DOMParser().parseFromString(content ?? '', 'text/html');\n // The broken image element is a div element with all the attributes of the original image element.\n // We need to convert it to a img element so the Rooster knows how to render it.\n // And we need to copy over all the attributes such as id, width, etc.\n // which is needed for sending the message with the images correctly.\n document.querySelectorAll('.broken-image-wrapper').forEach(brokenImage => {\n const imageElement = document.createElement('img');\n const attributes = brokenImage.attributes;\n for (const attribute of attributes) {\n imageElement.setAttribute(attribute.name, attribute.value);\n }\n imageElement.src = BROKEN_IMAGE_SVG_DATA;\n imageElement.style.width = '3rem';\n imageElement.style.height = '3rem';\n brokenImage.parentElement?.replaceChild(imageElement, brokenImage);\n });\n return document.body.innerHTML;\n return message.content;\n }, [message]);\n const [contentValue, setContentValue] = useState<string>(initialContent || '');\n const [contentValueWithInlineImagesOverflow, setContentValueWithInlineImagesOverflow] = useState(false);\n const [attachmentMetadata, handleAttachmentAction] = useReducer(attachmentMetadataReducer, getMessageWithAttachmentMetadata(message) ?? []);\n const [attachmentUploadsPendingError, setAttachmentUploadsPendingError] = useState<SendBoxErrorBarError | undefined>(undefined);\n const editTextFieldRef = React.useRef<RichTextEditorComponentRef>(null);\n const theme = useTheme();\n const messageState: MessageState = useMemo(() => {\n // get plain text content from the editor to check if the message is empty\n // as the content may contain tags even when the content is empty\n const plainTextContent = editTextFieldRef.current?.getPlainContent() ?? contentValue;\n let messageLengthState = getMessageState(plainTextContent, attachmentMetadata ?? []);\n const imageIds = inlineImageIds(contentValue);\n if (messageLengthState !== 'OK' && imageIds.length > 0) {\n // Check if too long\n if (isMessageTooLong(contentValue.length)) {\n messageLengthState = 'too long';\n } else {\n messageLengthState = 'OK';\n }\n }\n return messageLengthState;\n }, [attachmentMetadata, contentValue]);\n const imageUploadErrorMessage = useMemo(() => {\n return inlineImagesWithProgress?.filter(image => image.error).pop()?.error?.message;\n }, [inlineImagesWithProgress]);\n const editContainerStyles = useChatMessageRichTextEditContainerStyles();\n const chatMyMessageStyles = useChatMyMessageStyles();\n const locale = useLocale().strings;\n const setContent = useCallback((newValue?: string): void => {\n setContentValue(newValue ?? '');\n }, []);\n useEffect(() => {\n editTextFieldRef.current?.focus();\n }, []);\n const textTooLongMessage = useMemo(() => {\n return messageState === 'too long' || contentValueWithInlineImagesOverflow ? _formatString(strings.editBoxTextLimit, {\n limitNumber: `${MAXIMUM_LENGTH_OF_MESSAGE}`\n }) : undefined;\n }, [messageState, strings.editBoxTextLimit, contentValueWithInlineImagesOverflow]);\n const iconClassName = useCallback((isHover: boolean) => {\n const color = isHover ? theme.palette.accent : theme.palette.neutralSecondary;\n return mergeStyles(richTextEditBoxActionButtonIcon, {\n color\n });\n }, [theme.palette.accent, theme.palette.neutralSecondary]);\n const onRenderThemedCancelIcon = useCallback((isHover: boolean) => {\n return onRenderCancelIcon(iconClassName(isHover));\n }, [iconClassName]);\n const onRenderThemedSubmitIcon = useCallback((isHover: boolean) => {\n return onRenderSubmitIcon(iconClassName(isHover));\n }, [iconClassName]);\n const hasMultipleAttachments = useMemo(() => {\n return doesMessageContainMultipleAttachments(message);\n }, [message]);\n const onSubmitHandler = useCallback((): void => {\n if (messageState !== 'OK') {\n return;\n }\n if (inlineImagesWithProgress && inlineImagesWithProgress.length > 0) {\n const contentWithUpdatedInlineImagesInfo = getContentWithUpdatedInlineImagesInfo(contentValue, inlineImagesWithProgress);\n const messageTooLong = isMessageTooLong(contentWithUpdatedInlineImagesInfo.length);\n // Set contentValueWithInlineImagesOverflow state to display the error bar\n setContentValueWithInlineImagesOverflow(messageTooLong);\n // The change from the setContentValueOverflow in the previous line will not kick in yet.\n // We need to rely on the local value of messageTooLong to return early if the message is too long.\n if (messageTooLong) {\n return;\n }\n }\n\n // Don't send message until all attachments have been uploaded successfully\n setAttachmentUploadsPendingError(undefined);\n if (hasIncompleteAttachmentUploads(inlineImagesWithProgress)) {\n setAttachmentUploadsPendingError({\n message: strings.imageUploadsPendingError,\n timestamp: Date.now(),\n errorBarType: SendBoxErrorBarType.info\n });\n return;\n }\n let content = contentValue;\n content = removeBrokenImageContentAndClearImageSizeStyles(content);\n let initInlineImages: Record<string, string>[] = [];\n initInlineImages = initialInlineImages ?? [];\n modifyInlineImagesInContentString(content, initInlineImages, (content: string) => {\n // it's very important to pass an empty attachment here\n // so when user removes all attachments, UI can reflect it instantly\n // if you set it to undefined, the attachments pre-edited would still be there\n // until edit message event is received\n onSubmit(content, attachmentMetadata || []);\n });\n }, [messageState, inlineImagesWithProgress, initialInlineImages, contentValue, strings.imageUploadsPendingError, onSubmit, attachmentMetadata]);\n const actionButtons = useMemo(() => {\n return <Stack horizontal>\n <InputBoxButton className={richTextActionButtonsStyle} ariaLabel={strings.editBoxCancelButton} tooltipContent={strings.editBoxCancelButton} onRenderIcon={onRenderThemedCancelIcon} onClick={() => {\n onCancel && onCancel(message.messageId);\n }} id={'dismissIconWrapper'} data-testId={'chat-message-rich-text-edit-box-cancel-button'} />\n <InputBoxButton className={richTextActionButtonsStyle} ariaLabel={strings.editBoxSubmitButton} tooltipContent={strings.editBoxSubmitButton} onRenderIcon={onRenderThemedSubmitIcon} onClick={e => {\n onSubmitHandler();\n e.stopPropagation();\n }} id={'submitIconWrapper'} data-testId={'chat-message-rich-text-edit-box-submit-button'} />\n </Stack>;\n }, [message.messageId, onCancel, onRenderThemedCancelIcon, onRenderThemedSubmitIcon, strings.editBoxCancelButton, strings.editBoxSubmitButton, onSubmitHandler]);\n const richTextLocaleStrings = useMemo(() => {\n return {\n ...locale.richTextSendBox,\n ...strings\n };\n return locale.sendBox;\n }, [locale.richTextSendBox, strings, locale.sendBox]);\n const onCancelAttachmentUpload = useCallback((attachmentId: string) => {\n // edit box only capable of removing attachments\n // we need to expand attachment actions\n // if we want to support more actions e.g. add\n handleAttachmentAction({\n type: 'remove',\n id: attachmentId\n });\n }, []);\n const onRenderAttachmentUploads = useCallback(() => {\n return <Stack className={attachmentUploadCardsStyles}>\n <FluentV9ThemeProvider v8Theme={theme}>\n <_AttachmentUploadCards attachments={attachmentMetadata} onCancelAttachmentUpload={onCancelAttachmentUpload} />\n </FluentV9ThemeProvider>\n </Stack>;\n }, [attachmentMetadata, onCancelAttachmentUpload, theme]);\n const onChangeHandler = useCallback((content: string | undefined, removedInlineImages?: Record<string, string>[]) => {\n removedInlineImages?.forEach((removedInlineImage: Record<string, string>) => {\n onRemoveInlineImage && onRemoveInlineImage(removedInlineImage, message.messageId);\n });\n setContent(content);\n }, [setContent, onRemoveInlineImage, message.messageId]);\n const getContent = (): JSX.Element => {\n return <Stack className={mergeStyles(editBoxWidthStyles)}>\n <RichTextSendBoxErrors textTooLongMessage={textTooLongMessage} systemMessage={message.failureReason} attachmentUploadsPendingError={attachmentUploadsPendingError} attachmentProgressError={imageUploadErrorMessage ? {\n message: imageUploadErrorMessage,\n timestamp: Date.now(),\n errorBarType: SendBoxErrorBarType.error\n } : undefined} />\n <RichTextInputBoxComponent placeholderText={strings.editBoxPlaceholderText} onChange={onChangeHandler} onEnterKeyDown={onSubmitHandler} editorComponentRef={editTextFieldRef} initialContent={initialContent} strings={richTextLocaleStrings} disabled={false} actionComponents={actionButtons} richTextEditorStyleProps={editBoxRichTextEditorStyle} isHorizontalLayoutDisabled={true} onRenderAttachmentUploads={onRenderAttachmentUploads} onPaste={onPaste} onInsertInlineImage={onInsertInlineImage ? (imageAttributes: Record<string, string>) => {\n onInsertInlineImage(imageAttributes, message.messageId);\n } : undefined} />\n </Stack>;\n };\n const attached = message.attached === true ? 'center' : message.attached === 'bottom' ? 'bottom' : 'top';\n return <ChatMyMessage attached={attached} root={{\n className: mergeClasses(chatMyMessageStyles.root, hasMultipleAttachments ? chatMyMessageStyles.multipleAttachmentsInEditing : undefined)\n }} body={{\n className: mergeClasses(editContainerStyles.body, attached !== 'top' ? editContainerStyles.bodyAttached : undefined)\n }}>\n {getContent()}\n </ChatMyMessage>;\n};\nexport default ChatMessageComponentAsRichTextEditBox;"],"names":["useState","useMemo","getPreviousInlineImages","BROKEN_IMAGE_SVG_DATA","useReducer","attachmentMetadataReducer","getMessageWithAttachmentMetadata","useTheme","getMessageState","inlineImageIds","isMessageTooLong","useChatMessageRichTextEditContainerStyles","useChatMyMessageStyles","useLocale","useCallback","useEffect","_formatString","MAXIMUM_LENGTH_OF_MESSAGE","mergeStyles","richTextEditBoxActionButtonIcon","onRenderCancelIcon","onRenderSubmitIcon","doesMessageContainMultipleAttachments","getContentWithUpdatedInlineImagesInfo","hasIncompleteAttachmentUploads","SendBoxErrorBarType","removeBrokenImageContentAndClearImageSizeStyles","modifyInlineImagesInContentString","Stack","InputBoxButton","richTextActionButtonsStyle","attachmentUploadCardsStyles","FluentV9ThemeProvider","_AttachmentUploadCards","editBoxWidthStyles","RichTextSendBoxErrors","RichTextInputBoxComponent","editBoxR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,+BAAyB,EAAA,EAAC,eAAe,EAAE,OAAO,CAAC,sBAAsB,EAAE,QAAQ,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,wBAAwB,EAAEC,gCAA0B,EAAE,0BAA0B,EAAE,IAAI,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,GAAG,CAAC,eAAuC,KAAI;AACvhB,oBAAA,mBAAmB,CAAC,eAAe,EAAE,OAAO,CAAC,SAAS,CAAC;AACzD,iBAAC,GAAG,SAAS,EAAA,CAAI,CACT;AACZ,KAAC;IACD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,IAAI,GAAG,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,QAAQ,GAAG,QAAQ,GAAG,KAAK;IACxG,OAAO,KAAA,CAAA,aAAA,CAACC,uBAAa,EAAC,EAAA,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;AAC9C,YAAA,SAAS,EAAEC,4BAAY,CAAC,mBAAmB,CAAC,IAAI,EAAE,sBAAsB,GAAG,mBAAmB,CAAC,4BAA4B,GAAG,SAAS;AACxI,SAAA,EAAE,IAAI,EAAE;YACP,SAAS,EAAEA,4BAAY,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,KAAK,KAAK,GAAG,mBAAmB,CAAC,YAAY,GAAG,SAAS;SACpH,EACI,EAAA,UAAU,EAAE,CACC;AACpB;;;;;"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
3
|
var React = require('react');
|
4
|
-
var index = require('./index-
|
4
|
+
var index = require('./index-C-rok69c.js');
|
5
5
|
require('@fluentui/react');
|
6
6
|
require('@azure/communication-common');
|
7
7
|
require('@fluentui/react-components');
|
@@ -46,4 +46,4 @@ const RichTextSendBoxWrapper = (props) => {
|
|
46
46
|
};
|
47
47
|
|
48
48
|
exports.RichTextSendBoxWrapper = RichTextSendBoxWrapper;
|
49
|
-
//# sourceMappingURL=RichTextSendBoxWrapper-
|
49
|
+
//# sourceMappingURL=RichTextSendBoxWrapper-K8NQvjwe.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RichTextSendBoxWrapper-
|
1
|
+
{"version":3,"file":"RichTextSendBoxWrapper-K8NQvjwe.js","sources":["../../../preprocess-dist/react-composites/src/composites/common/RichTextSendBoxWrapper.tsx"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport React from 'react';\nimport { usePropsFor } from '../ChatComposite/hooks/usePropsFor';\nimport { RichTextSendBox, RichTextSendBoxProps } from '@internal/react-components';\n/**\n * @private\n *\n * Wrapper for RichTextSendBox component to allow us to use usePropsFor with richTextSendBox\n * before lazyLoading is done\n */\nexport const RichTextSendBoxWrapper = (props: RichTextSendBoxProps): JSX.Element => {\n const richTextSendBoxProps = usePropsFor(RichTextSendBox);\n return <RichTextSendBox {...richTextSendBoxProps} {...props} />;\n};"],"names":["usePropsFor","RichTextSendBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAIA;;;;;AAKG;AACU,MAAA,sBAAsB,GAAG,CAAC,KAA2B,KAAiB;AACjF,IAAA,MAAM,oBAAoB,GAAGA,iBAAW,CAACC,qBAAe,CAAC;AACzD,IAAA,OAAO,oBAACA,qBAAe,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,oBAAoB,EAAM,KAAK,EAAI;AACjE;;;;"}
|
@@ -184,7 +184,7 @@ function getDefaultExportFromCjs (x) {
|
|
184
184
|
// Copyright (c) Microsoft Corporation.
|
185
185
|
// Licensed under the MIT License.
|
186
186
|
// GENERATED FILE. DO NOT EDIT MANUALLY.
|
187
|
-
var telemetryVersion = '1.28.0-beta.
|
187
|
+
var telemetryVersion = '1.28.0-beta.2';
|
188
188
|
|
189
189
|
|
190
190
|
var telemetryVersion$1 = /*@__PURE__*/getDefaultExportFromCjs(telemetryVersion);
|
@@ -1994,7 +1994,8 @@ const captionsBannerSelector = reselect__namespace.createSelector([getCaptions,
|
|
1994
1994
|
displayName: finalDisplayName !== null && finalDisplayName !== void 0 ? finalDisplayName : 'Unnamed Participant',
|
1995
1995
|
captionText: c.captionText,
|
1996
1996
|
userId,
|
1997
|
-
createdTimeStamp: c.timestamp
|
1997
|
+
createdTimeStamp: c.timestamp,
|
1998
|
+
isFinalized: c.resultType === 'Final'
|
1998
1999
|
};
|
1999
2000
|
});
|
2000
2001
|
const completedRealTimeTexts = (_a = realTimeTexts === null || realTimeTexts === void 0 ? void 0 : realTimeTexts.completedMessages) === null || _a === void 0 ? void 0 : _a.filter(rtt => rtt.message !== '').map(rtt => {
|
@@ -2201,8 +2202,11 @@ class ProxyDeviceManager {
|
|
2201
2202
|
}), navigator.permissions.query({
|
2202
2203
|
name: 'microphone'
|
2203
2204
|
})]);
|
2204
|
-
|
2205
|
-
|
2205
|
+
// Use logical OR to combine the SDK state with the Permissions API state.
|
2206
|
+
// This way we can get a more accurate picture of the device permission state.
|
2207
|
+
// If the SDK state is 'granted', we don't need to check the Permissions API state.
|
2208
|
+
hasCameraPermission || (hasCameraPermission = cameraPermissions.state === 'granted');
|
2209
|
+
hasMicPermission || (hasMicPermission = micPermissions.state === 'granted');
|
2206
2210
|
}
|
2207
2211
|
catch (e) {
|
2208
2212
|
console.info('Permissions API is not supported by browser', e);
|
@@ -15965,8 +15969,8 @@ class _ErrorBoundary extends React.Component {
|
|
15965
15969
|
|
15966
15970
|
// Copyright (c) Microsoft Corporation.
|
15967
15971
|
// Licensed under the MIT License.
|
15968
|
-
const ChatMessageComponentAsRichTextEditBox = React.lazy(() => Promise.resolve().then(function () { return require('./ChatMessageComponentAsRichTextEditBox-
|
15969
|
-
const loadChatMessageComponentAsRichTextEditBox = () => Promise.resolve().then(function () { return require('./ChatMessageComponentAsRichTextEditBox-
|
15972
|
+
const ChatMessageComponentAsRichTextEditBox = React.lazy(() => Promise.resolve().then(function () { return require('./ChatMessageComponentAsRichTextEditBox-DQsJ0ty3.js'); }));
|
15973
|
+
const loadChatMessageComponentAsRichTextEditBox = () => Promise.resolve().then(function () { return require('./ChatMessageComponentAsRichTextEditBox-DQsJ0ty3.js'); });
|
15970
15974
|
/**
|
15971
15975
|
* @private
|
15972
15976
|
*/
|
@@ -24951,6 +24955,19 @@ const captionsContainerClassName = react.mergeStyles({
|
|
24951
24955
|
padding: 0,
|
24952
24956
|
overflowX: 'hidden'
|
24953
24957
|
});
|
24958
|
+
/**
|
24959
|
+
* @private
|
24960
|
+
*/
|
24961
|
+
const hiddenAnnouncementClassName = react.mergeStyles({
|
24962
|
+
position: 'absolute',
|
24963
|
+
width: '1px',
|
24964
|
+
height: '1px',
|
24965
|
+
padding: 0,
|
24966
|
+
overflow: 'hidden',
|
24967
|
+
clip: 'rect(0, 0, 0, 0)',
|
24968
|
+
whiteSpace: 'nowrap',
|
24969
|
+
border: 0
|
24970
|
+
});
|
24954
24971
|
/**
|
24955
24972
|
* @private
|
24956
24973
|
*/
|
@@ -25395,6 +25412,10 @@ const CaptionsBanner = (props) => {
|
|
25395
25412
|
const [isAtBottomOfScroll, setIsAtBottomOfScroll] = React.useState(true);
|
25396
25413
|
const theme = react.useTheme();
|
25397
25414
|
const [expandBannerHeight, setExpandBannerHeight] = React.useState(false);
|
25415
|
+
const [announcedRTT, setAnnouncedRTT] = React.useState([]);
|
25416
|
+
const [announcedCaption, setAnnouncedCaption] = React.useState([]);
|
25417
|
+
const [captionAnnouncementText, setCaptionAnnouncementText] = React.useState([]);
|
25418
|
+
const [rttAnnouncementText, setRTTAnnouncementText] = React.useState([]);
|
25398
25419
|
const getTitle = () => {
|
25399
25420
|
var _a, _b, _c;
|
25400
25421
|
if (isCaptionsOn && isRealTimeTextOn) {
|
@@ -25450,6 +25471,24 @@ const CaptionsBanner = (props) => {
|
|
25450
25471
|
setTextFieldValue('');
|
25451
25472
|
}
|
25452
25473
|
}, [latestLocalRealTimeText]);
|
25474
|
+
React.useEffect(() => {
|
25475
|
+
if (realTimeTexts === null || realTimeTexts === void 0 ? void 0 : realTimeTexts.completedMessages) {
|
25476
|
+
//filter out the messages that have already been announced
|
25477
|
+
const rTTMessagesToAnnounce = realTimeTexts.completedMessages.filter(message => !announcedRTT.includes(message.id));
|
25478
|
+
if (rTTMessagesToAnnounce.length > 0) {
|
25479
|
+
setRTTAnnouncementText(rTTMessagesToAnnounce);
|
25480
|
+
setAnnouncedRTT(prev => [...prev, ...rTTMessagesToAnnounce.map(message => message.id)]);
|
25481
|
+
}
|
25482
|
+
}
|
25483
|
+
if (captions.length > 0) {
|
25484
|
+
// filter out the captions that have already been announced
|
25485
|
+
const captionsToAnnounce = captions.filter(caption => !announcedCaption.includes(caption.id) && caption.isFinalized);
|
25486
|
+
if (captionsToAnnounce.length > 0) {
|
25487
|
+
setCaptionAnnouncementText(captionsToAnnounce);
|
25488
|
+
setAnnouncedCaption(prev => [...prev, ...captionsToAnnounce.map(caption => caption.id)]);
|
25489
|
+
}
|
25490
|
+
}
|
25491
|
+
}, [captions, realTimeTexts === null || realTimeTexts === void 0 ? void 0 : realTimeTexts.completedMessages, announcedRTT, announcedCaption]);
|
25453
25492
|
const handleKeyDown = (event) => {
|
25454
25493
|
if (event.key === 'Enter') {
|
25455
25494
|
event.preventDefault();
|
@@ -25475,6 +25514,19 @@ const CaptionsBanner = (props) => {
|
|
25475
25514
|
}));
|
25476
25515
|
};
|
25477
25516
|
return React.createElement(React.Fragment, null, (startCaptionsInProgress || isCaptionsOn || isRealTimeTextOn) && React.createElement(react.FocusZone, { shouldFocusOnMount: true, className: captionsContainerClassName, "data-ui-id": "captions-banner" },
|
25517
|
+
(rttAnnouncementText.length > 0 || (captionAnnouncementText === null || captionAnnouncementText === void 0 ? void 0 : captionAnnouncementText.length) > 0) && React.createElement("div", { "aria-live": "assertive", role: "alert", "aria-atomic": "true", className: hiddenAnnouncementClassName },
|
25518
|
+
React.createElement("span", null, rttAnnouncementText.map(text => React.createElement("span", null,
|
25519
|
+
strings.realTimeTextBannerTitle,
|
25520
|
+
" ",
|
25521
|
+
text.displayName,
|
25522
|
+
": ",
|
25523
|
+
text.message))),
|
25524
|
+
React.createElement("span", null, captionAnnouncementText.map(text => React.createElement("span", null,
|
25525
|
+
strings.captionsOnlyContainerTitle,
|
25526
|
+
" ",
|
25527
|
+
text.displayName,
|
25528
|
+
": ",
|
25529
|
+
text.captionText)))),
|
25478
25530
|
(isCaptionsOn || isRealTimeTextOn) && formFactor === 'compact' && React.createElement(react.Stack, { horizontal: true, horizontalAlign: "space-between", verticalAlign: "center", className: bannerTitleContainerClassName },
|
25479
25531
|
React.createElement(react.Text, { className: titleClassName$2 }, getTitle()),
|
25480
25532
|
React.createElement(react.IconButton, { "data-ui-id": "captions-banner-expand-icon", iconProps: {
|
@@ -31175,10 +31227,10 @@ const AttachmentDownloadErrorBar = (props) => {
|
|
31175
31227
|
/**
|
31176
31228
|
* Wrapper for RichTextSendBox component to allow us to use usePropsFor with richTextSendBox with lazy loading
|
31177
31229
|
*/
|
31178
|
-
const RichTextSendBoxWrapper = React.lazy(() => Promise.resolve().then(function () { return require('./RichTextSendBoxWrapper-
|
31230
|
+
const RichTextSendBoxWrapper = React.lazy(() => Promise.resolve().then(function () { return require('./RichTextSendBoxWrapper-K8NQvjwe.js'); }).then(module => ({
|
31179
31231
|
default: module.RichTextSendBoxWrapper
|
31180
31232
|
})));
|
31181
|
-
const loadRichTextSendBox = () => Promise.resolve().then(function () { return require('./RichTextSendBoxWrapper-
|
31233
|
+
const loadRichTextSendBox = () => Promise.resolve().then(function () { return require('./RichTextSendBoxWrapper-K8NQvjwe.js'); }).then(module => ({
|
31182
31234
|
default: module.RichTextSendBoxWrapper
|
31183
31235
|
}));
|
31184
31236
|
/**
|
@@ -32427,31 +32479,46 @@ const isDisabled$4 = (option) => {
|
|
32427
32479
|
}
|
32428
32480
|
return option.disabled;
|
32429
32481
|
};
|
32482
|
+
const isAndroidWebView = (environmentInfo) => {
|
32483
|
+
var _a, _b;
|
32484
|
+
const ua = navigator.userAgent || '';
|
32485
|
+
return ((_b = (_a = environmentInfo === null || environmentInfo === void 0 ? void 0 : environmentInfo.environment) === null || _a === void 0 ? void 0 : _a.browser) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'chrome webview' || /Android/.test(ua) && /Version\/[\d.]+/.test(ua) && /wv/.test(ua);
|
32486
|
+
};
|
32430
32487
|
/**
|
32431
32488
|
* @returns Permissions state for the camera.
|
32432
32489
|
*/
|
32433
|
-
const queryCameraPermissionFromPermissionsAPI = () => __awaiter$r(void 0, void 0, void 0, function* () {
|
32490
|
+
const queryCameraPermissionFromPermissionsAPI = (environmentInfo) => __awaiter$r(void 0, void 0, void 0, function* () {
|
32491
|
+
// Android WebView does not support permissions API, nor does it throw an error when trying to access it,
|
32492
|
+
// in actuality the API always returns 'prompt' which is not correct.
|
32493
|
+
if (isAndroidWebView(environmentInfo)) {
|
32494
|
+
return 'unsupported';
|
32495
|
+
}
|
32434
32496
|
try {
|
32435
32497
|
return (yield navigator.permissions.query({
|
32436
32498
|
name: 'camera'
|
32437
32499
|
})).state;
|
32500
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
32438
32501
|
}
|
32439
32502
|
catch (e) {
|
32440
|
-
console.info('permissions API is not supported by browser', e);
|
32441
32503
|
return 'unsupported';
|
32442
32504
|
}
|
32443
32505
|
});
|
32444
32506
|
/**
|
32445
32507
|
* @returns Permissions state for the microphone.
|
32446
32508
|
*/
|
32447
|
-
const queryMicrophonePermissionFromPermissionsAPI = () => __awaiter$r(void 0, void 0, void 0, function* () {
|
32509
|
+
const queryMicrophonePermissionFromPermissionsAPI = (environmentInfo) => __awaiter$r(void 0, void 0, void 0, function* () {
|
32510
|
+
// Android WebView does not support permissions API, nor does it throw an error when trying to access it,
|
32511
|
+
// in actuality the API always returns 'prompt' which is not correct.
|
32512
|
+
if (isAndroidWebView(environmentInfo)) {
|
32513
|
+
return 'unsupported';
|
32514
|
+
}
|
32448
32515
|
try {
|
32449
32516
|
return (yield navigator.permissions.query({
|
32450
32517
|
name: 'microphone'
|
32451
32518
|
})).state;
|
32519
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
32452
32520
|
}
|
32453
32521
|
catch (e) {
|
32454
|
-
console.info('permissions API is not supported by browser', e);
|
32455
32522
|
return 'unsupported';
|
32456
32523
|
}
|
32457
32524
|
});
|
@@ -32462,10 +32529,14 @@ const queryMicrophonePermissionFromPermissionsAPI = () => __awaiter$r(void 0, vo
|
|
32462
32529
|
* If permission API is not supported on this browser, permission state is set to unsupported.
|
32463
32530
|
* @private
|
32464
32531
|
*/
|
32465
|
-
const getDevicePermissionState = (setVideoState, setAudioState) => __awaiter$r(void 0, void 0, void 0, function* () {
|
32466
|
-
const [cameraResult, microphoneResult] = yield Promise.all([queryCameraPermissionFromPermissionsAPI(), queryMicrophonePermissionFromPermissionsAPI()]);
|
32467
|
-
|
32468
|
-
|
32532
|
+
const getDevicePermissionState = (environmentInfo, setVideoState, setAudioState, previousVideoState, previousAudioState) => __awaiter$r(void 0, void 0, void 0, function* () {
|
32533
|
+
const [cameraResult, microphoneResult] = yield Promise.all([queryCameraPermissionFromPermissionsAPI(environmentInfo), queryMicrophonePermissionFromPermissionsAPI(environmentInfo)]);
|
32534
|
+
if (cameraResult !== previousVideoState) {
|
32535
|
+
setVideoState(cameraResult);
|
32536
|
+
}
|
32537
|
+
if (microphoneResult !== previousAudioState) {
|
32538
|
+
setAudioState(microphoneResult);
|
32539
|
+
}
|
32469
32540
|
});
|
32470
32541
|
/**
|
32471
32542
|
* Check if we are using safari browser
|
@@ -40160,10 +40231,11 @@ const ConfigurationPage = (props) => {
|
|
40160
40231
|
const theme = useTheme();
|
40161
40232
|
const options = useAdaptedSelector(getSelector$1(DevicesButton));
|
40162
40233
|
const localDeviceSettingsHandlers = useHandlers();
|
40163
|
-
const { video: cameraPermissionGranted, audio: microphonePermissionGranted } = useSelector$1(devicePermissionSelector);
|
40234
|
+
const { video: cameraPermissionGranted, audio: microphonePermissionGranted } = useSelector$1(devicePermissionSelector);
|
40235
|
+
const environmentInfo = useSelector$1(getEnvironmentInfo); // use permission API to get video and audio permission state
|
40164
40236
|
const [videoState, setVideoState] = React.useState(undefined);
|
40165
40237
|
const [audioState, setAudioState] = React.useState(undefined);
|
40166
|
-
getDevicePermissionState(setVideoState, setAudioState);
|
40238
|
+
getDevicePermissionState(environmentInfo, setVideoState, setAudioState, videoState, audioState);
|
40167
40239
|
const configContainerRef = React.useRef(null);
|
40168
40240
|
const configWidth = _useContainerWidth(configContainerRef);
|
40169
40241
|
/**
|
@@ -40173,7 +40245,6 @@ const ConfigurationPage = (props) => {
|
|
40173
40245
|
const stackConfig = !!configWidth && configWidth < 450;
|
40174
40246
|
const errorBarProps = usePropsFor$1(ErrorBar);
|
40175
40247
|
const microphones = useSelector$1(getMicrophones);
|
40176
|
-
const environmentInfo = useSelector$1(getEnvironmentInfo);
|
40177
40248
|
let disableStartCallButton = (!microphonePermissionGranted || (microphones === null || microphones === void 0 ? void 0 : microphones.length) === 0) && joinCallOptions.microphoneCheck === 'requireMicrophoneAvailable';
|
40178
40249
|
const role = useSelector$1(getRole);
|
40179
40250
|
const isCameraOn = useSelector$1(localVideoSelector).isAvailable;
|
@@ -40226,19 +40297,21 @@ const ConfigurationPage = (props) => {
|
|
40226
40297
|
React.createElement(SvgWithWordWrapping, { width: mobileView ? 325 : 445, lineHeightPx: 16 * 1.5, bufferHeightPx: 16, text: locale.strings.call.configurationPageTitle, role: "heading" })) : React.createElement(React.Fragment, null);
|
40227
40298
|
const callDescription = locale.strings.call.configurationPageCallDetails && React.createElement(react.Stack.Item, { className: mobileView ? callDetailsStyleMobile(theme) : callDetailsStyleDesktop(theme) }, locale.strings.call.configurationPageCallDetails);
|
40228
40299
|
const mobileWithPreview = mobileView && role !== 'Consumer';
|
40229
|
-
const permissionsState = {
|
40300
|
+
const permissionsState = React.useMemo(() => ({
|
40230
40301
|
// fall back to using cameraPermissionGranted and microphonePermissionGranted if permission API is not supported
|
40231
40302
|
camera: videoState && videoState !== 'unsupported' ? cameraPermissionGranted !== false ? videoState : 'denied' : cameraPermissionGranted !== false ? cameraPermissionGranted ? 'granted' : 'prompt' : 'denied',
|
40232
40303
|
microphone: audioState && audioState !== 'unsupported' ? microphonePermissionGranted !== false ? audioState : 'denied' : microphonePermissionGranted !== false ? microphonePermissionGranted ? 'granted' : 'prompt' : 'denied'
|
40233
|
-
};
|
40304
|
+
}), [videoState, audioState, cameraPermissionGranted, microphonePermissionGranted]);
|
40234
40305
|
const networkErrors = errorBarProps.activeErrorMessages.filter(message => message.type === 'callNetworkQualityLow');
|
40235
40306
|
const [isPermissionsModalDismissed, setIsPermissionsModalDismissed] = React.useState(true);
|
40236
40307
|
// When permission API is not available, we want to show screen saying checking for access (disappears on its own)
|
40237
40308
|
// then based on permission setting, we show permission denied or nothing
|
40238
40309
|
const [minimumFallbackTimerElapsed, setMinimumFallbackTimerElapsed] = React.useState(false);
|
40239
|
-
|
40240
|
-
|
40241
|
-
|
40310
|
+
React.useEffect(() => {
|
40311
|
+
setTimeout(() => {
|
40312
|
+
setMinimumFallbackTimerElapsed(true);
|
40313
|
+
}, 2000);
|
40314
|
+
}, []);
|
40242
40315
|
const forceShowingCheckPermissions = !minimumFallbackTimerElapsed;
|
40243
40316
|
const { toggleVideoEffectsPane, closeVideoEffectsPane, isVideoEffectsPaneOpen } = useVideoEffectsPane(props.updateSidePaneRenderer, mobileView, props.latestErrors, props.onDismissError);
|
40244
40317
|
const startCall = React.useCallback(() => __awaiter$c(void 0, void 0, void 0, function* () {
|
@@ -46024,4 +46097,4 @@ exports.useTeamsCall = useTeamsCall;
|
|
46024
46097
|
exports.useTeamsCallAdapter = useTeamsCallAdapter;
|
46025
46098
|
exports.useTeamsCallAgent = useTeamsCallAgent;
|
46026
46099
|
exports.useTheme = useTheme;
|
46027
|
-
//# sourceMappingURL=index-
|
46100
|
+
//# sourceMappingURL=index-C-rok69c.js.map
|