@@ -50,12 +50,21 @@ import { useIsMobile } from '../utils/useIsMobile';
5050import { useBoolean , useId } from '@fluentui/react-hooks' ;
5151import { CallAdapterLocator } from '@azure/communication-react' ;
5252
53+ export type CallOption =
54+ | 'ACSCall'
55+ | 'TeamsMeeting'
56+ | /* @conditional -compile-remove(rooms) */ 'Rooms'
57+ | /* @conditional -compile-remove(rooms) */ 'StartRooms'
58+ | /* @conditional -compile-remove(teams-identity-support) */ 'TeamsIdentity'
59+ | /* @conditional -compile-remove(one-to-n-calling) */ '1:N'
60+ | /* @conditional -compile-remove(PSTN-calls) */ 'PSTN'
61+ | /* @conditional -compile-remove(teams-adhoc-call) */ 'TeamsAdhoc' ;
62+
5363export interface HomeScreenProps {
5464 startCallHandler ( callDetails : {
5565 displayName : string ;
5666 callLocator ?: CallAdapterLocator | TeamsMeetingLinkLocator | /* @conditional -compile-remove(rooms) */ RoomLocator ;
57- /* @conditional -compile-remove(rooms) */
58- option ?: string ;
67+ option ?: CallOption ;
5968 /* @conditional -compile-remove(rooms) */
6069 role ?: string ;
6170 /* @conditional -compile-remove(PSTN-calls) */
@@ -72,12 +81,14 @@ export interface HomeScreenProps {
7281 joiningExistingCall : boolean ;
7382}
7483
84+ type ICallChoiceGroupOption = IChoiceGroupOption & { key : CallOption } ;
85+
7586export const HomeScreen = ( props : HomeScreenProps ) : JSX . Element => {
7687 const imageProps = { src : heroSVG . toString ( ) } ;
7788 const headerTitle = props . joiningExistingCall ? 'Join Call' : 'Start or join a call' ;
7889 const callOptionsGroupLabel = 'Select a call option' ;
7990 const buttonText = 'Next' ;
80- const callOptions : IChoiceGroupOption [ ] = [
91+ const callOptions : ICallChoiceGroupOption [ ] = [
8192 { key : 'ACSCall' , text : 'Start a call' } ,
8293 /* @conditional -compile-remove(rooms) */
8394 { key : 'StartRooms' , text : 'Start a Rooms call' } ,
@@ -112,7 +123,7 @@ export const HomeScreen = (props: HomeScreenProps): JSX.Element => {
112123 const defaultDisplayName = localStorageAvailable ? getDisplayNameFromLocalStorage ( ) : null ;
113124 const [ displayName , setDisplayName ] = useState < string | undefined > ( defaultDisplayName ?? undefined ) ;
114125
115- const [ chosenCallOption , setChosenCallOption ] = useState < IChoiceGroupOption > ( callOptions [ 0 ] ) ;
126+ const [ chosenCallOption , setChosenCallOption ] = useState < ICallChoiceGroupOption > ( callOptions [ 0 ] ) ;
116127 const [ callLocator , setCallLocator ] = useState <
117128 TeamsMeetingLinkLocator | /* @conditional -compile-remove(rooms) */ RoomLocator
118129 > ( ) ;
@@ -196,7 +207,7 @@ export const HomeScreen = (props: HomeScreenProps): JSX.Element => {
196207 defaultSelectedKey = "ACSCall"
197208 options = { callOptions }
198209 required = { true }
199- onChange = { ( _ , option ) => option && setChosenCallOption ( option ) }
210+ onChange = { ( _ , option ) => option && setChosenCallOption ( option as ICallChoiceGroupOption ) }
200211 />
201212 ) }
202213 { ( teamsCallChosen || /* @conditional -compile-remove(teams-identity-support) */ teamsIdentityChosen ) && (
0 commit comments