@azure/communication-react 1.16.0-alpha-202404252104 → 1.16.0-alpha-202404260012
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 +12 -1
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-CWvESa8u.js → ChatMessageComponentAsRichTextEditBox-BLhY8s2s.js} +2 -2
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-CWvESa8u.js.map → ChatMessageComponentAsRichTextEditBox-BLhY8s2s.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{index-BTXDJhYg.js → index-r7pKdpFV.js} +230 -93
- package/dist/dist-cjs/communication-react/index-r7pKdpFV.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 +1 -1
- package/dist/dist-esm/calling-component-bindings/src/captionsSelector.js.map +1 -1
- package/dist/dist-esm/calling-stateful-client/src/Converter.js +1 -1
- package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js +28 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/InputBoxButton.d.ts +1 -0
- package/dist/dist-esm/react-components/src/components/InputBoxButton.js +9 -8
- package/dist/dist-esm/react-components/src/components/InputBoxButton.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +22 -7
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/SendBox.js +16 -6
- package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.d.ts +15 -0
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +19 -0
- package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +3 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/ChatButton/useUnreadMessagesTracker.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/ChatButton/useUnreadMessagesTracker.js +3 -3
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/ChatButton/useUnreadMessagesTracker.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +26 -12
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +130 -66
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +11 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/index.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/dist-cjs/communication-react/index-BTXDJhYg.js.map +0 -1
@@ -176,7 +176,7 @@ function getDefaultExportFromCjs (x) {
|
|
176
176
|
// Copyright (c) Microsoft Corporation.
|
177
177
|
// Licensed under the MIT License.
|
178
178
|
// GENERATED FILE. DO NOT EDIT MANUALLY.
|
179
|
-
var telemetryVersion = '1.16.0-alpha-
|
179
|
+
var telemetryVersion = '1.16.0-alpha-202404260012';
|
180
180
|
|
181
181
|
|
182
182
|
var telemetryVersion$1 = /*@__PURE__*/getDefaultExportFromCjs(telemetryVersion);
|
@@ -1359,7 +1359,7 @@ const _captionsBannerSelector = reselect__namespace.createSelector([getCaptions,
|
|
1359
1359
|
var _a, _b, _c;
|
1360
1360
|
const userId = getCaptionsSpeakerIdentifier(c);
|
1361
1361
|
return {
|
1362
|
-
id: (_a = c.speaker.displayName) !== null && _a !== void 0 ? _a : 'Unnamed Participant' + index,
|
1362
|
+
id: ((_a = c.speaker.displayName) !== null && _a !== void 0 ? _a : 'Unnamed Participant') + index,
|
1363
1363
|
displayName: (_b = c.speaker.displayName) !== null && _b !== void 0 ? _b : 'Unnamed Participant',
|
1364
1364
|
captionText: (_c = c.captionText) !== null && _c !== void 0 ? _c : '',
|
1365
1365
|
userId
|
@@ -8727,7 +8727,7 @@ const iconWrapperStyle$1 = react.mergeStyles({
|
|
8727
8727
|
* @private
|
8728
8728
|
*/
|
8729
8729
|
const InputBoxButton = (props) => {
|
8730
|
-
const { onRenderIcon, onClick, ariaLabel, className, id, tooltipContent, 'data-testId': dataTestId } = props;
|
8730
|
+
const { onRenderIcon, onClick, ariaLabel, className, id, tooltipContent, 'data-testId': dataTestId, ariaDisabled = false } = props;
|
8731
8731
|
const [isHover, setIsHover] = React.useState(false);
|
8732
8732
|
const mergedButtonStyle = react.mergeStyles(inputBoxButtonStyle, className);
|
8733
8733
|
const theme = react.useTheme();
|
@@ -8739,13 +8739,14 @@ const InputBoxButton = (props) => {
|
|
8739
8739
|
backgroundColor: isDarkThemed(theme) ? theme.palette.neutralLighter : ''
|
8740
8740
|
};
|
8741
8741
|
return (React.createElement(react.TooltipHost, { hostClassName: inputBoxButtonTooltipStyle, content: tooltipContent, calloutProps: Object.assign({}, calloutProps) },
|
8742
|
-
React.createElement(react.
|
8743
|
-
|
8744
|
-
|
8745
|
-
|
8746
|
-
|
8747
|
-
|
8748
|
-
|
8742
|
+
React.createElement(react.Stack, { "aria-disabled": ariaDisabled },
|
8743
|
+
React.createElement(react.IconButton, { className: mergedButtonStyle, ariaLabel: ariaLabel, onClick: onClick, id: id, onMouseEnter: () => {
|
8744
|
+
setIsHover(true);
|
8745
|
+
}, onMouseLeave: () => {
|
8746
|
+
setIsHover(false);
|
8747
|
+
},
|
8748
|
+
// VoiceOver fix: Avoid icon from stealing focus when IconButton is double-tapped to send message by wrapping with Stack with pointerEvents style to none
|
8749
|
+
onRenderIcon: () => React.createElement(react.Stack, { className: iconWrapperStyle$1 }, onRenderIcon(isHover)), "data-testid": dataTestId }))));
|
8749
8750
|
};
|
8750
8751
|
|
8751
8752
|
// Copyright (c) Microsoft Corporation.
|
@@ -9043,6 +9044,25 @@ const sanitizeText = (message) => {
|
|
9043
9044
|
return message;
|
9044
9045
|
}
|
9045
9046
|
};
|
9047
|
+
/**
|
9048
|
+
* Determines whether the send box should be disabled for ARIA accessibility.
|
9049
|
+
*
|
9050
|
+
* @param hasContent - Indicates whether the send box has content.
|
9051
|
+
* @param hasCompletedAttachmentUploads - Indicates whether attachment uploads have completed.
|
9052
|
+
* @param hasError - Indicates whether there is an error.
|
9053
|
+
* @param disabled - Indicates whether the send box is disabled.
|
9054
|
+
* @returns A boolean value indicating whether the send box should be disabled for ARIA accessibility.
|
9055
|
+
*/
|
9056
|
+
const isSendBoxButtonAriaDisabled = ({ hasContent,
|
9057
|
+
/* @conditional-compile-remove(attachment-upload) */
|
9058
|
+
hasCompletedAttachmentUploads, hasError, disabled }) => {
|
9059
|
+
return (
|
9060
|
+
// no content
|
9061
|
+
!(hasContent || /* @conditional-compile-remove(attachment-upload) */ hasCompletedAttachmentUploads) ||
|
9062
|
+
//error message exists
|
9063
|
+
hasError ||
|
9064
|
+
disabled);
|
9065
|
+
};
|
9046
9066
|
|
9047
9067
|
// Copyright (c) Microsoft Corporation.
|
9048
9068
|
// Licensed under the MIT License.
|
@@ -9447,8 +9467,8 @@ const SendBox = (props) => {
|
|
9447
9467
|
/* @conditional-compile-remove(attachment-upload) */ hasCompletedAttachmentUploads(attachmentsWithProgress)) {
|
9448
9468
|
onSendMessage && onSendMessage(message);
|
9449
9469
|
setTextValue('');
|
9470
|
+
(_a = sendTextFieldRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
9450
9471
|
}
|
9451
|
-
(_a = sendTextFieldRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
9452
9472
|
};
|
9453
9473
|
const setText = (newValue) => {
|
9454
9474
|
if (newValue === undefined) {
|
@@ -9463,17 +9483,27 @@ const SendBox = (props) => {
|
|
9463
9483
|
const mergedStyles = React.useMemo(() => react.concatStyleSets(styles), [styles]);
|
9464
9484
|
const mergedSendIconStyle = React.useMemo(() => sendIconStyle({
|
9465
9485
|
theme,
|
9466
|
-
hasText:
|
9486
|
+
hasText: sanitizeText(textValue).length > 0,
|
9467
9487
|
/* @conditional-compile-remove(attachment-upload) */ hasAttachment: hasCompletedAttachmentUploads(attachmentsWithProgress),
|
9468
9488
|
hasErrorMessage: !!errorMessage,
|
9469
|
-
customSendIconStyle: styles === null || styles === void 0 ? void 0 : styles.sendMessageIcon
|
9489
|
+
customSendIconStyle: styles === null || styles === void 0 ? void 0 : styles.sendMessageIcon,
|
9490
|
+
disabled: !!disabled
|
9470
9491
|
}), [
|
9471
9492
|
theme,
|
9472
9493
|
textValue,
|
9473
9494
|
/* @conditional-compile-remove(attachment-upload) */ attachmentsWithProgress,
|
9474
9495
|
errorMessage,
|
9475
|
-
styles === null || styles === void 0 ? void 0 : styles.sendMessageIcon
|
9496
|
+
styles === null || styles === void 0 ? void 0 : styles.sendMessageIcon,
|
9497
|
+
disabled
|
9476
9498
|
]);
|
9499
|
+
const isSendBoxButtonAriaDisabledValue = React.useMemo(() => {
|
9500
|
+
return isSendBoxButtonAriaDisabled({
|
9501
|
+
hasContent: sanitizeText(textValue).length > 0,
|
9502
|
+
/* @conditional-compile-remove(attachment-upload) */ hasCompletedAttachmentUploads: hasCompletedAttachmentUploads(attachmentsWithProgress),
|
9503
|
+
hasError: !!errorMessage,
|
9504
|
+
disabled: !!disabled
|
9505
|
+
});
|
9506
|
+
}, [/* @conditional-compile-remove(attachment-upload) */ attachmentsWithProgress, disabled, errorMessage, textValue]);
|
9477
9507
|
const onRenderSendIcon = React.useCallback((isHover) => onRenderIcon ? (onRenderIcon(isHover)) : (React.createElement(react.Icon, { iconName: isHover && textValue ? 'SendBoxSendHovered' : 'SendBoxSend', className: mergedSendIconStyle })), [mergedSendIconStyle, onRenderIcon, textValue]);
|
9478
9508
|
// Ensure that errors are cleared when there are no attachments in sendBox
|
9479
9509
|
/* @conditional-compile-remove(attachment-upload) */
|
@@ -9542,7 +9572,7 @@ const SendBox = (props) => {
|
|
9542
9572
|
sendMessageOnClick();
|
9543
9573
|
}
|
9544
9574
|
e.stopPropagation();
|
9545
|
-
}, id: 'sendIconWrapper', className: mergedSendButtonStyle, ariaLabel: localeStrings.sendButtonAriaLabel, tooltipContent: localeStrings.sendButtonAriaLabel })),
|
9575
|
+
}, id: 'sendIconWrapper', className: mergedSendButtonStyle, ariaLabel: localeStrings.sendButtonAriaLabel, tooltipContent: localeStrings.sendButtonAriaLabel, ariaDisabled: isSendBoxButtonAriaDisabledValue })),
|
9546
9576
|
/* @conditional-compile-remove(attachment-upload) */
|
9547
9577
|
onRenderAttachmentUploads())));
|
9548
9578
|
};
|
@@ -10872,8 +10902,8 @@ const RichTextSendBox = (props) => {
|
|
10872
10902
|
onSendMessage(message);
|
10873
10903
|
setContentValue('');
|
10874
10904
|
(_b = editorComponentRef.current) === null || _b === void 0 ? void 0 : _b.setEmptyContent();
|
10905
|
+
(_c = editorComponentRef.current) === null || _c === void 0 ? void 0 : _c.focus();
|
10875
10906
|
}
|
10876
|
-
(_c = editorComponentRef.current) === null || _c === void 0 ? void 0 : _c.focus();
|
10877
10907
|
}, [
|
10878
10908
|
contentValue,
|
10879
10909
|
contentValueOverflow,
|
@@ -10899,16 +10929,18 @@ const RichTextSendBox = (props) => {
|
|
10899
10929
|
attachmentUploadsPendingError,
|
10900
10930
|
systemMessage
|
10901
10931
|
]);
|
10902
|
-
const
|
10932
|
+
const hasContent = React.useMemo(() => {
|
10903
10933
|
var _a;
|
10904
10934
|
// get plain text content from the editor to check if the message is empty
|
10905
10935
|
// as the content may contain tags even when the content is empty
|
10906
10936
|
const plainTextContent = (_a = editorComponentRef.current) === null || _a === void 0 ? void 0 : _a.getPlainContent();
|
10907
|
-
|
10937
|
+
return !isContentEmpty({
|
10908
10938
|
plainTextContent: plainTextContent,
|
10909
10939
|
content: contentValue,
|
10910
10940
|
placeholder: strings.placeholderText
|
10911
10941
|
});
|
10942
|
+
}, [contentValue, strings.placeholderText]);
|
10943
|
+
const onRenderSendIcon = React.useCallback((isHover) => {
|
10912
10944
|
return (React.createElement(react.Icon, { iconName: isHover && hasContent ? 'SendBoxSendHovered' : 'SendBoxSend', className: sendIconStyle({
|
10913
10945
|
theme,
|
10914
10946
|
hasText: hasContent,
|
@@ -10918,7 +10950,7 @@ const RichTextSendBox = (props) => {
|
|
10918
10950
|
defaultTextColor: theme.palette.neutralSecondary,
|
10919
10951
|
disabled: disabled
|
10920
10952
|
}) }));
|
10921
|
-
}, [
|
10953
|
+
}, [disabled, hasContent, hasErrorMessage, theme]);
|
10922
10954
|
const sendBoxErrorsProps = React.useMemo(() => {
|
10923
10955
|
var _a, _b;
|
10924
10956
|
/* @conditional-compile-remove(attachment-upload) */
|
@@ -10963,12 +10995,25 @@ const RichTextSendBox = (props) => {
|
|
10963
10995
|
strings.attachmentMoreMenu,
|
10964
10996
|
theme
|
10965
10997
|
]);
|
10998
|
+
const isSendBoxButtonAriaDisabledValue = React.useMemo(() => {
|
10999
|
+
return isSendBoxButtonAriaDisabled({
|
11000
|
+
hasContent,
|
11001
|
+
/* @conditional-compile-remove(attachment-upload) */ hasCompletedAttachmentUploads: hasCompletedAttachmentUploads(attachmentsWithProgress),
|
11002
|
+
hasError: hasErrorMessage,
|
11003
|
+
disabled
|
11004
|
+
});
|
11005
|
+
}, [
|
11006
|
+
/* @conditional-compile-remove(attachment-upload) */ attachmentsWithProgress,
|
11007
|
+
disabled,
|
11008
|
+
hasContent,
|
11009
|
+
hasErrorMessage
|
11010
|
+
]);
|
10966
11011
|
const sendButton = React.useMemo(() => {
|
10967
11012
|
return (React.createElement(InputBoxButton, { onRenderIcon: onRenderSendIcon, onClick: (e) => {
|
10968
11013
|
sendMessageOnClick();
|
10969
11014
|
e.stopPropagation(); // Prevents the click from bubbling up and triggering a focus event on the chat.
|
10970
|
-
}, className: richTextActionButtonsStyle, ariaLabel: localeStrings.sendButtonAriaLabel, tooltipContent: localeStrings.sendButtonAriaLabel }));
|
10971
|
-
}, [localeStrings.sendButtonAriaLabel, onRenderSendIcon, sendMessageOnClick]);
|
11015
|
+
}, className: richTextActionButtonsStyle, ariaLabel: localeStrings.sendButtonAriaLabel, tooltipContent: localeStrings.sendButtonAriaLabel, ariaDisabled: isSendBoxButtonAriaDisabledValue }));
|
11016
|
+
}, [isSendBoxButtonAriaDisabledValue, localeStrings.sendButtonAriaLabel, onRenderSendIcon, sendMessageOnClick]);
|
10972
11017
|
/* @conditional-compile-remove(attachment-upload) */
|
10973
11018
|
const hasAttachmentUploads = React.useMemo(() => {
|
10974
11019
|
return (hasCompletedAttachmentUploads(attachmentsWithProgress) || hasIncompleteAttachmentUploads(attachmentsWithProgress));
|
@@ -12224,7 +12269,9 @@ const extractContentForAllyMessage = (props) => {
|
|
12224
12269
|
parsedContent.appendChild(attachmentTextNode);
|
12225
12270
|
}
|
12226
12271
|
// Strip all html tags from the content for aria.
|
12227
|
-
|
12272
|
+
let message = DOMPurify.sanitize(parsedContent, { ALLOWED_TAGS: [] });
|
12273
|
+
// decode HTML entities so that screen reader can read the content properly.
|
12274
|
+
message = decodeEntities(message);
|
12228
12275
|
return message;
|
12229
12276
|
}
|
12230
12277
|
return '';
|
@@ -12299,6 +12346,31 @@ const processHtmlToReact = (props) => {
|
|
12299
12346
|
};
|
12300
12347
|
return React.createElement(React.Fragment, null, parse((_a = props.message.content) !== null && _a !== void 0 ? _a : '', options));
|
12301
12348
|
};
|
12349
|
+
const decodeEntities = (encodedString) => {
|
12350
|
+
// This regular expression matches HTML entities.
|
12351
|
+
const translate_re = /&(nbsp|amp|quot|lt|gt);/g;
|
12352
|
+
// This object maps HTML entities to their respective characters.
|
12353
|
+
const translate = {
|
12354
|
+
nbsp: ' ',
|
12355
|
+
amp: '&',
|
12356
|
+
quot: '"',
|
12357
|
+
lt: '<',
|
12358
|
+
gt: '>'
|
12359
|
+
};
|
12360
|
+
return (encodedString
|
12361
|
+
// Find all matches of HTML entities defined in translate_re and
|
12362
|
+
// replace them with the corresponding character from the translate object.
|
12363
|
+
.replace(translate_re, function (match, entity) {
|
12364
|
+
return translate[entity];
|
12365
|
+
})
|
12366
|
+
// Find numeric entities (e.g., A)
|
12367
|
+
// and replace them with the equivalent character using the String.fromCharCode method,
|
12368
|
+
// which converts Unicode values into characters.
|
12369
|
+
.replace(/&#(\d+);/gi, function (match, numStr) {
|
12370
|
+
const num = parseInt(numStr, 10);
|
12371
|
+
return String.fromCharCode(num);
|
12372
|
+
}));
|
12373
|
+
};
|
12302
12374
|
|
12303
12375
|
// Copyright (c) Microsoft Corporation.
|
12304
12376
|
// Licensed under the MIT License.
|
@@ -12831,7 +12903,7 @@ class ErrorBoundary extends React.Component {
|
|
12831
12903
|
// Copyright (c) Microsoft Corporation.
|
12832
12904
|
// Licensed under the MIT License.
|
12833
12905
|
/* @conditional-compile-remove(rich-text-editor) */
|
12834
|
-
const ChatMessageComponentAsRichTextEditBox = React.lazy(() => Promise.resolve().then(function () { return require('./ChatMessageComponentAsRichTextEditBox-
|
12906
|
+
const ChatMessageComponentAsRichTextEditBox = React.lazy(() => Promise.resolve().then(function () { return require('./ChatMessageComponentAsRichTextEditBox-BLhY8s2s.js'); }));
|
12835
12907
|
/**
|
12836
12908
|
* @private
|
12837
12909
|
* Use this function to load RoosterJS dependencies early in the lifecycle.
|
@@ -12839,7 +12911,7 @@ const ChatMessageComponentAsRichTextEditBox = React.lazy(() => Promise.resolve()
|
|
12839
12911
|
*
|
12840
12912
|
* @conditional-compile-remove(rich-text-editor)
|
12841
12913
|
*/
|
12842
|
-
const loadChatMessageComponentAsRichTextEditBox = () => Promise.resolve().then(function () { return require('./ChatMessageComponentAsRichTextEditBox-
|
12914
|
+
const loadChatMessageComponentAsRichTextEditBox = () => Promise.resolve().then(function () { return require('./ChatMessageComponentAsRichTextEditBox-BLhY8s2s.js'); });
|
12843
12915
|
/**
|
12844
12916
|
* @private
|
12845
12917
|
*/
|
@@ -37748,12 +37820,12 @@ const chatNotificationContainerStyles = {
|
|
37748
37820
|
* Used by the CallWithChatComposite to track unread messages for showing as a badge on the Chat Button.
|
37749
37821
|
* @private
|
37750
37822
|
*/
|
37751
|
-
const useUnreadMessagesTracker = (chatAdapter, isChatPaneVisible) => {
|
37823
|
+
const useUnreadMessagesTracker = (chatAdapter, isChatPaneVisible, isChatInitiazed) => {
|
37752
37824
|
// Store messageIds of unread messages
|
37753
37825
|
const [unreadChatMessages, setUnreadChatMessages] = React.useState(new Set());
|
37754
37826
|
React.useEffect(() => {
|
37755
37827
|
// Clear unread messages when chat pane is opened
|
37756
|
-
if (isChatPaneVisible) {
|
37828
|
+
if (isChatPaneVisible || !isChatInitiazed) {
|
37757
37829
|
setUnreadChatMessages(new Set());
|
37758
37830
|
return;
|
37759
37831
|
}
|
@@ -37783,7 +37855,7 @@ const useUnreadMessagesTracker = (chatAdapter, isChatPaneVisible) => {
|
|
37783
37855
|
chatAdapter.off('messageReceived', incrementUnreadChatMessagesCount);
|
37784
37856
|
chatAdapter.off('messageDeleted', decrementUnreadChatMessagesCount);
|
37785
37857
|
};
|
37786
|
-
}, [chatAdapter, setUnreadChatMessages, isChatPaneVisible]);
|
37858
|
+
}, [chatAdapter, setUnreadChatMessages, isChatPaneVisible, isChatInitiazed]);
|
37787
37859
|
return unreadChatMessages.size;
|
37788
37860
|
};
|
37789
37861
|
/**
|
@@ -37804,6 +37876,7 @@ const CallWithChatScreen = (props) => {
|
|
37804
37876
|
}
|
37805
37877
|
const callAdapter = React.useMemo(() => new CallWithChatBackedCallAdapter(callWithChatAdapter), [callWithChatAdapter]);
|
37806
37878
|
const [currentCallState, setCurrentCallState] = React.useState();
|
37879
|
+
const [isChatInitialized, setIsChatInitialized] = React.useState(false);
|
37807
37880
|
const [currentPage, setCurrentPage] = React.useState();
|
37808
37881
|
const [isChatOpen, setIsChatOpen] = React.useState(false);
|
37809
37882
|
const containerRef = React.useRef(null);
|
@@ -37812,6 +37885,7 @@ const CallWithChatScreen = (props) => {
|
|
37812
37885
|
var _a;
|
37813
37886
|
setCurrentPage(newState.page);
|
37814
37887
|
setCurrentCallState((_a = newState.call) === null || _a === void 0 ? void 0 : _a.state);
|
37888
|
+
setIsChatInitialized(newState.chat ? true : false);
|
37815
37889
|
};
|
37816
37890
|
updateCallWithChatPage(callWithChatAdapter.getState());
|
37817
37891
|
callWithChatAdapter.onStateChange(updateCallWithChatPage);
|
@@ -37869,7 +37943,7 @@ const CallWithChatScreen = (props) => {
|
|
37869
37943
|
disabled: chatButtonDisabled
|
37870
37944
|
}
|
37871
37945
|
: undefined, [chatButtonDisabled, mobileView, toggleChat, showChatButton]);
|
37872
|
-
const unreadChatMessagesCount = useUnreadMessagesTracker(chatAdapter, isChatOpen);
|
37946
|
+
const unreadChatMessagesCount = useUnreadMessagesTracker(chatAdapter, isChatOpen, isChatInitialized);
|
37873
37947
|
const customChatButton = React.useCallback((args) => ({
|
37874
37948
|
placement: mobileView ? 'primary' : 'secondary',
|
37875
37949
|
onRenderButton: () => (React.createElement(ChatButtonWithUnreadMessagesBadge, { checked: isChatOpen, showLabel: args.displayType !== 'compact', onClick: toggleChat, disabled: chatButtonDisabled, strings: chatButtonStrings, styles: commonButtonStyles, newMessageLabel: callWithChatStrings.chatButtonNewMessageNotificationLabel, unreadChatMessagesCount: unreadChatMessagesCount,
|
@@ -38123,44 +38197,48 @@ class CallWithChatContext {
|
|
38123
38197
|
* Created for easy use with the {@link CallWithChatComposite}.
|
38124
38198
|
*/
|
38125
38199
|
class AzureCommunicationCallWithChatAdapter {
|
38126
|
-
constructor(callAdapter,
|
38200
|
+
constructor(callAdapter, chatAdapter) {
|
38201
|
+
this.emitter = new EventEmitter.EventEmitter();
|
38202
|
+
this.isAdapterDisposed = false;
|
38127
38203
|
/* @conditional-compile-remove(attachment-upload) */
|
38128
38204
|
this.registerActiveUploads = (files) => {
|
38129
|
-
|
38130
|
-
|
38205
|
+
return this.executeWithResolvedChatAdapter((adapter) => {
|
38206
|
+
return adapter.registerActiveUploads(files);
|
38207
|
+
});
|
38131
38208
|
};
|
38132
38209
|
/* @conditional-compile-remove(attachment-upload) */
|
38133
38210
|
this.registerCompletedUploads = (metadata) => {
|
38134
|
-
|
38135
|
-
|
38211
|
+
return this.executeWithResolvedChatAdapter((adapter) => {
|
38212
|
+
return adapter.registerCompletedUploads(metadata);
|
38213
|
+
});
|
38136
38214
|
};
|
38137
38215
|
/* @conditional-compile-remove(attachment-upload) */
|
38138
38216
|
this.clearUploads = () => {
|
38139
|
-
this.
|
38217
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38140
38218
|
adapter.clearUploads();
|
38141
38219
|
});
|
38142
38220
|
};
|
38143
38221
|
/* @conditional-compile-remove(attachment-upload) */
|
38144
38222
|
this.cancelUpload = (id) => {
|
38145
|
-
this.
|
38223
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38146
38224
|
adapter.cancelUpload(id);
|
38147
38225
|
});
|
38148
38226
|
};
|
38149
38227
|
/* @conditional-compile-remove(attachment-upload) */
|
38150
38228
|
this.updateUploadProgress = (id, progress) => {
|
38151
|
-
this.
|
38229
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38152
38230
|
adapter.updateUploadProgress(id, progress);
|
38153
38231
|
});
|
38154
38232
|
};
|
38155
38233
|
/* @conditional-compile-remove(attachment-upload) */
|
38156
38234
|
this.updateUploadStatusMessage = (id, errorMessage) => {
|
38157
|
-
this.
|
38235
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38158
38236
|
adapter.updateUploadStatusMessage(id, errorMessage);
|
38159
38237
|
});
|
38160
38238
|
};
|
38161
38239
|
/* @conditional-compile-remove(attachment-upload) */
|
38162
38240
|
this.updateUploadMetadata = (id, metadata) => {
|
38163
|
-
this.
|
38241
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38164
38242
|
adapter.updateUploadMetadata(id, metadata);
|
38165
38243
|
});
|
38166
38244
|
};
|
@@ -38171,19 +38249,28 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38171
38249
|
this.context.updateClientStateWithChatState(newChatAdapterState);
|
38172
38250
|
};
|
38173
38251
|
this.onChatStateChange = onChatStateChange;
|
38174
|
-
|
38175
|
-
|
38176
|
-
|
38177
|
-
/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
|
38178
|
-
this.chatAdapter = chatAdapter;
|
38179
|
-
this.context.updateClientStateWithChatState(chatAdapter.getState());
|
38180
|
-
});
|
38252
|
+
if (chatAdapter) {
|
38253
|
+
this.updateChatAdapter(chatAdapter);
|
38254
|
+
}
|
38181
38255
|
const onCallStateChange = (newCallAdapterState) => {
|
38182
38256
|
this.context.updateClientStateWithCallState(newCallAdapterState);
|
38183
38257
|
};
|
38184
38258
|
this.callAdapter.onStateChange(onCallStateChange);
|
38185
38259
|
this.onCallStateChange = onCallStateChange;
|
38186
38260
|
}
|
38261
|
+
setChatAdapterPromise(chatAdapter) {
|
38262
|
+
chatAdapter.then((adapter) => {
|
38263
|
+
if (!this.isAdapterDisposed) {
|
38264
|
+
this.updateChatAdapter(adapter);
|
38265
|
+
}
|
38266
|
+
});
|
38267
|
+
}
|
38268
|
+
updateChatAdapter(chatAdapter) {
|
38269
|
+
this.chatAdapter = chatAdapter;
|
38270
|
+
this.chatAdapter.onStateChange(this.onChatStateChange);
|
38271
|
+
this.context.updateClientStateWithChatState(chatAdapter.getState());
|
38272
|
+
this.emitter.emit('chatInitialized', this.chatAdapter);
|
38273
|
+
}
|
38187
38274
|
bindPublicMethods() {
|
38188
38275
|
this.joinCall.bind(this);
|
38189
38276
|
this.leaveCall.bind(this);
|
@@ -38304,16 +38391,13 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38304
38391
|
}
|
38305
38392
|
/** Dispose of the current CallWithChatAdapter. */
|
38306
38393
|
dispose() {
|
38307
|
-
|
38308
|
-
|
38309
|
-
|
38310
|
-
|
38311
|
-
|
38312
|
-
|
38313
|
-
|
38314
|
-
});
|
38315
|
-
this.callAdapter.dispose();
|
38316
|
-
});
|
38394
|
+
this.isAdapterDisposed = true;
|
38395
|
+
if (this.chatAdapter) {
|
38396
|
+
this.chatAdapter.offStateChange(this.onChatStateChange);
|
38397
|
+
this.chatAdapter.dispose();
|
38398
|
+
}
|
38399
|
+
this.callAdapter.offStateChange(this.onCallStateChange);
|
38400
|
+
this.callAdapter.dispose();
|
38317
38401
|
}
|
38318
38402
|
/** Remove a participant from the Call only. */
|
38319
38403
|
removeParticipant(userId) {
|
@@ -38451,7 +38535,7 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38451
38535
|
/** Fetch initial Call and Chat data such as chat messages. */
|
38452
38536
|
fetchInitialData() {
|
38453
38537
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38454
|
-
return yield this.
|
38538
|
+
return yield this.executeWithResolvedChatAdapter((adapter) => {
|
38455
38539
|
return adapter.fetchInitialData();
|
38456
38540
|
});
|
38457
38541
|
});
|
@@ -38459,7 +38543,7 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38459
38543
|
/** Send a chat message. */
|
38460
38544
|
sendMessage(content) {
|
38461
38545
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38462
|
-
return yield this.
|
38546
|
+
return yield this.executeWithResolvedChatAdapter((adapter) => {
|
38463
38547
|
return adapter.sendMessage(content);
|
38464
38548
|
});
|
38465
38549
|
});
|
@@ -38468,7 +38552,7 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38468
38552
|
/** Send a chat message with attachments. */
|
38469
38553
|
sendMessageWithAttachments(content, attachments) {
|
38470
38554
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38471
|
-
return yield this.
|
38555
|
+
return yield this.executeWithResolvedChatAdapter((adapter) => {
|
38472
38556
|
const fileSharingMetadata = {
|
38473
38557
|
fileSharingMetadata: JSON.stringify(attachments)
|
38474
38558
|
};
|
@@ -38481,7 +38565,7 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38481
38565
|
/** Send a chat read receipt. */
|
38482
38566
|
sendReadReceipt(chatMessageId) {
|
38483
38567
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38484
|
-
return yield this.
|
38568
|
+
return yield this.executeWithResolvedChatAdapter((adapter) => {
|
38485
38569
|
return adapter.sendReadReceipt(chatMessageId);
|
38486
38570
|
});
|
38487
38571
|
});
|
@@ -38489,7 +38573,7 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38489
38573
|
/** Send an isTyping indicator. */
|
38490
38574
|
sendTypingIndicator() {
|
38491
38575
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38492
|
-
return yield this.
|
38576
|
+
return yield this.executeWithResolvedChatAdapter((adapter) => {
|
38493
38577
|
return adapter.sendTypingIndicator();
|
38494
38578
|
});
|
38495
38579
|
});
|
@@ -38497,7 +38581,7 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38497
38581
|
/** Load previous Chat messages. */
|
38498
38582
|
loadPreviousChatMessages(messagesToLoad) {
|
38499
38583
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38500
|
-
return yield this.
|
38584
|
+
return yield this.executeWithResolvedChatAdapter((adapter) => {
|
38501
38585
|
return adapter.loadPreviousChatMessages(messagesToLoad);
|
38502
38586
|
});
|
38503
38587
|
});
|
@@ -38505,7 +38589,7 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38505
38589
|
/** Update an existing message. */
|
38506
38590
|
updateMessage(messageId, content, metadata, options) {
|
38507
38591
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38508
|
-
return this.
|
38592
|
+
return this.executeWithResolvedChatAdapter((adapter) => {
|
38509
38593
|
return adapter.updateMessage(messageId, content, metadata,
|
38510
38594
|
/* @conditional-compile-remove(attachment-upload) */ options);
|
38511
38595
|
});
|
@@ -38514,20 +38598,20 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38514
38598
|
/** Delete an existing message. */
|
38515
38599
|
deleteMessage(messageId) {
|
38516
38600
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38517
|
-
return yield this.
|
38601
|
+
return yield this.executeWithResolvedChatAdapter((adapter) => {
|
38518
38602
|
return adapter.deleteMessage(messageId);
|
38519
38603
|
});
|
38520
38604
|
});
|
38521
38605
|
}
|
38522
38606
|
downloadResourceToCache(resourceDetails) {
|
38523
38607
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38524
|
-
this.
|
38608
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38525
38609
|
adapter.downloadResourceToCache(resourceDetails);
|
38526
38610
|
});
|
38527
38611
|
});
|
38528
38612
|
}
|
38529
38613
|
removeResourceFromCache(resourceDetails) {
|
38530
|
-
this.
|
38614
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38531
38615
|
adapter.removeResourceFromCache(resourceDetails);
|
38532
38616
|
});
|
38533
38617
|
}
|
@@ -38669,37 +38753,37 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38669
38753
|
this.callAdapter.on('isSpokenLanguageChanged', listener);
|
38670
38754
|
break;
|
38671
38755
|
case 'messageReceived':
|
38672
|
-
this.
|
38756
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38673
38757
|
adapter.on('messageReceived', listener);
|
38674
38758
|
});
|
38675
38759
|
break;
|
38676
38760
|
case 'messageEdited':
|
38677
|
-
this.
|
38761
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38678
38762
|
adapter.on('messageEdited', listener);
|
38679
38763
|
});
|
38680
38764
|
break;
|
38681
38765
|
case 'messageDeleted':
|
38682
|
-
this.
|
38766
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38683
38767
|
adapter.on('messageDeleted', listener);
|
38684
38768
|
});
|
38685
38769
|
break;
|
38686
38770
|
case 'messageSent':
|
38687
|
-
this.
|
38771
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38688
38772
|
adapter.on('messageSent', listener);
|
38689
38773
|
});
|
38690
38774
|
break;
|
38691
38775
|
case 'messageRead':
|
38692
|
-
this.
|
38776
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38693
38777
|
adapter.on('messageRead', listener);
|
38694
38778
|
});
|
38695
38779
|
break;
|
38696
38780
|
case 'chatParticipantsAdded':
|
38697
|
-
this.
|
38781
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38698
38782
|
adapter.on('participantsAdded', listener);
|
38699
38783
|
});
|
38700
38784
|
break;
|
38701
38785
|
case 'chatParticipantsRemoved':
|
38702
|
-
this.
|
38786
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38703
38787
|
adapter.on('participantsRemoved', listener);
|
38704
38788
|
});
|
38705
38789
|
break;
|
@@ -38707,10 +38791,13 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38707
38791
|
this.callAdapter.on('error', listener);
|
38708
38792
|
break;
|
38709
38793
|
case 'chatError':
|
38710
|
-
this.
|
38794
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38711
38795
|
adapter.on('error', listener);
|
38712
38796
|
});
|
38713
38797
|
break;
|
38798
|
+
case 'chatInitialized':
|
38799
|
+
this.emitter.on(event, listener);
|
38800
|
+
break;
|
38714
38801
|
default:
|
38715
38802
|
throw `Unknown AzureCommunicationCallWithChatAdapter Event: ${event}`;
|
38716
38803
|
}
|
@@ -38761,37 +38848,37 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38761
38848
|
this.callAdapter.off('isSpokenLanguageChanged', listener);
|
38762
38849
|
break;
|
38763
38850
|
case 'messageReceived':
|
38764
|
-
this.
|
38851
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38765
38852
|
adapter.off('messageReceived', listener);
|
38766
38853
|
});
|
38767
38854
|
break;
|
38768
38855
|
case 'messageEdited':
|
38769
|
-
this.
|
38856
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38770
38857
|
adapter.off('messageEdited', listener);
|
38771
38858
|
});
|
38772
38859
|
break;
|
38773
38860
|
case 'messageDeleted':
|
38774
|
-
this.
|
38861
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38775
38862
|
adapter.off('messageDeleted', listener);
|
38776
38863
|
});
|
38777
38864
|
break;
|
38778
38865
|
case 'messageSent':
|
38779
|
-
this.
|
38866
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38780
38867
|
adapter.off('messageSent', listener);
|
38781
38868
|
});
|
38782
38869
|
break;
|
38783
38870
|
case 'messageRead':
|
38784
|
-
this.
|
38871
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38785
38872
|
adapter.off('messageRead', listener);
|
38786
38873
|
});
|
38787
38874
|
break;
|
38788
38875
|
case 'chatParticipantsAdded':
|
38789
|
-
this.
|
38876
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38790
38877
|
adapter.off('participantsAdded', listener);
|
38791
38878
|
});
|
38792
38879
|
break;
|
38793
38880
|
case 'chatParticipantsRemoved':
|
38794
|
-
this.
|
38881
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38795
38882
|
adapter.off('participantsRemoved', listener);
|
38796
38883
|
});
|
38797
38884
|
break;
|
@@ -38799,33 +38886,51 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38799
38886
|
this.callAdapter.off('error', listener);
|
38800
38887
|
break;
|
38801
38888
|
case 'chatError':
|
38802
|
-
this.
|
38889
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38803
38890
|
adapter.off('error', listener);
|
38804
38891
|
});
|
38805
38892
|
break;
|
38893
|
+
case 'chatInitialized':
|
38894
|
+
this.emitter.off(event, listener);
|
38895
|
+
break;
|
38806
38896
|
default:
|
38807
38897
|
throw `Unknown AzureCommunicationCallWithChatAdapter Event: ${event}`;
|
38808
38898
|
}
|
38809
38899
|
}
|
38900
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
38901
|
+
executeWithResolvedChatAdapter(callback) {
|
38902
|
+
if (!this.chatAdapter) {
|
38903
|
+
console.error('Chat is not initialized');
|
38904
|
+
}
|
38905
|
+
else {
|
38906
|
+
return callback(this.chatAdapter);
|
38907
|
+
}
|
38908
|
+
}
|
38810
38909
|
}
|
38811
38910
|
/**
|
38812
38911
|
* Arguments for use in {@link createAzureCommunicationCallWithChatAdapter} to join a Group Call with an associated Chat thread.
|
38813
|
-
* @
|
38912
|
+
* @private
|
38814
38913
|
*/
|
38815
38914
|
class CallAndChatProvider {
|
38816
38915
|
constructor(locator) {
|
38817
38916
|
this.locator = locator;
|
38818
38917
|
}
|
38819
|
-
|
38918
|
+
isCallInfoRequired() {
|
38919
|
+
return false;
|
38920
|
+
}
|
38921
|
+
getChatThreadPromise() {
|
38820
38922
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38821
|
-
return this.
|
38923
|
+
return this.getChatThread();
|
38822
38924
|
});
|
38823
38925
|
}
|
38926
|
+
getChatThread() {
|
38927
|
+
return this.locator.chatThreadId;
|
38928
|
+
}
|
38824
38929
|
}
|
38825
38930
|
/**
|
38826
38931
|
* Arguments for use in {@link createAzureCommunicationCallWithChatAdapter} to join a Teams meeting with an associated Chat thread.
|
38827
38932
|
*
|
38828
|
-
* @
|
38933
|
+
* @private
|
38829
38934
|
*/
|
38830
38935
|
class TeamsMeetingLinkProvider {
|
38831
38936
|
constructor(locator,
|
@@ -38834,7 +38939,14 @@ class TeamsMeetingLinkProvider {
|
|
38834
38939
|
/** @conditional-compile-remove(meeting-id) */
|
38835
38940
|
this.callAdapterPromise = callAdapterPromise;
|
38836
38941
|
}
|
38942
|
+
isCallInfoRequired() {
|
38943
|
+
return true;
|
38944
|
+
}
|
38837
38945
|
getChatThread() {
|
38946
|
+
/** @conditional-compile-remove(meeting-id) */
|
38947
|
+
throw new Error('Chat thread ID should be retrieved from call.callInfo using method getChatThreadPromise');
|
38948
|
+
}
|
38949
|
+
getChatThreadPromise() {
|
38838
38950
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38839
38951
|
/** @conditional-compile-remove(meeting-id) */
|
38840
38952
|
{
|
@@ -38863,28 +38975,45 @@ class TeamsMeetingLinkProvider {
|
|
38863
38975
|
/**
|
38864
38976
|
* Arguments for use in {@link createAzureCommunicationCallWithChatAdapter} to join a Teams meeting using meeting id.
|
38865
38977
|
*
|
38866
|
-
* @
|
38978
|
+
* @private
|
38867
38979
|
*/
|
38868
38980
|
class TeamsMeetingIdProvider {
|
38869
38981
|
constructor(locator, callAdapter) {
|
38870
38982
|
this.locator = locator;
|
38871
38983
|
this.callAdapter = callAdapter;
|
38872
38984
|
}
|
38985
|
+
isCallInfoRequired() {
|
38986
|
+
return true;
|
38987
|
+
}
|
38988
|
+
getChatThread() {
|
38989
|
+
throw new Error('Chat thread ID is not available for Teams meeting ID');
|
38990
|
+
}
|
38873
38991
|
/**
|
38874
38992
|
* Wait call to be connected to get thread ID.
|
38875
38993
|
* @returns the chat thread ID for the given meeting ID.
|
38876
38994
|
*/
|
38877
|
-
|
38995
|
+
getChatThreadPromise() {
|
38878
38996
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38879
38997
|
return new Promise((resolve) => {
|
38880
38998
|
const stateChangeListener = (state) => {
|
38881
38999
|
var _a, _b, _c;
|
38882
39000
|
if (((_a = state.call) === null || _a === void 0 ? void 0 : _a.state) === 'Connected' && ((_b = state.call.info) === null || _b === void 0 ? void 0 : _b.threadId)) {
|
39001
|
+
this.callAdapter.then((adapter) => {
|
39002
|
+
adapter.offStateChange(stateChangeListener);
|
39003
|
+
});
|
38883
39004
|
resolve((_c = state.call.info) === null || _c === void 0 ? void 0 : _c.threadId);
|
38884
39005
|
}
|
38885
39006
|
};
|
38886
39007
|
this.callAdapter.then((adapter) => {
|
38887
|
-
|
39008
|
+
var _a, _b, _c;
|
39009
|
+
const callState = (_a = adapter.getState().call) === null || _a === void 0 ? void 0 : _a.state;
|
39010
|
+
const threadId = (_c = (_b = adapter.getState().call) === null || _b === void 0 ? void 0 : _b.info) === null || _c === void 0 ? void 0 : _c.threadId;
|
39011
|
+
if (callState === 'Connected' && threadId) {
|
39012
|
+
resolve(threadId);
|
39013
|
+
}
|
39014
|
+
else {
|
39015
|
+
adapter.onStateChange(stateChangeListener);
|
39016
|
+
}
|
38888
39017
|
});
|
38889
39018
|
});
|
38890
39019
|
});
|
@@ -38909,8 +39038,16 @@ const createAzureCommunicationCallWithChatAdapter = (_a) => __awaiter$2(void 0,
|
|
38909
39038
|
telemetryImplementationHint: 'CallWithChat'
|
38910
39039
|
});
|
38911
39040
|
const chatThreadAdapter = _createChatThreadAdapterInner(locator, callAdapter);
|
38912
|
-
|
38913
|
-
|
39041
|
+
if (chatThreadAdapter.isCallInfoRequired()) {
|
39042
|
+
const callWithChatAdapter = new AzureCommunicationCallWithChatAdapter(yield callAdapter);
|
39043
|
+
const chatAdapterPromise = _createLazyAzureCommunicationChatAdapterInner(endpoint, userId, displayName, credential, chatThreadAdapter.getChatThreadPromise(), 'CallWithChat');
|
39044
|
+
callWithChatAdapter.setChatAdapterPromise(chatAdapterPromise);
|
39045
|
+
return callWithChatAdapter;
|
39046
|
+
}
|
39047
|
+
else {
|
39048
|
+
const chatAdapter = _createAzureCommunicationChatAdapterInner(endpoint, userId, displayName, credential, chatThreadAdapter.getChatThread(), 'CallWithChat');
|
39049
|
+
return new AzureCommunicationCallWithChatAdapter(yield callAdapter, yield chatAdapter);
|
39050
|
+
}
|
38914
39051
|
});
|
38915
39052
|
/**
|
38916
39053
|
* A custom React hook to simplify the creation of {@link CallWithChatAdapter}.
|
@@ -39039,8 +39176,8 @@ beforeDispose) => {
|
|
39039
39176
|
*/
|
39040
39177
|
const createAzureCommunicationCallWithChatAdapterFromClients = (_b) => __awaiter$2(void 0, [_b], void 0, function* ({ callClient, callAgent, callLocator, chatClient, chatThreadClient, callAdapterOptions }) {
|
39041
39178
|
const callAdapter = yield createAzureCommunicationCallAdapterFromClient(callClient, callAgent, callLocator, callAdapterOptions);
|
39042
|
-
const
|
39043
|
-
return new AzureCommunicationCallWithChatAdapter(callAdapter,
|
39179
|
+
const chatAdapter = yield createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient);
|
39180
|
+
return new AzureCommunicationCallWithChatAdapter(callAdapter, chatAdapter);
|
39044
39181
|
});
|
39045
39182
|
const isTeamsMeetingLocator = (locator) => {
|
39046
39183
|
return 'meetingLink' in locator || 'meetingId' in locator;
|
@@ -39628,4 +39765,4 @@ exports.useTeamsCall = useTeamsCall;
|
|
39628
39765
|
exports.useTeamsCallAdapter = useTeamsCallAdapter;
|
39629
39766
|
exports.useTeamsCallAgent = useTeamsCallAgent;
|
39630
39767
|
exports.useTheme = useTheme;
|
39631
|
-
//# sourceMappingURL=index-
|
39768
|
+
//# sourceMappingURL=index-r7pKdpFV.js.map
|