@azure/communication-react 1.4.2-alpha-202211230015.0 → 1.4.2-alpha-202211260013.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/communication-react.d.ts +158 -23
  2. package/dist/dist-cjs/communication-react/index.js +288 -126
  3. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  4. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  5. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  6. package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.js +12 -9
  7. package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.js.map +1 -1
  8. package/dist/dist-esm/react-components/src/components/ErrorBar.d.ts +10 -0
  9. package/dist/dist-esm/react-components/src/components/ErrorBar.js +5 -2
  10. package/dist/dist-esm/react-components/src/components/ErrorBar.js.map +1 -1
  11. package/dist/dist-esm/react-components/src/components/MessageThread.js +7 -11
  12. package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
  13. package/dist/dist-esm/react-components/src/components/VideoTile.d.ts +4 -0
  14. package/dist/dist-esm/react-components/src/components/VideoTile.js +25 -2
  15. package/dist/dist-esm/react-components/src/components/VideoTile.js.map +1 -1
  16. package/dist/dist-esm/react-components/src/components/utils/useLongPress.d.ts +12 -10
  17. package/dist/dist-esm/react-components/src/components/utils/useLongPress.js +61 -37
  18. package/dist/dist-esm/react-components/src/components/utils/useLongPress.js.map +1 -1
  19. package/dist/dist-esm/react-components/src/components/utils.d.ts +1 -1
  20. package/dist/dist-esm/react-components/src/components/utils.js +5 -1
  21. package/dist/dist-esm/react-components/src/components/utils.js.map +1 -1
  22. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.d.ts +2 -2
  23. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
  24. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +39 -7
  25. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +125 -37
  26. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  27. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +115 -27
  28. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
  29. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapterProvider.d.ts +3 -3
  30. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapterProvider.js.map +1 -1
  31. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/DiagnosticsForwarder.d.ts +2 -2
  32. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/DiagnosticsForwarder.js.map +1 -1
  33. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/createHandlers.d.ts +15 -0
  34. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/createHandlers.js +23 -0
  35. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/createHandlers.js.map +1 -0
  36. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.d.ts +3 -1
  37. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js +2 -0
  38. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js.map +1 -1
  39. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallPane.d.ts +2 -2
  40. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallPane.js.map +1 -1
  41. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.d.ts +2 -2
  42. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
  43. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.d.ts +3 -1
  44. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js +2 -0
  45. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
  46. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +3 -1
  47. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
  48. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js +3 -1
  49. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js.map +1 -1
  50. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js +3 -1
  51. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js.map +1 -1
  52. package/package.json +8 -8
