@azure/communication-react 1.5.1-alpha-202305030013 → 1.5.1-alpha-202305050017

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 (110) hide show
  1. package/CHANGELOG.beta.md +9 -1
  2. package/dist/dist-cjs/communication-react/index.js +1902 -1847
  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/Caption.js +1 -2
  7. package/dist/dist-esm/react-components/src/components/Caption.js.map +1 -1
  8. package/dist/dist-esm/react-components/src/components/styles/Captions.style.js +3 -2
  9. package/dist/dist-esm/react-components/src/components/styles/Captions.style.js.map +1 -1
  10. package/dist/dist-esm/react-components/src/theming/icons.js +12 -5
  11. package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
  12. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.d.ts +12 -0
  13. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js +33 -19
  14. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
  15. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.d.ts +4 -0
  16. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +76 -65
  17. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
  18. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js +2 -3
  19. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js.map +1 -1
  20. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalPreview.js +16 -3
  21. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalPreview.js.map +1 -1
  22. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/SidePane.d.ts +14 -0
  23. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/SidePane.js +63 -0
  24. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/SidePane.js.map +1 -0
  25. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/SidePaneProvider.d.ts +58 -0
  26. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/SidePaneProvider.js +31 -0
  27. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/SidePaneProvider.js.map +1 -0
  28. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.d.ts +17 -0
  29. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.js +43 -0
  30. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.js.map +1 -0
  31. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/useVideoEffectsPane.d.ts +9 -0
  32. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/useVideoEffectsPane.js +81 -0
  33. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/useVideoEffectsPane.js.map +1 -0
  34. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Custom.d.ts +0 -1
  35. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Custom.js +2 -2
  36. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Custom.js.map +1 -1
  37. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.d.ts +4 -0
  38. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +2 -4
  39. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
  40. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.d.ts +2 -0
  41. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js +35 -29
  42. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js.map +1 -1
  43. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.d.ts +4 -0
  44. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js +1 -3
  45. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js.map +1 -1
  46. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.d.ts +4 -0
  47. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js +1 -3
  48. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js.map +1 -1
  49. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/videoBackgroundErrorsSelector.d.ts +1 -1
  50. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/videoBackgroundErrorsSelector.js +1 -1
  51. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/videoBackgroundErrorsSelector.js.map +1 -1
  52. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.d.ts +2 -0
  53. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.js +4 -0
  54. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.js.map +1 -1
  55. package/dist/dist-esm/react-composites/src/composites/CallComposite/types/CallControlOptions.d.ts +9 -1
  56. package/dist/dist-esm/react-composites/src/composites/CallComposite/types/CallControlOptions.js.map +1 -1
  57. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.d.ts +12 -0
  58. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js +13 -0
  59. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js.map +1 -1
  60. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +116 -162
  61. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
  62. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/{ChatButton.d.ts → ChatButton/ChatButton.d.ts} +1 -1
  63. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/{ChatButton.js → ChatButton/ChatButton.js} +1 -1
  64. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/ChatButton/ChatButton.js.map +1 -0
  65. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/{ChatButtonWithUnreadMessagesBadge.d.ts → ChatButton/ChatButtonWithUnreadMessagesBadge.d.ts} +2 -2
  66. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/{ChatButtonWithUnreadMessagesBadge.js → ChatButton/ChatButtonWithUnreadMessagesBadge.js} +3 -3
  67. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/ChatButton/ChatButtonWithUnreadMessagesBadge.js.map +1 -0
  68. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/ChatButton/NotificationIcon.js.map +1 -0
  69. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleButton.js +2 -2
  70. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleButton.js.map +1 -1
  71. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.js +1 -1
  72. package/dist/dist-esm/react-composites/src/composites/common/AddPeopleDropdown.js.map +1 -1
  73. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.d.ts +4 -5
  74. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js +11 -24
  75. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CommonCallControlBar.js.map +1 -1
  76. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CustomButton.js +5 -2
  77. package/dist/dist-esm/react-composites/src/composites/common/ControlBar/CustomButton.js.map +1 -1
  78. package/dist/dist-esm/react-composites/src/composites/common/ConvertContextualMenuItemToDrawerMenuItem.js.map +1 -0
  79. package/dist/dist-esm/react-composites/src/composites/common/PeoplePaneContent.d.ts +0 -9
  80. package/dist/dist-esm/react-composites/src/composites/common/PeoplePaneContent.js +32 -12
  81. package/dist/dist-esm/react-composites/src/composites/common/PeoplePaneContent.js.map +1 -1
  82. package/dist/dist-esm/react-composites/src/composites/common/SidePaneHeader.d.ts +4 -4
  83. package/dist/dist-esm/react-composites/src/composites/common/SidePaneHeader.js +27 -2
  84. package/dist/dist-esm/react-composites/src/composites/common/SidePaneHeader.js.map +1 -1
  85. package/dist/dist-esm/react-composites/src/composites/common/TabHeader.d.ts +8 -5
  86. package/dist/dist-esm/react-composites/src/composites/common/TabHeader.js +11 -2
  87. package/dist/dist-esm/react-composites/src/composites/common/TabHeader.js.map +1 -1
  88. package/dist/dist-esm/react-composites/src/composites/common/VideoEffectsPane.d.ts +3 -15
  89. package/dist/dist-esm/react-composites/src/composites/common/VideoEffectsPane.js +16 -34
  90. package/dist/dist-esm/react-composites/src/composites/common/VideoEffectsPane.js.map +1 -1
  91. package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.d.ts +8 -0
  92. package/dist/dist-esm/react-composites/src/composites/common/types/CommonCallControlOptions.js.map +1 -1
  93. package/package.json +10 -10
  94. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallPane.d.ts +0 -24
  95. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallPane.js +0 -80
  96. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallPane.js.map +0 -1
  97. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useSidePaneState.d.ts +0 -16
  98. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useSidePaneState.js +0 -38
  99. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useSidePaneState.js.map +0 -1
  100. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatPane.d.ts +0 -34
  101. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatPane.js +0 -90
  102. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatPane.js.map +0 -1
  103. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/ChatButton.js.map +0 -1
  104. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/ChatButtonWithUnreadMessagesBadge.js.map +0 -1
  105. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/ConvertContextualMenuItemToDrawerMenuItem.js.map +0 -1
  106. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/NotificationIcon.js.map +0 -1
  107. /package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/{NotificationIcon.d.ts → ChatButton/NotificationIcon.d.ts} +0 -0
  108. /package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/{NotificationIcon.js → ChatButton/NotificationIcon.js} +0 -0
  109. /package/dist/dist-esm/react-composites/src/composites/{CallWithChatComposite → common}/ConvertContextualMenuItemToDrawerMenuItem.d.ts +0 -0
  110. /package/dist/dist-esm/react-composites/src/composites/{CallWithChatComposite → common}/ConvertContextualMenuItemToDrawerMenuItem.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallComposite/utils/Utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,EAAuC,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7F,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,sBAAsB,EAAE,sDAA6C;AAGvG,OAAO,EAEL,6BAA6B,EAC7B,8BAA8B,EAC9B,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,6BAA6B,CAAC;AAKrC,MAAM,oCAAoC,GAAG,IAAI,CAAC;AAClD,MAAM,wBAAwB,GAAG,MAAM,CAAC;AACxC,MAAM,2BAA2B,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,wBAAwB,CAAC,CAAC;AAC3E,wCAAwC;AACxC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AACrC,wCAAwC;AACxC,MAAM,kCAAkC,GAAG,IAAI,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAA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mB;wBACnC,WAAW,EAAE,oBAAoB,CAAC,GAAG,CAAC;qBACvC,CAAC;iBACH;gBAED,8FAA8F;gBAC9F,mCAAmC;gBACnC,oBAAoB,CAAC,GAAG,CAAC,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC;aACtE;YAED,wBAAwB,GAAG,MAAA,KAAK,CAAC,IAAI,0CAAE,kBAAkB,CAAC;SAC3D;QACD,uCACK,KAAK,KACR,IAAI,EAAE,KAAK,CAAC,IAAI;gBACd,CAAC,iCACM,KAAK,CAAC,IAAI,KACb,kBAAkB,EAAE,oBAAoB,IAE5C,CAAC,CAAC,SAAS,IACb;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CallAdapterState, CallCompositePage, END_CALL_PAGES } from '../adapter/CallAdapter';\n/* @conditional-compile-remove(video-background-effects) */\nimport { CommonCallAdapter } from '../adapter/CallAdapter';\nimport { _isInCall, _isPreviewOn, _isInLobbyOrConnecting } from '@internal/calling-component-bindings';\nimport { CallControlOptions } from '../types/CallControlOptions';\nimport { CallState, RemoteParticipantState } from '@internal/calling-stateful-client';\nimport {\n CommunicationIdentifier,\n isCommunicationUserIdentifier,\n isMicrosoftTeamsUserIdentifier,\n isPhoneNumberIdentifier,\n isUnknownIdentifier\n} from '@azure/communication-common';\n/* @conditional-compile-remove(unsupported-browser) */\nimport { EnvironmentInfo } from '@azure/communication-calling';\nimport { AdapterStateModifier } from '../adapter/AzureCommunicationCallAdapter';\n\nconst ACCESS_DENIED_TEAMS_MEETING_SUB_CODE = 5854;\nconst REMOTE_PSTN_USER_HUNG_UP = 560000;\nconst REMOVED_FROM_CALL_SUB_CODES = [5000, 5300, REMOTE_PSTN_USER_HUNG_UP];\n/* @conditional-compile-remove(rooms) */\nconst ROOM_NOT_FOUND_SUB_CODE = 5751;\n/* @conditional-compile-remove(rooms) */\nconst DENIED_PERMISSION_TO_ROOM_SUB_CODE = 5828;\n\n/**\n * @private\n */\nexport const isCameraOn = (state: CallAdapterState): boolean => {\n if (state.call) {\n const stream = state.call.localVideoStreams.find((stream) => stream.mediaStreamType === 'Video');\n return !!stream;\n } else {\n if (state.devices.selectedCamera) {\n const previewOn = _isPreviewOn(state.devices);\n return previewOn;\n }\n }\n return false;\n};\n\n/* @conditional-compile-remove(video-background-effects) */\n/**\n * @private\n */\nexport const startSelectedVideoEffect = async (adapter: CommonCallAdapter): Promise<void> => {\n if (adapter.getState().selectedVideoBackgroundEffect) {\n const selectedVideoBackgroundEffect = adapter.getState().selectedVideoBackgroundEffect;\n if (selectedVideoBackgroundEffect?.effectName === 'blur') {\n await adapter.blurVideoBackground();\n } else if (selectedVideoBackgroundEffect?.effectName === 'none') {\n await adapter.stopVideoBackgroundEffect();\n } else if (selectedVideoBackgroundEffect?.effectName === 'replacement') {\n await adapter.replaceVideoBackground({ backgroundImageUrl: selectedVideoBackgroundEffect.backgroundImageUrl });\n }\n }\n};\n\n/**\n * Reduce the set of call controls visible on mobile.\n * For example do not show screenshare button.\n *\n * @private\n */\nexport const reduceCallControlsForMobile = (\n callControlOptions: CallControlOptions | boolean | undefined\n): CallControlOptions | false => {\n if (callControlOptions === false) {\n return false;\n }\n\n // Ensure call controls a valid object.\n const reduceCallControlOptions = callControlOptions === true ? {} : callControlOptions || {};\n\n // Set to compressed mode when composite is optimized for mobile\n reduceCallControlOptions.displayType = 'compact';\n\n // Do not show screen share button when composite is optimized for mobile unless the developer\n // has explicitly opted in.\n if (reduceCallControlOptions.screenShareButton !== true) {\n reduceCallControlOptions.screenShareButton = false;\n }\n\n return reduceCallControlOptions;\n};\n\nenum CallEndReasons {\n LEFT_CALL,\n ACCESS_DENIED,\n REMOVED_FROM_CALL,\n ROOM_NOT_FOUND,\n DENIED_PERMISSION_TO_ROOM\n}\n\nconst getCallEndReason = (call: CallState): CallEndReasons => {\n const remoteParticipantsEndedArray = Array.from(Object.values(call.remoteParticipantsEnded));\n /**\n * Handle the special case in a PSTN call where removing the last user kicks the caller out of the call.\n * The code and subcode is the same as when a user is removed from a teams interop call.\n * Hence, we look at the last remote participant removed to determine if the last participant removed was a phone number.\n * If yes, the caller was kicked out of the call, but we need to show them that they left the call.\n * Note: This check will only work for 1:1 PSTN Calls. The subcode is different for 1:N PSTN calls, and we do not need to handle that case.\n */\n if (\n remoteParticipantsEndedArray.length === 1 &&\n isPhoneNumberIdentifier(remoteParticipantsEndedArray[0].identifier) &&\n call.callEndReason?.subCode !== REMOTE_PSTN_USER_HUNG_UP\n ) {\n return CallEndReasons.LEFT_CALL;\n }\n\n if (call.callEndReason?.subCode && call.callEndReason.subCode === ACCESS_DENIED_TEAMS_MEETING_SUB_CODE) {\n return CallEndReasons.ACCESS_DENIED;\n }\n\n if (call.callEndReason?.subCode && REMOVED_FROM_CALL_SUB_CODES.includes(call.callEndReason.subCode)) {\n return CallEndReasons.REMOVED_FROM_CALL;\n }\n\n /* @conditional-compile-remove(rooms) */\n if (call.callEndReason?.subCode && call.callEndReason.subCode === ROOM_NOT_FOUND_SUB_CODE) {\n return CallEndReasons.ROOM_NOT_FOUND;\n }\n\n /* @conditional-compile-remove(rooms) */\n if (call.callEndReason?.subCode && call.callEndReason.subCode === DENIED_PERMISSION_TO_ROOM_SUB_CODE) {\n return CallEndReasons.DENIED_PERMISSION_TO_ROOM;\n }\n\n if (call.callEndReason) {\n // No error codes match, assume the user simply left the call regularly\n return CallEndReasons.LEFT_CALL;\n }\n\n throw new Error('No matching call end reason');\n};\n\n/**\n * type definition for conditional-compilation\n */\ntype GetCallCompositePageFunction = ((\n call: CallState | undefined,\n previousCall: CallState | undefined\n) => CallCompositePage) &\n /* @conditional-compile-remove(unsupported-browser) */ ((\n call: CallState | undefined,\n previousCall: CallState | undefined,\n unsupportedBrowserInfo?: {\n environmentInfo?: EnvironmentInfo;\n unsupportedBrowserVersionOptedIn?: boolean;\n }\n ) => CallCompositePage);\n/**\n * Get the current call composite page based on the current call composite state\n *\n * @param Call - The current call state\n * @param previousCall - The state of the most recent previous call that has ended.\n *\n * @remarks - The previousCall state is needed to determine if the call has ended.\n * When the call ends a new call object is created, and so we must lookback at the\n * previous call state to understand how the call has ended. If there is no previous\n * call we know that this is a fresh call and can display the configuration page.\n *\n * @private\n */\nexport const getCallCompositePage: GetCallCompositePageFunction = (\n call,\n previousCall?,\n unsupportedBrowserInfo?\n): CallCompositePage => {\n /* @conditional-compile-remove(unsupported-browser) */\n if (\n isUnsupportedEnvironment(\n unsupportedBrowserInfo.environmentInfo,\n unsupportedBrowserInfo.unsupportedBrowserVersionOptedIn\n )\n ) {\n return 'unsupportedEnvironment';\n }\n\n if (call) {\n // Must check for ongoing call *before* looking at any previous calls.\n // If the composite completes one call and joins another, the previous calls\n // will be populated, but not relevant for determining the page.\n\n // `_isInLobbyOrConnecting` needs to be checked first because `_isInCall` also returns true when call is in lobby.\n if (_isInLobbyOrConnecting(call?.state)) {\n return 'lobby';\n // `LocalHold` needs to be checked before `isInCall` since it is also a state that's considered in call.\n } else if (call?.state === 'LocalHold') {\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n return 'hold';\n return 'call';\n } else if (_isInCall(call?.state)) {\n return 'call';\n } else {\n // When the call object has been constructed after clicking , but before 'connecting' has been\n // set on the call object, we continue to show the configuration screen.\n // The call object does not correctly reflect local device state until `call.state` moves to `connecting`.\n // Moving to the 'lobby' page too soon leads to components that depend on the `call` object to show incorrect\n // transitional state.\n return 'configuration';\n }\n }\n\n if (previousCall) {\n const reason = getCallEndReason(previousCall);\n /* @conditional-compile-remove(rooms) */\n switch (reason) {\n case CallEndReasons.ROOM_NOT_FOUND:\n return 'roomNotFound';\n case CallEndReasons.DENIED_PERMISSION_TO_ROOM:\n return 'deniedPermissionToRoom';\n }\n switch (reason) {\n case CallEndReasons.ACCESS_DENIED:\n return 'accessDeniedTeamsMeeting';\n case CallEndReasons.REMOVED_FROM_CALL:\n return 'removedFromCall';\n case CallEndReasons.LEFT_CALL:\n if (previousCall.diagnostics.network.latest.noNetwork) {\n return 'joinCallFailedDueToNoNetwork';\n }\n return 'leftCall';\n }\n }\n\n // No call state - show starting page (configuration)\n return 'configuration';\n};\n\n/** @private */\nexport const IsCallEndedPage = (\n /**\n * Explicitly listing the pages of this function intentionally.\n * This protects against adding a new composite page that should be marked as an callEndedPage.\n * EndCallPages are used to trigger onCallEnded events so this could easily be missed.\n * When you add a new composite page this will throw a compiler error. If this new page is an\n * EndCallPage ensure you update the END_CALL_PAGES. Afterwards update the `page` parameter\n * type below to allow your new page, i.e. add `| <your new page>\n */\n page:\n | 'accessDeniedTeamsMeeting'\n | 'call'\n | 'configuration'\n | 'joinCallFailedDueToNoNetwork'\n | 'leftCall'\n | 'lobby'\n | 'removedFromCall'\n | /* @conditional-compile-remove(PSTN-calls) */ 'hold'\n | /* @conditional-compile-remove(rooms) */ 'roomNotFound'\n | /* @conditional-compile-remove(rooms) */ 'deniedPermissionToRoom'\n | /* @conditional-compile-remove(unsupported-browser) */ 'unsupportedEnvironment'\n): boolean => END_CALL_PAGES.includes(page);\n\n/**\n * Creates a new call control options object and sets the correct values for disabling\n * the buttons provided in the `disabledControls` array.\n * Returns a new object without changing the original object.\n * @param callControlOptions options for the call control component that need to be modified.\n * @param disabledControls An array of controls to disable.\n * @returns a copy of callControlOptions with disabledControls disabled\n * @private\n */\nexport const disableCallControls = (\n callControlOptions: CallControlOptions | boolean | undefined,\n disabledControls: (keyof CallControlOptions)[]\n): CallControlOptions | boolean | undefined => {\n if (callControlOptions === false) {\n return false;\n }\n // Ensure we clone the prop if it is an object to ensure we do not mutate the original prop.\n let newOptions =\n (callControlOptions instanceof Object ? ({ ...callControlOptions } as CallControlOptions) : callControlOptions) ??\n {};\n if (newOptions === true || newOptions === undefined) {\n newOptions = disabledControls.reduce((acc, key) => {\n acc[key] = { disabled: true };\n return acc;\n }, {});\n } else {\n disabledControls.forEach((key) => {\n if (newOptions[key] !== false) {\n newOptions[key] = { disabled: true };\n }\n });\n }\n return newOptions;\n};\n\n/**\n * Check if a disabled object is provided for a button and returns if the button is disabled.\n * A button is only disabled if is explicitly set to disabled.\n *\n * @param option\n * @returns whether a button is disabled\n * @private\n */\nexport const isDisabled = (option: boolean | { disabled: boolean } | undefined): boolean => {\n if (option === undefined || typeof option === 'boolean') {\n return false;\n }\n\n return option.disabled;\n};\n\n/* @conditional-compile-remove(call-readiness) */\n/**\n * @returns Permissions state for the camera.\n */\nconst queryCameraPermissionFromPermissionsAPI = async (): Promise<PermissionState | 'unsupported'> => {\n try {\n return (await navigator.permissions.query({ name: 'camera' as PermissionName })).state;\n } catch (e) {\n console.info('permissions API is not supported by browser', e);\n return 'unsupported';\n }\n};\n\n/* @conditional-compile-remove(call-readiness) */\n/**\n * @returns Permissions state for the microphone.\n */\nconst queryMicrophonePermissionFromPermissionsAPI = async (): Promise<PermissionState | 'unsupported'> => {\n try {\n return (await navigator.permissions.query({ name: 'microphone' as PermissionName })).state;\n } catch (e) {\n console.info('permissions API is not supported by browser', e);\n return 'unsupported';\n }\n};\n\n/* @conditional-compile-remove(call-readiness) */\n/**\n *\n * This function uses permission API to determine if device permission state is granted, prompt or denied\n * @returns whether device permission state is granted, prompt or denied\n * If permission API is not supported on this browser, permission state is set to unsupported.\n * @private\n */\nexport const getDevicePermissionState = async (\n setVideoState: (state: PermissionState | 'unsupported') => void,\n setAudioState: (state: PermissionState | 'unsupported') => void\n): Promise<void> => {\n const [cameraResult, microphoneResult] = await Promise.all([\n queryCameraPermissionFromPermissionsAPI(),\n queryMicrophonePermissionFromPermissionsAPI()\n ]);\n setVideoState(cameraResult);\n setAudioState(microphoneResult);\n};\n/* @conditional-compile-remove(unsupported-browser) */\nconst isUnsupportedEnvironment = (\n environmentInfo?: EnvironmentInfo,\n unsupportedBrowserVersionOptedIn?: boolean\n): boolean => {\n return !!(\n environmentInfo?.isSupportedBrowser === false ||\n (environmentInfo?.isSupportedBrowserVersion === false && !unsupportedBrowserVersionOptedIn) ||\n environmentInfo?.isSupportedPlatform === false\n );\n};\n\n/**\n * Check if an object is identifier.\n *\n * @param identifier\n * @returns whether an identifier is one of identifier types (for runtime validation)\n * @private\n */\nexport const isValidIdentifier = (identifier: CommunicationIdentifier): boolean => {\n return (\n isCommunicationUserIdentifier(identifier) ||\n isPhoneNumberIdentifier(identifier) ||\n isMicrosoftTeamsUserIdentifier(identifier) ||\n isUnknownIdentifier(identifier)\n );\n};\n\n/**\n * Check if we are using safari browser\n * @private\n */\nexport const _isSafari = (\n environmentInfo: undefined | /* @conditional-compile-remove(unsupported-browser) */ EnvironmentInfo\n): boolean => {\n /* @conditional-compile-remove(unsupported-browser) */\n return environmentInfo?.environment.browser === 'safari';\n return /^((?!chrome|android|crios|fxios).)*safari/i.test(navigator.userAgent);\n};\n\n/**\n * @private\n * This is the util function to create a participant modifier for remote participantList\n * It memoize previous original participant items and only update the changed participant\n * It takes in one modifier function to generate one single participant object, it returns undefined if the object keeps unmodified\n */\nexport const createParticipantModifier = (\n createModifiedParticipant: (id: string, participant: RemoteParticipantState) => RemoteParticipantState | undefined\n): AdapterStateModifier => {\n let previousParticipantState:\n | {\n [keys: string]: RemoteParticipantState;\n }\n | undefined = undefined;\n let modifiedParticipants = {};\n const memoizedParticipants: {\n [id: string]: { originalRef: RemoteParticipantState; newParticipant: RemoteParticipantState };\n } = {};\n\n return (state: CallAdapterState) => {\n // if root state is the same, we don't need to update the participants\n if (state.call?.remoteParticipants !== previousParticipantState) {\n modifiedParticipants = {};\n const originalParticipants = state.call?.remoteParticipants;\n for (const key in originalParticipants) {\n const modifiedParticipant = createModifiedParticipant(key, originalParticipants[key]);\n if (modifiedParticipant === undefined) {\n modifiedParticipants[key] = originalParticipants[key];\n continue;\n }\n // Generate the new item if original cached item has been changed\n if (memoizedParticipants[key]?.originalRef !== originalParticipants[key]) {\n memoizedParticipants[key] = {\n newParticipant: modifiedParticipant,\n originalRef: originalParticipants[key]\n };\n }\n\n // the modified participant is always coming from the memoized cache, whether is was refreshed\n // from the previous closure or not\n modifiedParticipants[key] = memoizedParticipants[key].newParticipant;\n }\n\n previousParticipantState = state.call?.remoteParticipants;\n }\n return {\n ...state,\n call: state.call\n ? {\n ...state.call,\n remoteParticipants: modifiedParticipants\n }\n : undefined\n };\n };\n};\n\"../../../../../calling-component-bindings/src\"\"../../../../../calling-stateful-client/src\""]}
1
+ {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallComposite/utils/Utils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,EAAuC,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7F,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,sBAAsB,EAAE,sDAA6C;AAGvG,OAAO,EAEL,6BAA6B,EAC7B,8BAA8B,EAC9B,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,6BAA6B,CAAC;AAMrC,MAAM,oCAAoC,GAAG,IAAI,CAAC;AAClD,MAAM,wBAAwB,GAAG,MAAM,CAAC;AACxC,MAAM,2BAA2B,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,wBAAwB,CAAC,CAAC;AAC3E,wCAAwC;AACxC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AACrC,wCAAwC;AACxC,MAAM,kCAAkC,GAAG,IAAI,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAuB,EAAW,EAAE;IAC7D,IAAI,KAAK,CAAC,IAAI,EAAE;QACd,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,eAAe,KAAK,OAAO,CAAC,CAAC;QACjG,OAAO,CAAC,CAAC,MAAM,CAAC;KACjB;SAAM;QACL,IAAI,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE;YAChC,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,CAA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AAC,IAAI,KACb,kBAAkB,EAAE,oBAAoB,IAE5C,CAAC,CAAC,SAAS,IACb;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC;AAUF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,SAAuB,EAAkB,EAAE;;IAClF,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IACjC,MAAM,kBAAkB,GAAG,MAAA,SAAS,CAAC,SAAS,mCAAI,GAAG,CAAC;IAEtD,qEAAqE;IACrE,OAAO;QACL,WAAW,EAAE,GAAG,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,kBAAkB;QAChE,WAAW,EAAE,SAAS,CAAC,SAAS;KACjC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { CallAdapterState, CallCompositePage, END_CALL_PAGES } from '../adapter/CallAdapter';\n/* @conditional-compile-remove(video-background-effects) */\nimport { CommonCallAdapter } from '../adapter/CallAdapter';\nimport { _isInCall, _isPreviewOn, _isInLobbyOrConnecting } from '@internal/calling-component-bindings';\nimport { CallControlOptions } from '../types/CallControlOptions';\nimport { CallState, RemoteParticipantState } from '@internal/calling-stateful-client';\nimport {\n CommunicationIdentifier,\n isCommunicationUserIdentifier,\n isMicrosoftTeamsUserIdentifier,\n isPhoneNumberIdentifier,\n isUnknownIdentifier\n} from '@azure/communication-common';\n/* @conditional-compile-remove(unsupported-browser) */\nimport { EnvironmentInfo } from '@azure/communication-calling';\nimport { AdapterStateModifier } from '../adapter/AzureCommunicationCallAdapter';\nimport { AdapterError } from '../../common/adapters';\n\nconst ACCESS_DENIED_TEAMS_MEETING_SUB_CODE = 5854;\nconst REMOTE_PSTN_USER_HUNG_UP = 560000;\nconst REMOVED_FROM_CALL_SUB_CODES = [5000, 5300, REMOTE_PSTN_USER_HUNG_UP];\n/* @conditional-compile-remove(rooms) */\nconst ROOM_NOT_FOUND_SUB_CODE = 5751;\n/* @conditional-compile-remove(rooms) */\nconst DENIED_PERMISSION_TO_ROOM_SUB_CODE = 5828;\n\n/**\n * @private\n */\nexport const isCameraOn = (state: CallAdapterState): boolean => {\n if (state.call) {\n const stream = state.call.localVideoStreams.find((stream) => stream.mediaStreamType === 'Video');\n return !!stream;\n } else {\n if (state.devices.selectedCamera) {\n const previewOn = _isPreviewOn(state.devices);\n return previewOn;\n }\n }\n return false;\n};\n\n/* @conditional-compile-remove(video-background-effects) */\n/**\n * @private\n */\nexport const startSelectedVideoEffect = async (adapter: CommonCallAdapter): Promise<void> => {\n if (adapter.getState().selectedVideoBackgroundEffect) {\n const selectedVideoBackgroundEffect = adapter.getState().selectedVideoBackgroundEffect;\n if (selectedVideoBackgroundEffect?.effectName === 'blur') {\n await adapter.blurVideoBackground();\n } else if (selectedVideoBackgroundEffect?.effectName === 'none') {\n await adapter.stopVideoBackgroundEffect();\n } else if (selectedVideoBackgroundEffect?.effectName === 'replacement') {\n await adapter.replaceVideoBackground({ backgroundImageUrl: selectedVideoBackgroundEffect.backgroundImageUrl });\n }\n }\n};\n\n/**\n * Reduce the set of call controls visible on mobile.\n * For example do not show screenshare button.\n *\n * @private\n */\nexport const reduceCallControlsForMobile = (\n callControlOptions: CallControlOptions | boolean | undefined\n): CallControlOptions | false => {\n if (callControlOptions === false) {\n return false;\n }\n\n // Ensure call controls a valid object.\n const reduceCallControlOptions = callControlOptions === true ? {} : callControlOptions || {};\n\n // Set to compressed mode when composite is optimized for mobile\n reduceCallControlOptions.displayType = 'compact';\n\n // Do not show screen share button when composite is optimized for mobile unless the developer\n // has explicitly opted in.\n if (reduceCallControlOptions.screenShareButton !== true) {\n reduceCallControlOptions.screenShareButton = false;\n }\n\n return reduceCallControlOptions;\n};\n\nenum CallEndReasons {\n LEFT_CALL,\n ACCESS_DENIED,\n REMOVED_FROM_CALL,\n ROOM_NOT_FOUND,\n DENIED_PERMISSION_TO_ROOM\n}\n\nconst getCallEndReason = (call: CallState): CallEndReasons => {\n const remoteParticipantsEndedArray = Array.from(Object.values(call.remoteParticipantsEnded));\n /**\n * Handle the special case in a PSTN call where removing the last user kicks the caller out of the call.\n * The code and subcode is the same as when a user is removed from a teams interop call.\n * Hence, we look at the last remote participant removed to determine if the last participant removed was a phone number.\n * If yes, the caller was kicked out of the call, but we need to show them that they left the call.\n * Note: This check will only work for 1:1 PSTN Calls. The subcode is different for 1:N PSTN calls, and we do not need to handle that case.\n */\n if (\n remoteParticipantsEndedArray.length === 1 &&\n isPhoneNumberIdentifier(remoteParticipantsEndedArray[0].identifier) &&\n call.callEndReason?.subCode !== REMOTE_PSTN_USER_HUNG_UP\n ) {\n return CallEndReasons.LEFT_CALL;\n }\n\n if (call.callEndReason?.subCode && call.callEndReason.subCode === ACCESS_DENIED_TEAMS_MEETING_SUB_CODE) {\n return CallEndReasons.ACCESS_DENIED;\n }\n\n if (call.callEndReason?.subCode && REMOVED_FROM_CALL_SUB_CODES.includes(call.callEndReason.subCode)) {\n return CallEndReasons.REMOVED_FROM_CALL;\n }\n\n /* @conditional-compile-remove(rooms) */\n if (call.callEndReason?.subCode && call.callEndReason.subCode === ROOM_NOT_FOUND_SUB_CODE) {\n return CallEndReasons.ROOM_NOT_FOUND;\n }\n\n /* @conditional-compile-remove(rooms) */\n if (call.callEndReason?.subCode && call.callEndReason.subCode === DENIED_PERMISSION_TO_ROOM_SUB_CODE) {\n return CallEndReasons.DENIED_PERMISSION_TO_ROOM;\n }\n\n if (call.callEndReason) {\n // No error codes match, assume the user simply left the call regularly\n return CallEndReasons.LEFT_CALL;\n }\n\n throw new Error('No matching call end reason');\n};\n\n/**\n * type definition for conditional-compilation\n */\ntype GetCallCompositePageFunction = ((\n call: CallState | undefined,\n previousCall: CallState | undefined\n) => CallCompositePage) &\n /* @conditional-compile-remove(unsupported-browser) */ ((\n call: CallState | undefined,\n previousCall: CallState | undefined,\n unsupportedBrowserInfo?: {\n environmentInfo?: EnvironmentInfo;\n unsupportedBrowserVersionOptedIn?: boolean;\n }\n ) => CallCompositePage);\n/**\n * Get the current call composite page based on the current call composite state\n *\n * @param Call - The current call state\n * @param previousCall - The state of the most recent previous call that has ended.\n *\n * @remarks - The previousCall state is needed to determine if the call has ended.\n * When the call ends a new call object is created, and so we must lookback at the\n * previous call state to understand how the call has ended. If there is no previous\n * call we know that this is a fresh call and can display the configuration page.\n *\n * @private\n */\nexport const getCallCompositePage: GetCallCompositePageFunction = (\n call,\n previousCall?,\n unsupportedBrowserInfo?\n): CallCompositePage => {\n /* @conditional-compile-remove(unsupported-browser) */\n if (\n isUnsupportedEnvironment(\n unsupportedBrowserInfo.environmentInfo,\n unsupportedBrowserInfo.unsupportedBrowserVersionOptedIn\n )\n ) {\n return 'unsupportedEnvironment';\n }\n\n if (call) {\n // Must check for ongoing call *before* looking at any previous calls.\n // If the composite completes one call and joins another, the previous calls\n // will be populated, but not relevant for determining the page.\n\n // `_isInLobbyOrConnecting` needs to be checked first because `_isInCall` also returns true when call is in lobby.\n if (_isInLobbyOrConnecting(call?.state)) {\n return 'lobby';\n // `LocalHold` needs to be checked before `isInCall` since it is also a state that's considered in call.\n } else if (call?.state === 'LocalHold') {\n /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */\n return 'hold';\n return 'call';\n } else if (_isInCall(call?.state)) {\n return 'call';\n } else {\n // When the call object has been constructed after clicking , but before 'connecting' has been\n // set on the call object, we continue to show the configuration screen.\n // The call object does not correctly reflect local device state until `call.state` moves to `connecting`.\n // Moving to the 'lobby' page too soon leads to components that depend on the `call` object to show incorrect\n // transitional state.\n return 'configuration';\n }\n }\n\n if (previousCall) {\n const reason = getCallEndReason(previousCall);\n /* @conditional-compile-remove(rooms) */\n switch (reason) {\n case CallEndReasons.ROOM_NOT_FOUND:\n return 'roomNotFound';\n case CallEndReasons.DENIED_PERMISSION_TO_ROOM:\n return 'deniedPermissionToRoom';\n }\n switch (reason) {\n case CallEndReasons.ACCESS_DENIED:\n return 'accessDeniedTeamsMeeting';\n case CallEndReasons.REMOVED_FROM_CALL:\n return 'removedFromCall';\n case CallEndReasons.LEFT_CALL:\n if (previousCall.diagnostics.network.latest.noNetwork) {\n return 'joinCallFailedDueToNoNetwork';\n }\n return 'leftCall';\n }\n }\n\n // No call state - show starting page (configuration)\n return 'configuration';\n};\n\n/** @private */\nexport const IsCallEndedPage = (\n /**\n * Explicitly listing the pages of this function intentionally.\n * This protects against adding a new composite page that should be marked as an callEndedPage.\n * EndCallPages are used to trigger onCallEnded events so this could easily be missed.\n * When you add a new composite page this will throw a compiler error. If this new page is an\n * EndCallPage ensure you update the END_CALL_PAGES. Afterwards update the `page` parameter\n * type below to allow your new page, i.e. add `| <your new page>\n */\n page:\n | 'accessDeniedTeamsMeeting'\n | 'call'\n | 'configuration'\n | 'joinCallFailedDueToNoNetwork'\n | 'leftCall'\n | 'lobby'\n | 'removedFromCall'\n | /* @conditional-compile-remove(PSTN-calls) */ 'hold'\n | /* @conditional-compile-remove(rooms) */ 'roomNotFound'\n | /* @conditional-compile-remove(rooms) */ 'deniedPermissionToRoom'\n | /* @conditional-compile-remove(unsupported-browser) */ 'unsupportedEnvironment'\n): boolean => END_CALL_PAGES.includes(page);\n\n/**\n * Creates a new call control options object and sets the correct values for disabling\n * the buttons provided in the `disabledControls` array.\n * Returns a new object without changing the original object.\n * @param callControlOptions options for the call control component that need to be modified.\n * @param disabledControls An array of controls to disable.\n * @returns a copy of callControlOptions with disabledControls disabled\n * @private\n */\nexport const disableCallControls = (\n callControlOptions: CallControlOptions | boolean | undefined,\n disabledControls: (keyof CallControlOptions)[]\n): CallControlOptions | boolean | undefined => {\n if (callControlOptions === false) {\n return false;\n }\n // Ensure we clone the prop if it is an object to ensure we do not mutate the original prop.\n let newOptions =\n (callControlOptions instanceof Object ? ({ ...callControlOptions } as CallControlOptions) : callControlOptions) ??\n {};\n if (newOptions === true || newOptions === undefined) {\n newOptions = disabledControls.reduce((acc, key) => {\n acc[key] = { disabled: true };\n return acc;\n }, {});\n } else {\n disabledControls.forEach((key) => {\n if (newOptions[key] !== false) {\n newOptions[key] = { disabled: true };\n }\n });\n }\n return newOptions;\n};\n\n/**\n * Check if a disabled object is provided for a button and returns if the button is disabled.\n * A button is only disabled if is explicitly set to disabled.\n *\n * @param option\n * @returns whether a button is disabled\n * @private\n */\nexport const isDisabled = (option: boolean | { disabled: boolean } | undefined): boolean => {\n if (option === undefined || typeof option === 'boolean') {\n return false;\n }\n\n return option.disabled;\n};\n\n/* @conditional-compile-remove(call-readiness) */\n/**\n * @returns Permissions state for the camera.\n */\nconst queryCameraPermissionFromPermissionsAPI = async (): Promise<PermissionState | 'unsupported'> => {\n try {\n return (await navigator.permissions.query({ name: 'camera' as PermissionName })).state;\n } catch (e) {\n console.info('permissions API is not supported by browser', e);\n return 'unsupported';\n }\n};\n\n/* @conditional-compile-remove(call-readiness) */\n/**\n * @returns Permissions state for the microphone.\n */\nconst queryMicrophonePermissionFromPermissionsAPI = async (): Promise<PermissionState | 'unsupported'> => {\n try {\n return (await navigator.permissions.query({ name: 'microphone' as PermissionName })).state;\n } catch (e) {\n console.info('permissions API is not supported by browser', e);\n return 'unsupported';\n }\n};\n\n/* @conditional-compile-remove(call-readiness) */\n/**\n *\n * This function uses permission API to determine if device permission state is granted, prompt or denied\n * @returns whether device permission state is granted, prompt or denied\n * If permission API is not supported on this browser, permission state is set to unsupported.\n * @private\n */\nexport const getDevicePermissionState = async (\n setVideoState: (state: PermissionState | 'unsupported') => void,\n setAudioState: (state: PermissionState | 'unsupported') => void\n): Promise<void> => {\n const [cameraResult, microphoneResult] = await Promise.all([\n queryCameraPermissionFromPermissionsAPI(),\n queryMicrophonePermissionFromPermissionsAPI()\n ]);\n setVideoState(cameraResult);\n setAudioState(microphoneResult);\n};\n/* @conditional-compile-remove(unsupported-browser) */\nconst isUnsupportedEnvironment = (\n environmentInfo?: EnvironmentInfo,\n unsupportedBrowserVersionOptedIn?: boolean\n): boolean => {\n return !!(\n environmentInfo?.isSupportedBrowser === false ||\n (environmentInfo?.isSupportedBrowserVersion === false && !unsupportedBrowserVersionOptedIn) ||\n environmentInfo?.isSupportedPlatform === false\n );\n};\n\n/**\n * Check if an object is identifier.\n *\n * @param identifier\n * @returns whether an identifier is one of identifier types (for runtime validation)\n * @private\n */\nexport const isValidIdentifier = (identifier: CommunicationIdentifier): boolean => {\n return (\n isCommunicationUserIdentifier(identifier) ||\n isPhoneNumberIdentifier(identifier) ||\n isMicrosoftTeamsUserIdentifier(identifier) ||\n isUnknownIdentifier(identifier)\n );\n};\n\n/**\n * Check if we are using safari browser\n * @private\n */\nexport const _isSafari = (\n environmentInfo: undefined | /* @conditional-compile-remove(unsupported-browser) */ EnvironmentInfo\n): boolean => {\n /* @conditional-compile-remove(unsupported-browser) */\n return environmentInfo?.environment.browser === 'safari';\n return /^((?!chrome|android|crios|fxios).)*safari/i.test(navigator.userAgent);\n};\n\n/**\n * @private\n * This is the util function to create a participant modifier for remote participantList\n * It memoize previous original participant items and only update the changed participant\n * It takes in one modifier function to generate one single participant object, it returns undefined if the object keeps unmodified\n */\nexport const createParticipantModifier = (\n createModifiedParticipant: (id: string, participant: RemoteParticipantState) => RemoteParticipantState | undefined\n): AdapterStateModifier => {\n let previousParticipantState:\n | {\n [keys: string]: RemoteParticipantState;\n }\n | undefined = undefined;\n let modifiedParticipants = {};\n const memoizedParticipants: {\n [id: string]: { originalRef: RemoteParticipantState; newParticipant: RemoteParticipantState };\n } = {};\n\n return (state: CallAdapterState) => {\n // if root state is the same, we don't need to update the participants\n if (state.call?.remoteParticipants !== previousParticipantState) {\n modifiedParticipants = {};\n const originalParticipants = state.call?.remoteParticipants;\n for (const key in originalParticipants) {\n const modifiedParticipant = createModifiedParticipant(key, originalParticipants[key]);\n if (modifiedParticipant === undefined) {\n modifiedParticipants[key] = originalParticipants[key];\n continue;\n }\n // Generate the new item if original cached item has been changed\n if (memoizedParticipants[key]?.originalRef !== originalParticipants[key]) {\n memoizedParticipants[key] = {\n newParticipant: modifiedParticipant,\n originalRef: originalParticipants[key]\n };\n }\n\n // the modified participant is always coming from the memoized cache, whether is was refreshed\n // from the previous closure or not\n modifiedParticipants[key] = memoizedParticipants[key].newParticipant;\n }\n\n previousParticipantState = state.call?.remoteParticipants;\n }\n return {\n ...state,\n call: state.call\n ? {\n ...state.call,\n remoteParticipants: modifiedParticipants\n }\n : undefined\n };\n };\n};\n\n/**\n * @private\n */\nexport interface DismissedError {\n dismissedAt: Date;\n activeSince?: Date;\n}\n\n/**\n * @private\n */\nexport const dismissVideoEffectsError = (toDismiss: AdapterError): DismissedError => {\n const now = new Date(Date.now());\n const toDismissTimestamp = toDismiss.timestamp ?? now;\n\n // Record that this error was dismissed for the first time right now.\n return {\n dismissedAt: now > toDismissTimestamp ? now : toDismissTimestamp,\n activeSince: toDismiss.timestamp\n };\n};\n\"../../../../../calling-component-bindings/src\"\"../../../../../calling-stateful-client/src\""]}
@@ -1,47 +1,32 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
3
  import React, { useCallback, useState, useMemo, useEffect, useRef } from 'react';
4
- import { LayerHost, mergeStyles, Stack } from '@fluentui/react';
5
- import { CallComposite } from '../CallComposite';
6
- import { CallAdapterProvider } from '../CallComposite/adapter/CallAdapterProvider';
7
- import { CommonCallControlBar } from '../common/ControlBar/CommonCallControlBar';
8
- import { callCompositeContainerStyles, compositeOuterContainerStyles, controlBarContainerStyles } from './styles/CallWithChatCompositeStyles';
4
+ import { mergeStyles, Stack } from '@fluentui/react';
5
+ import { callCompositeContainerStyles, compositeOuterContainerStyles } from './styles/CallWithChatCompositeStyles';
9
6
  import { CallWithChatBackedCallAdapter } from './adapter/CallWithChatBackedCallAdapter';
10
7
  import { CallWithChatBackedChatAdapter } from './adapter/CallWithChatBackedChatAdapter';
8
+ import { ChatComposite } from '../ChatComposite';
11
9
  import { BaseProvider } from '../common/BaseComposite';
12
- import { ChatAdapterProvider } from '../ChatComposite/adapter/ChatAdapterProvider';
13
- import { PreparedMoreDrawer } from '../common/Drawer/PreparedMoreDrawer';
14
- import { _useContainerHeight, _useContainerWidth } from "../../../../react-components/src";
10
+ import { useTheme } from "../../../../react-components/src";
15
11
  import { useId } from '@fluentui/react-hooks';
16
- import { CallWithChatPane } from './CallWithChatPane';
17
12
  import { containerDivStyles } from '../common/ContainerRectProps';
18
- import { modalLayerHostStyle } from '../common/styles/ModalLocalAndRemotePIP.styles';
19
- /* @conditional-compile-remove(PSTN-calls) */
20
- import { SendDtmfDialpad } from '../common/SendDtmfDialpad';
21
- /* @conditional-compile-remove(PSTN-calls) */
22
13
  import { useCallWithChatCompositeStrings } from './hooks/useCallWithChatCompositeStrings';
23
- import { drawerContainerStyles } from '../CallComposite/styles/CallComposite.styles';
24
- /* @conditional-compile-remove(video-background-effects) */
25
- import { VideoEffectsPane } from '../common/VideoEffectsPane';
14
+ import { CallCompositeInner } from '../CallComposite/CallComposite';
15
+ import { ChatButtonWithUnreadMessagesBadge } from './ChatButton/ChatButtonWithUnreadMessagesBadge';
16
+ import { getDesktopCommonButtonStyles } from '../common/ControlBar/CommonCallControlBar';
17
+ import { isDisabled } from '../CallComposite/utils';
18
+ import { SidePaneHeader } from '../common/SidePaneHeader';
26
19
  const CallWithChatScreen = (props) => {
27
20
  const { callWithChatAdapter, fluentTheme, formFactor = 'desktop' } = props;
28
21
  const mobileView = formFactor === 'mobile';
29
- /* @conditional-compile-remove(video-background-effects) */
30
- const [showVideoEffectsPane, setVideoEffectsPane] = useState(false);
31
- /* @conditional-compile-remove(video-background-effects) */
32
- const setShowVideoEffectsPane = useCallback((showVideoEffectsOptions) => {
33
- setVideoEffectsPane(showVideoEffectsOptions);
34
- }, [setVideoEffectsPane]);
35
22
  if (!callWithChatAdapter) {
36
23
  throw new Error('CallWithChatAdapter is undefined');
37
24
  }
38
25
  const callAdapter = useMemo(() => new CallWithChatBackedCallAdapter(callWithChatAdapter), [callWithChatAdapter]);
39
26
  const [currentCallState, setCurrentCallState] = useState();
40
27
  const [currentPage, setCurrentPage] = useState();
41
- const [activePane, setActivePane] = useState('none');
28
+ const [isChatOpen, setIsChatOpen] = useState(false);
42
29
  const containerRef = useRef(null);
43
- const containerWidth = _useContainerWidth(containerRef);
44
- const containerHeight = _useContainerHeight(containerRef);
45
30
  useEffect(() => {
46
31
  const updateCallWithChatPage = (newState) => {
47
32
  var _a;
@@ -54,105 +39,80 @@ const CallWithChatScreen = (props) => {
54
39
  callWithChatAdapter.offStateChange(updateCallWithChatPage);
55
40
  };
56
41
  }, [callWithChatAdapter]);
57
- const closePane = useCallback(() => {
58
- setActivePane('none');
59
- }, [setActivePane]);
60
42
  const chatProps = useMemo(() => {
61
43
  return {
62
44
  adapter: new CallWithChatBackedChatAdapter(callWithChatAdapter)
63
45
  };
64
46
  }, [callWithChatAdapter]);
65
- const modalLayerHostId = useId('modalLayerhost');
66
- const isInLobbyOrConnecting = currentPage === 'lobby';
67
- /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
68
- const isInLocalHold = currentPage === 'hold';
69
- const hasJoinedCall = !!(currentPage && hasJoinedCallFn(currentPage, currentCallState !== null && currentCallState !== void 0 ? currentCallState : 'None'));
70
- const showControlBar = isInLobbyOrConnecting || hasJoinedCall;
71
- const isMobileWithActivePane = mobileView && hasJoinedCall && activePane !== 'none';
72
47
  /** Constant setting of id for the parent stack of the composite */
73
48
  const compositeParentDivId = useId('callWithChatCompositeParentDiv-internal');
74
- const toggleChat = useCallback(() => {
75
- if (activePane === 'chat' || !hasJoinedCall) {
76
- setActivePane('none');
77
- }
78
- else {
79
- setActivePane('chat');
80
- // timeout is required to give the window time to render the sendbox so we have something to send focus to.
81
- // TODO: Selecting elements in the DOM via attributes is not stable. We should expose an API from ChatComposite to be able to focus on the sendbox.
82
- const chatFocusTimeout = setInterval(() => {
83
- const callWithChatCompositeRootDiv = document.querySelector(`[id="${compositeParentDivId}"]`);
84
- const sendbox = callWithChatCompositeRootDiv === null || callWithChatCompositeRootDiv === void 0 ? void 0 : callWithChatCompositeRootDiv.querySelector(`[id="sendbox"]`);
85
- if (sendbox !== null) {
86
- sendbox.focus();
87
- clearInterval(chatFocusTimeout);
88
- }
89
- }, 3);
90
- setTimeout(() => {
91
- clearInterval(chatFocusTimeout);
92
- }, 300);
93
- }
94
- }, [activePane, setActivePane, compositeParentDivId, hasJoinedCall]);
95
- const togglePeople = useCallback(() => {
96
- if (activePane === 'people' || !hasJoinedCall) {
97
- setActivePane('none');
98
- }
99
- else {
100
- setActivePane('people');
101
- }
102
- }, [activePane, setActivePane, hasJoinedCall]);
103
- const selectChat = useCallback(() => {
104
- if (hasJoinedCall) {
105
- setActivePane('chat');
106
- }
107
- }, [setActivePane, hasJoinedCall]);
108
- const selectPeople = useCallback(() => {
109
- if (hasJoinedCall) {
110
- setActivePane('people');
111
- }
112
- }, [setActivePane, hasJoinedCall]);
113
- const [showDrawer, setShowDrawer] = useState(false);
114
- const onMoreButtonClicked = useCallback(() => {
115
- closePane();
116
- setShowDrawer(true);
117
- }, [closePane]);
118
- const closeDrawer = useCallback(() => {
119
- setShowDrawer(false);
49
+ const closeChat = useCallback(() => {
50
+ setIsChatOpen(false);
120
51
  }, []);
121
- const onMoreDrawerPeopleClicked = useCallback(() => {
122
- setShowDrawer(false);
123
- togglePeople();
124
- }, [togglePeople]);
125
- // On mobile, when there is an active call and some side pane is active,
126
- // we hide the call composite via CSS to show only the pane.
127
- // We only set `display` to `none` instead of unmounting the call composite component tree
128
- // to avoid the performance cost of rerendering video streams when we later show the composite again.
129
- const callCompositeContainerCSS = useMemo(() => {
130
- return { display: isMobileWithActivePane ? 'none' : 'flex' };
131
- }, [isMobileWithActivePane]);
132
- /* @conditional-compile-remove(PSTN-calls) */
133
- const [showDtmfDialpad, setShowDtmfDialpad] = useState(false);
134
- /* @conditional-compile-remove(PSTN-calls) */
135
- const onDismissDtmfDialpad = () => {
136
- setShowDtmfDialpad(false);
137
- };
138
- /* @conditional-compile-remove(PSTN-calls) */
139
- const onClickShowDialpad = () => {
140
- setShowDtmfDialpad(true);
141
- };
142
- /* @conditional-compile-remove(PSTN-calls) */
52
+ const openChat = useCallback(() => {
53
+ setIsChatOpen(true);
54
+ // timeout is required to give the window time to render the sendbox so we have something to send focus to.
55
+ // TODO: Selecting elements in the DOM via attributes is not stable. We should expose an API from ChatComposite to be able to focus on the sendbox.
56
+ const chatFocusTimeout = setInterval(() => {
57
+ const callWithChatCompositeRootDiv = document.querySelector(`[id="${compositeParentDivId}"]`);
58
+ const sendbox = callWithChatCompositeRootDiv === null || callWithChatCompositeRootDiv === void 0 ? void 0 : callWithChatCompositeRootDiv.querySelector(`[id="sendbox"]`);
59
+ if (sendbox !== null) {
60
+ sendbox.focus();
61
+ clearInterval(chatFocusTimeout);
62
+ }
63
+ }, 3);
64
+ setTimeout(() => {
65
+ clearInterval(chatFocusTimeout);
66
+ }, 300);
67
+ }, [compositeParentDivId]);
68
+ const hasJoinedCall = !!(currentPage && hasJoinedCallFn(currentPage, currentCallState !== null && currentCallState !== void 0 ? currentCallState : 'None'));
69
+ const toggleChat = useCallback(() => {
70
+ isChatOpen || !hasJoinedCall ? closeChat() : openChat();
71
+ }, [closeChat, hasJoinedCall, isChatOpen, openChat]);
143
72
  const callWithChatStrings = useCallWithChatCompositeStrings();
144
- /* @conditional-compile-remove(PSTN-calls) */
145
- const dialpadStrings = useMemo(() => ({
146
- dialpadModalAriaLabel: callWithChatStrings.dialpadModalAriaLabel,
147
- dialpadCloseModalButtonAriaLabel: callWithChatStrings.dialpadCloseModalButtonAriaLabel,
148
- placeholderText: callWithChatStrings.dtmfDialpadPlaceholderText
73
+ const chatButtonStrings = useMemo(() => ({
74
+ label: callWithChatStrings.chatButtonLabel,
75
+ tooltipOffContent: callWithChatStrings.chatButtonTooltipOpen,
76
+ tooltipOnContent: callWithChatStrings.chatButtonTooltipClose
149
77
  }), [callWithChatStrings]);
150
- /* @conditional-compile-remove(PSTN-calls) */
151
- const alternateCallerId = callAdapter.getState().alternateCallerId;
152
- /* @conditional-compile-remove(close-captions) */
153
- const isTeamsCall = callAdapter.getState().isTeamsCall;
78
+ const theme = useTheme();
79
+ const commonButtonStyles = useMemo(() => (!mobileView ? getDesktopCommonButtonStyles(theme) : undefined), [mobileView, theme]);
80
+ const showChatButton = checkShowChatButton(props.callControls);
81
+ const chatButtonDisabled = showChatButton && (checkChatButtonIsDisabled(props.callControls) || !hasJoinedCall);
82
+ const chatTabHeaderProps = useMemo(() => mobileView && showChatButton
83
+ ? {
84
+ onClick: toggleChat,
85
+ disabled: chatButtonDisabled
86
+ }
87
+ : undefined, [chatButtonDisabled, mobileView, toggleChat, showChatButton]);
88
+ const customChatButton = useCallback((args) => ({
89
+ placement: mobileView ? 'primary' : 'secondary',
90
+ onRenderButton: () => (React.createElement(ChatButtonWithUnreadMessagesBadge, { chatAdapter: chatProps.adapter, isChatPaneVisible: isChatOpen, checked: isChatOpen, showLabel: args.displayType !== 'compact', onClick: toggleChat, disabled: chatButtonDisabled, strings: chatButtonStrings, styles: commonButtonStyles, newMessageLabel: callWithChatStrings.chatButtonNewMessageNotificationLabel }))
91
+ }), [
92
+ callWithChatStrings.chatButtonNewMessageNotificationLabel,
93
+ chatButtonStrings,
94
+ chatProps.adapter,
95
+ commonButtonStyles,
96
+ isChatOpen,
97
+ chatButtonDisabled,
98
+ mobileView,
99
+ toggleChat
100
+ ]);
101
+ const callControlOptionsFromProps = useMemo(() => (Object.assign({}, (typeof props.callControls === 'object' ? props.callControls : {}))), [props.callControls]);
102
+ const injectedCustomButtonsFromProps = useMemo(() => {
103
+ var _a;
104
+ /* @conditional-compile-remove(control-bar-button-injection) */
105
+ return [...((_a = callControlOptionsFromProps.onFetchCustomButtonProps) !== null && _a !== void 0 ? _a : [])];
106
+ return [];
107
+ }, [callControlOptionsFromProps]);
154
108
  const callCompositeOptions = useMemo(() => ({
155
- callControls: false,
109
+ callControls: props.callControls === false
110
+ ? false
111
+ : Object.assign(Object.assign({}, callControlOptionsFromProps), { onFetchCustomButtonProps: [
112
+ ...(showChatButton ? [customChatButton] : []),
113
+ /* @conditional-compile-remove(control-bar-button-injection) */
114
+ ...injectedCustomButtonsFromProps
115
+ ], legacyControlBarExperience: false }),
156
116
  /* @conditional-compile-remove(call-readiness) */
157
117
  deviceChecks: props.deviceChecks,
158
118
  /* @conditional-compile-remove(call-readiness) */
@@ -162,6 +122,11 @@ const CallWithChatScreen = (props) => {
162
122
  /* @conditional-compile-remove(unsupported-browser) */
163
123
  onEnvironmentInfoTroubleshootingClick: props.onEnvironmentInfoTroubleshootingClick
164
124
  }), [
125
+ props.callControls,
126
+ callControlOptionsFromProps,
127
+ showChatButton,
128
+ customChatButton,
129
+ injectedCustomButtonsFromProps,
165
130
  /* @conditional-compile-remove(call-readiness) */
166
131
  props.deviceChecks,
167
132
  /* @conditional-compile-remove(unsupported-browser) */
@@ -171,49 +136,44 @@ const CallWithChatScreen = (props) => {
171
136
  /* @conditional-compile-remove(call-readiness) */
172
137
  props.onPermissionsTroubleshootingClick
173
138
  ]);
139
+ const onRenderChatContent = useCallback(() => (React.createElement(ChatComposite, Object.assign({}, chatProps, { fluentTheme: theme, options: {
140
+ topic: false,
141
+ /* @conditional-compile-remove(chat-composite-participant-pane) */
142
+ participantPane: false,
143
+ /* @conditional-compile-remove(file-sharing) */
144
+ fileSharing: props.fileSharing
145
+ }, onFetchAvatarPersonaData: props.onFetchAvatarPersonaData }))), [
146
+ chatProps,
147
+ /* @conditional-compile-remove(file-sharing) */ props.fileSharing,
148
+ props.onFetchAvatarPersonaData,
149
+ theme
150
+ ]);
151
+ const sidePaneHeaderRenderer = useCallback(() => {
152
+ var _a;
153
+ return (React.createElement(SidePaneHeader, { headingText: callWithChatStrings.chatPaneTitle, onClose: closeChat, dismissSidePaneButtonAriaLabel: (_a = callWithChatStrings.dismissSidePaneButtonLabel) !== null && _a !== void 0 ? _a : '', mobileView: mobileView }));
154
+ }, [callWithChatStrings.chatPaneTitle, callWithChatStrings.dismissSidePaneButtonLabel, closeChat, mobileView]);
155
+ const sidePaneContentRenderer = useMemo(() => (hasJoinedCall ? onRenderChatContent : undefined), [hasJoinedCall, onRenderChatContent]);
156
+ const sidePaneRenderer = useMemo(() => ({
157
+ contentRenderer: sidePaneContentRenderer,
158
+ headerRenderer: sidePaneHeaderRenderer,
159
+ id: 'chat'
160
+ }), [sidePaneContentRenderer, sidePaneHeaderRenderer]);
161
+ const overrideSidePaneProps = useMemo(() => ({
162
+ renderer: sidePaneRenderer,
163
+ isActive: isChatOpen,
164
+ persistRenderingWhenClosed: true
165
+ }), [isChatOpen, sidePaneRenderer]);
166
+ const onSidePaneIdChange = useCallback((sidePaneId) => {
167
+ // If the pane is switched to something other than chat, removing rendering chat.
168
+ if (sidePaneId && sidePaneId !== 'chat') {
169
+ closeChat();
170
+ }
171
+ }, [closeChat]);
174
172
  return (React.createElement("div", { ref: containerRef, className: mergeStyles(containerDivStyles) },
175
173
  React.createElement(Stack, { verticalFill: true, grow: true, styles: compositeOuterContainerStyles, id: compositeParentDivId },
176
174
  React.createElement(Stack, { horizontal: true, grow: true },
177
- React.createElement(Stack.Item, { grow: true, styles: callCompositeContainerStyles(mobileView),
178
- // Perf: Instead of removing the video gallery from DOM, we hide it to prevent re-renders.
179
- style: callCompositeContainerCSS },
180
- React.createElement(CallComposite, Object.assign({}, props, { formFactor: formFactor, options: callCompositeOptions, adapter: callAdapter, fluentTheme: fluentTheme }))),
181
- /* @conditional-compile-remove(video-background-effects) */
182
- React.createElement(CallAdapterProvider, { adapter: callAdapter },
183
- React.createElement(VideoEffectsPane, { showVideoEffectsOptions: showVideoEffectsPane, setshowVideoEffectsOptions: setShowVideoEffectsPane })),
184
- chatProps.adapter && callAdapter && hasJoinedCall && (React.createElement(CallWithChatPane, { chatCompositeProps: chatProps, inviteLink: props.joinInvitationURL, onClose: closePane, chatAdapter: chatProps.adapter, callAdapter: callAdapter, onFetchAvatarPersonaData: props.onFetchAvatarPersonaData, onFetchParticipantMenuItems: props.onFetchParticipantMenuItems, onChatButtonClicked: showShowChatTabHeaderButton(props.callControls) ? selectChat : undefined, onPeopleButtonClicked: showShowPeopleTabHeaderButton(props.callControls) ? selectPeople : undefined, modalLayerHostId: modalLayerHostId, mobileView: mobileView, activePane: activePane,
185
- /* @conditional-compile-remove(file-sharing) */
186
- fileSharing: props.fileSharing, rtl: props.rtl, callControls: typeof props.callControls !== 'boolean' ? props.callControls : undefined }))),
187
- showControlBar && !isMobileWithActivePane && (React.createElement(ChatAdapterProvider, { adapter: chatProps.adapter },
188
- React.createElement(Stack.Item, { styles: controlBarContainerStyles },
189
- React.createElement(CommonCallControlBar, { callAdapter: callAdapter, chatAdapter: chatProps.adapter, chatButtonChecked: activePane === 'chat', onChatButtonClicked: toggleChat, peopleButtonChecked: activePane === 'people', onPeopleButtonClicked: togglePeople, onMoreButtonClicked: onMoreButtonClicked, mobileView: mobileView, disableButtonsForLobbyPage: isInLobbyOrConnecting,
190
- /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
191
- disableButtonsForHoldScreen: isInLocalHold, callControls: props.callControls, containerHeight: containerHeight, containerWidth: containerWidth,
192
- /* @conditional-compile-remove(PSTN-calls) */
193
- onClickShowDialpad: alternateCallerId ? onClickShowDialpad : undefined,
194
- /* @conditional-compile-remove(close-captions) */
195
- isCaptionsSupported: isTeamsCall && hasJoinedCall,
196
- /* @conditional-compile-remove(video-background-effects) */
197
- onShowVideoEffectsPicker: setShowVideoEffectsPane, rtl: props.rtl })))),
198
- showControlBar && showDrawer && (React.createElement(ChatAdapterProvider, { adapter: chatProps.adapter },
199
- React.createElement(CallAdapterProvider, { adapter: callAdapter },
200
- React.createElement(Stack, { styles: drawerContainerStyles() },
201
- React.createElement(PreparedMoreDrawer, { callControls: props.callControls, onLightDismiss: closeDrawer, onPeopleButtonClicked: onMoreDrawerPeopleClicked,
202
- /* @conditional-compile-remove(PSTN-calls) */
203
- onClickShowDialpad: alternateCallerId ? onClickShowDialpad : undefined,
204
- /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
205
- disableButtonsForHoldScreen: isInLocalHold,
206
- /* @conditional-compile-remove(close-captions) */
207
- isCaptionsSupported: isTeamsCall && hasJoinedCall }))))),
208
- /* @conditional-compile-remove(PSTN-calls) */
209
- showControlBar && showDtmfDialpad && (React.createElement(ChatAdapterProvider, { adapter: chatProps.adapter },
210
- React.createElement(CallAdapterProvider, { adapter: callAdapter },
211
- React.createElement(Stack, { styles: drawerContainerStyles() },
212
- React.createElement(SendDtmfDialpad, { isMobile: mobileView, strings: dialpadStrings, showDialpad: showDtmfDialpad, onDismissDialpad: onDismissDtmfDialpad }))))),
213
- // This layer host is for ModalLocalAndRemotePIP in CallWithChatPane. This LayerHost cannot be inside the CallWithChatPane
214
- // because when the CallWithChatPane is hidden, ie. style property display is 'none', it takes up no space. This causes problems when dragging
215
- // the Modal because the draggable bounds thinks it has no space and will always return to its initial position after dragging.
216
- mobileView && React.createElement(LayerHost, { id: modalLayerHostId, className: mergeStyles(modalLayerHostStyle) }))));
175
+ React.createElement(Stack.Item, { grow: true, styles: callCompositeContainerStyles(mobileView) },
176
+ React.createElement(CallCompositeInner, Object.assign({}, props, { formFactor: formFactor, options: callCompositeOptions, adapter: callAdapter, fluentTheme: fluentTheme, callInvitationUrl: props.joinInvitationURL, overrideSidePane: overrideSidePaneProps, onSidePaneIdChange: onSidePaneIdChange, mobileChatTabHeader: chatTabHeaderProps })))))));
217
177
  };
218
178
  /**
219
179
  * CallWithChatComposite brings together key components to provide a full call with chat experience out of the box.
@@ -236,7 +196,7 @@ const hasJoinedCallFn = (page, callStatus) => {
236
196
  (page === 'hold' && (callStatus === 'LocalHold' || callStatus === 'Disconnecting')));
237
197
  return page === 'call' && (callStatus === 'Connected' || callStatus === 'Disconnecting');
238
198
  };
239
- const showShowChatTabHeaderButton = (callControls) => {
199
+ const checkShowChatButton = (callControls) => {
240
200
  if (callControls === undefined || callControls === true) {
241
201
  return true;
242
202
  }
@@ -245,13 +205,7 @@ const showShowChatTabHeaderButton = (callControls) => {
245
205
  }
246
206
  return callControls.chatButton !== false;
247
207
  };
248
- const showShowPeopleTabHeaderButton = (callControls) => {
249
- if (callControls === undefined || callControls === true) {
250
- return true;
251
- }
252
- if (callControls === false) {
253
- return false;
254
- }
255
- return callControls.peopleButton !== false;
208
+ const checkChatButtonIsDisabled = (callControls) => {
209
+ return typeof callControls === 'object' && isDisabled(callControls === null || callControls === void 0 ? void 0 : callControls.chatButton);
256
210
  };
257
211
  //# sourceMappingURL=CallWithChatComposite.js.map