@azure/communication-react 1.16.0-alpha-202404252104 → 1.16.0-alpha-202404270012
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-DSlV4PZz.js} +2 -2
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-CWvESa8u.js.map → ChatMessageComponentAsRichTextEditBox-DSlV4PZz.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{index-BTXDJhYg.js → index-aGXLnB_I.js} +271 -100
- package/dist/dist-cjs/communication-react/index-aGXLnB_I.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/DevicesButton.d.ts +2 -1
- package/dist/dist-esm/react-components/src/components/DevicesButton.js +6 -2
- package/dist/dist-esm/react-components/src/components/DevicesButton.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/Buttons/Table/RichTextInsertTableButton.js +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextInsertTableButton.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextInsertTablePane.d.ts +1 -2
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextInsertTablePane.js +4 -2
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextInsertTablePane.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/CallComposite/CallComposite.js +3 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.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/dist/dist-esm/react-composites/src/composites/common/AudioProvider.d.ts +19 -0
- package/dist/dist-esm/react-composites/src/composites/common/AudioProvider.js +25 -0
- package/dist/dist-esm/react-composites/src/composites/common/AudioProvider.js.map +1 -0
- package/dist/dist-esm/react-composites/src/composites/common/BaseComposite.js +7 -1
- package/dist/dist-esm/react-composites/src/composites/common/BaseComposite.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-202404270012';
|
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
|
};
|
@@ -10159,9 +10189,10 @@ const RowColumnInitialValue = 0;
|
|
10159
10189
|
* Component for the insert table pane
|
10160
10190
|
*/
|
10161
10191
|
const RichTextInsertTablePane = (props) => {
|
10162
|
-
const { item, onClick,
|
10192
|
+
const { item, onClick, maxColumnsNumber, maxRowsNumber } = props;
|
10163
10193
|
const [column, setColumn] = React.useState(RowColumnInitialValue);
|
10164
10194
|
const [row, setRow] = React.useState(RowColumnInitialValue);
|
10195
|
+
const theme = useTheme();
|
10165
10196
|
const updateSize = React.useCallback((target) => {
|
10166
10197
|
if (target !== undefined && target.dataset.column !== undefined && target.dataset.row !== undefined) {
|
10167
10198
|
const column = parseInt(target.dataset.column);
|
@@ -10188,7 +10219,7 @@ const RichTextInsertTablePane = (props) => {
|
|
10188
10219
|
for (let j = 0; j < maxColumnsNumber; j++) {
|
10189
10220
|
const key = `cell_${i}_${j}`;
|
10190
10221
|
const isSelected = j <= column && i <= row;
|
10191
|
-
items.push(React.createElement("button", { className: react.mergeStyles(insertTableMenuCellButtonStyles(theme), isSelected ? insertTableMenuCellButtonSelectedStyles(theme) : undefined), onClick: onClickButton, key: key, id: key, "data-column": j, "data-row": i, "data-is-focusable": true, onMouseEnter: onMouseEnter, "aria-label": formatText((_a = item.text) !== null && _a !== void 0 ? _a : '', i, j) }));
|
10222
|
+
items.push(React.createElement("button", { className: react.mergeStyles(insertTableMenuCellButtonStyles(theme), isSelected ? insertTableMenuCellButtonSelectedStyles(theme) : undefined), onClick: onClickButton, key: key, id: key, "data-column": j, "data-row": i, "data-is-focusable": true, onMouseEnter: onMouseEnter, "aria-label": formatText((_a = item.text) !== null && _a !== void 0 ? _a : '', formatRowColumnText(i), formatRowColumnText(j)), "data-testid": key }));
|
10192
10223
|
}
|
10193
10224
|
}
|
10194
10225
|
return items;
|
@@ -10230,7 +10261,7 @@ const insertTableButton = (theme, maxRowsNumber, maxColumnsNumber) => {
|
|
10230
10261
|
insertTablePane: `Insert ${ColumnRowReplaceString} table`
|
10231
10262
|
},
|
10232
10263
|
itemRender: (item, onClick) => {
|
10233
|
-
return (React.createElement(RichTextInsertTablePane, { item: item, onClick: onClick,
|
10264
|
+
return (React.createElement(RichTextInsertTablePane, { item: item, onClick: onClick, maxColumnsNumber: maxColumnsNumber, maxRowsNumber: maxRowsNumber }));
|
10234
10265
|
},
|
10235
10266
|
commandBarSubMenuProperties: {
|
10236
10267
|
className: insertTableMenuTablePane
|
@@ -10872,8 +10903,8 @@ const RichTextSendBox = (props) => {
|
|
10872
10903
|
onSendMessage(message);
|
10873
10904
|
setContentValue('');
|
10874
10905
|
(_b = editorComponentRef.current) === null || _b === void 0 ? void 0 : _b.setEmptyContent();
|
10906
|
+
(_c = editorComponentRef.current) === null || _c === void 0 ? void 0 : _c.focus();
|
10875
10907
|
}
|
10876
|
-
(_c = editorComponentRef.current) === null || _c === void 0 ? void 0 : _c.focus();
|
10877
10908
|
}, [
|
10878
10909
|
contentValue,
|
10879
10910
|
contentValueOverflow,
|
@@ -10899,16 +10930,18 @@ const RichTextSendBox = (props) => {
|
|
10899
10930
|
attachmentUploadsPendingError,
|
10900
10931
|
systemMessage
|
10901
10932
|
]);
|
10902
|
-
const
|
10933
|
+
const hasContent = React.useMemo(() => {
|
10903
10934
|
var _a;
|
10904
10935
|
// get plain text content from the editor to check if the message is empty
|
10905
10936
|
// as the content may contain tags even when the content is empty
|
10906
10937
|
const plainTextContent = (_a = editorComponentRef.current) === null || _a === void 0 ? void 0 : _a.getPlainContent();
|
10907
|
-
|
10938
|
+
return !isContentEmpty({
|
10908
10939
|
plainTextContent: plainTextContent,
|
10909
10940
|
content: contentValue,
|
10910
10941
|
placeholder: strings.placeholderText
|
10911
10942
|
});
|
10943
|
+
}, [contentValue, strings.placeholderText]);
|
10944
|
+
const onRenderSendIcon = React.useCallback((isHover) => {
|
10912
10945
|
return (React.createElement(react.Icon, { iconName: isHover && hasContent ? 'SendBoxSendHovered' : 'SendBoxSend', className: sendIconStyle({
|
10913
10946
|
theme,
|
10914
10947
|
hasText: hasContent,
|
@@ -10918,7 +10951,7 @@ const RichTextSendBox = (props) => {
|
|
10918
10951
|
defaultTextColor: theme.palette.neutralSecondary,
|
10919
10952
|
disabled: disabled
|
10920
10953
|
}) }));
|
10921
|
-
}, [
|
10954
|
+
}, [disabled, hasContent, hasErrorMessage, theme]);
|
10922
10955
|
const sendBoxErrorsProps = React.useMemo(() => {
|
10923
10956
|
var _a, _b;
|
10924
10957
|
/* @conditional-compile-remove(attachment-upload) */
|
@@ -10963,12 +10996,25 @@ const RichTextSendBox = (props) => {
|
|
10963
10996
|
strings.attachmentMoreMenu,
|
10964
10997
|
theme
|
10965
10998
|
]);
|
10999
|
+
const isSendBoxButtonAriaDisabledValue = React.useMemo(() => {
|
11000
|
+
return isSendBoxButtonAriaDisabled({
|
11001
|
+
hasContent,
|
11002
|
+
/* @conditional-compile-remove(attachment-upload) */ hasCompletedAttachmentUploads: hasCompletedAttachmentUploads(attachmentsWithProgress),
|
11003
|
+
hasError: hasErrorMessage,
|
11004
|
+
disabled
|
11005
|
+
});
|
11006
|
+
}, [
|
11007
|
+
/* @conditional-compile-remove(attachment-upload) */ attachmentsWithProgress,
|
11008
|
+
disabled,
|
11009
|
+
hasContent,
|
11010
|
+
hasErrorMessage
|
11011
|
+
]);
|
10966
11012
|
const sendButton = React.useMemo(() => {
|
10967
11013
|
return (React.createElement(InputBoxButton, { onRenderIcon: onRenderSendIcon, onClick: (e) => {
|
10968
11014
|
sendMessageOnClick();
|
10969
11015
|
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]);
|
11016
|
+
}, className: richTextActionButtonsStyle, ariaLabel: localeStrings.sendButtonAriaLabel, tooltipContent: localeStrings.sendButtonAriaLabel, ariaDisabled: isSendBoxButtonAriaDisabledValue }));
|
11017
|
+
}, [isSendBoxButtonAriaDisabledValue, localeStrings.sendButtonAriaLabel, onRenderSendIcon, sendMessageOnClick]);
|
10972
11018
|
/* @conditional-compile-remove(attachment-upload) */
|
10973
11019
|
const hasAttachmentUploads = React.useMemo(() => {
|
10974
11020
|
return (hasCompletedAttachmentUploads(attachmentsWithProgress) || hasIncompleteAttachmentUploads(attachmentsWithProgress));
|
@@ -12224,7 +12270,9 @@ const extractContentForAllyMessage = (props) => {
|
|
12224
12270
|
parsedContent.appendChild(attachmentTextNode);
|
12225
12271
|
}
|
12226
12272
|
// Strip all html tags from the content for aria.
|
12227
|
-
|
12273
|
+
let message = DOMPurify.sanitize(parsedContent, { ALLOWED_TAGS: [] });
|
12274
|
+
// decode HTML entities so that screen reader can read the content properly.
|
12275
|
+
message = decodeEntities(message);
|
12228
12276
|
return message;
|
12229
12277
|
}
|
12230
12278
|
return '';
|
@@ -12299,6 +12347,31 @@ const processHtmlToReact = (props) => {
|
|
12299
12347
|
};
|
12300
12348
|
return React.createElement(React.Fragment, null, parse((_a = props.message.content) !== null && _a !== void 0 ? _a : '', options));
|
12301
12349
|
};
|
12350
|
+
const decodeEntities = (encodedString) => {
|
12351
|
+
// This regular expression matches HTML entities.
|
12352
|
+
const translate_re = /&(nbsp|amp|quot|lt|gt);/g;
|
12353
|
+
// This object maps HTML entities to their respective characters.
|
12354
|
+
const translate = {
|
12355
|
+
nbsp: ' ',
|
12356
|
+
amp: '&',
|
12357
|
+
quot: '"',
|
12358
|
+
lt: '<',
|
12359
|
+
gt: '>'
|
12360
|
+
};
|
12361
|
+
return (encodedString
|
12362
|
+
// Find all matches of HTML entities defined in translate_re and
|
12363
|
+
// replace them with the corresponding character from the translate object.
|
12364
|
+
.replace(translate_re, function (match, entity) {
|
12365
|
+
return translate[entity];
|
12366
|
+
})
|
12367
|
+
// Find numeric entities (e.g., A)
|
12368
|
+
// and replace them with the equivalent character using the String.fromCharCode method,
|
12369
|
+
// which converts Unicode values into characters.
|
12370
|
+
.replace(/&#(\d+);/gi, function (match, numStr) {
|
12371
|
+
const num = parseInt(numStr, 10);
|
12372
|
+
return String.fromCharCode(num);
|
12373
|
+
}));
|
12374
|
+
};
|
12302
12375
|
|
12303
12376
|
// Copyright (c) Microsoft Corporation.
|
12304
12377
|
// Licensed under the MIT License.
|
@@ -12831,7 +12904,7 @@ class ErrorBoundary extends React.Component {
|
|
12831
12904
|
// Copyright (c) Microsoft Corporation.
|
12832
12905
|
// Licensed under the MIT License.
|
12833
12906
|
/* @conditional-compile-remove(rich-text-editor) */
|
12834
|
-
const ChatMessageComponentAsRichTextEditBox = React.lazy(() => Promise.resolve().then(function () { return require('./ChatMessageComponentAsRichTextEditBox-
|
12907
|
+
const ChatMessageComponentAsRichTextEditBox = React.lazy(() => Promise.resolve().then(function () { return require('./ChatMessageComponentAsRichTextEditBox-DSlV4PZz.js'); }));
|
12835
12908
|
/**
|
12836
12909
|
* @private
|
12837
12910
|
* Use this function to load RoosterJS dependencies early in the lifecycle.
|
@@ -12839,7 +12912,7 @@ const ChatMessageComponentAsRichTextEditBox = React.lazy(() => Promise.resolve()
|
|
12839
12912
|
*
|
12840
12913
|
* @conditional-compile-remove(rich-text-editor)
|
12841
12914
|
*/
|
12842
|
-
const loadChatMessageComponentAsRichTextEditBox = () => Promise.resolve().then(function () { return require('./ChatMessageComponentAsRichTextEditBox-
|
12915
|
+
const loadChatMessageComponentAsRichTextEditBox = () => Promise.resolve().then(function () { return require('./ChatMessageComponentAsRichTextEditBox-DSlV4PZz.js'); });
|
12843
12916
|
/**
|
12844
12917
|
* @private
|
12845
12918
|
*/
|
@@ -19300,6 +19373,10 @@ const _HighContrastAwareIcon = (props) => {
|
|
19300
19373
|
|
19301
19374
|
// Copyright (c) Microsoft Corporation.
|
19302
19375
|
// Licensed under the MIT License.
|
19376
|
+
const defaultLocalVideoViewOptions$1 = {
|
19377
|
+
scalingMode: 'Crop',
|
19378
|
+
isMirrored: true
|
19379
|
+
};
|
19303
19380
|
/**
|
19304
19381
|
* Generates default {@link IContextualMenuProps} for buttons that
|
19305
19382
|
* show a drop-down to select devices to use.
|
@@ -19354,7 +19431,7 @@ const generateDefaultDeviceMenuProps = (props, strings, primaryActionItem, isSel
|
|
19354
19431
|
isChecked: camera.id === (selectedCamera === null || selectedCamera === void 0 ? void 0 : selectedCamera.id),
|
19355
19432
|
onClick: () => {
|
19356
19433
|
if (camera.id !== (selectedCamera === null || selectedCamera === void 0 ? void 0 : selectedCamera.id)) {
|
19357
|
-
onSelectCamera(camera);
|
19434
|
+
onSelectCamera(camera, defaultLocalVideoViewOptions$1);
|
19358
19435
|
}
|
19359
19436
|
}
|
19360
19437
|
}))
|
@@ -26454,6 +26531,30 @@ const globalLayerHostStyle = {
|
|
26454
26531
|
visibility: 'hidden'
|
26455
26532
|
};
|
26456
26533
|
|
26534
|
+
// Copyright (c) Microsoft Corporation.
|
26535
|
+
// Licensed under the MIT License.
|
26536
|
+
/**
|
26537
|
+
*
|
26538
|
+
* @param props
|
26539
|
+
* @returns
|
26540
|
+
*/
|
26541
|
+
const ACSAudioProvider = (props) => {
|
26542
|
+
const { audioContext, children } = props;
|
26543
|
+
const alreadyWrapped = useAudio();
|
26544
|
+
if (alreadyWrapped) {
|
26545
|
+
return React.createElement(React.Fragment, null, children);
|
26546
|
+
}
|
26547
|
+
return React.createElement(ACSAudioContext.Provider, { value: audioContext }, props.children);
|
26548
|
+
};
|
26549
|
+
/**
|
26550
|
+
* @private
|
26551
|
+
*/
|
26552
|
+
const ACSAudioContext = React.createContext(new AudioContext());
|
26553
|
+
/**
|
26554
|
+
* @private
|
26555
|
+
*/
|
26556
|
+
const useAudio = () => React.useContext(ACSAudioContext);
|
26557
|
+
|
26457
26558
|
// Copyright (c) Microsoft Corporation.
|
26458
26559
|
// Licensed under the MIT License.
|
26459
26560
|
/**
|
@@ -26489,12 +26590,17 @@ const BaseProvider = (props) => {
|
|
26489
26590
|
* to ensure all icons render correctly.
|
26490
26591
|
*/
|
26491
26592
|
react.registerIcons({ icons: Object.assign(Object.assign({}, iconsToRegister), props.icons) });
|
26593
|
+
/**
|
26594
|
+
* We need to create one context for the AudioProvider to ensure that we only have one instance of the AudioContext.
|
26595
|
+
*/
|
26596
|
+
const compositeAudioContext = new AudioContext();
|
26492
26597
|
// we use Customizer to override default LayerHost injected to <body />
|
26493
26598
|
// which stop polluting global dom tree and increase compatibility with react-full-screen
|
26494
26599
|
const CompositeElement = (React.createElement(FluentThemeProvider, { fluentTheme: fluentTheme, rtl: rtl },
|
26495
26600
|
React.createElement("meta", { name: "viewport", content: "width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" }),
|
26496
26601
|
React.createElement(react.Customizer, { scopedSettings: { Layer: { hostId: globalLayerHostId } } },
|
26497
|
-
React.createElement(
|
26602
|
+
React.createElement(ACSAudioProvider, { audioContext: compositeAudioContext },
|
26603
|
+
React.createElement(WithBackgroundColor, null, props.children))),
|
26498
26604
|
React.createElement(react.LayerHost, { id: globalLayerHostId, className: react.mergeStyles(globalLayerHostStyle) })));
|
26499
26605
|
const localizedElement = locale ? LocalizationProvider({ locale, children: CompositeElement }) : CompositeElement;
|
26500
26606
|
return React.createElement(BaseContext.Provider, { value: true }, localizedElement);
|
@@ -35526,7 +35632,7 @@ const MainScreen = (props) => {
|
|
35526
35632
|
adapter.off('callEnded', closeSidePane);
|
35527
35633
|
};
|
35528
35634
|
}, [adapter]);
|
35529
|
-
const compositeAudioContext =
|
35635
|
+
const compositeAudioContext = useAudio();
|
35530
35636
|
const capabilitiesChangedInfoAndRole = useSelector$1(capabilitiesChangedInfoAndRoleSelector);
|
35531
35637
|
const capabilitiesChangedNotificationBarProps = useTrackedCapabilityChangedNotifications(capabilitiesChangedInfoAndRole);
|
35532
35638
|
// Track the last dismissed errors of any error kind to prevent errors from re-appearing on subsequent page navigation
|
@@ -35601,7 +35707,7 @@ const MainScreen = (props) => {
|
|
35601
35707
|
pageElement = (React.createElement(TransferPage, { mobileView: props.mobileView, modalLayerHostId: props.modalLayerHostId, options: props.options, updateSidePaneRenderer: setSidePaneRenderer, mobileChatTabHeader: props.mobileChatTabHeader, onFetchAvatarPersonaData: onFetchAvatarPersonaData, latestErrors: latestErrors, onDismissError: onDismissError, capabilitiesChangedNotificationBarProps: capabilitiesChangedNotificationBarProps }));
|
35602
35708
|
break;
|
35603
35709
|
case 'call':
|
35604
|
-
pageElement = (React.createElement(CallPage, { callInvitationURL: callInvitationUrl, onFetchAvatarPersonaData: onFetchAvatarPersonaData, onFetchParticipantMenuItems: onFetchParticipantMenuItems, mobileView: props.mobileView, modalLayerHostId: props.modalLayerHostId, options: props.options, updateSidePaneRenderer: setSidePaneRenderer, mobileChatTabHeader: props.mobileChatTabHeader, onCloseChatPane: props.onCloseChatPane, latestErrors: latestErrors, onDismissError: onDismissError, galleryLayout: userSetGalleryLayout, onUserSetGalleryLayoutChange: setUserSetGalleryLayout, onSetUserSetOverflowGalleryPosition: setUserSetOverflowGalleryPosition, userSetOverflowGalleryPosition: userSetOverflowGalleryPosition, capabilitiesChangedNotificationBarProps: capabilitiesChangedNotificationBarProps, pinnedParticipants: pinnedParticipants, setPinnedParticipants: setPinnedParticipants, compositeAudioContext: compositeAudioContext
|
35710
|
+
pageElement = (React.createElement(CallPage, { callInvitationURL: callInvitationUrl, onFetchAvatarPersonaData: onFetchAvatarPersonaData, onFetchParticipantMenuItems: onFetchParticipantMenuItems, mobileView: props.mobileView, modalLayerHostId: props.modalLayerHostId, options: props.options, updateSidePaneRenderer: setSidePaneRenderer, mobileChatTabHeader: props.mobileChatTabHeader, onCloseChatPane: props.onCloseChatPane, latestErrors: latestErrors, onDismissError: onDismissError, galleryLayout: userSetGalleryLayout, onUserSetGalleryLayoutChange: setUserSetGalleryLayout, onSetUserSetOverflowGalleryPosition: setUserSetOverflowGalleryPosition, userSetOverflowGalleryPosition: userSetOverflowGalleryPosition, capabilitiesChangedNotificationBarProps: capabilitiesChangedNotificationBarProps, pinnedParticipants: pinnedParticipants, setPinnedParticipants: setPinnedParticipants, compositeAudioContext: compositeAudioContext }));
|
35605
35711
|
break;
|
35606
35712
|
/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
|
35607
35713
|
case 'hold':
|
@@ -37748,12 +37854,12 @@ const chatNotificationContainerStyles = {
|
|
37748
37854
|
* Used by the CallWithChatComposite to track unread messages for showing as a badge on the Chat Button.
|
37749
37855
|
* @private
|
37750
37856
|
*/
|
37751
|
-
const useUnreadMessagesTracker = (chatAdapter, isChatPaneVisible) => {
|
37857
|
+
const useUnreadMessagesTracker = (chatAdapter, isChatPaneVisible, isChatInitiazed) => {
|
37752
37858
|
// Store messageIds of unread messages
|
37753
37859
|
const [unreadChatMessages, setUnreadChatMessages] = React.useState(new Set());
|
37754
37860
|
React.useEffect(() => {
|
37755
37861
|
// Clear unread messages when chat pane is opened
|
37756
|
-
if (isChatPaneVisible) {
|
37862
|
+
if (isChatPaneVisible || !isChatInitiazed) {
|
37757
37863
|
setUnreadChatMessages(new Set());
|
37758
37864
|
return;
|
37759
37865
|
}
|
@@ -37783,7 +37889,7 @@ const useUnreadMessagesTracker = (chatAdapter, isChatPaneVisible) => {
|
|
37783
37889
|
chatAdapter.off('messageReceived', incrementUnreadChatMessagesCount);
|
37784
37890
|
chatAdapter.off('messageDeleted', decrementUnreadChatMessagesCount);
|
37785
37891
|
};
|
37786
|
-
}, [chatAdapter, setUnreadChatMessages, isChatPaneVisible]);
|
37892
|
+
}, [chatAdapter, setUnreadChatMessages, isChatPaneVisible, isChatInitiazed]);
|
37787
37893
|
return unreadChatMessages.size;
|
37788
37894
|
};
|
37789
37895
|
/**
|
@@ -37804,6 +37910,7 @@ const CallWithChatScreen = (props) => {
|
|
37804
37910
|
}
|
37805
37911
|
const callAdapter = React.useMemo(() => new CallWithChatBackedCallAdapter(callWithChatAdapter), [callWithChatAdapter]);
|
37806
37912
|
const [currentCallState, setCurrentCallState] = React.useState();
|
37913
|
+
const [isChatInitialized, setIsChatInitialized] = React.useState(false);
|
37807
37914
|
const [currentPage, setCurrentPage] = React.useState();
|
37808
37915
|
const [isChatOpen, setIsChatOpen] = React.useState(false);
|
37809
37916
|
const containerRef = React.useRef(null);
|
@@ -37812,6 +37919,7 @@ const CallWithChatScreen = (props) => {
|
|
37812
37919
|
var _a;
|
37813
37920
|
setCurrentPage(newState.page);
|
37814
37921
|
setCurrentCallState((_a = newState.call) === null || _a === void 0 ? void 0 : _a.state);
|
37922
|
+
setIsChatInitialized(newState.chat ? true : false);
|
37815
37923
|
};
|
37816
37924
|
updateCallWithChatPage(callWithChatAdapter.getState());
|
37817
37925
|
callWithChatAdapter.onStateChange(updateCallWithChatPage);
|
@@ -37869,7 +37977,7 @@ const CallWithChatScreen = (props) => {
|
|
37869
37977
|
disabled: chatButtonDisabled
|
37870
37978
|
}
|
37871
37979
|
: undefined, [chatButtonDisabled, mobileView, toggleChat, showChatButton]);
|
37872
|
-
const unreadChatMessagesCount = useUnreadMessagesTracker(chatAdapter, isChatOpen);
|
37980
|
+
const unreadChatMessagesCount = useUnreadMessagesTracker(chatAdapter, isChatOpen, isChatInitialized);
|
37873
37981
|
const customChatButton = React.useCallback((args) => ({
|
37874
37982
|
placement: mobileView ? 'primary' : 'secondary',
|
37875
37983
|
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 +38231,48 @@ class CallWithChatContext {
|
|
38123
38231
|
* Created for easy use with the {@link CallWithChatComposite}.
|
38124
38232
|
*/
|
38125
38233
|
class AzureCommunicationCallWithChatAdapter {
|
38126
|
-
constructor(callAdapter,
|
38234
|
+
constructor(callAdapter, chatAdapter) {
|
38235
|
+
this.emitter = new EventEmitter.EventEmitter();
|
38236
|
+
this.isAdapterDisposed = false;
|
38127
38237
|
/* @conditional-compile-remove(attachment-upload) */
|
38128
38238
|
this.registerActiveUploads = (files) => {
|
38129
|
-
|
38130
|
-
|
38239
|
+
return this.executeWithResolvedChatAdapter((adapter) => {
|
38240
|
+
return adapter.registerActiveUploads(files);
|
38241
|
+
});
|
38131
38242
|
};
|
38132
38243
|
/* @conditional-compile-remove(attachment-upload) */
|
38133
38244
|
this.registerCompletedUploads = (metadata) => {
|
38134
|
-
|
38135
|
-
|
38245
|
+
return this.executeWithResolvedChatAdapter((adapter) => {
|
38246
|
+
return adapter.registerCompletedUploads(metadata);
|
38247
|
+
});
|
38136
38248
|
};
|
38137
38249
|
/* @conditional-compile-remove(attachment-upload) */
|
38138
38250
|
this.clearUploads = () => {
|
38139
|
-
this.
|
38251
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38140
38252
|
adapter.clearUploads();
|
38141
38253
|
});
|
38142
38254
|
};
|
38143
38255
|
/* @conditional-compile-remove(attachment-upload) */
|
38144
38256
|
this.cancelUpload = (id) => {
|
38145
|
-
this.
|
38257
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38146
38258
|
adapter.cancelUpload(id);
|
38147
38259
|
});
|
38148
38260
|
};
|
38149
38261
|
/* @conditional-compile-remove(attachment-upload) */
|
38150
38262
|
this.updateUploadProgress = (id, progress) => {
|
38151
|
-
this.
|
38263
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38152
38264
|
adapter.updateUploadProgress(id, progress);
|
38153
38265
|
});
|
38154
38266
|
};
|
38155
38267
|
/* @conditional-compile-remove(attachment-upload) */
|
38156
38268
|
this.updateUploadStatusMessage = (id, errorMessage) => {
|
38157
|
-
this.
|
38269
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38158
38270
|
adapter.updateUploadStatusMessage(id, errorMessage);
|
38159
38271
|
});
|
38160
38272
|
};
|
38161
38273
|
/* @conditional-compile-remove(attachment-upload) */
|
38162
38274
|
this.updateUploadMetadata = (id, metadata) => {
|
38163
|
-
this.
|
38275
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38164
38276
|
adapter.updateUploadMetadata(id, metadata);
|
38165
38277
|
});
|
38166
38278
|
};
|
@@ -38171,19 +38283,28 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38171
38283
|
this.context.updateClientStateWithChatState(newChatAdapterState);
|
38172
38284
|
};
|
38173
38285
|
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
|
-
});
|
38286
|
+
if (chatAdapter) {
|
38287
|
+
this.updateChatAdapter(chatAdapter);
|
38288
|
+
}
|
38181
38289
|
const onCallStateChange = (newCallAdapterState) => {
|
38182
38290
|
this.context.updateClientStateWithCallState(newCallAdapterState);
|
38183
38291
|
};
|
38184
38292
|
this.callAdapter.onStateChange(onCallStateChange);
|
38185
38293
|
this.onCallStateChange = onCallStateChange;
|
38186
38294
|
}
|
38295
|
+
setChatAdapterPromise(chatAdapter) {
|
38296
|
+
chatAdapter.then((adapter) => {
|
38297
|
+
if (!this.isAdapterDisposed) {
|
38298
|
+
this.updateChatAdapter(adapter);
|
38299
|
+
}
|
38300
|
+
});
|
38301
|
+
}
|
38302
|
+
updateChatAdapter(chatAdapter) {
|
38303
|
+
this.chatAdapter = chatAdapter;
|
38304
|
+
this.chatAdapter.onStateChange(this.onChatStateChange);
|
38305
|
+
this.context.updateClientStateWithChatState(chatAdapter.getState());
|
38306
|
+
this.emitter.emit('chatInitialized', this.chatAdapter);
|
38307
|
+
}
|
38187
38308
|
bindPublicMethods() {
|
38188
38309
|
this.joinCall.bind(this);
|
38189
38310
|
this.leaveCall.bind(this);
|
@@ -38304,16 +38425,13 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38304
38425
|
}
|
38305
38426
|
/** Dispose of the current CallWithChatAdapter. */
|
38306
38427
|
dispose() {
|
38307
|
-
|
38308
|
-
|
38309
|
-
|
38310
|
-
|
38311
|
-
|
38312
|
-
|
38313
|
-
|
38314
|
-
});
|
38315
|
-
this.callAdapter.dispose();
|
38316
|
-
});
|
38428
|
+
this.isAdapterDisposed = true;
|
38429
|
+
if (this.chatAdapter) {
|
38430
|
+
this.chatAdapter.offStateChange(this.onChatStateChange);
|
38431
|
+
this.chatAdapter.dispose();
|
38432
|
+
}
|
38433
|
+
this.callAdapter.offStateChange(this.onCallStateChange);
|
38434
|
+
this.callAdapter.dispose();
|
38317
38435
|
}
|
38318
38436
|
/** Remove a participant from the Call only. */
|
38319
38437
|
removeParticipant(userId) {
|
@@ -38451,7 +38569,7 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38451
38569
|
/** Fetch initial Call and Chat data such as chat messages. */
|
38452
38570
|
fetchInitialData() {
|
38453
38571
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38454
|
-
return yield this.
|
38572
|
+
return yield this.executeWithResolvedChatAdapter((adapter) => {
|
38455
38573
|
return adapter.fetchInitialData();
|
38456
38574
|
});
|
38457
38575
|
});
|
@@ -38459,7 +38577,7 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38459
38577
|
/** Send a chat message. */
|
38460
38578
|
sendMessage(content) {
|
38461
38579
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38462
|
-
return yield this.
|
38580
|
+
return yield this.executeWithResolvedChatAdapter((adapter) => {
|
38463
38581
|
return adapter.sendMessage(content);
|
38464
38582
|
});
|
38465
38583
|
});
|
@@ -38468,7 +38586,7 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38468
38586
|
/** Send a chat message with attachments. */
|
38469
38587
|
sendMessageWithAttachments(content, attachments) {
|
38470
38588
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38471
|
-
return yield this.
|
38589
|
+
return yield this.executeWithResolvedChatAdapter((adapter) => {
|
38472
38590
|
const fileSharingMetadata = {
|
38473
38591
|
fileSharingMetadata: JSON.stringify(attachments)
|
38474
38592
|
};
|
@@ -38481,7 +38599,7 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38481
38599
|
/** Send a chat read receipt. */
|
38482
38600
|
sendReadReceipt(chatMessageId) {
|
38483
38601
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38484
|
-
return yield this.
|
38602
|
+
return yield this.executeWithResolvedChatAdapter((adapter) => {
|
38485
38603
|
return adapter.sendReadReceipt(chatMessageId);
|
38486
38604
|
});
|
38487
38605
|
});
|
@@ -38489,7 +38607,7 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38489
38607
|
/** Send an isTyping indicator. */
|
38490
38608
|
sendTypingIndicator() {
|
38491
38609
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38492
|
-
return yield this.
|
38610
|
+
return yield this.executeWithResolvedChatAdapter((adapter) => {
|
38493
38611
|
return adapter.sendTypingIndicator();
|
38494
38612
|
});
|
38495
38613
|
});
|
@@ -38497,7 +38615,7 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38497
38615
|
/** Load previous Chat messages. */
|
38498
38616
|
loadPreviousChatMessages(messagesToLoad) {
|
38499
38617
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38500
|
-
return yield this.
|
38618
|
+
return yield this.executeWithResolvedChatAdapter((adapter) => {
|
38501
38619
|
return adapter.loadPreviousChatMessages(messagesToLoad);
|
38502
38620
|
});
|
38503
38621
|
});
|
@@ -38505,7 +38623,7 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38505
38623
|
/** Update an existing message. */
|
38506
38624
|
updateMessage(messageId, content, metadata, options) {
|
38507
38625
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38508
|
-
return this.
|
38626
|
+
return this.executeWithResolvedChatAdapter((adapter) => {
|
38509
38627
|
return adapter.updateMessage(messageId, content, metadata,
|
38510
38628
|
/* @conditional-compile-remove(attachment-upload) */ options);
|
38511
38629
|
});
|
@@ -38514,20 +38632,20 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38514
38632
|
/** Delete an existing message. */
|
38515
38633
|
deleteMessage(messageId) {
|
38516
38634
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38517
|
-
return yield this.
|
38635
|
+
return yield this.executeWithResolvedChatAdapter((adapter) => {
|
38518
38636
|
return adapter.deleteMessage(messageId);
|
38519
38637
|
});
|
38520
38638
|
});
|
38521
38639
|
}
|
38522
38640
|
downloadResourceToCache(resourceDetails) {
|
38523
38641
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38524
|
-
this.
|
38642
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38525
38643
|
adapter.downloadResourceToCache(resourceDetails);
|
38526
38644
|
});
|
38527
38645
|
});
|
38528
38646
|
}
|
38529
38647
|
removeResourceFromCache(resourceDetails) {
|
38530
|
-
this.
|
38648
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38531
38649
|
adapter.removeResourceFromCache(resourceDetails);
|
38532
38650
|
});
|
38533
38651
|
}
|
@@ -38669,37 +38787,37 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38669
38787
|
this.callAdapter.on('isSpokenLanguageChanged', listener);
|
38670
38788
|
break;
|
38671
38789
|
case 'messageReceived':
|
38672
|
-
this.
|
38790
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38673
38791
|
adapter.on('messageReceived', listener);
|
38674
38792
|
});
|
38675
38793
|
break;
|
38676
38794
|
case 'messageEdited':
|
38677
|
-
this.
|
38795
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38678
38796
|
adapter.on('messageEdited', listener);
|
38679
38797
|
});
|
38680
38798
|
break;
|
38681
38799
|
case 'messageDeleted':
|
38682
|
-
this.
|
38800
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38683
38801
|
adapter.on('messageDeleted', listener);
|
38684
38802
|
});
|
38685
38803
|
break;
|
38686
38804
|
case 'messageSent':
|
38687
|
-
this.
|
38805
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38688
38806
|
adapter.on('messageSent', listener);
|
38689
38807
|
});
|
38690
38808
|
break;
|
38691
38809
|
case 'messageRead':
|
38692
|
-
this.
|
38810
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38693
38811
|
adapter.on('messageRead', listener);
|
38694
38812
|
});
|
38695
38813
|
break;
|
38696
38814
|
case 'chatParticipantsAdded':
|
38697
|
-
this.
|
38815
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38698
38816
|
adapter.on('participantsAdded', listener);
|
38699
38817
|
});
|
38700
38818
|
break;
|
38701
38819
|
case 'chatParticipantsRemoved':
|
38702
|
-
this.
|
38820
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38703
38821
|
adapter.on('participantsRemoved', listener);
|
38704
38822
|
});
|
38705
38823
|
break;
|
@@ -38707,10 +38825,13 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38707
38825
|
this.callAdapter.on('error', listener);
|
38708
38826
|
break;
|
38709
38827
|
case 'chatError':
|
38710
|
-
this.
|
38828
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38711
38829
|
adapter.on('error', listener);
|
38712
38830
|
});
|
38713
38831
|
break;
|
38832
|
+
case 'chatInitialized':
|
38833
|
+
this.emitter.on(event, listener);
|
38834
|
+
break;
|
38714
38835
|
default:
|
38715
38836
|
throw `Unknown AzureCommunicationCallWithChatAdapter Event: ${event}`;
|
38716
38837
|
}
|
@@ -38761,37 +38882,37 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38761
38882
|
this.callAdapter.off('isSpokenLanguageChanged', listener);
|
38762
38883
|
break;
|
38763
38884
|
case 'messageReceived':
|
38764
|
-
this.
|
38885
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38765
38886
|
adapter.off('messageReceived', listener);
|
38766
38887
|
});
|
38767
38888
|
break;
|
38768
38889
|
case 'messageEdited':
|
38769
|
-
this.
|
38890
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38770
38891
|
adapter.off('messageEdited', listener);
|
38771
38892
|
});
|
38772
38893
|
break;
|
38773
38894
|
case 'messageDeleted':
|
38774
|
-
this.
|
38895
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38775
38896
|
adapter.off('messageDeleted', listener);
|
38776
38897
|
});
|
38777
38898
|
break;
|
38778
38899
|
case 'messageSent':
|
38779
|
-
this.
|
38900
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38780
38901
|
adapter.off('messageSent', listener);
|
38781
38902
|
});
|
38782
38903
|
break;
|
38783
38904
|
case 'messageRead':
|
38784
|
-
this.
|
38905
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38785
38906
|
adapter.off('messageRead', listener);
|
38786
38907
|
});
|
38787
38908
|
break;
|
38788
38909
|
case 'chatParticipantsAdded':
|
38789
|
-
this.
|
38910
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38790
38911
|
adapter.off('participantsAdded', listener);
|
38791
38912
|
});
|
38792
38913
|
break;
|
38793
38914
|
case 'chatParticipantsRemoved':
|
38794
|
-
this.
|
38915
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38795
38916
|
adapter.off('participantsRemoved', listener);
|
38796
38917
|
});
|
38797
38918
|
break;
|
@@ -38799,33 +38920,51 @@ class AzureCommunicationCallWithChatAdapter {
|
|
38799
38920
|
this.callAdapter.off('error', listener);
|
38800
38921
|
break;
|
38801
38922
|
case 'chatError':
|
38802
|
-
this.
|
38923
|
+
this.executeWithResolvedChatAdapter((adapter) => {
|
38803
38924
|
adapter.off('error', listener);
|
38804
38925
|
});
|
38805
38926
|
break;
|
38927
|
+
case 'chatInitialized':
|
38928
|
+
this.emitter.off(event, listener);
|
38929
|
+
break;
|
38806
38930
|
default:
|
38807
38931
|
throw `Unknown AzureCommunicationCallWithChatAdapter Event: ${event}`;
|
38808
38932
|
}
|
38809
38933
|
}
|
38934
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
38935
|
+
executeWithResolvedChatAdapter(callback) {
|
38936
|
+
if (!this.chatAdapter) {
|
38937
|
+
console.error('Chat is not initialized');
|
38938
|
+
}
|
38939
|
+
else {
|
38940
|
+
return callback(this.chatAdapter);
|
38941
|
+
}
|
38942
|
+
}
|
38810
38943
|
}
|
38811
38944
|
/**
|
38812
38945
|
* Arguments for use in {@link createAzureCommunicationCallWithChatAdapter} to join a Group Call with an associated Chat thread.
|
38813
|
-
* @
|
38946
|
+
* @private
|
38814
38947
|
*/
|
38815
38948
|
class CallAndChatProvider {
|
38816
38949
|
constructor(locator) {
|
38817
38950
|
this.locator = locator;
|
38818
38951
|
}
|
38819
|
-
|
38952
|
+
isCallInfoRequired() {
|
38953
|
+
return false;
|
38954
|
+
}
|
38955
|
+
getChatThreadPromise() {
|
38820
38956
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38821
|
-
return this.
|
38957
|
+
return this.getChatThread();
|
38822
38958
|
});
|
38823
38959
|
}
|
38960
|
+
getChatThread() {
|
38961
|
+
return this.locator.chatThreadId;
|
38962
|
+
}
|
38824
38963
|
}
|
38825
38964
|
/**
|
38826
38965
|
* Arguments for use in {@link createAzureCommunicationCallWithChatAdapter} to join a Teams meeting with an associated Chat thread.
|
38827
38966
|
*
|
38828
|
-
* @
|
38967
|
+
* @private
|
38829
38968
|
*/
|
38830
38969
|
class TeamsMeetingLinkProvider {
|
38831
38970
|
constructor(locator,
|
@@ -38834,7 +38973,14 @@ class TeamsMeetingLinkProvider {
|
|
38834
38973
|
/** @conditional-compile-remove(meeting-id) */
|
38835
38974
|
this.callAdapterPromise = callAdapterPromise;
|
38836
38975
|
}
|
38976
|
+
isCallInfoRequired() {
|
38977
|
+
return true;
|
38978
|
+
}
|
38837
38979
|
getChatThread() {
|
38980
|
+
/** @conditional-compile-remove(meeting-id) */
|
38981
|
+
throw new Error('Chat thread ID should be retrieved from call.callInfo using method getChatThreadPromise');
|
38982
|
+
}
|
38983
|
+
getChatThreadPromise() {
|
38838
38984
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38839
38985
|
/** @conditional-compile-remove(meeting-id) */
|
38840
38986
|
{
|
@@ -38863,28 +39009,45 @@ class TeamsMeetingLinkProvider {
|
|
38863
39009
|
/**
|
38864
39010
|
* Arguments for use in {@link createAzureCommunicationCallWithChatAdapter} to join a Teams meeting using meeting id.
|
38865
39011
|
*
|
38866
|
-
* @
|
39012
|
+
* @private
|
38867
39013
|
*/
|
38868
39014
|
class TeamsMeetingIdProvider {
|
38869
39015
|
constructor(locator, callAdapter) {
|
38870
39016
|
this.locator = locator;
|
38871
39017
|
this.callAdapter = callAdapter;
|
38872
39018
|
}
|
39019
|
+
isCallInfoRequired() {
|
39020
|
+
return true;
|
39021
|
+
}
|
39022
|
+
getChatThread() {
|
39023
|
+
throw new Error('Chat thread ID is not available for Teams meeting ID');
|
39024
|
+
}
|
38873
39025
|
/**
|
38874
39026
|
* Wait call to be connected to get thread ID.
|
38875
39027
|
* @returns the chat thread ID for the given meeting ID.
|
38876
39028
|
*/
|
38877
|
-
|
39029
|
+
getChatThreadPromise() {
|
38878
39030
|
return __awaiter$2(this, void 0, void 0, function* () {
|
38879
39031
|
return new Promise((resolve) => {
|
38880
39032
|
const stateChangeListener = (state) => {
|
38881
39033
|
var _a, _b, _c;
|
38882
39034
|
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)) {
|
39035
|
+
this.callAdapter.then((adapter) => {
|
39036
|
+
adapter.offStateChange(stateChangeListener);
|
39037
|
+
});
|
38883
39038
|
resolve((_c = state.call.info) === null || _c === void 0 ? void 0 : _c.threadId);
|
38884
39039
|
}
|
38885
39040
|
};
|
38886
39041
|
this.callAdapter.then((adapter) => {
|
38887
|
-
|
39042
|
+
var _a, _b, _c;
|
39043
|
+
const callState = (_a = adapter.getState().call) === null || _a === void 0 ? void 0 : _a.state;
|
39044
|
+
const threadId = (_c = (_b = adapter.getState().call) === null || _b === void 0 ? void 0 : _b.info) === null || _c === void 0 ? void 0 : _c.threadId;
|
39045
|
+
if (callState === 'Connected' && threadId) {
|
39046
|
+
resolve(threadId);
|
39047
|
+
}
|
39048
|
+
else {
|
39049
|
+
adapter.onStateChange(stateChangeListener);
|
39050
|
+
}
|
38888
39051
|
});
|
38889
39052
|
});
|
38890
39053
|
});
|
@@ -38909,8 +39072,16 @@ const createAzureCommunicationCallWithChatAdapter = (_a) => __awaiter$2(void 0,
|
|
38909
39072
|
telemetryImplementationHint: 'CallWithChat'
|
38910
39073
|
});
|
38911
39074
|
const chatThreadAdapter = _createChatThreadAdapterInner(locator, callAdapter);
|
38912
|
-
|
38913
|
-
|
39075
|
+
if (chatThreadAdapter.isCallInfoRequired()) {
|
39076
|
+
const callWithChatAdapter = new AzureCommunicationCallWithChatAdapter(yield callAdapter);
|
39077
|
+
const chatAdapterPromise = _createLazyAzureCommunicationChatAdapterInner(endpoint, userId, displayName, credential, chatThreadAdapter.getChatThreadPromise(), 'CallWithChat');
|
39078
|
+
callWithChatAdapter.setChatAdapterPromise(chatAdapterPromise);
|
39079
|
+
return callWithChatAdapter;
|
39080
|
+
}
|
39081
|
+
else {
|
39082
|
+
const chatAdapter = _createAzureCommunicationChatAdapterInner(endpoint, userId, displayName, credential, chatThreadAdapter.getChatThread(), 'CallWithChat');
|
39083
|
+
return new AzureCommunicationCallWithChatAdapter(yield callAdapter, yield chatAdapter);
|
39084
|
+
}
|
38914
39085
|
});
|
38915
39086
|
/**
|
38916
39087
|
* A custom React hook to simplify the creation of {@link CallWithChatAdapter}.
|
@@ -39039,8 +39210,8 @@ beforeDispose) => {
|
|
39039
39210
|
*/
|
39040
39211
|
const createAzureCommunicationCallWithChatAdapterFromClients = (_b) => __awaiter$2(void 0, [_b], void 0, function* ({ callClient, callAgent, callLocator, chatClient, chatThreadClient, callAdapterOptions }) {
|
39041
39212
|
const callAdapter = yield createAzureCommunicationCallAdapterFromClient(callClient, callAgent, callLocator, callAdapterOptions);
|
39042
|
-
const
|
39043
|
-
return new AzureCommunicationCallWithChatAdapter(callAdapter,
|
39213
|
+
const chatAdapter = yield createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient);
|
39214
|
+
return new AzureCommunicationCallWithChatAdapter(callAdapter, chatAdapter);
|
39044
39215
|
});
|
39045
39216
|
const isTeamsMeetingLocator = (locator) => {
|
39046
39217
|
return 'meetingLink' in locator || 'meetingId' in locator;
|
@@ -39628,4 +39799,4 @@ exports.useTeamsCall = useTeamsCall;
|
|
39628
39799
|
exports.useTeamsCallAdapter = useTeamsCallAdapter;
|
39629
39800
|
exports.useTeamsCallAgent = useTeamsCallAgent;
|
39630
39801
|
exports.useTheme = useTheme;
|
39631
|
-
//# sourceMappingURL=index-
|
39802
|
+
//# sourceMappingURL=index-aGXLnB_I.js.map
|