@@ -202,7 +202,7 @@ const _toCommunicationIdentifier = (id) => {
202
202
  // Copyright (c) Microsoft Corporation.
203
203
  // Licensed under the MIT license.
204
204
  // GENERATED FILE. DO NOT EDIT MANUALLY.
205
- var telemetryVersion = '1.4.2-alpha-202211230015.0';
205
+ var telemetryVersion = '1.4.2-alpha-202211260013.0';
206
206
 
207
207
  // Copyright (c) Microsoft Corporation.
208
208
  /**
@@ -4333,12 +4333,16 @@ const dropDismissalsForInactiveErrors = (activeErrorMessages, dismissedErrors) =
4333
4333
  * @param dismissedErrors
4334
4334
  * @returns ActiveErrorMessage[]
4335
4335
  */
4336
- const errorsToShow = (activeErrorMessages, dismissedErrors) => {
4336
+ const errorsToShow = (activeErrorMessages, dismissedErrors, mountTimestamp) => {
4337
4337
  const dismissed = new Map();
4338
4338
  for (const error of dismissedErrors) {
4339
4339
  dismissed.set(error.type, error);
4340
4340
  }
4341
4341
  return activeErrorMessages.filter((error) => {
4342
+ if (mountTimestamp && error.timestamp && mountTimestamp > error.timestamp) {
4343
+ // Error has a timestamp and it is older than when the component was mounted.
4344
+ return false;
4345
+ }
4342
4346
  const dismissal = dismissed.get(error.type);
4343
4347
  if (!dismissal) {
4344
4348
  // This error was never dismissed.
@@ -4447,11 +4451,14 @@ const ErrorBar = (props) => {
4447
4451
  var _a;
4448
4452
  const localeStrings = useLocale$1().strings.errorBar;
4449
4453
  const strings = (_a = props.strings) !== null && _a !== void 0 ? _a : localeStrings;
4454
+ // Timestamp for when this comopnent is first mounted.
4455
+ // Never updated through the lifecycle of this component.
4456
+ const mountTimestamp = React.useRef(new Date(Date.now()));
4450
4457
  const [dismissedErrors, setDismissedErrors] = React.useState([]);
4451
4458
  // dropDismissalsForInactiveErrors only returns a new object if `dismissedErrors` actually changes.
4452
4459
  // Without this behaviour, this `useEffect` block would cause a render loop.
4453
4460
  React.useEffect(() => setDismissedErrors(dropDismissalsForInactiveErrors(props.activeErrorMessages, dismissedErrors)), [props.activeErrorMessages, dismissedErrors]);
4454
- const toShow = errorsToShow(props.activeErrorMessages, dismissedErrors);
4461
+ const toShow = errorsToShow(props.activeErrorMessages, dismissedErrors, props.ignorePremountErrors ? mountTimestamp.current : undefined);
4455
4462
  return (React__default['default'].createElement(react.Stack, { "data-ui-id": "error-bar-stack" }, toShow.map((error) => (React__default['default'].createElement(react.MessageBar, Object.assign({}, props, { styles: {
4456
4463
  innerText: {
4457
4464
  paddingTop: messageBarType(error.type) === 5 ? '0.15rem' : '0.1rem',
@@ -7081,11 +7088,13 @@ const MessageThread = (props) => {
7081
7088
  }, [scrollToBottom, sendMessageStatusIfAtBottom]);
7082
7089
  // Infinite scrolling + threadInitialize function
7083
7090
  const fetchNewMessageWhenAtTop = React.useCallback(() => __awaiter$m(void 0, void 0, void 0, function* () {
7084
- if (chatScrollDivRef.current && !isLoadingChatMessagesRef.current) {
7091
+ if (!isLoadingChatMessagesRef.current) {
7085
7092
  if (onLoadPreviousChatMessages) {
7086
7093
  isLoadingChatMessagesRef.current = true;
7087
7094
  // Fetch message until scrollTop reach the threshold for fetching new message
7088
- while (!isAllChatMessagesLoadedRef.current && chatScrollDivRef.current.scrollTop <= 500) {
7095
+ while (!isAllChatMessagesLoadedRef.current &&
7096
+ chatScrollDivRef.current &&
7097
+ chatScrollDivRef.current.scrollTop <= 500) {
7089
7098
  isAllChatMessagesLoadedRef.current = yield onLoadPreviousChatMessages(numberOfChatMessagesToReload);
7090
7099
  yield delay(200);
7091
7100
  }
@@ -7093,12 +7102,6 @@ const MessageThread = (props) => {
7093
7102
  }
7094
7103
  }
7095
7104
  }), [numberOfChatMessagesToReload, onLoadPreviousChatMessages]);
7096
- const handleInfiniteScroll = React.useCallback(() => {
7097
- if (!chatScrollDivRef.current) {
7098
- return;
7099
- }
7100
- fetchNewMessageWhenAtTop();
7101
- }, [fetchNewMessageWhenAtTop]);
7102
7105
  // The below 2 of useEffects are design for fixing infinite scrolling problem
7103
7106
  // Scrolling element will behave differently when scrollTop = 0(it sticks at the top)
7104
7107
  // we need to get previousTop before it prepend contents
@@ -7136,12 +7139,12 @@ const MessageThread = (props) => {
7136
7139
  React.useEffect(() => {
7137
7140
  const chatScrollDiv = chatScrollDivRef.current;
7138
7141
  chatScrollDiv === null || chatScrollDiv === void 0 ? void 0 : chatScrollDiv.addEventListener('scroll', handleScrollToTheBottom);
7139
- chatScrollDiv === null || chatScrollDiv === void 0 ? void 0 : chatScrollDiv.addEventListener('scroll', handleInfiniteScroll);
7142
+ chatScrollDiv === null || chatScrollDiv === void 0 ? void 0 : chatScrollDiv.addEventListener('scroll', fetchNewMessageWhenAtTop);
7140
7143
  return () => {
7141
7144
  chatScrollDiv === null || chatScrollDiv === void 0 ? void 0 : chatScrollDiv.removeEventListener('scroll', handleScrollToTheBottom);
7142
- chatScrollDiv === null || chatScrollDiv === void 0 ? void 0 : chatScrollDiv.removeEventListener('scroll', handleInfiniteScroll);
7145
+ chatScrollDiv === null || chatScrollDiv === void 0 ? void 0 : chatScrollDiv.removeEventListener('scroll', fetchNewMessageWhenAtTop);
7143
7146
  };
7144
- }, [handleInfiniteScroll, handleScrollToTheBottom]);
7147
+ }, [fetchNewMessageWhenAtTop, handleScrollToTheBottom]);
7145
7148
  /**
7146
7149
  * ClientHeight controls the number of messages to render. However ClientHeight will not be initialized after the
7147
7150
  * first render (not sure but I guess Fluent is updating it in hook which is after render maybe?) so we need to
@@ -8040,6 +8043,93 @@ const getVideoTileOverrideColor = (isVideoRendered, theme, color) => {
8040
8043
  return { color: isVideoRendered ? react.DefaultPalette[color] : theme.palette[color] };
8041
8044
  };
8042
8045
 
8046
+ // Copyright (c) Microsoft Corporation.
8047
+ /**
8048
+ * @private
8049
+ */
8050
+ function useLongPress(props) {
8051
+ const { onClick, onLongPress, touchEventsOnly = false } = props;
8052
+ const timerRef = React.useRef();
8053
+ const [isLongPress, setIsLongPress] = React.useState(false);
8054
+ const [action, setAction] = React.useState(false);
8055
+ React.useEffect(() => {
8056
+ if (timerRef.current) {
8057
+ clearTimeout(timerRef.current);
8058
+ }
8059
+ return () => {
8060
+ if (timerRef.current) {
8061
+ clearTimeout(timerRef.current);
8062
+ }
8063
+ };
8064
+ }, [onClick, onLongPress, touchEventsOnly]);
8065
+ const startPressTimer = React.useCallback(() => {
8066
+ setIsLongPress(false);
8067
+ timerRef.current = setTimeout(() => {
8068
+ setIsLongPress(true);
8069
+ onLongPress();
8070
+ }, 500);
8071
+ }, [onLongPress]);
8072
+ const handleOnClick = React.useCallback(() => {
8073
+ if (touchEventsOnly || !onClick) {
8074
+ return;
8075
+ }
8076
+ if (!isLongPress) {
8077
+ onClick();
8078
+ }
8079
+ }, [isLongPress, onClick, touchEventsOnly]);
8080
+ const handleOnKeyDown = React.useCallback(() => {
8081
+ if (touchEventsOnly) {
8082
+ return;
8083
+ }
8084
+ if (action) {
8085
+ setAction(false);
8086
+ startPressTimer();
8087
+ }
8088
+ }, [action, startPressTimer, touchEventsOnly]);
8089
+ const handleOnKeyUp = React.useCallback(() => {
8090
+ if (touchEventsOnly) {
8091
+ return;
8092
+ }
8093
+ setAction(true);
8094
+ timerRef.current && clearTimeout(timerRef.current);
8095
+ }, [touchEventsOnly]);
8096
+ const handleOnMouseDown = React.useCallback(() => {
8097
+ if (touchEventsOnly) {
8098
+ return;
8099
+ }
8100
+ startPressTimer();
8101
+ }, [startPressTimer, touchEventsOnly]);
8102
+ const handleOnMouseUp = React.useCallback(() => {
8103
+ if (touchEventsOnly) {
8104
+ return;
8105
+ }
8106
+ timerRef.current && clearTimeout(timerRef.current);
8107
+ }, [touchEventsOnly]);
8108
+ const handleOnTouchStart = React.useCallback(() => {
8109
+ startPressTimer();
8110
+ }, [startPressTimer]);
8111
+ const handleOnTouchEnd = React.useCallback(() => {
8112
+ timerRef.current && clearTimeout(timerRef.current);
8113
+ }, []);
8114
+ return React.useMemo(() => ({
8115
+ onClick: handleOnClick,
8116
+ onMouseDown: handleOnMouseDown,
8117
+ onMouseUp: handleOnMouseUp,
8118
+ onTouchStart: handleOnTouchStart,
8119
+ onTouchEnd: handleOnTouchEnd,
8120
+ onKeyDown: handleOnKeyDown,
8121
+ onKeyUp: handleOnKeyUp
8122
+ }), [
8123
+ handleOnClick,
8124
+ handleOnKeyDown,
8125
+ handleOnKeyUp,
8126
+ handleOnMouseDown,
8127
+ handleOnMouseUp,
8128
+ handleOnTouchEnd,
8129
+ handleOnTouchStart
8130
+ ]);
8131
+ }
8132
+
8043
8133
  // Copyright (c) Microsoft Corporation.
8044
8134
  // Coin max size is set to PersonaSize.size100
8045
8135
  const DEFAULT_PERSONA_MAX_SIZE_PX = 100;
@@ -8092,6 +8182,26 @@ const VideoTile = (props) => {
8092
8182
  const currentObserver = observer.current;
8093
8183
  return () => currentObserver.disconnect();
8094
8184
  }, [observer, videoTileRef]);
8185
+ /* @conditional-compile-remove(pinned-participants) */
8186
+ const useLongPressProps = React.useMemo(() => {
8187
+ return {
8188
+ onLongPress: () => {
8189
+ var _a;
8190
+ (_a = props.onLongTouch) === null || _a === void 0 ? void 0 : _a.call(props);
8191
+ },
8192
+ touchEventsOnly: true
8193
+ };
8194
+ // eslint-disable-next-line react-hooks/exhaustive-deps
8195
+ }, [props.onLongTouch]);
8196
+ /* @conditional-compile-remove(pinned-participants) */
8197
+ const longPressHandlers = useLongPress(useLongPressProps);
8198
+ const longPressHandlersTrampoline = React.useMemo(() => {
8199
+ /* @conditional-compile-remove(pinned-participants) */
8200
+ return longPressHandlers;
8201
+ }, [
8202
+ /* @conditional-compile-remove(pinned-participants) */
8203
+ longPressHandlers
8204
+ ]);
8095
8205
  const placeholderOptions = {
8096
8206
  userId,
8097
8207
  text: initialsName || displayName,
@@ -8106,7 +8216,7 @@ const VideoTile = (props) => {
8106
8216
  const canShowLabel = showLabel && (displayName || (showMuteIndicator && isMuted));
8107
8217
  const participantStateString = participantStateStringTrampoline(props, locale);
8108
8218
  return (React__default['default'].createElement(reactNorthstar.Ref, { innerRef: videoTileRef },
8109
- React__default['default'].createElement(react.Stack, { "data-ui-id": ids.videoTile, className: react.mergeStyles(rootStyles, {
8219
+ React__default['default'].createElement(react.Stack, Object.assign({ "data-ui-id": ids.videoTile, className: react.mergeStyles(rootStyles, {
8110
8220
  background: theme.palette.neutralLighter,
8111
8221
  borderRadius: theme.effects.roundedCorner4
8112
8222
  }, isSpeaking && {
@@ -8119,7 +8229,7 @@ const VideoTile = (props) => {
8119
8229
  width: '100%',
8120
8230
  height: '100%'
8121
8231
  }
8122
- }, styles === null || styles === void 0 ? void 0 : styles.root) },
8232
+ }, styles === null || styles === void 0 ? void 0 : styles.root) }, longPressHandlersTrampoline),
8123
8233
  isVideoRendered ? (React__default['default'].createElement(react.Stack, { className: react.mergeStyles(videoContainerStyles, isMirrored && { transform: 'scaleX(-1)' }, styles === null || styles === void 0 ? void 0 : styles.videoContainer) }, renderElement)) : (React__default['default'].createElement(react.Stack, { className: react.mergeStyles(videoContainerStyles), style: { opacity: participantStateString ? 0.4 : 1 } }, onRenderPlaceholder ? (onRenderPlaceholder(userId !== null && userId !== void 0 ? userId : '', placeholderOptions, DefaultPlaceholder)) : (React__default['default'].createElement(DefaultPlaceholder, Object.assign({}, placeholderOptions))))),
8124
8234
  (canShowLabel || participantStateString) && (React__default['default'].createElement(react.Stack, { horizontal: true, className: tileInfoContainerStyle, tokens: tileInfoContainerTokens },
8125
8235
  React__default['default'].createElement(react.Stack, { horizontal: true, className: tileInfoStyle },
@@ -11158,69 +11268,6 @@ const formatPhoneNumber = (phoneNumber) => {
11158
11268
  return `${countryCodeNA}(${phoneNumber.slice(0, 3)}) ${phoneNumber.slice(3, 6)}-${phoneNumber.slice(6, phoneNumber.length)}`;
11159
11269
  };
11160
11270
 
11161
- // Copyright (c) Microsoft Corporation.
11162
- /**
11163
- * @private
11164
- */
11165
- function useLongPress(onClick, onLongPress, isMobile) {
11166
- const timerRef = React.useRef();
11167
- const [isLongPress, setIsLongPress] = React.useState(false);
11168
- const [action, setAction] = React.useState(false);
11169
- function startPressTimer() {
11170
- setIsLongPress(false);
11171
- timerRef.current = setTimeout(() => {
11172
- setIsLongPress(true);
11173
- }, 500);
11174
- }
11175
- function handleOnClick() {
11176
- // when it's mobile use ontouchstart and ontouchend to fire onclick and onlongpress event
11177
- if (isMobile) {
11178
- return;
11179
- }
11180
- onClick();
11181
- if (isLongPress) {
11182
- onLongPress();
11183
- return;
11184
- }
11185
- }
11186
- function handleOnKeyDown() {
11187
- if (action) {
11188
- setAction(false);
11189
- startPressTimer();
11190
- }
11191
- }
11192
- function handleOnKeyUp() {
11193
- setAction(true);
11194
- timerRef.current && clearTimeout(timerRef.current);
11195
- }
11196
- function handleOnMouseDown() {
11197
- startPressTimer();
11198
- }
11199
- function handleOnMouseUp() {
11200
- timerRef.current && clearTimeout(timerRef.current);
11201
- }
11202
- function handleOnTouchStart() {
11203
- startPressTimer();
11204
- }
11205
- function handleOnTouchEnd() {
11206
- if (isMobile) {
11207
- isLongPress ? onLongPress() : onClick();
11208
- }
11209
- timerRef.current && clearTimeout(timerRef.current);
11210
- }
11211
- return {
11212
- handlers: {
11213
- onClick: handleOnClick,
11214
- onMouseDown: handleOnMouseDown,
11215
- onMouseUp: handleOnMouseUp,
11216
- onTouchStart: handleOnTouchStart,
11217
- onTouchEnd: handleOnTouchEnd,
11218
- onKeyDown: handleOnKeyDown,
11219
- onKeyUp: handleOnKeyUp
11220
- }
11221
- };
11222
- }
11223
-
11224
11271
  // Copyright (c) Microsoft Corporation.
11225
11272
  // Licensed under the MIT license.
11226
11273
  var __awaiter$j = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -11264,14 +11311,17 @@ const DialpadButton = (props) => {
11264
11311
  var _a, _b, _c, _d;
11265
11312
  const theme = react.useTheme();
11266
11313
  const { digit, index, onClick, onLongPress, isMobile = false } = props;
11267
- const clickFunction = React.useCallback(() => __awaiter$j(void 0, void 0, void 0, function* () {
11268
- onClick(digit, index);
11269
- }), [digit, index, onClick]);
11270
- const longPressFunction = React.useCallback(() => __awaiter$j(void 0, void 0, void 0, function* () {
11271
- onLongPress(digit, index);
11272
- }), [digit, index, onLongPress]);
11273
- const { handlers } = useLongPress(clickFunction, longPressFunction, isMobile);
11274
- return (React__default['default'].createElement(react.DefaultButton, Object.assign({ "data-test-id": `dialpad-button-${props.index}`, styles: react.concatStyleSets(buttonStyles(), (_a = props.styles) === null || _a === void 0 ? void 0 : _a.button) }, handlers),
11314
+ const useLongPressProps = React__default['default'].useMemo(() => ({
11315
+ onClick: () => __awaiter$j(void 0, void 0, void 0, function* () {
11316
+ onClick(digit, index);
11317
+ }),
11318
+ onLongPress: () => __awaiter$j(void 0, void 0, void 0, function* () {
11319
+ onLongPress(digit, index);
11320
+ }),
11321
+ touchEventsOnly: isMobile
11322
+ }), [digit, index, isMobile, onClick, onLongPress]);
11323
+ const longPressHandlers = useLongPress(useLongPressProps);
11324
+ return (React__default['default'].createElement(react.DefaultButton, Object.assign({ "data-test-id": `dialpad-button-${props.index}`, styles: react.concatStyleSets(buttonStyles(), (_a = props.styles) === null || _a === void 0 ? void 0 : _a.button) }, longPressHandlers),
11275
11325
  React__default['default'].createElement(react.Stack, null,
11276
11326
  React__default['default'].createElement(react.Text, { className: react.mergeStyles(digitStyles(theme), (_b = props.styles) === null || _b === void 0 ? void 0 : _b.digit) }, props.digit),
11277
11327
  React__default['default'].createElement(react.Text, { className: react.mergeStyles(letterStyles(theme), (_c = props.styles) === null || _c === void 0 ? void 0 : _c.letter) }, (_d = props.letter) !== null && _d !== void 0 ? _d : ' '))));
@@ -17976,7 +18026,9 @@ const CallPage = (props) => {
17976
18026
  const strings = useLocale().strings.call;
17977
18027
  // Reduce the controls shown when mobile view is enabled.
17978
18028
  const callControlOptions = mobileView ? reduceCallControlsForMobile(options === null || options === void 0 ? void 0 : options.callControls) : options === null || options === void 0 ? void 0 : options.callControls;
17979
- return (React__default['default'].createElement(CallArrangement, { complianceBannerProps: Object.assign(Object.assign({}, complianceBannerProps), { strings }), errorBarProps: (options === null || options === void 0 ? void 0 : options.errorBar) !== false && Object.assign({}, errorBarProps), mutedNotificationProps: mutedNotificationProps, callControlProps: {
18029
+ return (React__default['default'].createElement(CallArrangement, { complianceBannerProps: Object.assign(Object.assign({}, complianceBannerProps), { strings }),
18030
+ // Ignore errors from before current call. This avoids old errors from showing up when a user re-joins a call.
18031
+ errorBarProps: (options === null || options === void 0 ? void 0 : options.errorBar) !== false && Object.assign(Object.assign({}, errorBarProps), { ignorePremountErrors: true }), mutedNotificationProps: mutedNotificationProps, callControlProps: {
17980
18032
  callInvitationURL: callInvitationURL,
17981
18033
  onFetchParticipantMenuItems: onFetchParticipantMenuItems,
17982
18034
  options: callControlOptions,
@@ -18914,7 +18966,9 @@ const LobbyPage = (props) => {
18914
18966
  ? reduceCallControlsForMobile((_b = props.options) === null || _b === void 0 ? void 0 : _b.callControls)
18915
18967
  : (_c = props.options) === null || _c === void 0 ? void 0 : _c.callControls;
18916
18968
  callControlOptions = disableCallControls(callControlOptions, ['screenShareButton', 'participantsButton']);
18917
- return (React__default['default'].createElement(CallArrangement, { complianceBannerProps: { strings }, errorBarProps: ((_d = props.options) === null || _d === void 0 ? void 0 : _d.errorBar) !== false && Object.assign({}, errorBarProps), callControlProps: {
18969
+ return (React__default['default'].createElement(CallArrangement, { complianceBannerProps: { strings },
18970
+ // Ignore errors from before current call. This avoids old errors from showing up when a user re-joins a call.
18971
+ errorBarProps: ((_d = props.options) === null || _d === void 0 ? void 0 : _d.errorBar) !== false && Object.assign(Object.assign({}, errorBarProps), { ignorePremountErrors: true }), callControlProps: {
18918
18972
  options: callControlOptions,
18919
18973
  increaseFlyoutItemSize: props.mobileView
18920
18974
  }, mobileView: props.mobileView,
@@ -19147,7 +19201,9 @@ const HoldPage = (props) => {
19147
19201
  /* @conditional-compile-remove(one-to-n-calling) */
19148
19202
  'holdButton'
19149
19203
  ]);
19150
- return (React__default['default'].createElement(CallArrangement, { complianceBannerProps: { strings }, errorBarProps: ((_c = props.options) === null || _c === void 0 ? void 0 : _c.errorBar) !== false && Object.assign({}, errorBarProps), callControlProps: {
19204
+ return (React__default['default'].createElement(CallArrangement, { complianceBannerProps: { strings },
19205
+ // Ignore errors from before current call. This avoids old errors from showing up when a user re-joins a call.
19206
+ errorBarProps: ((_c = props.options) === null || _c === void 0 ? void 0 : _c.errorBar) !== false && Object.assign(Object.assign({}, errorBarProps), { ignorePremountErrors: true }), callControlProps: {
19151
19207
  options: callControlOptions,
19152
19208
  increaseFlyoutItemSize: props.mobileView
19153
19209
  }, mobileView: props.mobileView,
@@ -19406,6 +19462,24 @@ class DiagnosticsForwarder {
19406
19462
  }
19407
19463
  }
19408
19464
 
19465
+ // Copyright (c) Microsoft Corporation.
19466
+ /**
19467
+ * @private
19468
+ *
19469
+ * This is used to create correct handler for generic agent type
19470
+ */
19471
+ const createHandlers = (callClient, callAgent, deviceManager, call) => {
19472
+ // Call can be either undefined or ACS Call
19473
+ if (_isACSCallAgent(callAgent) && (!call || (call && _isACSCall(call)))) {
19474
+ return createDefaultCallingHandlers(callClient, callAgent, deviceManager, call);
19475
+ }
19476
+ /* @conditional-compile-remove(teams-identity-support) */
19477
+ if (_isTeamsCallAgent(callAgent) && (!call || (call && _isTeamsCall(call)))) {
19478
+ return createDefaultTeamsCallingHandlers(callClient, callAgent, deviceManager, call);
19479
+ }
19480
+ throw new Error('Unhandled agent type');
19481
+ };
19482
+
19409
19483
  // Copyright (c) Microsoft Corporation.
19410
19484
  // Licensed under the MIT license.
19411
19485
  var __awaiter$4 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -19541,7 +19615,7 @@ class AzureCommunicationCallAdapter {
19541
19615
  }
19542
19616
  this.context.updateClientState(clientState);
19543
19617
  };
19544
- this.handlers = createDefaultCallingHandlers(callClient, callAgent, deviceManager, undefined);
19618
+ this.handlers = createHandlers(callClient, callAgent, deviceManager, undefined);
19545
19619
  this.onClientStateChange = onStateChange;
19546
19620
  this.subscribeDeviceManagerEvents();
19547
19621
  this.callClient.onStateChange(onStateChange);
@@ -19659,6 +19733,16 @@ class AzureCommunicationCallAdapter {
19659
19733
  const isTeamsMeeting = 'meetingLink' in this.locator;
19660
19734
  /* @conditional-compile-remove(rooms) */
19661
19735
  const isRoomsCall = 'roomId' in this.locator;
19736
+ /* @conditional-compile-remove(teams-identity-support) */
19737
+ if (_isTeamsCallAgent(this.callAgent)) {
19738
+ if (!isTeamsMeeting) {
19739
+ throw new Error('Locator not supported by TeamsCallAgent');
19740
+ }
19741
+ return this.callAgent.join(this.locator, {
19742
+ audioOptions,
19743
+ videoOptions
19744
+ });
19745
+ }
19662
19746
  if (isTeamsMeeting) {
19663
19747
  return this.callAgent.join(this.locator, {
19664
19748
  audioOptions,
@@ -19701,7 +19785,7 @@ class AzureCommunicationCallAdapter {
19701
19785
  return __awaiter$4(this, void 0, void 0, function* () {
19702
19786
  yield this.handlers.onHangUp(forEveryone);
19703
19787
  this.unsubscribeCallEvents();
19704
- this.handlers = createDefaultCallingHandlers(this.callClient, this.callAgent, this.deviceManager, undefined);
19788
+ this.handlers = createHandlers(this.callClient, this.callAgent, this.deviceManager, undefined);
19705
19789
  // We set the adapter.call object to undefined immediately when a call is ended.
19706
19790
  // We do not set the context.callId to undefined because it is a part of the immutable data flow loop.
19707
19791
  this.call = undefined;
@@ -19815,14 +19899,14 @@ class AzureCommunicationCallAdapter {
19815
19899
  throw new Error('Unable to start call.');
19816
19900
  }
19817
19901
  this.processNewCall(call);
19818
- return this.call;
19902
+ return call;
19819
19903
  }
19820
19904
  processNewCall(call) {
19821
19905
  this.call = call;
19822
19906
  this.context.setCurrentCallId(call.id);
19823
19907
  // Resync state after callId is set
19824
19908
  this.context.updateClientState(this.callClient.getState());
19825
- this.handlers = createDefaultCallingHandlers(this.callClient, this.callAgent, this.deviceManager, this.call);
19909
+ this.handlers = createHandlers(this.callClient, this.callAgent, this.deviceManager, this.call);
19826
19910
  this.subscribeCallEvents();
19827
19911
  }
19828
19912
  removeParticipant(userId) {
@@ -19983,40 +20067,26 @@ const createAzureCommunicationCallAdapter = ({ userId, displayName, credential,
19983
20067
  /* @conditional-compile-remove(rooms) */ options);
19984
20068
  return adapter;
19985
20069
  });
20070
+ /* @conditional-compile-remove(teams-identity-support) */
19986
20071
  /**
19987
- * A custom React hook to simplify the creation of {@link CallAdapter}.
19988
- *
19989
- * Similar to {@link createAzureCommunicationCallAdapter}, but takes care of asynchronous
19990
- * creation of the adapter internally.
19991
- *
19992
- * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments
19993
- * as they are created. The adapter is only created when all arguments are defined.
19994
- *
19995
- * Note that you must memoize the arguments to avoid recreating adapter on each render.
19996
- * See storybook for typical usage examples.
19997
- *
19998
- * @public
19999
- */
20000
- const useAzureCommunicationCallAdapter = (
20001
- /**
20002
- * Arguments to be passed to {@link createAzureCommunicationCallAdapter}.
20003
- *
20004
- * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments
20005
- * as they are created. The adapter is only created when all arguments are defined.
20006
- */
20007
- args,
20008
- /**
20009
- * Optional callback to modify the adapter once it is created.
20010
- *
20011
- * If set, must return the modified adapter.
20072
+ * @beta
20012
20073
  */
20013
- afterCreate,
20074
+ const createAzureCommunicationTeamsCallAdapter = ({ userId, credential, locator,
20075
+ /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId }) => __awaiter$4(void 0, void 0, void 0, function* () {
20076
+ const callClient = createStatefulCallClient({
20077
+ userId,
20078
+ /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId
20079
+ });
20080
+ const callAgent = yield callClient.createTeamsCallAgent(credential, {
20081
+ undefined
20082
+ });
20083
+ const adapter = createAzureCommunicationTeamsCallAdapterFromClient(callClient, callAgent, locator);
20084
+ return adapter;
20085
+ });
20014
20086
  /**
20015
- * Optional callback called before the adapter is disposed.
20016
- *
20017
- * This is useful for clean up tasks, e.g., leaving any ongoing calls.
20087
+ * @private
20018
20088
  */
20019
- beforeDispose) => {
20089
+ const useAzureCommunicationCallAdapterGeneric = (args, createAzureCommunicationCallAdapter, afterCreate, beforeDispose) => {
20020
20090
  const { credential, displayName, locator, userId,
20021
20091
  /*@conditional-compile-remove(PSTN-calls) */ alternateCallerId,
20022
20092
  /*@conditional-compile-remove(rooms) */ options } = args;
@@ -20070,11 +20140,12 @@ beforeDispose) => {
20070
20140
  afterCreateRef,
20071
20141
  /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId,
20072
20142
  beforeDisposeRef,
20143
+ createAzureCommunicationCallAdapter,
20073
20144
  credential,
20074
20145
  displayName,
20075
20146
  locator,
20076
- userId,
20077
- /* @conditional-compile-remove(PSTN-calls) */ options
20147
+ /* @conditional-compile-remove(rooms) */ options,
20148
+ userId
20078
20149
  ]);
20079
20150
  // Dispose any existing adapter when the component unmounts.
20080
20151
  React.useEffect(() => {
@@ -20092,6 +20163,79 @@ beforeDispose) => {
20092
20163
  }, []);
20093
20164
  return adapter;
20094
20165
  };
20166
+ /**
20167
+ * A custom React hook to simplify the creation of {@link CallAdapter}.
20168
+ *
20169
+ * Similar to {@link createAzureCommunicationCallAdapter}, but takes care of asynchronous
20170
+ * creation of the adapter internally.
20171
+ *
20172
+ * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments
20173
+ * as they are created. The adapter is only created when all arguments are defined.
20174
+ *
20175
+ * Note that you must memoize the arguments to avoid recreating adapter on each render.
20176
+ * See storybook for typical usage examples.
20177
+ *
20178
+ * @public
20179
+ */
20180
+ const useAzureCommunicationCallAdapter = (
20181
+ /**
20182
+ * Arguments to be passed to {@link createAzureCommunicationCallAdapter}.
20183
+ *
20184
+ * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments
20185
+ * as they are created. The adapter is only created when all arguments are defined.
20186
+ */
20187
+ args,
20188
+ /**
20189
+ * Optional callback to modify the adapter once it is created.
20190
+ *
20191
+ * If set, must return the modified adapter.
20192
+ */
20193
+ afterCreate,
20194
+ /**
20195
+ * Optional callback called before the adapter is disposed.
20196
+ *
20197
+ * This is useful for clean up tasks, e.g., leaving any ongoing calls.
20198
+ */
20199
+ beforeDispose) => {
20200
+ return useAzureCommunicationCallAdapterGeneric(args, createAzureCommunicationCallAdapter, afterCreate, beforeDispose);
20201
+ };
20202
+ /* @conditional-compile-remove(teams-identity-support) */
20203
+ /**
20204
+ * A custom React hook to simplify the creation of {@link TeamsCallAdapter}.
20205
+ *
20206
+ * Similar to {@link createTeamsAzureCommunicationCallAdapter}, but takes care of asynchronous
20207
+ * creation of the adapter internally.
20208
+ *
20209
+ * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments
20210
+ * as they are created. The adapter is only created when all arguments are defined.
20211
+ *
20212
+ * Note that you must memoize the arguments to avoid recreating adapter on each render.
20213
+ * See storybook for typical usage examples.
20214
+ *
20215
+ * @beta
20216
+ */
20217
+ const useAzureCommunicationTeamsCallAdapter = (
20218
+ /**
20219
+ * Arguments to be passed to {@link createAzureCommunicationCallAdapter}.
20220
+ *
20221
+ * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments
20222
+ * as they are created. The adapter is only created when all arguments are defined.
20223
+ */
20224
+ args,
20225
+ /**
20226
+ * Optional callback to modify the adapter once it is created.
20227
+ *
20228
+ * If set, must return the modified adapter.
20229
+ */
20230
+ afterCreate,
20231
+ /**
20232
+ * Optional callback called before the adapter is disposed.
20233
+ *
20234
+ * This is useful for clean up tasks, e.g., leaving any ongoing calls.
20235
+ */
20236
+ beforeDispose) => {
20237
+ return useAzureCommunicationCallAdapterGeneric(args, createAzureCommunicationTeamsCallAdapter, afterCreate, beforeDispose);
20238
+ };
20095
20239
  /**
20096
20240
  * Create a {@link CallAdapter} using the provided {@link StatefulCallClient}.
20097
20241
  *
@@ -20107,6 +20251,21 @@ const createAzureCommunicationCallAdapterFromClient = (callClient, callAgent, lo
20107
20251
  return new AzureCommunicationCallAdapter(callClient, locator, callAgent, deviceManager,
20108
20252
  /* @conditional-compile-remove(rooms) */ options);
20109
20253
  });
20254
+ /* @conditional-compile-remove(teams-identity-support) */
20255
+ /**
20256
+ * Create a {@link TeamsCallAdapter} using the provided {@link StatefulCallClient}.
20257
+ *
20258
+ * Useful if you want to keep a reference to {@link StatefulCallClient}.
20259
+ * Consider using {@link createAzureCommunicationCallAdapter} for a simpler API.
20260
+ *
20261
+ * @beta
20262
+ */
20263
+ const createAzureCommunicationTeamsCallAdapterFromClient = (callClient, callAgent, locator) => __awaiter$4(void 0, void 0, void 0, function* () {
20264
+ const deviceManager = (yield callClient.getDeviceManager());
20265
+ /* @conditional-compile-remove(unsupported-browser) */
20266
+ yield callClient.feature(communicationCalling.Features.DebugInfo).getEnvironmentInfo();
20267
+ return new AzureCommunicationCallAdapter(callClient, locator, callAgent, deviceManager);
20268
+ });
20110
20269
  const isCallError = (e) => {
20111
20270
  return e['target'] !== undefined && e['innerError'] !== undefined;
20112
20271
  };
@@ -22118,6 +22277,8 @@ exports.createAzureCommunicationCallWithChatAdapter = createAzureCommunicationCa
22118
22277
  exports.createAzureCommunicationCallWithChatAdapterFromClients = createAzureCommunicationCallWithChatAdapterFromClients;
22119
22278
  exports.createAzureCommunicationChatAdapter = createAzureCommunicationChatAdapter;
22120
22279
  exports.createAzureCommunicationChatAdapterFromClient = createAzureCommunicationChatAdapterFromClient;
22280
+ exports.createAzureCommunicationTeamsCallAdapter = createAzureCommunicationTeamsCallAdapter;
22281
+ exports.createAzureCommunicationTeamsCallAdapterFromClient = createAzureCommunicationTeamsCallAdapterFromClient;
22121
22282
  exports.createDefaultCallingHandlers = createDefaultCallingHandlers;
22122
22283
  exports.createDefaultChatHandlers = createDefaultChatHandlers;
22123
22284
  exports.createDefaultTeamsCallingHandlers = createDefaultTeamsCallingHandlers;
@@ -22132,6 +22293,7 @@ exports.toFlatCommunicationIdentifier = toFlatCommunicationIdentifier;
22132
22293
  exports.useAzureCommunicationCallAdapter = useAzureCommunicationCallAdapter;
22133
22294
  exports.useAzureCommunicationCallWithChatAdapter = useAzureCommunicationCallWithChatAdapter;
22134
22295
  exports.useAzureCommunicationChatAdapter = useAzureCommunicationChatAdapter;
22296
+ exports.useAzureCommunicationTeamsCallAdapter = useAzureCommunicationTeamsCallAdapter;
22135
22297
  exports.useCall = useCall;
22136
22298
  exports.useCallAgent = useCallAgent;
22137
22299
  exports.useCallClient = useCallClient;